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

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

Cubiz_2.swf

This is the info page for
Flash #31843

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


Text
<p align="center"><font face="Gemelli" size="34" color="#000000" letterSpacing="2.000000" kerning="0"><b>TEXTZ</b></font></p>

Box2D

ActionScript [AS3]

Section 1
//b2BoxDef (Box2D.Collision.Shapes.b2BoxDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2BoxDef extends b2ShapeDef { public var extents:b2Vec2; public function b2BoxDef(){ type = b2Shape.e_boxShape; extents = new b2Vec2(1, 1); } } }//package Box2D.Collision.Shapes
Section 2
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef) package Box2D.Collision.Shapes { public class b2CircleDef extends b2ShapeDef { public var radius:Number; public function b2CircleDef(){ type = b2Shape.e_circleShape; radius = 1; } } }//package Box2D.Collision.Shapes
Section 3
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape) package Box2D.Collision.Shapes { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; public class b2CircleShape extends b2Shape { public var m_localPosition:b2Vec2; public var m_radius:Number; public function b2CircleShape(_arg1:b2ShapeDef, _arg2:b2Body, _arg3:b2Vec2){ var _local4:b2CircleDef; var _local5:Number; var _local6:Number; var _local7:b2AABB; var _local8:b2BroadPhase; m_localPosition = new b2Vec2(); super(_arg1, _arg2); _local4 = (_arg1 as b2CircleDef); m_localPosition.Set((_arg1.localPosition.x - _arg3.x), (_arg1.localPosition.y - _arg3.y)); m_type = b2Shape.e_circleShape; m_radius = _local4.radius; m_R.SetM(m_body.m_R); _local5 = ((m_R.col1.x * m_localPosition.x) + (m_R.col2.x * m_localPosition.y)); _local6 = ((m_R.col1.y * m_localPosition.x) + (m_R.col2.y * m_localPosition.y)); m_position.x = (m_body.m_position.x + _local5); m_position.y = (m_body.m_position.y + _local6); m_maxRadius = (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))) + m_radius); _local7 = new b2AABB(); _local7.minVertex.Set((m_position.x - m_radius), (m_position.y - m_radius)); _local7.maxVertex.Set((m_position.x + m_radius), (m_position.y + m_radius)); _local8 = m_body.m_world.m_broadPhase; if (_local8.InRange(_local7)){ m_proxyId = _local8.CreateProxy(_local7, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; if (m_proxyId == b2Pair.b2_nullProxy){ m_body.Freeze(); }; } override public function ResetProxy(_arg1:b2BroadPhase):void{ var _local2:b2Proxy; var _local3:b2AABB; if (m_proxyId == b2Pair.b2_nullProxy){ return; }; _local2 = _arg1.GetProxy(m_proxyId); _arg1.DestroyProxy(m_proxyId); _local2 = null; _local3 = new b2AABB(); _local3.minVertex.Set((m_position.x - m_radius), (m_position.y - m_radius)); _local3.maxVertex.Set((m_position.x + m_radius), (m_position.y + m_radius)); if (_arg1.InRange(_local3)){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; if (m_proxyId == b2Pair.b2_nullProxy){ m_body.Freeze(); }; } override public function QuickSync(_arg1:b2Vec2, _arg2:b2Mat22):void{ m_R.SetM(_arg2); m_position.x = (((_arg2.col1.x * m_localPosition.x) + (_arg2.col2.x * m_localPosition.y)) + _arg1.x); m_position.y = (((_arg2.col1.y * m_localPosition.x) + (_arg2.col2.y * m_localPosition.y)) + _arg1.y); } override public function Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{ var _local4:Number; _local4 = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2))); _arg1 = (_arg1 / _local4); _arg2 = (_arg2 / _local4); _arg3.Set((m_position.x + (m_radius * _arg1)), (m_position.y + (m_radius * _arg2))); } override public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{ var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:b2AABB; var _local12:b2BroadPhase; m_R.SetM(_arg4); m_position.x = (((_arg4.col1.x * m_localPosition.x) + (_arg4.col2.x * m_localPosition.y)) + _arg3.x); m_position.y = (((_arg4.col1.y * m_localPosition.x) + (_arg4.col2.y * m_localPosition.y)) + _arg3.y); if (m_proxyId == b2Pair.b2_nullProxy){ return; }; _local5 = (_arg1.x + ((_arg2.col1.x * m_localPosition.x) + (_arg2.col2.x * m_localPosition.y))); _local6 = (_arg1.y + ((_arg2.col1.y * m_localPosition.x) + (_arg2.col2.y * m_localPosition.y))); _local7 = Math.min(_local5, m_position.x); _local8 = Math.min(_local6, m_position.y); _local9 = Math.max(_local5, m_position.x); _local10 = Math.max(_local6, m_position.y); _local11 = new b2AABB(); _local11.minVertex.Set((_local7 - m_radius), (_local8 - m_radius)); _local11.maxVertex.Set((_local9 + m_radius), (_local10 + m_radius)); _local12 = m_body.m_world.m_broadPhase; if (_local12.InRange(_local11)){ _local12.MoveProxy(m_proxyId, _local11); } else { m_body.Freeze(); }; } override public function TestPoint(_arg1:b2Vec2):Boolean{ var _local2:b2Vec2; _local2 = new b2Vec2(); _local2.SetV(_arg1); _local2.Subtract(m_position); return ((b2Math.b2Dot(_local2, _local2) <= (m_radius * m_radius))); } } }//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2MassData { public var mass:Number;// = 0 public var center:b2Vec2; public var I:Number;// = 0 public function b2MassData(){ mass = 0; center = new b2Vec2(0, 0); I = 0; super(); } } }//package Box2D.Collision.Shapes
Section 5
//b2PolyDef (Box2D.Collision.Shapes.b2PolyDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PolyDef extends b2ShapeDef { public var vertexCount:int; public var vertices:Array; public function b2PolyDef(){ var _local1:int; vertices = new Array(b2Settings.b2_maxPolyVertices); super(); type = b2Shape.e_polyShape; vertexCount = 0; _local1 = 0; while (_local1 < b2Settings.b2_maxPolyVertices) { vertices[_local1] = new b2Vec2(); _local1++; }; } } }//package Box2D.Collision.Shapes
Section 6
//b2PolyShape (Box2D.Collision.Shapes.b2PolyShape) package Box2D.Collision.Shapes { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolyShape extends b2Shape { public var m_vertices:Array; public var m_localOBB:b2OBB; public var m_normals:Array; public var m_vertexCount:int; private var syncMat:b2Mat22; public var m_coreVertices:Array; public var m_localCentroid:b2Vec2; private var syncAABB:b2AABB; private static var tempVec:b2Vec2 = new b2Vec2(); private static var tAbsR:b2Mat22 = new b2Mat22(); public function b2PolyShape(_arg1:b2ShapeDef, _arg2:b2Body, _arg3:b2Vec2){ var _local4:int; var _local5:Number; var _local6:Number; var _local7:b2Vec2; var _local8:b2AABB; var _local9:b2Mat22; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:int; var _local15:int; var _local16:Number; var _local17:Number; var _local18:b2BroadPhase; var _local19:b2BoxDef; var _local20:Number; var _local21:Number; var _local22:b2PolyDef; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:b2Vec2; syncAABB = new b2AABB(); syncMat = new b2Mat22(); m_localCentroid = new b2Vec2(); m_localOBB = new b2OBB(); super(_arg1, _arg2); _local8 = new b2AABB(); m_vertices = new Array(b2Settings.b2_maxPolyVertices); m_coreVertices = new Array(b2Settings.b2_maxPolyVertices); m_normals = new Array(b2Settings.b2_maxPolyVertices); m_type = b2Shape.e_polyShape; _local9 = new b2Mat22(_arg1.localRotation); if (_arg1.type == b2Shape.e_boxShape){ m_localCentroid.x = (_arg1.localPosition.x - _arg3.x); m_localCentroid.y = (_arg1.localPosition.y - _arg3.y); _local19 = (_arg1 as b2BoxDef); m_vertexCount = 4; _local5 = _local19.extents.x; _local6 = _local19.extents.y; _local20 = Math.max(0, (_local5 - (2 * b2Settings.b2_linearSlop))); _local21 = Math.max(0, (_local6 - (2 * b2Settings.b2_linearSlop))); _local7 = (m_vertices[0] = new b2Vec2()); _local7.x = ((_local9.col1.x * _local5) + (_local9.col2.x * _local6)); _local7.y = ((_local9.col1.y * _local5) + (_local9.col2.y * _local6)); _local7 = (m_vertices[1] = new b2Vec2()); _local7.x = ((_local9.col1.x * -(_local5)) + (_local9.col2.x * _local6)); _local7.y = ((_local9.col1.y * -(_local5)) + (_local9.col2.y * _local6)); _local7 = (m_vertices[2] = new b2Vec2()); _local7.x = ((_local9.col1.x * -(_local5)) + (_local9.col2.x * -(_local6))); _local7.y = ((_local9.col1.y * -(_local5)) + (_local9.col2.y * -(_local6))); _local7 = (m_vertices[3] = new b2Vec2()); _local7.x = ((_local9.col1.x * _local5) + (_local9.col2.x * -(_local6))); _local7.y = ((_local9.col1.y * _local5) + (_local9.col2.y * -(_local6))); _local7 = (m_coreVertices[0] = new b2Vec2()); _local7.x = ((_local9.col1.x * _local20) + (_local9.col2.x * _local21)); _local7.y = ((_local9.col1.y * _local20) + (_local9.col2.y * _local21)); _local7 = (m_coreVertices[1] = new b2Vec2()); _local7.x = ((_local9.col1.x * -(_local20)) + (_local9.col2.x * _local21)); _local7.y = ((_local9.col1.y * -(_local20)) + (_local9.col2.y * _local21)); _local7 = (m_coreVertices[2] = new b2Vec2()); _local7.x = ((_local9.col1.x * -(_local20)) + (_local9.col2.x * -(_local21))); _local7.y = ((_local9.col1.y * -(_local20)) + (_local9.col2.y * -(_local21))); _local7 = (m_coreVertices[3] = new b2Vec2()); _local7.x = ((_local9.col1.x * _local20) + (_local9.col2.x * -(_local21))); _local7.y = ((_local9.col1.y * _local20) + (_local9.col2.y * -(_local21))); } else { _local22 = (_arg1 as b2PolyDef); m_vertexCount = _local22.vertexCount; PolyCentroid(_local22.vertices, _local22.vertexCount, tempVec); _local23 = tempVec.x; _local24 = tempVec.y; m_localCentroid.x = ((_arg1.localPosition.x + ((_local9.col1.x * _local23) + (_local9.col2.x * _local24))) - _arg3.x); m_localCentroid.y = ((_arg1.localPosition.y + ((_local9.col1.y * _local23) + (_local9.col2.y * _local24))) - _arg3.y); _local4 = 0; while (_local4 < m_vertexCount) { m_vertices[_local4] = new b2Vec2(); m_coreVertices[_local4] = new b2Vec2(); _local5 = (_local22.vertices[_local4].x - _local23); _local6 = (_local22.vertices[_local4].y - _local24); m_vertices[_local4].x = ((_local9.col1.x * _local5) + (_local9.col2.x * _local6)); m_vertices[_local4].y = ((_local9.col1.y * _local5) + (_local9.col2.y * _local6)); _local25 = m_vertices[_local4].x; _local26 = m_vertices[_local4].y; _local27 = Math.sqrt(((_local25 * _local25) + (_local26 * _local26))); if (_local27 > Number.MIN_VALUE){ _local25 = (_local25 * (1 / _local27)); _local26 = (_local26 * (1 / _local27)); }; m_coreVertices[_local4].x = (m_vertices[_local4].x - ((2 * b2Settings.b2_linearSlop) * _local25)); m_coreVertices[_local4].y = (m_vertices[_local4].y - ((2 * b2Settings.b2_linearSlop) * _local26)); _local4++; }; }; _local10 = Number.MAX_VALUE; _local11 = Number.MAX_VALUE; _local12 = -(Number.MAX_VALUE); _local13 = -(Number.MAX_VALUE); m_maxRadius = 0; _local4 = 0; while (_local4 < m_vertexCount) { _local28 = m_vertices[_local4]; _local10 = Math.min(_local10, _local28.x); _local11 = Math.min(_local11, _local28.y); _local12 = Math.max(_local12, _local28.x); _local13 = Math.max(_local13, _local28.y); m_maxRadius = Math.max(m_maxRadius, _local28.Length()); _local4++; }; m_localOBB.R.SetIdentity(); m_localOBB.center.Set(((_local10 + _local12) * 0.5), ((_local11 + _local13) * 0.5)); m_localOBB.extents.Set(((_local12 - _local10) * 0.5), ((_local13 - _local11) * 0.5)); _local4 = 0; while (_local4 < m_vertexCount) { m_normals[_local4] = new b2Vec2(); _local14 = _local4; _local15 = (((_local4 + 1) < m_vertexCount)) ? (_local4 + 1) : 0; m_normals[_local4].x = (m_vertices[_local15].y - m_vertices[_local14].y); m_normals[_local4].y = -((m_vertices[_local15].x - m_vertices[_local14].x)); m_normals[_local4].Normalize(); _local4++; }; _local4 = 0; while (_local4 < m_vertexCount) { _local14 = _local4; _local15 = (((_local4 + 1) < m_vertexCount)) ? (_local4 + 1) : 0; _local4++; }; m_R.SetM(m_body.m_R); m_position.x = (m_body.m_position.x + ((m_R.col1.x * m_localCentroid.x) + (m_R.col2.x * m_localCentroid.y))); m_position.y = (m_body.m_position.y + ((m_R.col1.y * m_localCentroid.x) + (m_R.col2.y * m_localCentroid.y))); tAbsR.col1.x = ((m_R.col1.x * m_localOBB.R.col1.x) + (m_R.col2.x * m_localOBB.R.col1.y)); tAbsR.col1.y = ((m_R.col1.y * m_localOBB.R.col1.x) + (m_R.col2.y * m_localOBB.R.col1.y)); tAbsR.col2.x = ((m_R.col1.x * m_localOBB.R.col2.x) + (m_R.col2.x * m_localOBB.R.col2.y)); tAbsR.col2.y = ((m_R.col1.y * m_localOBB.R.col2.x) + (m_R.col2.y * m_localOBB.R.col2.y)); tAbsR.Abs(); _local5 = ((tAbsR.col1.x * m_localOBB.extents.x) + (tAbsR.col2.x * m_localOBB.extents.y)); _local6 = ((tAbsR.col1.y * m_localOBB.extents.x) + (tAbsR.col2.y * m_localOBB.extents.y)); _local16 = (m_position.x + ((m_R.col1.x * m_localOBB.center.x) + (m_R.col2.x * m_localOBB.center.y))); _local17 = (m_position.y + ((m_R.col1.y * m_localOBB.center.x) + (m_R.col2.y * m_localOBB.center.y))); _local8.minVertex.x = (_local16 - _local5); _local8.minVertex.y = (_local17 - _local6); _local8.maxVertex.x = (_local16 + _local5); _local8.maxVertex.y = (_local17 + _local6); _local18 = m_body.m_world.m_broadPhase; if (_local18.InRange(_local8)){ m_proxyId = _local18.CreateProxy(_local8, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; if (m_proxyId == b2Pair.b2_nullProxy){ m_body.Freeze(); }; } override public function QuickSync(_arg1:b2Vec2, _arg2:b2Mat22):void{ m_R.SetM(_arg2); m_position.x = (_arg1.x + ((_arg2.col1.x * m_localCentroid.x) + (_arg2.col2.x * m_localCentroid.y))); m_position.y = (_arg1.y + ((_arg2.col1.y * m_localCentroid.x) + (_arg2.col2.y * m_localCentroid.y))); } override public function Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{ var _local4:Number; var _local5:Number; var _local6:int; var _local7:Number; var _local8:int; var _local9:Number; _local4 = ((_arg1 * m_R.col1.x) + (_arg2 * m_R.col1.y)); _local5 = ((_arg1 * m_R.col2.x) + (_arg2 * m_R.col2.y)); _local6 = 0; _local7 = ((m_coreVertices[0].x * _local4) + (m_coreVertices[0].y * _local5)); _local8 = 1; while (_local8 < m_vertexCount) { _local9 = ((m_coreVertices[_local8].x * _local4) + (m_coreVertices[_local8].y * _local5)); if (_local9 > _local7){ _local6 = _local8; _local7 = _local9; }; _local8++; }; _arg3.Set((m_position.x + ((m_R.col1.x * m_coreVertices[_local6].x) + (m_R.col2.x * m_coreVertices[_local6].y))), (m_position.y + ((m_R.col1.y * m_coreVertices[_local6].x) + (m_R.col2.y * m_coreVertices[_local6].y)))); } override public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{ var _local5:Number; var _local6:Number; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:Number; var _local12:Number; var _local13:b2BroadPhase; m_R.SetM(_arg4); m_position.x = (m_body.m_position.x + ((_arg4.col1.x * m_localCentroid.x) + (_arg4.col2.x * m_localCentroid.y))); m_position.y = (m_body.m_position.y + ((_arg4.col1.y * m_localCentroid.x) + (_arg4.col2.y * m_localCentroid.y))); if (m_proxyId == b2Pair.b2_nullProxy){ return; }; _local7 = _arg2.col1; _local8 = _arg2.col2; _local9 = m_localOBB.R.col1; _local10 = m_localOBB.R.col2; syncMat.col1.x = ((_local7.x * _local9.x) + (_local8.x * _local9.y)); syncMat.col1.y = ((_local7.y * _local9.x) + (_local8.y * _local9.y)); syncMat.col2.x = ((_local7.x * _local10.x) + (_local8.x * _local10.y)); syncMat.col2.y = ((_local7.y * _local10.x) + (_local8.y * _local10.y)); syncMat.Abs(); _local5 = (m_localCentroid.x + m_localOBB.center.x); _local6 = (m_localCentroid.y + m_localOBB.center.y); _local11 = (_arg1.x + ((_arg2.col1.x * _local5) + (_arg2.col2.x * _local6))); _local12 = (_arg1.y + ((_arg2.col1.y * _local5) + (_arg2.col2.y * _local6))); _local5 = ((syncMat.col1.x * m_localOBB.extents.x) + (syncMat.col2.x * m_localOBB.extents.y)); _local6 = ((syncMat.col1.y * m_localOBB.extents.x) + (syncMat.col2.y * m_localOBB.extents.y)); syncAABB.minVertex.x = (_local11 - _local5); syncAABB.minVertex.y = (_local12 - _local6); syncAABB.maxVertex.x = (_local11 + _local5); syncAABB.maxVertex.y = (_local12 + _local6); _local7 = _arg4.col1; _local8 = _arg4.col2; _local9 = m_localOBB.R.col1; _local10 = m_localOBB.R.col2; syncMat.col1.x = ((_local7.x * _local9.x) + (_local8.x * _local9.y)); syncMat.col1.y = ((_local7.y * _local9.x) + (_local8.y * _local9.y)); syncMat.col2.x = ((_local7.x * _local10.x) + (_local8.x * _local10.y)); syncMat.col2.y = ((_local7.y * _local10.x) + (_local8.y * _local10.y)); syncMat.Abs(); _local5 = (m_localCentroid.x + m_localOBB.center.x); _local6 = (m_localCentroid.y + m_localOBB.center.y); _local11 = (_arg3.x + ((_arg4.col1.x * _local5) + (_arg4.col2.x * _local6))); _local12 = (_arg3.y + ((_arg4.col1.y * _local5) + (_arg4.col2.y * _local6))); _local5 = ((syncMat.col1.x * m_localOBB.extents.x) + (syncMat.col2.x * m_localOBB.extents.y)); _local6 = ((syncMat.col1.y * m_localOBB.extents.x) + (syncMat.col2.y * m_localOBB.extents.y)); syncAABB.minVertex.x = Math.min(syncAABB.minVertex.x, (_local11 - _local5)); syncAABB.minVertex.y = Math.min(syncAABB.minVertex.y, (_local12 - _local6)); syncAABB.maxVertex.x = Math.max(syncAABB.maxVertex.x, (_local11 + _local5)); syncAABB.maxVertex.y = Math.max(syncAABB.maxVertex.y, (_local12 + _local6)); _local13 = m_body.m_world.m_broadPhase; if (_local13.InRange(syncAABB)){ _local13.MoveProxy(m_proxyId, syncAABB); } else { m_body.Freeze(); }; } override public function TestPoint(_arg1:b2Vec2):Boolean{ var _local2:b2Vec2; var _local3:int; var _local4:b2Vec2; var _local5:Number; _local2 = new b2Vec2(); _local2.SetV(_arg1); _local2.Subtract(m_position); _local2.MulTM(m_R); _local3 = 0; while (_local3 < m_vertexCount) { _local4 = new b2Vec2(); _local4.SetV(_local2); _local4.Subtract(m_vertices[_local3]); _local5 = b2Math.b2Dot(m_normals[_local3], _local4); if (_local5 > 0){ return (false); }; _local3++; }; return (true); } override public function ResetProxy(_arg1:b2BroadPhase):void{ var _local2:b2Proxy; var _local3:b2Mat22; var _local4:b2Mat22; var _local5:b2Vec2; var _local6:b2Vec2; var _local7:b2AABB; if (m_proxyId == b2Pair.b2_nullProxy){ return; }; _local2 = _arg1.GetProxy(m_proxyId); _arg1.DestroyProxy(m_proxyId); _local2 = null; _local3 = b2Math.b2MulMM(m_R, m_localOBB.R); _local4 = b2Math.b2AbsM(_local3); _local5 = b2Math.b2MulMV(_local4, m_localOBB.extents); _local6 = b2Math.b2MulMV(m_R, m_localOBB.center); _local6.Add(m_position); _local7 = new b2AABB(); _local7.minVertex.SetV(_local6); _local7.minVertex.Subtract(_local5); _local7.maxVertex.SetV(_local6); _local7.maxVertex.Add(_local5); if (_arg1.InRange(_local7)){ m_proxyId = _arg1.CreateProxy(_local7, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; if (m_proxyId == b2Pair.b2_nullProxy){ m_body.Freeze(); }; } } }//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape) package Box2D.Collision.Shapes { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2Shape { public var m_body:b2Body; public var m_maxRadius:Number; public var m_next:b2Shape; public var m_R:b2Mat22; public var m_type:int; public var m_friction:Number; public var m_proxyId:uint; public var m_maskBits:uint; public var m_groupIndex:int; public var m_userData;// = null public var m_restitution:Number; public var m_position:b2Vec2; public var m_categoryBits:uint; public static const e_boxShape:int = 1; public static const e_unknownShape:int = -1; public static const e_shapeTypeCount:int = 4; public static const e_circleShape:int = 0; public static const e_meshShape:int = 3; public static const e_polyShape:int = 2; public function b2Shape(_arg1:b2ShapeDef, _arg2:b2Body){ m_R = new b2Mat22(); m_position = new b2Vec2(); m_userData = null; super(); m_userData = _arg1.userData; m_friction = _arg1.friction; m_restitution = _arg1.restitution; m_body = _arg2; m_proxyId = b2Pair.b2_nullProxy; m_maxRadius = 0; m_categoryBits = _arg1.categoryBits; m_maskBits = _arg1.maskBits; m_groupIndex = _arg1.groupIndex; } public function GetMaxRadius():Number{ return (m_maxRadius); } public function GetPosition():b2Vec2{ return (m_position); } public function QuickSync(_arg1:b2Vec2, _arg2:b2Mat22):void{ } public function GetNext():b2Shape{ return (m_next); } public function GetType():int{ return (m_type); } public function GetUserData(){ return (m_userData); } public function Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{ } public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{ } public function DestroyProxy():void{ if (m_proxyId != b2Pair.b2_nullProxy){ m_body.m_world.m_broadPhase.DestroyProxy(m_proxyId); m_proxyId = b2Pair.b2_nullProxy; }; } public function GetRotationMatrix():b2Mat22{ return (m_R); } public function GetBody():b2Body{ return (m_body); } public function TestPoint(_arg1:b2Vec2):Boolean{ return (false); } public function ResetProxy(_arg1:b2BroadPhase):void{ } public static function Destroy(_arg1:b2Shape):void{ if (_arg1.m_proxyId != b2Pair.b2_nullProxy){ _arg1.m_body.m_world.m_broadPhase.DestroyProxy(_arg1.m_proxyId); }; } public static function PolyMass(_arg1:b2MassData, _arg2:Array, _arg3:int, _arg4:Number):void{ var _local5:b2Vec2; var _local6:Number; var _local7:Number; var _local8:b2Vec2; var _local9:Number; var _local10:int; var _local11:b2Vec2; var _local12:b2Vec2; var _local13:b2Vec2; var _local14:b2Vec2; var _local15:b2Vec2; var _local16:Number; var _local17:Number; var _local18:b2Vec2; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; _local5 = new b2Vec2(); _local5.SetZero(); _local6 = 0; _local7 = 0; _local8 = new b2Vec2(0, 0); _local9 = (1 / 3); _local10 = 0; while (_local10 < _arg3) { _local11 = _local8; _local12 = _arg2[_local10]; _local13 = (((_local10 + 1) < _arg3)) ? _arg2[(_local10 + 1)] : _arg2[0]; _local14 = b2Math.SubtractVV(_local12, _local11); _local15 = b2Math.SubtractVV(_local13, _local11); _local16 = b2Math.b2CrossVV(_local14, _local15); _local17 = (0.5 * _local16); _local6 = (_local6 + _local17); _local18 = new b2Vec2(); _local18.SetV(_local11); _local18.Add(_local12); _local18.Add(_local13); _local18.Multiply((_local9 * _local17)); _local5.Add(_local18); _local19 = _local11.x; _local20 = _local11.y; _local21 = _local14.x; _local22 = _local14.y; _local23 = _local15.x; _local24 = _local15.y; _local25 = ((_local9 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19)); _local26 = ((_local9 * ((0.25 * (((_local22 * _local22) + (_local24 * _local22)) + (_local24 * _local24))) + ((_local20 * _local22) + (_local20 * _local24)))) + ((0.5 * _local20) * _local20)); _local7 = (_local7 + (_local16 * (_local25 + _local26))); _local10++; }; _arg1.mass = (_arg4 * _local6); _local5.Multiply((1 / _local6)); _arg1.center = _local5; _local7 = (_arg4 * (_local7 - (_local6 * b2Math.b2Dot(_local5, _local5)))); _arg1.I = _local7; } public static function PolyCentroid(_arg1:Array, _arg2:int, _arg3:b2Vec2):void{ var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; 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; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; _local4 = 0; _local5 = 0; _local6 = 0; _local7 = 0; _local8 = 0; _local9 = (1 / 3); _local10 = 0; while (_local10 < _arg2) { _local11 = _local7; _local12 = _local8; _local13 = _arg1[_local10].x; _local14 = _arg1[_local10].y; _local15 = (((_local10 + 1) < _arg2)) ? _arg1[(_local10 + 1)].x : _arg1[0].x; _local16 = (((_local10 + 1) < _arg2)) ? _arg1[(_local10 + 1)].y : _arg1[0].y; _local17 = (_local13 - _local11); _local18 = (_local14 - _local12); _local19 = (_local15 - _local11); _local20 = (_local16 - _local12); _local21 = ((_local17 * _local20) - (_local18 * _local19)); _local22 = (0.5 * _local21); _local6 = (_local6 + _local22); _local4 = (_local4 + ((_local22 * _local9) * ((_local11 + _local13) + _local15))); _local5 = (_local5 + ((_local22 * _local9) * ((_local12 + _local14) + _local16))); _local10++; }; _local4 = (_local4 * (1 / _local6)); _local5 = (_local5 * (1 / _local6)); _arg3.Set(_local4, _local5); } public static function Create(_arg1:b2ShapeDef, _arg2:b2Body, _arg3:b2Vec2):b2Shape{ switch (_arg1.type){ case e_circleShape: return (new b2CircleShape(_arg1, _arg2, _arg3)); case e_boxShape: case e_polyShape: return (new b2PolyShape(_arg1, _arg2, _arg3)); }; return (null); } } }//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2ShapeDef { public var groupIndex:int; public var categoryBits:int; public var localRotation:Number; public var restitution:Number; public var userData;// = null public var density:Number; public var maskBits:int; public var type:int; public var localPosition:b2Vec2; public var friction:Number; public function b2ShapeDef(){ userData = null; super(); type = b2Shape.e_unknownShape; userData = null; localPosition = new b2Vec2(0, 0); localRotation = 0; friction = 0.2; restitution = 0; density = 0; categoryBits = 1; maskBits = 0xFFFF; groupIndex = 0; } public function ComputeMass(_arg1:b2MassData):void{ var _local2:b2CircleDef; var _local3:b2BoxDef; var _local4:b2PolyDef; _arg1.center = new b2Vec2(0, 0); if (density == 0){ _arg1.mass = 0; _arg1.center.Set(0, 0); _arg1.I = 0; }; switch (type){ case b2Shape.e_circleShape: _local2 = (this as b2CircleDef); _arg1.mass = (((density * b2Settings.b2_pi) * _local2.radius) * _local2.radius); _arg1.center.Set(0, 0); _arg1.I = (((0.5 * _arg1.mass) * _local2.radius) * _local2.radius); break; case b2Shape.e_boxShape: _local3 = (this as b2BoxDef); _arg1.mass = (((4 * density) * _local3.extents.x) * _local3.extents.y); _arg1.center.Set(0, 0); _arg1.I = ((_arg1.mass / 3) * b2Math.b2Dot(_local3.extents, _local3.extents)); break; case b2Shape.e_polyShape: _local4 = (this as b2PolyDef); b2Shape.PolyMass(_arg1, _local4.vertices, _local4.vertexCount, density); break; default: _arg1.mass = 0; _arg1.center.Set(0, 0); _arg1.I = 0; break; }; } } }//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2AABB { public var minVertex:b2Vec2; public var maxVertex:b2Vec2; public function b2AABB(){ minVertex = new b2Vec2(); maxVertex = new b2Vec2(); super(); } public function IsValid():Boolean{ var _local1:Number; var _local2:Number; var _local3:Boolean; _local1 = maxVertex.x; _local2 = maxVertex.y; _local1 = maxVertex.x; _local2 = maxVertex.y; _local1 = (_local1 - minVertex.x); _local2 = (_local2 - minVertex.y); _local3 = (((_local1 >= 0)) && ((_local2 >= 0))); _local3 = ((((_local3) && (minVertex.IsValid()))) && (maxVertex.IsValid())); return (_local3); } } }//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound) package Box2D.Collision { public class b2Bound { public var proxyId:uint; public var stabbingCount:uint; public var value:uint; public function Swap(_arg1:b2Bound):void{ var _local2:uint; var _local3:uint; var _local4:uint; _local2 = value; _local3 = proxyId; _local4 = stabbingCount; value = _arg1.value; proxyId = _arg1.proxyId; stabbingCount = _arg1.stabbingCount; _arg1.value = _local2; _arg1.proxyId = _local3; _arg1.stabbingCount = _local4; } public function IsLower():Boolean{ return (((value & 1) == 0)); } public function IsUpper():Boolean{ return (((value & 1) == 1)); } } }//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues) package Box2D.Collision { public class b2BoundValues { public var lowerValues:Array; public var upperValues:Array; public function b2BoundValues(){ lowerValues = [0, 0]; upperValues = [0, 0]; super(); } } }//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2BroadPhase { public var m_quantizationFactor:b2Vec2; public var m_worldAABB:b2AABB; public var m_bounds:Array; public var m_freeProxy:uint; public var m_proxyCount:int; public var m_proxyPool:Array; public var m_queryResultCount:int; public var m_pairManager:b2PairManager; public var m_timeStamp:uint; public var m_queryResults:Array; public static const b2_nullEdge:uint = 0xFFFF; public static const b2_invalid:uint = 0xFFFF; public static var s_validate:Boolean = false; public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){ var _local3:int; var _local4:Number; var _local5:Number; var _local6:b2Proxy; var _local7:int; m_pairManager = new b2PairManager(); m_proxyPool = new Array(b2Settings.b2_maxPairs); m_bounds = new Array((2 * b2Settings.b2_maxProxies)); m_queryResults = new Array(b2Settings.b2_maxProxies); m_quantizationFactor = new b2Vec2(); super(); m_pairManager.Initialize(this, _arg2); m_worldAABB = _arg1; m_proxyCount = 0; _local3 = 0; while (_local3 < b2Settings.b2_maxProxies) { m_queryResults[_local3] = 0; _local3++; }; m_bounds = new Array(2); _local3 = 0; while (_local3 < 2) { m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies)); _local7 = 0; while (_local7 < (2 * b2Settings.b2_maxProxies)) { m_bounds[_local3][_local7] = new b2Bound(); _local7++; }; _local3++; }; _local4 = _arg1.maxVertex.x; _local5 = _arg1.maxVertex.y; _local4 = (_local4 - _arg1.minVertex.x); _local5 = (_local5 - _arg1.minVertex.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[(b2Settings.b2_maxProxies - 1)] = _local6; _local6.SetNext(b2Pair.b2_nullProxy); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; m_freeProxy = 0; m_timeStamp = 1; m_queryResultCount = 0; } public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{ var _local4:Array; var _local5:Array; var _local6:uint; var _local7:uint; var _local8:Array; var _local9:Array; var _local10:int; var _local11:int; var _local12:b2Proxy; _local4 = new Array(); _local5 = new Array(); ComputeBounds(_local4, _local5, _arg1); _local8 = [_local6]; _local9 = [_local7]; Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0); Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1); _local10 = 0; _local11 = 0; while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) { _local12 = m_proxyPool[m_queryResults[_local11]]; _arg2[_local11] = _local12.userData; _local11++; _local10++; }; m_queryResultCount = 0; IncrementTimeStamp(); return (_local10); } public function Commit():void{ m_pairManager.Commit(); } public function GetProxy(_arg1:int):b2Proxy{ if ((((_arg1 == b2Pair.b2_nullProxy)) || ((m_proxyPool[_arg1].IsValid() == false)))){ return (null); }; return (m_proxyPool[_arg1]); } private function IncrementTimeStamp():void{ var _local1:uint; if (m_timeStamp == b2Settings.USHRT_MAX){ _local1 = 0; while (_local1 < b2Settings.b2_maxProxies) { m_proxyPool[_local1].timeStamp = 0; _local1++; }; m_timeStamp = 1; } else { m_timeStamp++; }; } private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{ var _local8:uint; var _local9:uint; var _local10:uint; var _local11:int; var _local12:int; var _local13:b2Proxy; _local8 = BinarySearch(_arg5, _arg6, _arg3); _local9 = BinarySearch(_arg5, _arg6, _arg4); _local10 = _local8; while (_local10 < _local9) { if (_arg5[_local10].IsLower()){ IncrementOverlapCount(_arg5[_local10].proxyId); }; _local10++; }; if (_local8 > 0){ _local11 = (_local8 - 1); _local12 = _arg5[_local11].stabbingCount; while (_local12) { if (_arg5[_local11].IsLower()){ _local13 = m_proxyPool[_arg5[_local11].proxyId]; if (_local8 <= _local13.upperBounds[_arg7]){ IncrementOverlapCount(_arg5[_local11].proxyId); _local12--; }; }; _local11--; }; }; _arg1[0] = _local8; _arg2[0] = _local9; } private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{ var _local3:int; var _local4:Array; _local3 = 0; while (_local3 < 2) { _local4 = m_bounds[_local3]; if (_local4[_arg1.lowerBounds[_local3]].value > _local4[_arg2.upperBounds[_local3]].value){ return (false); }; if (_local4[_arg1.upperBounds[_local3]].value < _local4[_arg2.lowerBounds[_local3]].value){ return (false); }; _local3++; }; return (true); } private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{ var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; _local4 = _arg3.minVertex.x; _local5 = _arg3.minVertex.y; _local4 = b2Math.b2Min(_local4, m_worldAABB.maxVertex.x); _local5 = b2Math.b2Min(_local5, m_worldAABB.maxVertex.y); _local4 = b2Math.b2Max(_local4, m_worldAABB.minVertex.x); _local5 = b2Math.b2Max(_local5, m_worldAABB.minVertex.y); _local6 = _arg3.maxVertex.x; _local7 = _arg3.maxVertex.y; _local6 = b2Math.b2Min(_local6, m_worldAABB.maxVertex.x); _local7 = b2Math.b2Min(_local7, m_worldAABB.maxVertex.y); _local6 = b2Math.b2Max(_local6, m_worldAABB.minVertex.x); _local7 = b2Math.b2Max(_local7, m_worldAABB.minVertex.y); _arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.minVertex.x))) & (b2Settings.USHRT_MAX - 1)); _arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.minVertex.x))) & 0xFFFF) | 1); _arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.minVertex.y))) & (b2Settings.USHRT_MAX - 1)); _arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.minVertex.y))) & 0xFFFF) | 1); } public function CreateProxy(_arg1:b2AABB, _arg2):uint{ var _local3:uint; var _local4:b2Proxy; var _local5:uint; var _local6:uint; var _local7:Array; var _local8:Array; var _local9:int; var _local10:int; var _local11:Array; var _local12:uint; var _local13:uint; var _local14:Array; var _local15:Array; var _local16:Array; var _local17:int; var _local18:int; var _local19:b2Bound; var _local20:b2Bound; var _local21:int; var _local22:b2Proxy; _local5 = m_freeProxy; _local4 = m_proxyPool[_local5]; m_freeProxy = _local4.GetNext(); _local4.overlapCount = 0; _local4.userData = _arg2; _local6 = (2 * m_proxyCount); _local7 = new Array(); _local8 = new Array(); ComputeBounds(_local7, _local8, _arg1); _local9 = 0; while (_local9 < 2) { _local11 = m_bounds[_local9]; _local14 = [_local12]; _local15 = [_local13]; Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9); _local12 = _local14[0]; _local13 = _local15[0]; _local16 = new Array(); _local18 = (_local6 - _local13); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[(_local13 + _local17)]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local21 = (_local13 + 2); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[(_local21 + _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[(_local12 + _local17)]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local21 = (_local12 + 1); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[(_local21 + _local17)]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local13++; _local11[_local12].value = _local7[_local9]; _local11[_local12].proxyId = _local5; _local11[_local13].value = _local8[_local9]; _local11[_local13].proxyId = _local5; _local11[_local12].stabbingCount = ((_local12 == 0)) ? 0 : _local11[(_local12 - 1)].stabbingCount; _local11[_local13].stabbingCount = _local11[(_local13 - 1)].stabbingCount; _local3 = _local12; while (_local3 < _local13) { _local11[_local3].stabbingCount++; _local3++; }; _local3 = _local12; while (_local3 < (_local6 + 2)) { _local22 = m_proxyPool[_local11[_local3].proxyId]; if (_local11[_local3].IsLower()){ _local22.lowerBounds[_local9] = _local3; } else { _local22.upperBounds[_local9] = _local3; }; _local3++; }; _local9++; }; m_proxyCount++; _local10 = 0; while (_local10 < m_queryResultCount) { m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]); _local10++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); return (_local5); } public function DestroyProxy(_arg1:uint):void{ var _local2:b2Proxy; var _local3:int; var _local4:int; var _local5:int; var _local6:Array; var _local7:uint; var _local8:uint; var _local9:uint; var _local10:uint; var _local11:Array; var _local12:int; var _local13:int; var _local14:b2Bound; var _local15:b2Bound; var _local16:int; var _local17:uint; var _local18:int; var _local19:b2Proxy; _local2 = m_proxyPool[_arg1]; _local3 = (2 * m_proxyCount); _local4 = 0; while (_local4 < 2) { _local6 = m_bounds[_local4]; _local7 = _local2.lowerBounds[_local4]; _local8 = _local2.upperBounds[_local4]; _local9 = _local6[_local7].value; _local10 = _local6[_local8].value; _local11 = new Array(); _local13 = ((_local8 - _local7) - 1); _local12 = 0; while (_local12 < _local13) { _local11[_local12] = new b2Bound(); _local14 = _local11[_local12]; _local15 = _local6[((_local7 + 1) + _local12)]; _local14.value = _local15.value; _local14.proxyId = _local15.proxyId; _local14.stabbingCount = _local15.stabbingCount; _local12++; }; _local13 = _local11.length; _local16 = _local7; _local12 = 0; while (_local12 < _local13) { _local15 = _local11[_local12]; _local14 = _local6[(_local16 + _local12)]; _local14.value = _local15.value; _local14.proxyId = _local15.proxyId; _local14.stabbingCount = _local15.stabbingCount; _local12++; }; _local11 = new Array(); _local13 = ((_local3 - _local8) - 1); _local12 = 0; while (_local12 < _local13) { _local11[_local12] = new b2Bound(); _local14 = _local11[_local12]; _local15 = _local6[((_local8 + 1) + _local12)]; _local14.value = _local15.value; _local14.proxyId = _local15.proxyId; _local14.stabbingCount = _local15.stabbingCount; _local12++; }; _local13 = _local11.length; _local16 = (_local8 - 1); _local12 = 0; while (_local12 < _local13) { _local15 = _local11[_local12]; _local14 = _local6[(_local16 + _local12)]; _local14.value = _local15.value; _local14.proxyId = _local15.proxyId; _local14.stabbingCount = _local15.stabbingCount; _local12++; }; _local13 = (_local3 - 2); _local17 = _local7; while (_local17 < _local13) { _local19 = m_proxyPool[_local6[_local17].proxyId]; if (_local6[_local17].IsLower()){ _local19.lowerBounds[_local4] = _local17; } else { _local19.upperBounds[_local4] = _local17; }; _local17++; }; _local13 = (_local8 - 1); _local18 = _local7; while (_local18 < _local13) { _local6[_local18].stabbingCount--; _local18++; }; Query([0], [0], _local9, _local10, _local6, (_local3 - 2), _local4); _local4++; }; _local5 = 0; while (_local5 < m_queryResultCount) { m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local5]); _local5++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); _local2.userData = null; _local2.overlapCount = b2_invalid; _local2.lowerBounds[0] = b2_invalid; _local2.lowerBounds[1] = b2_invalid; _local2.upperBounds[0] = b2_invalid; _local2.upperBounds[1] = b2_invalid; _local2.SetNext(m_freeProxy); m_freeProxy = _arg1; m_proxyCount--; } public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{ var _local3:int; var _local4:Array; _local3 = 0; while (_local3 < 2) { _local4 = m_bounds[_local3]; if (_arg1.lowerValues[_local3] > _local4[_arg2.upperBounds[_local3]].value){ return (false); }; if (_arg1.upperValues[_local3] < _local4[_arg2.lowerBounds[_local3]].value){ return (false); }; _local3++; }; return (true); } public function Validate():void{ var _local1:b2Pair; var _local2:b2Proxy; var _local3:b2Proxy; var _local4:Boolean; var _local5:int; var _local6:b2Bound; var _local7:uint; var _local8:uint; var _local9:uint; var _local10:b2Bound; _local5 = 0; while (_local5 < 2) { _local6 = m_bounds[_local5]; _local7 = (2 * m_proxyCount); _local8 = 0; _local9 = 0; while (_local9 < _local7) { _local10 = _local6[_local9]; if (_local10.IsLower() == true){ _local8++; } else { _local8--; }; _local9++; }; _local5++; }; } private function IncrementOverlapCount(_arg1:uint):void{ var _local2:b2Proxy; _local2 = m_proxyPool[_arg1]; if (_local2.timeStamp < m_timeStamp){ _local2.timeStamp = m_timeStamp; _local2.overlapCount = 1; } else { _local2.overlapCount = 2; m_queryResults[m_queryResultCount] = _arg1; m_queryResultCount++; }; } public function InRange(_arg1:b2AABB):Boolean{ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local2 = _arg1.minVertex.x; _local3 = _arg1.minVertex.y; _local2 = (_local2 - m_worldAABB.maxVertex.x); _local3 = (_local3 - m_worldAABB.maxVertex.y); _local4 = m_worldAABB.minVertex.x; _local5 = m_worldAABB.minVertex.y; _local4 = (_local4 - _arg1.maxVertex.x); _local5 = (_local5 - _arg1.maxVertex.y); _local2 = b2Math.b2Max(_local2, _local4); _local3 = b2Math.b2Max(_local3, _local5); return ((b2Math.b2Max(_local2, _local3) < 0)); } public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{ var _local3:uint; var _local4:uint; var _local5:b2Bound; var _local6:b2Bound; var _local7:b2Bound; var _local8:uint; var _local9:b2Proxy; var _local10:uint; var _local11:b2Proxy; var _local12:b2BoundValues; var _local13:b2BoundValues; var _local14:Array; var _local15:uint; var _local16:uint; var _local17:uint; var _local18:uint; var _local19:int; var _local20:int; var _local21:uint; var _local22:b2Proxy; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){ return; }; if (_arg2.IsValid() == false){ return; }; _local10 = (2 * m_proxyCount); _local11 = m_proxyPool[_arg1]; _local12 = new b2BoundValues(); ComputeBounds(_local12.lowerValues, _local12.upperValues, _arg2); _local13 = new b2BoundValues(); _local3 = 0; while (_local3 < 2) { _local13.lowerValues[_local3] = m_bounds[_local3][_local11.lowerBounds[_local3]].value; _local13.upperValues[_local3] = m_bounds[_local3][_local11.upperBounds[_local3]].value; _local3++; }; _local3 = 0; while (_local3 < 2) { _local14 = m_bounds[_local3]; _local15 = _local11.lowerBounds[_local3]; _local16 = _local11.upperBounds[_local3]; _local17 = _local12.lowerValues[_local3]; _local18 = _local12.upperValues[_local3]; _local19 = (_local17 - _local14[_local15].value); _local20 = (_local18 - _local14[_local16].value); _local14[_local15].value = _local17; _local14[_local16].value = _local18; if (_local19 < 0){ _local4 = _local15; while ((((_local4 > 0)) && ((_local17 < _local14[(_local4 - 1)].value)))) { _local5 = _local14[_local4]; _local6 = _local14[(_local4 - 1)]; _local21 = _local6.proxyId; _local22 = m_proxyPool[_local6.proxyId]; _local6.stabbingCount++; if (_local6.IsUpper() == true){ if (TestOverlap(_local12, _local22)){ m_pairManager.AddBufferedPair(_arg1, _local21); }; var _local23 = _local22.upperBounds; var _local24 = _local3; var _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.stabbingCount++; } else { _local23 = _local22.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.stabbingCount--; }; _local23 = _local11.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.Swap(_local6); _local4--; }; }; if (_local20 > 0){ _local4 = _local16; while ((((_local4 < (_local10 - 1))) && ((_local14[(_local4 + 1)].value <= _local18)))) { _local5 = _local14[_local4]; _local7 = _local14[(_local4 + 1)]; _local8 = _local7.proxyId; _local9 = m_proxyPool[_local8]; _local7.stabbingCount++; if (_local7.IsLower() == true){ if (TestOverlap(_local12, _local9)){ m_pairManager.AddBufferedPair(_arg1, _local8); }; _local23 = _local9.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.stabbingCount++; } else { _local23 = _local9.upperBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.stabbingCount--; }; _local23 = _local11.upperBounds; _local24 = _local3; _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.Swap(_local7); _local4++; }; }; if (_local19 > 0){ _local4 = _local15; while ((((_local4 < (_local10 - 1))) && ((_local14[(_local4 + 1)].value <= _local17)))) { _local5 = _local14[_local4]; _local7 = _local14[(_local4 + 1)]; _local8 = _local7.proxyId; _local9 = m_proxyPool[_local8]; _local7.stabbingCount--; if (_local7.IsUpper()){ if (TestOverlap(_local13, _local9)){ m_pairManager.RemoveBufferedPair(_arg1, _local8); }; _local23 = _local9.upperBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.stabbingCount--; } else { _local23 = _local9.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.stabbingCount++; }; _local23 = _local11.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.Swap(_local7); _local4++; }; }; if (_local20 < 0){ _local4 = _local16; while ((((_local4 > 0)) && ((_local18 < _local14[(_local4 - 1)].value)))) { _local5 = _local14[_local4]; _local6 = _local14[(_local4 - 1)]; _local21 = _local6.proxyId; _local22 = m_proxyPool[_local21]; _local6.stabbingCount--; if (_local6.IsLower() == true){ if (TestOverlap(_local13, _local22)){ m_pairManager.RemoveBufferedPair(_arg1, _local21); }; _local23 = _local22.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.stabbingCount--; } else { _local23 = _local22.upperBounds; _local24 = _local3; _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.stabbingCount++; }; _local23 = _local11.upperBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.Swap(_local6); _local4--; }; }; _local3++; }; } public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{ var _local4:int; var _local5:int; var _local6:int; _local4 = 0; _local5 = (_arg2 - 1); while (_local4 <= _local5) { _local6 = ((_local4 + _local5) / 2); if (_arg1[_local6].value > _arg3){ _local5 = (_local6 - 1); } else { if (_arg1[_local6].value < _arg3){ _local4 = (_local6 + 1); } else { return (uint(_local6)); }; }; }; return (uint(_local4)); } } }//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair) package Box2D.Collision { public class b2BufferedPair { public var proxyId1:uint; public var proxyId2:uint; } }//package Box2D.Collision
Section 14
//b2Collision (Box2D.Collision.b2Collision) package Box2D.Collision { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Collision { public static const b2_nullFeature:uint = 0xFF; private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2(); public static function EdgeSeparation(_arg1:b2PolyShape, _arg2:int, _arg3:b2PolyShape):Number{ var _local4:Array; var _local5:int; var _local6:Array; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:Number; var _local12:Number; var _local13:int; var _local14:Number; var _local15:int; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:b2Vec2; var _local22:Number; _local4 = _arg1.m_vertices; _local5 = _arg3.m_vertexCount; _local6 = _arg3.m_vertices; _local7 = _arg1.m_normals[_arg2].x; _local8 = _arg1.m_normals[_arg2].y; _local9 = _local7; _local10 = _arg1.m_R; _local7 = ((_local10.col1.x * _local9) + (_local10.col2.x * _local8)); _local8 = ((_local10.col1.y * _local9) + (_local10.col2.y * _local8)); _local11 = _local7; _local12 = _local8; _local10 = _arg3.m_R; _local9 = ((_local11 * _local10.col1.x) + (_local12 * _local10.col1.y)); _local12 = ((_local11 * _local10.col2.x) + (_local12 * _local10.col2.y)); _local11 = _local9; _local13 = 0; _local14 = Number.MAX_VALUE; _local15 = 0; while (_local15 < _local5) { _local21 = _local6[_local15]; _local22 = ((_local21.x * _local11) + (_local21.y * _local12)); if (_local22 < _local14){ _local14 = _local22; _local13 = _local15; }; _local15++; }; _local10 = _arg1.m_R; _local16 = (_arg1.m_position.x + ((_local10.col1.x * _local4[_arg2].x) + (_local10.col2.x * _local4[_arg2].y))); _local17 = (_arg1.m_position.y + ((_local10.col1.y * _local4[_arg2].x) + (_local10.col2.y * _local4[_arg2].y))); _local10 = _arg3.m_R; _local18 = (_arg3.m_position.x + ((_local10.col1.x * _local6[_local13].x) + (_local10.col2.x * _local6[_local13].y))); _local19 = (_arg3.m_position.y + ((_local10.col1.y * _local6[_local13].x) + (_local10.col2.y * _local6[_local13].y))); _local18 = (_local18 - _local16); _local19 = (_local19 - _local17); _local20 = ((_local18 * _local7) + (_local19 * _local8)); return (_local20); } public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{ var _local3:b2Vec2; var _local4:b2Vec2; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; _local3 = _arg2.minVertex; _local4 = _arg1.maxVertex; _local5 = (_local3.x - _local4.x); _local6 = (_local3.y - _local4.y); _local3 = _arg1.minVertex; _local4 = _arg2.maxVertex; _local7 = (_local3.x - _local4.x); _local8 = (_local3.y - _local4.y); if ((((_local5 > 0)) || ((_local6 > 0)))){ return (false); }; if ((((_local7 > 0)) || ((_local8 > 0)))){ return (false); }; return (true); } public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolyShape, _arg3:int, _arg4:b2PolyShape):void{ var _local5:int; var _local6:Array; var _local7:int; var _local8:Array; var _local9:int; var _local10:int; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:b2Mat22; var _local19:Number; var _local20:Number; var _local21:int; var _local22:int; var _local23:Number; var _local24:int; var _local25:ClipVertex; var _local26:int; var _local27:int; var _local28:Number; var _local29:Number; var _local30:Number; _local5 = _arg2.m_vertexCount; _local6 = _arg2.m_vertices; _local7 = _arg4.m_vertexCount; _local8 = _arg4.m_vertices; _local9 = _arg3; _local10 = (((_arg3 + 1) == _local5)) ? 0 : (_arg3 + 1); _local11 = _local6[_local10]; _local12 = _local11.x; _local13 = _local11.y; _local11 = _local6[_local9]; _local12 = (_local12 - _local11.x); _local13 = (_local13 - _local11.y); _local14 = _local12; _local12 = _local13; _local13 = -(_local14); _local15 = (1 / Math.sqrt(((_local12 * _local12) + (_local13 * _local13)))); _local12 = (_local12 * _local15); _local13 = (_local13 * _local15); _local16 = _local12; _local17 = _local13; _local14 = _local16; _local18 = _arg2.m_R; _local16 = ((_local18.col1.x * _local14) + (_local18.col2.x * _local17)); _local17 = ((_local18.col1.y * _local14) + (_local18.col2.y * _local17)); _local19 = _local16; _local20 = _local17; _local18 = _arg4.m_R; _local14 = ((_local19 * _local18.col1.x) + (_local20 * _local18.col1.y)); _local20 = ((_local19 * _local18.col2.x) + (_local20 * _local18.col2.y)); _local19 = _local14; _local23 = Number.MAX_VALUE; _local24 = 0; while (_local24 < _local7) { _local26 = _local24; _local27 = (((_local24 + 1) < _local7)) ? (_local24 + 1) : 0; _local11 = _local8[_local27]; _local28 = _local11.x; _local29 = _local11.y; _local11 = _local8[_local26]; _local28 = (_local28 - _local11.x); _local29 = (_local29 - _local11.y); _local14 = _local28; _local28 = _local29; _local29 = -(_local14); _local15 = (1 / Math.sqrt(((_local28 * _local28) + (_local29 * _local29)))); _local28 = (_local28 * _local15); _local29 = (_local29 * _local15); _local30 = ((_local28 * _local19) + (_local29 * _local20)); if (_local30 < _local23){ _local23 = _local30; _local21 = _local26; _local22 = _local27; }; _local24++; }; _local25 = _arg1[0]; _local11 = _local25.v; _local11.SetV(_local8[_local21]); _local11.MulM(_arg4.m_R); _local11.Add(_arg4.m_position); _local25.id.features.referenceFace = _arg3; _local25.id.features.incidentEdge = _local21; _local25.id.features.incidentVertex = _local21; _local25 = _arg1[1]; _local11 = _local25.v; _local11.SetV(_local8[_local22]); _local11.MulM(_arg4.m_R); _local11.Add(_arg4.m_position); _local25.id.features.referenceFace = _arg3; _local25.id.features.incidentEdge = _local21; _local25.id.features.incidentVertex = _local22; } public static function b2CollidePolyAndCircle(_arg1:b2Manifold, _arg2:b2PolyShape, _arg3:b2CircleShape, _arg4:Boolean):void{ var _local5:b2ContactPoint; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:Number; var _local12:Number; var _local13:int; var _local14:Number; var _local15:Number; var _local16:int; var _local17:int; var _local18:int; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:b2Vec2; _arg1.pointCount = 0; _local8 = (_arg3.m_position.x - _arg2.m_position.x); _local9 = (_arg3.m_position.y - _arg2.m_position.y); _local10 = _arg2.m_R; _local11 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); _local9 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); _local8 = _local11; _local13 = 0; _local14 = -(Number.MAX_VALUE); _local15 = _arg3.m_radius; _local16 = 0; while (_local16 < _arg2.m_vertexCount) { _local25 = ((_arg2.m_normals[_local16].x * (_local8 - _arg2.m_vertices[_local16].x)) + (_arg2.m_normals[_local16].y * (_local9 - _arg2.m_vertices[_local16].y))); if (_local25 > _local15){ return; }; if (_local25 > _local14){ _local14 = _local25; _local13 = _local16; }; _local16++; }; if (_local14 < Number.MIN_VALUE){ _arg1.pointCount = 1; _local26 = _arg2.m_normals[_local13]; _arg1.normal.x = ((_local10.col1.x * _local26.x) + (_local10.col2.x * _local26.y)); _arg1.normal.y = ((_local10.col1.y * _local26.x) + (_local10.col2.y * _local26.y)); _local5 = _arg1.points[0]; _local5.id.features.incidentEdge = _local13; _local5.id.features.incidentVertex = b2_nullFeature; _local5.id.features.referenceFace = b2_nullFeature; _local5.id.features.flip = 0; _local5.position.x = (_arg3.m_position.x - (_local15 * _arg1.normal.x)); _local5.position.y = (_arg3.m_position.y - (_local15 * _arg1.normal.y)); _local5.separation = (_local14 - _local15); return; }; _local17 = _local13; _local18 = (((_local17 + 1) < _arg2.m_vertexCount)) ? (_local17 + 1) : 0; _local19 = (_arg2.m_vertices[_local18].x - _arg2.m_vertices[_local17].x); _local20 = (_arg2.m_vertices[_local18].y - _arg2.m_vertices[_local17].y); _local21 = Math.sqrt(((_local19 * _local19) + (_local20 * _local20))); _local19 = (_local19 / _local21); _local20 = (_local20 / _local21); if (_local21 < Number.MIN_VALUE){ _local6 = (_local8 - _arg2.m_vertices[_local17].x); _local7 = (_local9 - _arg2.m_vertices[_local17].y); _local12 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); _local6 = (_local6 / _local12); _local7 = (_local7 / _local12); if (_local12 > _local15){ return; }; _arg1.pointCount = 1; _arg1.normal.Set(((_local10.col1.x * _local6) + (_local10.col2.x * _local7)), ((_local10.col1.y * _local6) + (_local10.col2.y * _local7))); _local5 = _arg1.points[0]; _local5.id.features.incidentEdge = b2_nullFeature; _local5.id.features.incidentVertex = _local17; _local5.id.features.referenceFace = b2_nullFeature; _local5.id.features.flip = 0; _local5.position.x = (_arg3.m_position.x - (_local15 * _arg1.normal.x)); _local5.position.y = (_arg3.m_position.y - (_local15 * _arg1.normal.y)); _local5.separation = (_local12 - _local15); return; }; _local22 = (((_local8 - _arg2.m_vertices[_local17].x) * _local19) + ((_local9 - _arg2.m_vertices[_local17].y) * _local20)); _local5 = _arg1.points[0]; _local5.id.features.incidentEdge = b2_nullFeature; _local5.id.features.incidentVertex = b2_nullFeature; _local5.id.features.referenceFace = b2_nullFeature; _local5.id.features.flip = 0; if (_local22 <= 0){ _local23 = _arg2.m_vertices[_local17].x; _local24 = _arg2.m_vertices[_local17].y; _local5.id.features.incidentVertex = _local17; } else { if (_local22 >= _local21){ _local23 = _arg2.m_vertices[_local18].x; _local24 = _arg2.m_vertices[_local18].y; _local5.id.features.incidentVertex = _local18; } else { _local23 = ((_local19 * _local22) + _arg2.m_vertices[_local17].x); _local24 = ((_local20 * _local22) + _arg2.m_vertices[_local17].y); _local5.id.features.incidentEdge = _local17; }; }; _local6 = (_local8 - _local23); _local7 = (_local9 - _local24); _local12 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); _local6 = (_local6 / _local12); _local7 = (_local7 / _local12); if (_local12 > _local15){ return; }; _arg1.pointCount = 1; _arg1.normal.Set(((_local10.col1.x * _local6) + (_local10.col2.x * _local7)), ((_local10.col1.y * _local6) + (_local10.col2.y * _local7))); _local5.position.x = (_arg3.m_position.x - (_local15 * _arg1.normal.x)); _local5.position.y = (_arg3.m_position.y - (_local15 * _arg1.normal.y)); _local5.separation = (_local12 - _local15); } public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolyShape, _arg3:b2PolyShape, _arg4:Boolean):Number{ var _local5:int; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:int; var _local11:Number; var _local12:int; var _local13:Number; var _local14:int; var _local15:Number; var _local16:int; var _local17:Number; var _local18:int; var _local19:Number; var _local20:int; var _local21:Number; _local5 = _arg2.m_vertexCount; _local6 = (_arg3.m_position.x - _arg2.m_position.x); _local7 = (_arg3.m_position.y - _arg2.m_position.y); _local8 = ((_local6 * _arg2.m_R.col1.x) + (_local7 * _arg2.m_R.col1.y)); _local9 = ((_local6 * _arg2.m_R.col2.x) + (_local7 * _arg2.m_R.col2.y)); _local10 = 0; _local11 = -(Number.MAX_VALUE); _local12 = 0; while (_local12 < _local5) { _local21 = ((_arg2.m_normals[_local12].x * _local8) + (_arg2.m_normals[_local12].y * _local9)); if (_local21 > _local11){ _local11 = _local21; _local10 = _local12; }; _local12++; }; _local13 = EdgeSeparation(_arg2, _local10, _arg3); if ((((_local13 > 0)) && ((_arg4 == false)))){ return (_local13); }; _local14 = (((_local10 - 1) >= 0)) ? (_local10 - 1) : (_local5 - 1); _local15 = EdgeSeparation(_arg2, _local14, _arg3); if ((((_local15 > 0)) && ((_arg4 == false)))){ return (_local15); }; _local16 = (((_local10 + 1) < _local5)) ? (_local10 + 1) : 0; _local17 = EdgeSeparation(_arg2, _local16, _arg3); if ((((_local17 > 0)) && ((_arg4 == false)))){ return (_local17); }; if ((((_local15 > _local13)) && ((_local15 > _local17)))){ _local20 = -1; _local18 = _local14; _local19 = _local15; } else { if (_local17 > _local13){ _local20 = 1; _local18 = _local16; _local19 = _local17; } else { _arg1[0] = _local10; return (_local13); }; }; while (true) { if (_local20 == -1){ _local10 = (((_local18 - 1) >= 0)) ? (_local18 - 1) : (_local5 - 1); } else { _local10 = (((_local18 + 1) < _local5)) ? (_local18 + 1) : 0; }; _local13 = EdgeSeparation(_arg2, _local10, _arg3); if ((((_local13 > 0)) && ((_arg4 == false)))){ return (_local13); }; if (_local13 > _local19){ _local18 = _local10; _local19 = _local13; } else { break; }; }; _arg1[0] = _local18; return (_local19); } public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{ var _local5:int; var _local6:b2Vec2; var _local7:b2Vec2; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:b2Vec2; _local5 = 0; _local6 = _arg2[0].v; _local7 = _arg2[1].v; _local8 = (b2Math.b2Dot(_arg3, _arg2[0].v) - _arg4); _local9 = (b2Math.b2Dot(_arg3, _arg2[1].v) - _arg4); if (_local8 <= 0){ var _temp1 = _local5; _local5 = (_local5 + 1); var _local12 = _temp1; _arg1[_local12] = _arg2[0]; }; if (_local9 <= 0){ var _temp2 = _local5; _local5 = (_local5 + 1); _local12 = _temp2; _arg1[_local12] = _arg2[1]; }; if ((_local8 * _local9) < 0){ _local10 = (_local8 / (_local8 - _local9)); _local11 = _arg1[_local5].v; _local11.x = (_local6.x + (_local10 * (_local7.x - _local6.x))); _local11.y = (_local6.y + (_local10 * (_local7.y - _local6.y))); if (_local8 > 0){ _arg1[_local5].id = _arg2[0].id; } else { _arg1[_local5].id = _arg2[1].id; }; _local5++; }; return (_local5); } public static function b2CollidePoly(_arg1:b2Manifold, _arg2:b2PolyShape, _arg3:b2PolyShape, _arg4:Boolean):void{ var _local5:int; var _local6:Array; var _local7:Number; var _local8:int; var _local9:Array; var _local10:Number; var _local11:b2PolyShape; var _local12:b2PolyShape; var _local13:int; var _local14:int; var _local15:Number; var _local16:Number; var _local17:Array; var _local18:int; var _local19:Array; var _local20:b2Vec2; var _local21:b2Vec2; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:b2Mat22; 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:Array; var _local39:Array; var _local40:int; var _local41:int; var _local42:int; var _local43:b2Vec2; var _local44:Number; var _local45:b2ContactPoint; _arg1.pointCount = 0; _local5 = 0; _local6 = [_local5]; _local7 = FindMaxSeparation(_local6, _arg2, _arg3, _arg4); _local5 = _local6[0]; if ((((_local7 > 0)) && ((_arg4 == false)))){ return; }; _local8 = 0; _local9 = [_local8]; _local10 = FindMaxSeparation(_local9, _arg3, _arg2, _arg4); _local8 = _local9[0]; if ((((_local10 > 0)) && ((_arg4 == false)))){ return; }; _local15 = 0.98; _local16 = 0.001; if (_local10 > ((_local15 * _local7) + _local16)){ _local11 = _arg3; _local12 = _arg2; _local13 = _local8; _local14 = 1; } else { _local11 = _arg2; _local12 = _arg3; _local13 = _local5; _local14 = 0; }; _local17 = [new ClipVertex(), new ClipVertex()]; FindIncidentEdge(_local17, _local11, _local13, _local12); _local18 = _local11.m_vertexCount; _local19 = _local11.m_vertices; _local20 = _local19[_local13]; _local21 = (((_local13 + 1) < _local18)) ? _local19[(_local13 + 1)] : _local19[0]; _local22 = (_local21.x - _local20.x); _local23 = (_local21.y - _local20.y); _local24 = (_local21.x - _local20.x); _local25 = (_local21.y - _local20.y); _local26 = _local24; _local27 = _local11.m_R; _local24 = ((_local27.col1.x * _local26) + (_local27.col2.x * _local25)); _local25 = ((_local27.col1.y * _local26) + (_local27.col2.y * _local25)); _local28 = (1 / Math.sqrt(((_local24 * _local24) + (_local25 * _local25)))); _local24 = (_local24 * _local28); _local25 = (_local25 * _local28); _local29 = _local24; _local30 = _local25; _local26 = _local29; _local29 = _local30; _local30 = -(_local26); _local31 = _local20.x; _local32 = _local20.y; _local26 = _local31; _local27 = _local11.m_R; _local31 = ((_local27.col1.x * _local26) + (_local27.col2.x * _local32)); _local32 = ((_local27.col1.y * _local26) + (_local27.col2.y * _local32)); _local31 = (_local31 + _local11.m_position.x); _local32 = (_local32 + _local11.m_position.y); _local33 = _local21.x; _local34 = _local21.y; _local26 = _local33; _local27 = _local11.m_R; _local33 = ((_local27.col1.x * _local26) + (_local27.col2.x * _local34)); _local34 = ((_local27.col1.y * _local26) + (_local27.col2.y * _local34)); _local33 = (_local33 + _local11.m_position.x); _local34 = (_local34 + _local11.m_position.y); _local35 = ((_local29 * _local31) + (_local30 * _local32)); _local36 = -(((_local24 * _local31) + (_local25 * _local32))); _local37 = ((_local24 * _local33) + (_local25 * _local34)); _local38 = [new ClipVertex(), new ClipVertex()]; _local39 = [new ClipVertex(), new ClipVertex()]; b2CollidePolyTempVec.Set(-(_local24), -(_local25)); _local40 = ClipSegmentToLine(_local38, _local17, b2CollidePolyTempVec, _local36); if (_local40 < 2){ return; }; b2CollidePolyTempVec.Set(_local24, _local25); _local40 = ClipSegmentToLine(_local39, _local38, b2CollidePolyTempVec, _local37); if (_local40 < 2){ return; }; if (_local14){ _arg1.normal.Set(-(_local29), -(_local30)); } else { _arg1.normal.Set(_local29, _local30); }; _local41 = 0; _local42 = 0; while (_local42 < b2Settings.b2_maxManifoldPoints) { _local43 = _local39[_local42].v; _local44 = (((_local29 * _local43.x) + (_local30 * _local43.y)) - _local35); if ((((_local44 <= 0)) || ((_arg4 == true)))){ _local45 = _arg1.points[_local41]; _local45.separation = _local44; _local45.position.SetV(_local39[_local42].v); _local45.id.Set(_local39[_local42].id); _local45.id.features.flip = _local14; _local41++; }; _local42++; }; _arg1.pointCount = _local41; } public static function b2CollideCircle(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2CircleShape, _arg4:Boolean):void{ var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:b2ContactPoint; var _local11:Number; var _local12:Number; _arg1.pointCount = 0; _local5 = (_arg3.m_position.x - _arg2.m_position.x); _local6 = (_arg3.m_position.y - _arg2.m_position.y); _local7 = ((_local5 * _local5) + (_local6 * _local6)); _local8 = (_arg2.m_radius + _arg3.m_radius); if ((((_local7 > (_local8 * _local8))) && ((_arg4 == false)))){ return; }; if (_local7 < Number.MIN_VALUE){ _local9 = -(_local8); _arg1.normal.Set(0, 1); } else { _local11 = Math.sqrt(_local7); _local9 = (_local11 - _local8); _local12 = (1 / _local11); _arg1.normal.x = (_local12 * _local5); _arg1.normal.y = (_local12 * _local6); }; _arg1.pointCount = 1; _local10 = _arg1.points[0]; _local10.id.key = 0; _local10.separation = _local9; _local10.position.x = (_arg3.m_position.x - (_arg3.m_radius * _arg1.normal.x)); _local10.position.y = (_arg3.m_position.y - (_arg3.m_radius * _arg1.normal.y)); } } }//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID) package Box2D.Collision { public class b2ContactID { public var _key:uint; public var features:Features; public function b2ContactID(){ features = new Features(); super(); features._m_id = this; } public function Set(_arg1:b2ContactID):void{ key = _arg1._key; } public function Copy():b2ContactID{ var _local1:b2ContactID; _local1 = new b2ContactID(); _local1.key = key; return (_local1); } public function get key():uint{ return (_key); } public function set key(_arg1:uint):void{ _key = _arg1; features._referenceFace = (_key & 0xFF); features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF); features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF); features._flip = (((_key & 4278190080) >> 24) & 0xFF); } } }//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint) package Box2D.Collision { import Box2D.Common.Math.*; public class b2ContactPoint { public var separation:Number; public var position:b2Vec2; public var normalImpulse:Number; public var tangentImpulse:Number; public var id:b2ContactID; public function b2ContactPoint(){ position = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 17
//b2Manifold (Box2D.Collision.b2Manifold) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Manifold { public var points:Array; public var pointCount:int; public var normal:b2Vec2; public function b2Manifold(){ var _local1:int; super(); points = new Array(b2Settings.b2_maxManifoldPoints); _local1 = 0; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ContactPoint(); _local1++; }; normal = new b2Vec2(); } } }//package Box2D.Collision
Section 18
//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 19
//b2Pair (Box2D.Collision.b2Pair) package Box2D.Collision { import Box2D.Common.*; public class b2Pair { public var userData;// = null public var proxyId1:uint; public var proxyId2:uint; public var status:uint; public var next:uint; public static var e_pairFinal:uint = 4; public static var b2_tableMask:int = (b2_tableCapacity - 1); public static var e_pairRemoved:uint = 2; public static var b2_nullPair:uint = b2Settings.USHRT_MAX; public static var e_pairBuffered:uint = 1; public static var b2_nullProxy:uint = b2Settings.USHRT_MAX; public static var b2_tableCapacity:int = b2Settings.b2_maxPairs; public function b2Pair(){ userData = null; super(); } public function SetBuffered():void{ status = (status | e_pairBuffered); } public function IsBuffered():Boolean{ return (((status & e_pairBuffered) == e_pairBuffered)); } public function IsFinal():Boolean{ return (((status & e_pairFinal) == e_pairFinal)); } public function ClearRemoved():void{ status = (status & ~(e_pairRemoved)); } public function SetFinal():void{ status = (status | e_pairFinal); } public function IsRemoved():Boolean{ return (((status & e_pairRemoved) == e_pairRemoved)); } public function ClearBuffered():void{ status = (status & ~(e_pairBuffered)); } public function SetRemoved():void{ status = (status | e_pairRemoved); } } }//package Box2D.Collision
Section 20
//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 21
//b2PairManager (Box2D.Collision.b2PairManager) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PairManager { public var m_pairCount:int; public var m_pairBuffer:Array; public var m_callback:b2PairCallback; public var m_pairs:Array; public var m_pairBufferCount:int; public var m_hashTable:Array; public var m_broadPhase:b2BroadPhase; public var m_freePair:uint; public function b2PairManager(){ var _local1:uint; super(); m_hashTable = new Array(b2Pair.b2_tableCapacity); _local1 = 0; while (_local1 < b2Pair.b2_tableCapacity) { m_hashTable[_local1] = b2Pair.b2_nullPair; _local1++; }; m_pairs = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1] = new b2Pair(); _local1++; }; m_pairBuffer = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairBuffer[_local1] = new b2BufferedPair(); _local1++; }; _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy; m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy; m_pairs[_local1].userData = null; m_pairs[_local1].status = 0; m_pairs[_local1].next = (_local1 + 1); _local1++; }; m_pairs[(b2Settings.b2_maxPairs - 1)].next = b2Pair.b2_nullPair; m_pairCount = 0; } private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{ var _local4:uint; _local4 = m_hashTable[_arg3]; while (((!((_local4 == b2Pair.b2_nullPair))) && ((Equals(m_pairs[_local4], _arg1, _arg2) == false)))) { _local4 = m_pairs[_local4].next; }; if (_local4 == b2Pair.b2_nullPair){ return (null); }; return (m_pairs[_local4]); } private function Find(_arg1:uint, _arg2:uint):b2Pair{ var _local3:uint; var _local4:uint; if (_arg1 > _arg2){ _local4 = _arg1; _arg1 = _arg2; _arg2 = _local4; }; _local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); return (FindHash(_arg1, _arg2, _local3)); } private function ValidateBuffer():void{ } public function Commit():void{ var _local1:int; var _local2:int; var _local3:Array; var _local4:b2Pair; var _local5:b2Proxy; var _local6:b2Proxy; _local2 = 0; _local3 = m_broadPhase.m_proxyPool; _local1 = 0; while (_local1 < m_pairBufferCount) { _local4 = Find(m_pairBuffer[_local1].proxyId1, m_pairBuffer[_local1].proxyId2); _local4.ClearBuffered(); _local5 = _local3[_local4.proxyId1]; _local6 = _local3[_local4.proxyId2]; if (_local4.IsRemoved()){ if (_local4.IsFinal() == true){ m_callback.PairRemoved(_local5.userData, _local6.userData, _local4.userData); }; m_pairBuffer[_local2].proxyId1 = _local4.proxyId1; m_pairBuffer[_local2].proxyId2 = _local4.proxyId2; _local2++; } else { if (_local4.IsFinal() == false){ _local4.userData = m_callback.PairAdded(_local5.userData, _local6.userData); _local4.SetFinal(); }; }; _local1++; }; _local1 = 0; while (_local1 < _local2) { RemovePair(m_pairBuffer[_local1].proxyId1, m_pairBuffer[_local1].proxyId2); _local1++; }; m_pairBufferCount = 0; if (b2BroadPhase.s_validate){ ValidateTable(); }; } public function RemoveBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2Pair; _local3 = Find(_arg1, _arg2); if (_local3 == null){ return; }; if (_local3.IsBuffered() == false){ _local3.SetBuffered(); m_pairBuffer[m_pairBufferCount].proxyId1 = _local3.proxyId1; m_pairBuffer[m_pairBufferCount].proxyId2 = _local3.proxyId2; m_pairBufferCount++; }; _local3.SetRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function RemovePair(_arg1:uint, _arg2:uint){ var _local3:uint; var _local4:uint; var _local5:b2Pair; var _local6:uint; var _local7:uint; var _local8:b2Pair; var _local9:*; if (_arg1 > _arg2){ _local6 = _arg1; _arg1 = _arg2; _arg2 = _local6; }; _local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); _local4 = m_hashTable[_local3]; _local5 = null; while (_local4 != b2Pair.b2_nullPair) { if (Equals(m_pairs[_local4], _arg1, _arg2)){ _local7 = _local4; if (_local5){ _local5.next = m_pairs[_local4].next; } else { m_hashTable[_local3] = m_pairs[_local4].next; }; _local8 = m_pairs[_local7]; _local9 = _local8.userData; _local8.next = m_freePair; _local8.proxyId1 = b2Pair.b2_nullProxy; _local8.proxyId2 = b2Pair.b2_nullProxy; _local8.userData = null; _local8.status = 0; m_freePair = _local7; m_pairCount--; return (_local9); } else { _local5 = m_pairs[_local4]; _local4 = _local5.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:b2Pair; _local3 = AddPair(_arg1, _arg2); if (_local3.IsBuffered() == false){ _local3.SetBuffered(); m_pairBuffer[m_pairBufferCount].proxyId1 = _local3.proxyId1; m_pairBuffer[m_pairBufferCount].proxyId2 = _local3.proxyId2; m_pairBufferCount++; }; _local3.ClearRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function AddPair(_arg1:uint, _arg2:uint):b2Pair{ var _local3:uint; var _local4:b2Pair; var _local5:uint; var _local6:uint; if (_arg1 > _arg2){ _local6 = _arg1; _arg1 = _arg2; _arg2 = _local6; }; _local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); _local4 = FindHash(_arg1, _arg2, _local3); if (_local4 != null){ return (_local4); }; _local5 = m_freePair; _local4 = m_pairs[_local5]; m_freePair = _local4.next; _local4.proxyId1 = _arg1; _local4.proxyId2 = _arg2; _local4.status = 0; _local4.userData = null; _local4.next = m_hashTable[_local3]; m_hashTable[_local3] = _local5; m_pairCount++; return (_local4); } private function ValidateTable():void{ } public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{ return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2)))); } public static function Hash(_arg1:uint, _arg2:uint):uint{ var _local3:uint; _local3 = (((_arg2 << 16) & 4294901760) | _arg1); _local3 = (~(_local3) + ((_local3 << 15) & 4294934528)); _local3 = (_local3 ^ ((_local3 >> 12) & 1048575)); _local3 = (_local3 + ((_local3 << 2) & 4294967292)); _local3 = (_local3 ^ ((_local3 >> 4) & 268435455)); _local3 = (_local3 * 2057); _local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF)); return (_local3); } public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{ return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3)))); } } }//package Box2D.Collision
Section 22
//b2Proxy (Box2D.Collision.b2Proxy) package Box2D.Collision { public class b2Proxy { public var overlapCount:uint; public var lowerBounds:Array; public var upperBounds:Array; public var userData;// = null public var timeStamp:uint; public function b2Proxy(){ lowerBounds = [uint(0), uint(0)]; upperBounds = [uint(0), uint(0)]; userData = null; super(); } public function GetNext():uint{ return (lowerBounds[0]); } public function IsValid():Boolean{ return (!((overlapCount == b2BroadPhase.b2_invalid))); } public function SetNext(_arg1:uint):void{ lowerBounds[0] = (_arg1 & 0xFFFF); } } }//package Box2D.Collision
Section 23
//ClipVertex (Box2D.Collision.ClipVertex) package Box2D.Collision { import Box2D.Common.Math.*; public class ClipVertex { public var v:b2Vec2; public var id:b2ContactID; public function ClipVertex(){ v = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 24
//Features (Box2D.Collision.Features) package Box2D.Collision { public class Features { public var _referenceFace:int; public var _incidentEdge:int; public var _flip:int; public var _incidentVertex:int; public var _m_id:b2ContactID; public function get referenceFace():int{ return (_referenceFace); } 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 referenceFace(_arg1:int):void{ _referenceFace = _arg1; _m_id._key = ((_m_id._key & 4294967040) | (_referenceFace & 0xFF)); } public function set flip(_arg1:int):void{ _flip = _arg1; _m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080)); } public function get incidentVertex():int{ return (_incidentVertex); } public function set incidentEdge(_arg1:int):void{ _incidentEdge = _arg1; _m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00)); } } }//package Box2D.Collision
Section 25
//b2Mat22 (Box2D.Common.Math.b2Mat22) package Box2D.Common.Math { public class b2Mat22 { public var col1:b2Vec2; public var col2:b2Vec2; public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){ var _local4:Number; var _local5:Number; col1 = new b2Vec2(); col2 = new b2Vec2(); super(); if (((!((_arg2 == null))) && (!((_arg3 == null))))){ col1.SetV(_arg2); col2.SetV(_arg3); } else { _local4 = Math.cos(_arg1); _local5 = Math.sin(_arg1); col1.x = _local4; col2.x = -(_local5); col1.y = _local5; col2.y = _local4; }; } public function SetIdentity():void{ col1.x = 1; col2.x = 0; col1.y = 0; col2.y = 1; } public function Set(_arg1:Number):void{ var _local2:Number; var _local3:Number; _local2 = Math.cos(_arg1); _local3 = Math.sin(_arg1); col1.x = _local2; col2.x = -(_local3); col1.y = _local3; col2.y = _local2; } public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{ col1.SetV(_arg1); col2.SetV(_arg2); } public function SetZero():void{ col1.x = 0; col2.x = 0; col1.y = 0; col2.y = 0; } public function SetM(_arg1:b2Mat22):void{ col1.SetV(_arg1.col1); col2.SetV(_arg1.col2); } public function AddM(_arg1:b2Mat22):void{ col1.x = (col1.x + _arg1.col1.x); col1.y = (col1.y + _arg1.col1.y); col2.x = (col2.x + _arg1.col2.x); col2.y = (col2.y + _arg1.col2.y); } public function Abs():void{ col1.Abs(); col2.Abs(); } public function Copy():b2Mat22{ return (new b2Mat22(0, col1, col2)); } public function Invert(_arg1:b2Mat22):b2Mat22{ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; _local2 = col1.x; _local3 = col2.x; _local4 = col1.y; _local5 = col2.y; _local6 = ((_local2 * _local5) - (_local3 * _local4)); _local6 = (1 / _local6); _arg1.col1.x = (_local6 * _local5); _arg1.col2.x = (-(_local6) * _local3); _arg1.col1.y = (-(_local6) * _local4); _arg1.col2.y = (_local6 * _local2); return (_arg1); } public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; _local4 = col1.x; _local5 = col2.x; _local6 = col1.y; _local7 = col2.y; _local8 = ((_local4 * _local7) - (_local5 * _local6)); _local8 = (1 / _local8); _arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3))); _arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2))); return (_arg1); } } }//package Box2D.Common.Math
Section 26
//b2Math (Box2D.Common.Math.b2Math) package Box2D.Common.Math { public class b2Math { public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x)); return (_local3); } public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y)); return (_local3); } public static function b2IsValid(_arg1:Number):Boolean{ return (isFinite(_arg1)); } public static function b2Swap(_arg1:Array, _arg2:Array):void{ var _local3:*; _local3 = _arg1[0]; _arg1[0] = _arg2[0]; _arg2[0] = _local3; } public static function b2Abs(_arg1:Number):Number{ return (((_arg1 > 0)) ? _arg1 : -(_arg1)); } public static function b2AbsM(_arg1:b2Mat22):b2Mat22{ var _local2:b2Mat22; _local2 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2)); return (_local2); } public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y)); return (_local3); } public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x))); } public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{ return (b2Max(_arg2, b2Min(_arg1, _arg3))); } public static function b2AbsV(_arg1:b2Vec2):b2Vec2{ var _local2:b2Vec2; _local2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y)); return (_local2); } public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y)); return (_local3); } public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y))); } public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x)); return (_local3); } public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22; _local3 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2)); return (_local3); } public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Vec2; var _local4:b2Vec2; var _local5:b2Mat22; _local3 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1)); _local4 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2)); _local5 = new b2Mat22(0, _local3, _local4); return (_local5); } public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y)); return (_local3); } public static function b2IsPowerOfTwo(_arg1:uint):Boolean{ var _local2:Boolean; _local2 = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0))); return (_local2); } public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{ return (b2MaxV(_arg2, b2MinV(_arg1, _arg3))); } public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y)); return (_local3); } public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2)); return (_local3); } public static function b2Min(_arg1:Number, _arg2:Number):Number{ return (((_arg1 < _arg2)) ? _arg1 : _arg2); } public static function b2Random():Number{ return (((Math.random() * 2) - 1)); } public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22; _local3 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2)); return (_local3); } public static function b2NextPowerOfTwo(_arg1:uint):uint{ _arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647)); _arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823)); _arg1 = (_arg1 | ((_arg1 >> 4) & 268435455)); _arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF)); _arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF)); return ((_arg1 + 1)); } public static function b2Max(_arg1:Number, _arg2:Number):Number{ return (((_arg1 > _arg2)) ? _arg1 : _arg2); } public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y))); return (_local3); } } }//package Box2D.Common.Math
Section 27
//b2Vec2 (Box2D.Common.Math.b2Vec2) package Box2D.Common.Math { public class b2Vec2 { public var x:Number; public var y:Number; public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Set(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Multiply(_arg1:Number):void{ x = (x * _arg1); y = (y * _arg1); } public function Length():Number{ return (Math.sqrt(((x * x) + (y * y)))); } public function Add(_arg1:b2Vec2):void{ x = (x + _arg1.x); y = (y + _arg1.y); } public function SetZero():void{ x = 0; y = 0; } public function CrossVF(_arg1:Number):void{ var _local2:Number; _local2 = 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 Abs():void{ x = Math.abs(x); y = Math.abs(y); } public function Copy():b2Vec2{ return (new b2Vec2(x, y)); } public function MulTM(_arg1:b2Mat22):void{ var _local2:Number; _local2 = b2Math.b2Dot(this, _arg1.col1); y = b2Math.b2Dot(this, _arg1.col2); x = _local2; } public function IsValid():Boolean{ return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y)))); } public function MinV(_arg1:b2Vec2):void{ x = ((x < _arg1.x)) ? x : _arg1.x; y = ((y < _arg1.y)) ? y : _arg1.y; } public function MulM(_arg1:b2Mat22):void{ var _local2:Number; _local2 = x; x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y)); y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y)); } public function Normalize():Number{ var _local1:Number; var _local2:Number; _local1 = Length(); if (_local1 < Number.MIN_VALUE){ return (0); }; _local2 = (1 / _local1); x = (x * _local2); y = (y * _local2); return (_local1); } public function Subtract(_arg1:b2Vec2):void{ x = (x - _arg1.x); y = (y - _arg1.y); } public function CrossFV(_arg1:Number):void{ var _local2:Number; _local2 = x; x = (-(_arg1) * y); y = (_arg1 * _local2); } public static function Make(_arg1:Number, _arg2:Number):b2Vec2{ return (new b2Vec2(_arg1, _arg2)); } } }//package Box2D.Common.Math
Section 28
//b2Settings (Box2D.Common.b2Settings) package Box2D.Common { import Box2D.Common.Math.*; public class b2Settings { public static const b2_lengthUnitsPerMeter:Number = 30; public static const b2_angularSleepTolerance:Number = 0.0111111111111111; public static const b2_linearSleepTolerance:Number = 0.3; public static const b2_angularSlop:Number = 0.0349065850398866; public static const b2_linearSlop:Number = 0.15; public static const b2_pi:Number = 3.14159265358979; public static const b2_maxShapesPerBody:int = 64; public static const b2_maxProxies:int = 0x0400; public static const b2_velocityThreshold:Number = 30; public static const b2_timeToSleep:Number = 0.5; public static const b2_contactBaumgarte:Number = 0.2; public static const b2_maxPairs:int = 8192; public static const b2_maxManifoldPoints:int = 2; public static const b2_massUnitsPerKilogram:Number = 1; public static const b2_maxAngularCorrection:Number = 0.139626340159546; public static const USHRT_MAX:int = 0xFFFF; public static const b2_maxLinearCorrection:Number = 6; public static const b2_maxPolyVertices:int = 8; public static const b2_timeUnitsPerSecond:Number = 1; public static function b2Assert(_arg1:Boolean):void{ var _local2:b2Vec2; if (!_arg1){ _local2.x++; }; } } }//package Box2D.Common
Section 29
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact) package Box2D.Dynamics.Contacts { import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2CircleContact extends b2Contact { public var m_manifold:Array; public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifold = [new b2Manifold()]; super(_arg1, _arg2); m_manifold[0].pointCount = 0; m_manifold[0].points[0].normalImpulse = 0; m_manifold[0].points[0].tangentImpulse = 0; } override public function GetManifolds():Array{ return (m_manifold); } override public function Evaluate():void{ b2Collision.b2CollideCircle(m_manifold[0], (m_shape1 as b2CircleShape), (m_shape2 as b2CircleShape), false); if (m_manifold[0].pointCount > 0){ m_manifoldCount = 1; } else { m_manifoldCount = 0; }; } 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 30
//b2Contact (Box2D.Dynamics.Contacts.b2Contact) package Box2D.Dynamics.Contacts { import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2Contact { public var m_shape1:b2Shape; public var m_shape2:b2Shape; public var m_prev:b2Contact; public var m_next:b2Contact; public var m_friction:Number; public var m_manifoldCount:int; public var m_node1:b2ContactNode; public var m_node2:b2ContactNode; public var m_restitution:Number; public var m_flags:uint; public static var s_registers:Array; public static var s_initialized:Boolean = false; public static var e_islandFlag:uint = 1; public static var e_destroyFlag:uint = 2; public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){ m_node1 = new b2ContactNode(); m_node2 = new b2ContactNode(); super(); m_flags = 0; if (((!(_arg1)) || (!(_arg2)))){ m_shape1 = null; m_shape2 = null; return; }; m_shape1 = _arg1; m_shape2 = _arg2; m_manifoldCount = 0; m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction)); m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution); m_prev = null; m_next = null; m_node1.contact = null; m_node1.prev = null; m_node1.next = null; m_node1.other = null; m_node2.contact = null; m_node2.prev = null; m_node2.next = null; m_node2.other = null; } public function GetShape1():b2Shape{ return (m_shape1); } public function GetNext():b2Contact{ return (m_next); } public function GetShape2():b2Shape{ return (m_shape2); } public function GetManifoldCount():int{ return (m_manifoldCount); } public function GetManifolds():Array{ return (null); } public function Evaluate():void{ } public static function InitializeRegisters():void{ var _local1:int; var _local2:int; s_registers = new Array(b2Shape.e_shapeTypeCount); _local1 = 0; while (_local1 < b2Shape.e_shapeTypeCount) { s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount); _local2 = 0; while (_local2 < b2Shape.e_shapeTypeCount) { s_registers[_local1][_local2] = new b2ContactRegister(); _local2++; }; _local1++; }; AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape); AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polyShape, b2Shape.e_circleShape); AddType(b2PolyContact.Create, b2PolyContact.Destroy, b2Shape.e_polyShape, b2Shape.e_polyShape); } public static function Destroy(_arg1:b2Contact, _arg2):void{ var _local3:int; var _local4:int; var _local5:*; if (_arg1.GetManifoldCount() > 0){ _arg1.m_shape1.m_body.WakeUp(); _arg1.m_shape2.m_body.WakeUp(); }; _local3 = _arg1.m_shape1.m_type; _local4 = _arg1.m_shape2.m_type; _local5 = s_registers[_local3][_local4].destroyFcn; _local5(_arg1, _arg2); } public static function AddType(_arg1, _arg2, _arg3:int, _arg4:int):void{ s_registers[_arg3][_arg4].createFcn = _arg1; s_registers[_arg3][_arg4].destroyFcn = _arg2; s_registers[_arg3][_arg4].primary = true; if (_arg3 != _arg4){ s_registers[_arg4][_arg3].createFcn = _arg1; s_registers[_arg4][_arg3].destroyFcn = _arg2; s_registers[_arg4][_arg3].primary = false; }; } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ var _local4:int; var _local5:int; var _local6:*; var _local7:b2Contact; var _local8:int; var _local9:b2Manifold; if (s_initialized == false){ InitializeRegisters(); s_initialized = true; }; _local4 = _arg1.m_type; _local5 = _arg2.m_type; _local6 = s_registers[_local4][_local5].createFcn; if (_local6){ if (s_registers[_local4][_local5].primary){ return (_local6(_arg1, _arg2, _arg3)); }; _local7 = _local6(_arg2, _arg1, _arg3); _local8 = 0; while (_local8 < _local7.GetManifoldCount()) { _local9 = _local7.GetManifolds()[_local8]; _local7.GetManifolds()[_local8].normal = _local9.normal.Negative(); _local8++; }; return (_local7); //unresolved jump }; return (null); } } }//package Box2D.Dynamics.Contacts
Section 31
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactConstraint { public var points:Array; public var restitution:Number; public var body1:b2Body; public var manifold:b2Manifold; public var normal:b2Vec2; public var body2:b2Body; public var friction:Number; public var pointCount:int; public function b2ContactConstraint(){ var _local1:int; normal = new b2Vec2(); super(); points = new Array(b2Settings.b2_maxManifoldPoints); _local1 = 0; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ContactConstraintPoint(); _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 32
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; public class b2ContactConstraintPoint { public var separation:Number; public var positionImpulse:Number; public var normalImpulse:Number; public var tangentImpulse:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var tangentMass:Number; public var normalMass:Number; public var velocityBias:Number; public function b2ContactConstraintPoint(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); } } }//package Box2D.Dynamics.Contacts
Section 33
//b2ContactNode (Box2D.Dynamics.Contacts.b2ContactNode) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2ContactNode { public var next:b2ContactNode; public var other:b2Body; public var contact:b2Contact; public var prev:b2ContactNode; } }//package Box2D.Dynamics.Contacts
Section 34
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister) package Box2D.Dynamics.Contacts { public class b2ContactRegister { public var primary:Boolean; public var createFcn; public var destroyFcn; } }//package Box2D.Dynamics.Contacts
Section 35
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactSolver { public var m_constraintCount:int; public var m_constraints:Array; public var m_allocator; public function b2ContactSolver(_arg1:Array, _arg2:int, _arg3){ var _local4:int; var _local5:b2Vec2; var _local6:b2Mat22; var _local7:int; var _local8:b2Contact; var _local9:b2Body; var _local10:b2Body; var _local11:int; var _local12:Array; 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:int; var _local22:b2Manifold; var _local23:Number; var _local24:Number; var _local25:b2ContactConstraint; var _local26:uint; var _local27:b2ContactPoint; var _local28:b2ContactConstraintPoint; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local39:Number; var _local40:Number; var _local41:Number; var _local42:Number; var _local43:Number; var _local44:Number; var _local45:Number; m_constraints = new Array(); super(); m_allocator = _arg3; m_constraintCount = 0; _local4 = 0; while (_local4 < _arg2) { m_constraintCount = (m_constraintCount + _arg1[_local4].GetManifoldCount()); _local4++; }; _local4 = 0; while (_local4 < m_constraintCount) { m_constraints[_local4] = new b2ContactConstraint(); _local4++; }; _local7 = 0; _local4 = 0; while (_local4 < _arg2) { _local8 = _arg1[_local4]; _local9 = _local8.m_shape1.m_body; _local10 = _local8.m_shape2.m_body; _local11 = _local8.GetManifoldCount(); _local12 = _local8.GetManifolds(); _local13 = _local8.m_friction; _local14 = _local8.m_restitution; _local15 = _local9.m_linearVelocity.x; _local16 = _local9.m_linearVelocity.y; _local17 = _local10.m_linearVelocity.x; _local18 = _local10.m_linearVelocity.y; _local19 = _local9.m_angularVelocity; _local20 = _local10.m_angularVelocity; _local21 = 0; while (_local21 < _local11) { _local22 = _local12[_local21]; _local23 = _local22.normal.x; _local24 = _local22.normal.y; _local25 = m_constraints[_local7]; _local25.body1 = _local9; _local25.body2 = _local10; _local25.manifold = _local22; _local25.normal.x = _local23; _local25.normal.y = _local24; _local25.pointCount = _local22.pointCount; _local25.friction = _local13; _local25.restitution = _local14; _local26 = 0; while (_local26 < _local25.pointCount) { _local27 = _local22.points[_local26]; _local28 = _local25.points[_local26]; _local28.normalImpulse = _local27.normalImpulse; _local28.tangentImpulse = _local27.tangentImpulse; _local28.separation = _local27.separation; _local29 = (_local27.position.x - _local9.m_position.x); _local30 = (_local27.position.y - _local9.m_position.y); _local31 = (_local27.position.x - _local10.m_position.x); _local32 = (_local27.position.y - _local10.m_position.y); _local5 = _local28.localAnchor1; _local6 = _local9.m_R; _local5.x = ((_local29 * _local6.col1.x) + (_local30 * _local6.col1.y)); _local5.y = ((_local29 * _local6.col2.x) + (_local30 * _local6.col2.y)); _local5 = _local28.localAnchor2; _local6 = _local10.m_R; _local5.x = ((_local31 * _local6.col1.x) + (_local32 * _local6.col1.y)); _local5.y = ((_local31 * _local6.col2.x) + (_local32 * _local6.col2.y)); _local33 = ((_local29 * _local29) + (_local30 * _local30)); _local34 = ((_local31 * _local31) + (_local32 * _local32)); _local35 = ((_local29 * _local23) + (_local30 * _local24)); _local36 = ((_local31 * _local23) + (_local32 * _local24)); _local37 = (_local9.m_invMass + _local10.m_invMass); _local37 = (_local37 + ((_local9.m_invI * (_local33 - (_local35 * _local35))) + (_local10.m_invI * (_local34 - (_local36 * _local36))))); _local28.normalMass = (1 / _local37); _local38 = _local24; _local39 = -(_local23); _local40 = ((_local29 * _local38) + (_local30 * _local39)); _local41 = ((_local31 * _local38) + (_local32 * _local39)); _local42 = (_local9.m_invMass + _local10.m_invMass); _local42 = (_local42 + ((_local9.m_invI * (_local33 - (_local40 * _local40))) + (_local10.m_invI * (_local34 - (_local41 * _local41))))); _local28.tangentMass = (1 / _local42); _local28.velocityBias = 0; if (_local28.separation > 0){ _local28.velocityBias = (-60 * _local28.separation); }; _local43 = (((_local17 + (-(_local20) * _local32)) - _local15) - (-(_local19) * _local30)); _local44 = (((_local18 + (_local20 * _local31)) - _local16) - (_local19 * _local29)); _local45 = ((_local25.normal.x * _local43) + (_local25.normal.y * _local44)); if (_local45 < -(b2Settings.b2_velocityThreshold)){ _local28.velocityBias = (_local28.velocityBias + (-(_local25.restitution) * _local45)); }; _local26++; }; _local7++; _local21++; }; _local4++; }; } public function SolvePositionConstraints(_arg1:Number):Boolean{ var _local2:Number; var _local3:b2Mat22; var _local4:b2Vec2; var _local5:int; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:b2Vec2; var _local10:Number; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:int; var _local22:int; var _local23:b2ContactConstraintPoint; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local39:Number; _local2 = 0; _local5 = 0; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_position; _local10 = _local7.m_rotation; _local11 = _local8.m_position; _local12 = _local8.m_rotation; _local13 = _local7.m_invMass; _local14 = _local7.m_invI; _local15 = _local8.m_invMass; _local16 = _local8.m_invI; _local17 = _local6.normal.x; _local18 = _local6.normal.y; _local19 = _local18; _local20 = -(_local17); _local21 = _local6.pointCount; _local22 = 0; while (_local22 < _local21) { _local23 = _local6.points[_local22]; _local3 = _local7.m_R; _local4 = _local23.localAnchor1; _local24 = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local25 = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local3 = _local8.m_R; _local4 = _local23.localAnchor2; _local26 = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local27 = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local28 = (_local9.x + _local24); _local29 = (_local9.y + _local25); _local30 = (_local11.x + _local26); _local31 = (_local11.y + _local27); _local32 = (_local30 - _local28); _local33 = (_local31 - _local29); _local34 = (((_local32 * _local17) + (_local33 * _local18)) + _local23.separation); _local2 = b2Math.b2Min(_local2, _local34); _local35 = (_arg1 * b2Math.b2Clamp((_local34 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0)); _local36 = (-(_local23.normalMass) * _local35); _local37 = _local23.positionImpulse; _local23.positionImpulse = b2Math.b2Max((_local37 + _local36), 0); _local36 = (_local23.positionImpulse - _local37); _local38 = (_local36 * _local17); _local39 = (_local36 * _local18); _local9.x = (_local9.x - (_local13 * _local38)); _local9.y = (_local9.y - (_local13 * _local39)); _local10 = (_local10 - (_local14 * ((_local24 * _local39) - (_local25 * _local38)))); _local7.m_R.Set(_local10); _local11.x = (_local11.x + (_local15 * _local38)); _local11.y = (_local11.y + (_local15 * _local39)); _local12 = (_local12 + (_local16 * ((_local26 * _local39) - (_local27 * _local38)))); _local8.m_R.Set(_local12); _local22++; }; _local7.m_rotation = _local10; _local8.m_rotation = _local12; _local5++; }; return ((_local2 >= -(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:b2Mat22; var _local14:b2Vec2; var _local15:int; var _local16:b2ContactConstraint; var _local17:b2Body; var _local18:b2Body; var _local19:Number; var _local20:b2Vec2; var _local21:Number; var _local22:b2Vec2; 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:int; var _local32:Number; var _local33:Number; var _local34:Number; _local15 = 0; while (_local15 < m_constraintCount) { _local16 = m_constraints[_local15]; _local17 = _local16.body1; _local18 = _local16.body2; _local19 = _local17.m_angularVelocity; _local20 = _local17.m_linearVelocity; _local21 = _local18.m_angularVelocity; _local22 = _local18.m_linearVelocity; _local23 = _local17.m_invMass; _local24 = _local17.m_invI; _local25 = _local18.m_invMass; _local26 = _local18.m_invI; _local27 = _local16.normal.x; _local28 = _local16.normal.y; _local29 = _local28; _local30 = -(_local27); _local31 = _local16.pointCount; _local1 = 0; while (_local1 < _local31) { _local2 = _local16.points[_local1]; _local13 = _local17.m_R; _local14 = _local2.localAnchor1; _local3 = ((_local13.col1.x * _local14.x) + (_local13.col2.x * _local14.y)); _local4 = ((_local13.col1.y * _local14.x) + (_local13.col2.y * _local14.y)); _local13 = _local18.m_R; _local14 = _local2.localAnchor2; _local5 = ((_local13.col1.x * _local14.x) + (_local13.col2.x * _local14.y)); _local6 = ((_local13.col1.y * _local14.x) + (_local13.col2.y * _local14.y)); _local7 = (((_local22.x + (-(_local21) * _local6)) - _local20.x) - (-(_local19) * _local4)); _local8 = (((_local22.y + (_local21 * _local5)) - _local20.y) - (_local19 * _local3)); _local32 = ((_local7 * _local27) + (_local8 * _local28)); _local9 = (-(_local2.normalMass) * (_local32 - _local2.velocityBias)); _local10 = b2Math.b2Max((_local2.normalImpulse + _local9), 0); _local9 = (_local10 - _local2.normalImpulse); _local11 = (_local9 * _local27); _local12 = (_local9 * _local28); _local20.x = (_local20.x - (_local23 * _local11)); _local20.y = (_local20.y - (_local23 * _local12)); _local19 = (_local19 - (_local24 * ((_local3 * _local12) - (_local4 * _local11)))); _local22.x = (_local22.x + (_local25 * _local11)); _local22.y = (_local22.y + (_local25 * _local12)); _local21 = (_local21 + (_local26 * ((_local5 * _local12) - (_local6 * _local11)))); _local2.normalImpulse = _local10; _local7 = (((_local22.x + (-(_local21) * _local6)) - _local20.x) - (-(_local19) * _local4)); _local8 = (((_local22.y + (_local21 * _local5)) - _local20.y) - (_local19 * _local3)); _local33 = ((_local7 * _local29) + (_local8 * _local30)); _local9 = (_local2.tangentMass * -(_local33)); _local34 = (_local16.friction * _local2.normalImpulse); _local10 = b2Math.b2Clamp((_local2.tangentImpulse + _local9), -(_local34), _local34); _local9 = (_local10 - _local2.tangentImpulse); _local11 = (_local9 * _local29); _local12 = (_local9 * _local30); _local20.x = (_local20.x - (_local23 * _local11)); _local20.y = (_local20.y - (_local23 * _local12)); _local19 = (_local19 - (_local24 * ((_local3 * _local12) - (_local4 * _local11)))); _local22.x = (_local22.x + (_local25 * _local11)); _local22.y = (_local22.y + (_local25 * _local12)); _local21 = (_local21 + (_local26 * ((_local5 * _local12) - (_local6 * _local11)))); _local2.tangentImpulse = _local10; _local1++; }; _local17.m_angularVelocity = _local19; _local18.m_angularVelocity = _local21; _local15++; }; } public function PreSolve():void{ var _local1:b2Vec2; var _local2:b2Vec2; var _local3:b2Mat22; var _local4:int; var _local5:b2ContactConstraint; var _local6:b2Body; var _local7:b2Body; 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:int; var _local17:int; var _local18:b2ContactConstraintPoint; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:b2ContactConstraintPoint; _local4 = 0; while (_local4 < m_constraintCount) { _local5 = m_constraints[_local4]; _local6 = _local5.body1; _local7 = _local5.body2; _local8 = _local6.m_invMass; _local9 = _local6.m_invI; _local10 = _local7.m_invMass; _local11 = _local7.m_invI; _local12 = _local5.normal.x; _local13 = _local5.normal.y; _local14 = _local13; _local15 = -(_local12); if (b2World.s_enableWarmStarting){ _local17 = _local5.pointCount; _local16 = 0; while (_local16 < _local17) { _local18 = _local5.points[_local16]; _local19 = ((_local18.normalImpulse * _local12) + (_local18.tangentImpulse * _local14)); _local20 = ((_local18.normalImpulse * _local13) + (_local18.tangentImpulse * _local15)); _local3 = _local6.m_R; _local1 = _local18.localAnchor1; _local21 = ((_local3.col1.x * _local1.x) + (_local3.col2.x * _local1.y)); _local22 = ((_local3.col1.y * _local1.x) + (_local3.col2.y * _local1.y)); _local3 = _local7.m_R; _local1 = _local18.localAnchor2; _local23 = ((_local3.col1.x * _local1.x) + (_local3.col2.x * _local1.y)); _local24 = ((_local3.col1.y * _local1.x) + (_local3.col2.y * _local1.y)); _local6.m_angularVelocity = (_local6.m_angularVelocity - (_local9 * ((_local21 * _local20) - (_local22 * _local19)))); _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x - (_local8 * _local19)); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y - (_local8 * _local20)); _local7.m_angularVelocity = (_local7.m_angularVelocity + (_local11 * ((_local23 * _local20) - (_local24 * _local19)))); _local7.m_linearVelocity.x = (_local7.m_linearVelocity.x + (_local10 * _local19)); _local7.m_linearVelocity.y = (_local7.m_linearVelocity.y + (_local10 * _local20)); _local18.positionImpulse = 0; _local16++; }; } else { _local17 = _local5.pointCount; _local16 = 0; while (_local16 < _local17) { _local25 = _local5.points[_local16]; _local25.normalImpulse = 0; _local25.tangentImpulse = 0; _local25.positionImpulse = 0; _local16++; }; }; _local4++; }; } public function PostSolve():void{ var _local1:int; var _local2:b2ContactConstraint; var _local3:b2Manifold; var _local4:int; var _local5:b2ContactPoint; var _local6:b2ContactConstraintPoint; _local1 = 0; while (_local1 < m_constraintCount) { _local2 = m_constraints[_local1]; _local3 = _local2.manifold; _local4 = 0; while (_local4 < _local2.pointCount) { _local5 = _local3.points[_local4]; _local6 = _local2.points[_local4]; _local5.normalImpulse = _local6.normalImpulse; _local5.tangentImpulse = _local6.tangentImpulse; _local4++; }; _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 36
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact) package Box2D.Dynamics.Contacts { public class b2NullContact extends b2Contact { public function b2NullContact():void{ } override public function GetManifolds():Array{ return (null); } override public function Evaluate():void{ } } }//package Box2D.Dynamics.Contacts
Section 37
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact) package Box2D.Dynamics.Contacts { import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolyAndCircleContact extends b2Contact { public var m_manifold:Array; public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifold = [new b2Manifold()]; super(_arg1, _arg2); b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polyShape)); b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape)); m_manifold[0].pointCount = 0; m_manifold[0].points[0].normalImpulse = 0; m_manifold[0].points[0].tangentImpulse = 0; } override public function GetManifolds():Array{ return (m_manifold); } override public function Evaluate():void{ b2Collision.b2CollidePolyAndCircle(m_manifold[0], (m_shape1 as b2PolyShape), (m_shape2 as b2CircleShape), false); if (m_manifold[0].pointCount > 0){ m_manifoldCount = 1; } else { m_manifoldCount = 0; }; } 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 38
//b2PolyContact (Box2D.Dynamics.Contacts.b2PolyContact) package Box2D.Dynamics.Contacts { import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolyContact extends b2Contact { public var m_manifold:Array; private var m0:b2Manifold; public function b2PolyContact(_arg1:b2Shape, _arg2:b2Shape):void{ m0 = new b2Manifold(); m_manifold = [new b2Manifold()]; super(_arg1, _arg2); m_manifold[0].pointCount = 0; } override public function GetManifolds():Array{ return (m_manifold); } override public function Evaluate():void{ var _local1:b2Manifold; var _local2:Array; var _local3:int; var _local4:b2ContactPoint; var _local5:b2ContactPoint; var _local6:Array; var _local7:int; var _local8:b2ContactPoint; var _local9:uint; var _local10:int; var _local11:b2ContactPoint; var _local12:b2ContactID; _local1 = m_manifold[0]; _local2 = m0.points; _local3 = 0; while (_local3 < _local1.pointCount) { _local4 = _local2[_local3]; _local5 = _local1.points[_local3]; _local4.normalImpulse = _local5.normalImpulse; _local4.tangentImpulse = _local5.tangentImpulse; _local4.id = _local5.id.Copy(); _local3++; }; m0.pointCount = _local1.pointCount; b2Collision.b2CollidePoly(_local1, (m_shape1 as b2PolyShape), (m_shape2 as b2PolyShape), false); if (_local1.pointCount > 0){ _local6 = [false, false]; _local7 = 0; while (_local7 < _local1.pointCount) { _local8 = _local1.points[_local7]; _local8.normalImpulse = 0; _local8.tangentImpulse = 0; _local9 = _local8.id.key; _local10 = 0; while (_local10 < m0.pointCount) { if (_local6[_local10] == true){ } else { _local11 = m0.points[_local10]; _local12 = _local11.id; if (_local12.key == _local9){ _local6[_local10] = true; _local8.normalImpulse = _local11.normalImpulse; _local8.tangentImpulse = _local11.tangentImpulse; break; }; }; _local10++; }; _local7++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolyContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 39
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2DistanceJoint extends b2Joint { public var m_localAnchor2:b2Vec2; public var m_mass:Number; public var m_localAnchor1:b2Vec2; public var m_u:b2Vec2; public var m_impulse: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); _local2 = m_body1.m_R; _local3 = (_arg1.anchorPoint1.x - m_body1.m_position.x); _local4 = (_arg1.anchorPoint1.y - m_body1.m_position.y); m_localAnchor1.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)); m_localAnchor1.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)); _local2 = m_body2.m_R; _local3 = (_arg1.anchorPoint2.x - m_body2.m_position.x); _local4 = (_arg1.anchorPoint2.y - m_body2.m_position.y); m_localAnchor2.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)); m_localAnchor2.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)); _local3 = (_arg1.anchorPoint2.x - _arg1.anchorPoint1.x); _local4 = (_arg1.anchorPoint2.y - _arg1.anchorPoint1.y); m_length = Math.sqrt(((_local3 * _local3) + (_local4 * _local4))); m_impulse = 0; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; 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; _local2 = m_body1.m_R; _local3 = ((_local2.col1.x * m_localAnchor1.x) + (_local2.col2.x * m_localAnchor1.y)); _local4 = ((_local2.col1.y * m_localAnchor1.x) + (_local2.col2.y * m_localAnchor1.y)); _local2 = m_body2.m_R; _local5 = ((_local2.col1.x * m_localAnchor2.x) + (_local2.col2.x * m_localAnchor2.y)); _local6 = ((_local2.col1.y * m_localAnchor2.x) + (_local2.col2.y * m_localAnchor2.y)); _local7 = (m_body1.m_linearVelocity.x + (-(m_body1.m_angularVelocity) * _local4)); _local8 = (m_body1.m_linearVelocity.y + (m_body1.m_angularVelocity * _local3)); _local9 = (m_body2.m_linearVelocity.x + (-(m_body2.m_angularVelocity) * _local6)); _local10 = (m_body2.m_linearVelocity.y + (m_body2.m_angularVelocity * _local5)); _local11 = ((m_u.x * (_local9 - _local7)) + (m_u.y * (_local10 - _local8))); _local12 = (-(m_mass) * _local11); m_impulse = (m_impulse + _local12); _local13 = (_local12 * m_u.x); _local14 = (_local12 * m_u.y); m_body1.m_linearVelocity.x = (m_body1.m_linearVelocity.x - (m_body1.m_invMass * _local13)); m_body1.m_linearVelocity.y = (m_body1.m_linearVelocity.y - (m_body1.m_invMass * _local14)); m_body1.m_angularVelocity = (m_body1.m_angularVelocity - (m_body1.m_invI * ((_local3 * _local14) - (_local4 * _local13)))); m_body2.m_linearVelocity.x = (m_body2.m_linearVelocity.x + (m_body2.m_invMass * _local13)); m_body2.m_linearVelocity.y = (m_body2.m_linearVelocity.y + (m_body2.m_invMass * _local14)); m_body2.m_angularVelocity = (m_body2.m_angularVelocity + (m_body2.m_invI * ((_local5 * _local14) - (_local6 * _local13)))); } override public function GetAnchor1():b2Vec2{ return (b2Math.AddVV(m_body1.m_position, b2Math.b2MulMV(m_body1.m_R, m_localAnchor1))); } override public function GetAnchor2():b2Vec2{ return (b2Math.AddVV(m_body2.m_position, b2Math.b2MulMV(m_body2.m_R, m_localAnchor2))); } override public function PrepareVelocitySolver():void{ var _local1:b2Mat22; var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; _local1 = m_body1.m_R; _local2 = ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y)); _local3 = ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y)); _local1 = m_body2.m_R; _local4 = ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y)); _local5 = ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y)); m_u.x = (((m_body2.m_position.x + _local4) - m_body1.m_position.x) - _local2); m_u.y = (((m_body2.m_position.y + _local5) - m_body1.m_position.y) - _local3); _local6 = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y))); if (_local6 > b2Settings.b2_linearSlop){ m_u.Multiply((1 / _local6)); } else { m_u.SetZero(); }; _local7 = ((_local2 * m_u.y) - (_local3 * m_u.x)); _local8 = ((_local4 * m_u.y) - (_local5 * m_u.x)); m_mass = (((m_body1.m_invMass + ((m_body1.m_invI * _local7) * _local7)) + m_body2.m_invMass) + ((m_body2.m_invI * _local8) * _local8)); m_mass = (1 / m_mass); if (b2World.s_enableWarmStarting){ _local9 = (m_impulse * m_u.x); _local10 = (m_impulse * m_u.y); m_body1.m_linearVelocity.x = (m_body1.m_linearVelocity.x - (m_body1.m_invMass * _local9)); m_body1.m_linearVelocity.y = (m_body1.m_linearVelocity.y - (m_body1.m_invMass * _local10)); m_body1.m_angularVelocity = (m_body1.m_angularVelocity - (m_body1.m_invI * ((_local2 * _local10) - (_local3 * _local9)))); m_body2.m_linearVelocity.x = (m_body2.m_linearVelocity.x + (m_body2.m_invMass * _local9)); m_body2.m_linearVelocity.y = (m_body2.m_linearVelocity.y + (m_body2.m_invMass * _local10)); m_body2.m_angularVelocity = (m_body2.m_angularVelocity + (m_body2.m_invI * ((_local4 * _local10) - (_local5 * _local9)))); } else { m_impulse = 0; }; } override public function GetReactionTorque(_arg1:Number):Number{ return (0); } override public function GetReactionForce(_arg1:Number):b2Vec2{ var _local2:b2Vec2; _local2 = new b2Vec2(); _local2.SetV(m_u); _local2.Multiply((m_impulse * _arg1)); return (_local2); } override public function SolvePositionConstraints():Boolean{ var _local1:b2Mat22; var _local2:Number; 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; _local1 = m_body1.m_R; _local2 = ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y)); _local3 = ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y)); _local1 = m_body2.m_R; _local4 = ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y)); _local5 = ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y)); _local6 = (((m_body2.m_position.x + _local4) - m_body1.m_position.x) - _local2); _local7 = (((m_body2.m_position.y + _local5) - m_body1.m_position.y) - _local3); _local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); _local6 = (_local6 / _local8); _local7 = (_local7 / _local8); _local9 = (_local8 - m_length); _local9 = b2Math.b2Clamp(_local9, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local10 = (-(m_mass) * _local9); m_u.Set(_local6, _local7); _local11 = (_local10 * m_u.x); _local12 = (_local10 * m_u.y); m_body1.m_position.x = (m_body1.m_position.x - (m_body1.m_invMass * _local11)); m_body1.m_position.y = (m_body1.m_position.y - (m_body1.m_invMass * _local12)); m_body1.m_rotation = (m_body1.m_rotation - (m_body1.m_invI * ((_local2 * _local12) - (_local3 * _local11)))); m_body2.m_position.x = (m_body2.m_position.x + (m_body2.m_invMass * _local11)); m_body2.m_position.y = (m_body2.m_position.y + (m_body2.m_invMass * _local12)); m_body2.m_rotation = (m_body2.m_rotation + (m_body2.m_invI * ((_local4 * _local12) - (_local5 * _local11)))); m_body1.m_R.Set(m_body1.m_rotation); m_body2.m_R.Set(m_body2.m_rotation); return ((b2Math.b2Abs(_local9) < b2Settings.b2_linearSlop)); } } }//package Box2D.Dynamics.Joints
Section 40
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2DistanceJointDef extends b2JointDef { public var anchorPoint2:b2Vec2; public var anchorPoint1:b2Vec2; public function b2DistanceJointDef(){ anchorPoint1 = new b2Vec2(); anchorPoint2 = new b2Vec2(); super(); type = b2Joint.e_distanceJoint; } } }//package Box2D.Dynamics.Joints
Section 41
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2GearJoint extends b2Joint { public var m_impulse:Number; public var m_mass:Number; public var m_prismatic1:b2PrismaticJoint; public var m_prismatic2:b2PrismaticJoint; public var m_ground1:b2Body; public var m_ground2:b2Body; public var m_constant:Number; public var m_revolute1:b2RevoluteJoint; public var m_revolute2:b2RevoluteJoint; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_ratio:Number; public var m_J:b2Jacobian; public function b2GearJoint(_arg1:b2GearJointDef){ var _local2:Number; var _local3:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_J = new b2Jacobian(); super(_arg1); 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 (_arg1.joint1.m_type == b2Joint.e_revoluteJoint){ m_revolute1 = (_arg1.joint1 as b2RevoluteJoint); m_groundAnchor1.SetV(m_revolute1.m_localAnchor1); m_localAnchor1.SetV(m_revolute1.m_localAnchor2); _local2 = m_revolute1.GetJointAngle(); } else { m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint); m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1); m_localAnchor1.SetV(m_prismatic1.m_localAnchor2); _local2 = m_prismatic1.GetJointTranslation(); }; m_ground2 = _arg1.joint2.m_body1; m_body2 = _arg1.joint2.m_body2; if (_arg1.joint2.m_type == b2Joint.e_revoluteJoint){ m_revolute2 = (_arg1.joint2 as b2RevoluteJoint); m_groundAnchor2.SetV(m_revolute2.m_localAnchor1); m_localAnchor2.SetV(m_revolute2.m_localAnchor2); _local3 = m_revolute2.GetJointAngle(); } else { m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint); m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1); m_localAnchor2.SetV(m_prismatic2.m_localAnchor2); _local3 = m_prismatic2.GetJointTranslation(); }; m_ratio = _arg1.ratio; m_constant = (_local2 + (m_ratio * _local3)); m_impulse = 0; } override public function GetAnchor1():b2Vec2{ var _local1:b2Mat22; _local1 = m_body1.m_R; return (new b2Vec2((m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y))), (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y))))); } override public function GetAnchor2():b2Vec2{ var _local1:b2Mat22; _local1 = m_body2.m_R; return (new b2Vec2((m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y))), (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y))))); } override public function PrepareVelocitySolver():void{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Body; var _local4:b2Body; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:b2Mat22; var _local10:b2Vec2; var _local11:Number; var _local12:Number; _local1 = m_ground1; _local2 = m_ground2; _local3 = m_body1; _local4 = m_body2; _local12 = 0; m_J.SetZero(); if (m_revolute1){ m_J.angular1 = -1; _local12 = (_local12 + _local3.m_invI); } else { _local9 = _local1.m_R; _local10 = m_prismatic1.m_localXAxis1; _local5 = ((_local9.col1.x * _local10.x) + (_local9.col2.x * _local10.y)); _local6 = ((_local9.col1.y * _local10.x) + (_local9.col2.y * _local10.y)); _local9 = _local3.m_R; _local7 = ((_local9.col1.x * m_localAnchor1.x) + (_local9.col2.x * m_localAnchor1.y)); _local8 = ((_local9.col1.y * m_localAnchor1.x) + (_local9.col2.y * m_localAnchor1.y)); _local11 = ((_local7 * _local6) - (_local8 * _local5)); m_J.linear1.Set(-(_local5), -(_local6)); m_J.angular1 = -(_local11); _local12 = (_local12 + (_local3.m_invMass + ((_local3.m_invI * _local11) * _local11))); }; if (m_revolute2){ m_J.angular2 = -(m_ratio); _local12 = (_local12 + ((m_ratio * m_ratio) * _local4.m_invI)); } else { _local9 = _local2.m_R; _local10 = m_prismatic2.m_localXAxis1; _local5 = ((_local9.col1.x * _local10.x) + (_local9.col2.x * _local10.y)); _local6 = ((_local9.col1.y * _local10.x) + (_local9.col2.y * _local10.y)); _local9 = _local4.m_R; _local7 = ((_local9.col1.x * m_localAnchor2.x) + (_local9.col2.x * m_localAnchor2.y)); _local8 = ((_local9.col1.y * m_localAnchor2.x) + (_local9.col2.y * m_localAnchor2.y)); _local11 = ((_local7 * _local6) - (_local8 * _local5)); m_J.linear2.Set((-(m_ratio) * _local5), (-(m_ratio) * _local6)); m_J.angular2 = (-(m_ratio) * _local11); _local12 = (_local12 + ((m_ratio * m_ratio) * (_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)))); }; m_mass = (1 / _local12); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * m_impulse) * m_J.linear1.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * m_impulse) * m_J.linear1.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * m_impulse) * m_J.angular1)); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * m_impulse) * m_J.linear2.x)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * m_impulse) * m_J.linear2.y)); _local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * m_impulse) * m_J.angular2)); } override public function GetReactionForce(_arg1:Number):b2Vec2{ return (new b2Vec2()); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:b2Body; var _local3:b2Body; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; _local1 = 0; _local2 = m_body1; _local3 = m_body2; if (m_revolute1){ _local4 = m_revolute1.GetJointAngle(); } else { _local4 = m_prismatic1.GetJointTranslation(); }; if (m_revolute2){ _local5 = m_revolute2.GetJointAngle(); } else { _local5 = m_prismatic2.GetJointTranslation(); }; _local6 = (m_constant - (_local4 + (m_ratio * _local5))); _local7 = (-(m_mass) * _local6); _local2.m_position.x = (_local2.m_position.x + ((_local2.m_invMass * _local7) * m_J.linear1.x)); _local2.m_position.y = (_local2.m_position.y + ((_local2.m_invMass * _local7) * m_J.linear1.y)); _local2.m_rotation = (_local2.m_rotation + ((_local2.m_invI * _local7) * m_J.angular1)); _local3.m_position.x = (_local3.m_position.x + ((_local3.m_invMass * _local7) * m_J.linear2.x)); _local3.m_position.y = (_local3.m_position.y + ((_local3.m_invMass * _local7) * m_J.linear2.y)); _local3.m_rotation = (_local3.m_rotation + ((_local3.m_invI * _local7) * m_J.angular2)); _local2.m_R.Set(_local2.m_rotation); _local3.m_R.Set(_local3.m_rotation); return ((_local1 < b2Settings.b2_linearSlop)); } override public function GetReactionTorque(_arg1:Number):Number{ return (0); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:Number; var _local5:Number; _local2 = m_body1; _local3 = m_body2; _local4 = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local5 = (-(m_mass) * _local4); m_impulse = (m_impulse + _local5); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local5) * m_J.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local5) * m_J.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local5) * m_J.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local5) * m_J.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local5) * m_J.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local5) * m_J.angular2)); } } }//package Box2D.Dynamics.Joints
Section 42
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef) package Box2D.Dynamics.Joints { public class b2GearJointDef extends b2JointDef { public var joint2:b2Joint; public var joint1:b2Joint; public var ratio:Number; public function b2GearJointDef(){ type = b2Joint.e_gearJoint; joint1 = null; joint2 = null; ratio = 1; } } }//package Box2D.Dynamics.Joints
Section 43
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2Jacobian { public var linear1:b2Vec2; public var linear2:b2Vec2; public var angular2:Number; public var angular1:Number; public function b2Jacobian(){ linear1 = new b2Vec2(); linear2 = new b2Vec2(); super(); } public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{ linear1.SetV(_arg1); angular1 = _arg2; linear2.SetV(_arg3); angular2 = _arg4; } public function SetZero():void{ linear1.SetZero(); angular1 = 0; linear2.SetZero(); angular2 = 0; } public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{ return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4))); } } }//package Box2D.Dynamics.Joints
Section 44
//b2Joint (Box2D.Dynamics.Joints.b2Joint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2Joint { public var m_islandFlag:Boolean; public var m_collideConnected:Boolean; public var m_prev:b2Joint; public var m_next:b2Joint; public var m_type:int; public var m_node1:b2JointNode; public var m_node2:b2JointNode; public var m_userData; public var m_body1:b2Body; 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 b2JointNode(); m_node2 = new b2JointNode(); super(); m_type = _arg1.type; m_prev = null; m_next = null; m_body1 = _arg1.body1; m_body2 = _arg1.body2; m_collideConnected = _arg1.collideConnected; m_islandFlag = false; m_userData = _arg1.userData; } public function GetAnchor1():b2Vec2{ return (null); } public function GetAnchor2():b2Vec2{ return (null); } public function GetNext():b2Joint{ return (m_next); } public function GetType():int{ return (m_type); } public function GetBody2():b2Body{ return (m_body2); } public function PrepareVelocitySolver():void{ } public function PreparePositionSolver():void{ } public function GetReactionTorque(_arg1:Number):Number{ return (0); } public function GetUserData(){ return (m_userData); } public function GetReactionForce(_arg1:Number):b2Vec2{ return (null); } public function SolvePositionConstraints():Boolean{ return (false); } public function GetBody1():b2Body{ return (m_body1); } public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ } public static function Destroy(_arg1:b2Joint, _arg2):void{ } public static function Create(_arg1:b2JointDef, _arg2):b2Joint{ var _local3:b2Joint; _local3 = null; switch (_arg1.type){ case e_distanceJoint: _local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef)); break; case e_mouseJoint: _local3 = new b2MouseJoint((_arg1 as b2MouseJointDef)); break; case e_prismaticJoint: _local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef)); break; case e_revoluteJoint: _local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef)); break; case e_pulleyJoint: _local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef)); break; case e_gearJoint: _local3 = new b2GearJoint((_arg1 as b2GearJointDef)); break; default: break; }; return (_local3); } } }//package Box2D.Dynamics.Joints
Section 45
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointDef { public var collideConnected:Boolean; public var body1:b2Body; public var body2:b2Body; public var userData; public var type:int; public function b2JointDef(){ type = b2Joint.e_unknownJoint; userData = null; body1 = null; body2 = null; collideConnected = false; } } }//package Box2D.Dynamics.Joints
Section 46
//b2JointNode (Box2D.Dynamics.Joints.b2JointNode) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointNode { public var joint:b2Joint; public var other:b2Body; public var next:b2JointNode; public var prev:b2JointNode; } }//package Box2D.Dynamics.Joints
Section 47
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2MouseJoint extends b2Joint { public var m_beta:Number; public var m_target:b2Vec2; public var m_impulse:b2Vec2; public var m_ptpMass:b2Mat22; public var m_localAnchor:b2Vec2; private var K1:b2Mat22; private var K2:b2Mat22; private var K:b2Mat22; public var m_gamma:Number; public var m_C:b2Vec2; public var m_maxForce:Number; public function b2MouseJoint(_arg1:b2MouseJointDef){ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); m_localAnchor = new b2Vec2(); m_target = new b2Vec2(); m_impulse = new b2Vec2(); m_ptpMass = new b2Mat22(); m_C = new b2Vec2(); super(_arg1); m_target.SetV(_arg1.target); _local2 = (m_target.x - m_body2.m_position.x); _local3 = (m_target.y - m_body2.m_position.y); m_localAnchor.x = ((_local2 * m_body2.m_R.col1.x) + (_local3 * m_body2.m_R.col1.y)); m_localAnchor.y = ((_local2 * m_body2.m_R.col2.x) + (_local3 * m_body2.m_R.col2.y)); m_maxForce = _arg1.maxForce; m_impulse.SetZero(); _local4 = m_body2.m_mass; _local5 = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz); _local6 = (((2 * _local4) * _arg1.dampingRatio) * _local5); _local7 = ((_local4 * _local5) * _local5); m_gamma = (1 / (_local6 + (_arg1.timeStep * _local7))); m_beta = ((_arg1.timeStep * _local7) / (_local6 + (_arg1.timeStep * _local7))); } override public function GetAnchor1():b2Vec2{ return (m_target); } override public function GetAnchor2():b2Vec2{ var _local1:b2Vec2; _local1 = b2Math.b2MulMV(m_body2.m_R, m_localAnchor); _local1.Add(m_body2.m_position); return (_local1); } override public function PrepareVelocitySolver():void{ var _local1:b2Body; var _local2:b2Mat22; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; _local1 = m_body2; _local2 = _local1.m_R; _local3 = ((_local2.col1.x * m_localAnchor.x) + (_local2.col2.x * m_localAnchor.y)); _local4 = ((_local2.col1.y * m_localAnchor.x) + (_local2.col2.y * m_localAnchor.y)); _local5 = _local1.m_invMass; _local6 = _local1.m_invI; K1.col1.x = _local5; K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = _local5; K2.col1.x = ((_local6 * _local4) * _local4); K2.col2.x = ((-(_local6) * _local3) * _local4); K2.col1.y = ((-(_local6) * _local3) * _local4); K2.col2.y = ((_local6 * _local3) * _local3); 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_ptpMass); m_C.x = ((_local1.m_position.x + _local3) - m_target.x); m_C.y = ((_local1.m_position.y + _local4) - m_target.y); _local1.m_angularVelocity = (_local1.m_angularVelocity * 0.98); _local7 = m_impulse.x; _local8 = m_impulse.y; _local1.m_linearVelocity.x = (_local1.m_linearVelocity.x + (_local5 * _local7)); _local1.m_linearVelocity.y = (_local1.m_linearVelocity.y + (_local5 * _local8)); _local1.m_angularVelocity = (_local1.m_angularVelocity + (_local6 * ((_local3 * _local8) - (_local4 * _local7)))); } override public function GetReactionForce(_arg1:Number):b2Vec2{ var _local2:b2Vec2; _local2 = new b2Vec2(); _local2.SetV(m_impulse); _local2.Multiply(_arg1); return (_local2); } override public function SolvePositionConstraints():Boolean{ return (true); } override public function GetReactionTorque(_arg1:Number):Number{ return (0); } public function SetTarget(_arg1:b2Vec2):void{ m_body2.WakeUp(); m_target = _arg1; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; _local2 = m_body2; _local3 = _local2.m_R; _local4 = ((_local3.col1.x * m_localAnchor.x) + (_local3.col2.x * m_localAnchor.y)); _local5 = ((_local3.col1.y * m_localAnchor.x) + (_local3.col2.y * m_localAnchor.y)); _local6 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local5)); _local7 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local4)); _local3 = m_ptpMass; _local8 = ((_local6 + ((m_beta * _arg1.inv_dt) * m_C.x)) + (m_gamma * m_impulse.x)); _local9 = ((_local7 + ((m_beta * _arg1.inv_dt) * m_C.y)) + (m_gamma * m_impulse.y)); _local10 = -(((_local3.col1.x * _local8) + (_local3.col2.x * _local9))); _local11 = -(((_local3.col1.y * _local8) + (_local3.col2.y * _local9))); _local12 = m_impulse.x; _local13 = m_impulse.y; m_impulse.x = (m_impulse.x + _local10); m_impulse.y = (m_impulse.y + _local11); _local14 = m_impulse.Length(); if (_local14 > (_arg1.dt * m_maxForce)){ m_impulse.Multiply(((_arg1.dt * m_maxForce) / _local14)); }; _local10 = (m_impulse.x - _local12); _local11 = (m_impulse.y - _local13); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local10)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local11)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local4 * _local11) - (_local5 * _local10)))); } } }//package Box2D.Dynamics.Joints
Section 48
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2MouseJointDef extends b2JointDef { public var frequencyHz:Number; public var dampingRatio:Number; public var maxForce:Number; public var target:b2Vec2; public var timeStep:Number; public function b2MouseJointDef(){ target = new b2Vec2(); super(); type = b2Joint.e_mouseJoint; maxForce = 0; frequencyHz = 5; dampingRatio = 0.7; timeStep = (1 / 60); } } }//package Box2D.Dynamics.Joints
Section 49
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PrismaticJoint extends b2Joint { public var m_initialAngle:Number; public var m_lowerTranslation:Number; public var m_localXAxis1:b2Vec2; public var m_enableLimit:Boolean; public var m_maxMotorForce:Number; public var m_angularMass:Number; public var m_localYAxis1:b2Vec2; public var m_linearImpulse:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_motorMass:Number; public var m_limitState:int; public var m_linearMass:Number; public var m_upperTranslation:Number; public var m_angularImpulse:Number; public var m_motorImpulse:Number; public var m_motorJacobian:b2Jacobian; public var m_limitImpulse:Number; public var m_motorSpeed:Number; public var m_enableMotor:Boolean; public var m_limitPositionImpulse:Number; 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); _local2 = m_body1.m_R; _local3 = (_arg1.anchorPoint.x - m_body1.m_position.x); _local4 = (_arg1.anchorPoint.y - m_body1.m_position.y); m_localAnchor1.Set(((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)), ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y))); _local2 = m_body2.m_R; _local3 = (_arg1.anchorPoint.x - m_body2.m_position.x); _local4 = (_arg1.anchorPoint.y - m_body2.m_position.y); m_localAnchor2.Set(((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)), ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y))); _local2 = m_body1.m_R; _local3 = _arg1.axis.x; _local4 = _arg1.axis.y; m_localXAxis1.Set(((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)), ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y))); m_localYAxis1.x = -(m_localXAxis1.y); m_localYAxis1.y = m_localXAxis1.x; m_initialAngle = (m_body2.m_rotation - m_body1.m_rotation); m_linearJacobian.SetZero(); m_linearMass = 0; m_linearImpulse = 0; m_angularMass = 0; m_angularImpulse = 0; m_motorJacobian.SetZero(); m_motorMass = 0; m_motorImpulse = 0; m_limitImpulse = 0; m_limitPositionImpulse = 0; m_lowerTranslation = _arg1.lowerTranslation; m_upperTranslation = _arg1.upperTranslation; m_maxMotorForce = _arg1.motorForce; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function GetAnchor1():b2Vec2{ var _local1:b2Body; var _local2:b2Vec2; _local1 = m_body1; _local2 = new b2Vec2(); _local2.SetV(m_localAnchor1); _local2.MulM(_local1.m_R); _local2.Add(_local1.m_position); return (_local2); } override public function GetAnchor2():b2Vec2{ var _local1:b2Body; var _local2:b2Vec2; _local1 = m_body2; _local2 = new b2Vec2(); _local2.SetV(m_localAnchor2); _local2.MulM(_local1.m_R); _local2.Add(_local1.m_position); return (_local2); } override public function PrepareVelocitySolver():void{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; _local1 = m_body1; _local2 = m_body2; _local3 = _local1.m_R; _local4 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y)); _local5 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y)); _local3 = _local2.m_R; _local6 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y)); _local7 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y)); _local8 = _local1.m_invMass; _local9 = _local2.m_invMass; _local10 = _local1.m_invI; _local11 = _local2.m_invI; _local3 = _local1.m_R; _local12 = ((_local3.col1.x * m_localYAxis1.x) + (_local3.col2.x * m_localYAxis1.y)); _local13 = ((_local3.col1.y * m_localYAxis1.x) + (_local3.col2.y * m_localYAxis1.y)); _local14 = ((_local2.m_position.x + _local6) - _local1.m_position.x); _local15 = ((_local2.m_position.y + _local7) - _local1.m_position.y); m_linearJacobian.linear1.x = -(_local12); m_linearJacobian.linear1.y = -(_local13); m_linearJacobian.linear2.x = _local12; m_linearJacobian.linear2.y = _local13; m_linearJacobian.angular1 = -(((_local14 * _local13) - (_local15 * _local12))); m_linearJacobian.angular2 = ((_local6 * _local13) - (_local7 * _local12)); m_linearMass = (((_local8 + ((_local10 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local9) + ((_local11 * m_linearJacobian.angular2) * m_linearJacobian.angular2)); m_linearMass = (1 / m_linearMass); m_angularMass = (1 / (_local10 + _local11)); if (((m_enableLimit) || (m_enableMotor))){ _local3 = _local1.m_R; _local16 = ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y)); _local17 = ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y)); m_motorJacobian.linear1.x = -(_local16); m_motorJacobian.linear1.y = -(_local17); m_motorJacobian.linear2.x = _local16; m_motorJacobian.linear2.y = _local17; m_motorJacobian.angular1 = -(((_local14 * _local17) - (_local15 * _local16))); m_motorJacobian.angular2 = ((_local6 * _local17) - (_local7 * _local16)); m_motorMass = (((_local8 + ((_local10 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local9) + ((_local11 * m_motorJacobian.angular2) * m_motorJacobian.angular2)); m_motorMass = (1 / m_motorMass); if (m_enableLimit){ _local18 = (_local14 - _local4); _local19 = (_local15 - _local5); _local20 = ((_local16 * _local18) + (_local17 * _local19)); if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){ m_limitState = e_equalLimits; } else { if (_local20 <= m_lowerTranslation){ if (m_limitState != e_atLowerLimit){ m_limitImpulse = 0; }; m_limitState = e_atLowerLimit; } else { if (_local20 >= m_upperTranslation){ if (m_limitState != e_atUpperLimit){ m_limitImpulse = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitImpulse = 0; }; }; }; }; }; if (m_enableMotor == false){ m_motorImpulse = 0; }; if (m_enableLimit == false){ m_limitImpulse = 0; }; if (b2World.s_enableWarmStarting){ _local21 = ((m_linearImpulse * m_linearJacobian.linear1.x) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear1.x)); _local22 = ((m_linearImpulse * m_linearJacobian.linear1.y) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear1.y)); _local23 = ((m_linearImpulse * m_linearJacobian.linear2.x) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear2.x)); _local24 = ((m_linearImpulse * m_linearJacobian.linear2.y) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear2.y)); _local25 = (((m_linearImpulse * m_linearJacobian.angular1) - m_angularImpulse) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.angular1)); _local26 = (((m_linearImpulse * m_linearJacobian.angular2) + m_angularImpulse) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.angular2)); _local1.m_linearVelocity.x = (_local1.m_linearVelocity.x + (_local8 * _local21)); _local1.m_linearVelocity.y = (_local1.m_linearVelocity.y + (_local8 * _local22)); _local1.m_angularVelocity = (_local1.m_angularVelocity + (_local10 * _local25)); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local9 * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local9 * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local11 * _local26)); } else { m_linearImpulse = 0; m_angularImpulse = 0; m_limitImpulse = 0; m_motorImpulse = 0; }; m_limitPositionImpulse = 0; } public function GetJointTranslation():Number{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; _local1 = m_body1; _local2 = m_body2; _local3 = _local1.m_R; _local4 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y)); _local5 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y)); _local3 = _local2.m_R; _local6 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y)); _local7 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y)); _local8 = (_local1.m_position.x + _local4); _local9 = (_local1.m_position.y + _local5); _local10 = (_local2.m_position.x + _local6); _local11 = (_local2.m_position.y + _local7); _local12 = (_local10 - _local8); _local13 = (_local11 - _local9); _local3 = _local1.m_R; _local14 = ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y)); _local15 = ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y)); _local16 = ((_local14 * _local12) + (_local15 * _local13)); return (_local16); } override public function GetReactionForce(_arg1:Number):b2Vec2{ var _local2:Number; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; _local2 = (_arg1 * m_limitImpulse); _local3 = m_body1.m_R; _local4 = (_local2 * ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y))); _local5 = (_local2 * ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y))); _local6 = (_local2 * ((_local3.col1.x * m_localYAxis1.x) + (_local3.col2.x * m_localYAxis1.y))); _local7 = (_local2 * ((_local3.col1.y * m_localYAxis1.x) + (_local3.col2.y * m_localYAxis1.y))); return (new b2Vec2((_local4 + _local6), (_local5 + _local7))); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local3:b2Body; var _local4:b2Body; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:b2Mat22; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; _local3 = m_body1; _local4 = m_body2; _local5 = _local3.m_invMass; _local6 = _local4.m_invMass; _local7 = _local3.m_invI; _local8 = _local4.m_invI; _local9 = _local3.m_R; _local10 = ((_local9.col1.x * m_localAnchor1.x) + (_local9.col2.x * m_localAnchor1.y)); _local11 = ((_local9.col1.y * m_localAnchor1.x) + (_local9.col2.y * m_localAnchor1.y)); _local9 = _local4.m_R; _local12 = ((_local9.col1.x * m_localAnchor2.x) + (_local9.col2.x * m_localAnchor2.y)); _local13 = ((_local9.col1.y * m_localAnchor2.x) + (_local9.col2.y * m_localAnchor2.y)); _local14 = (_local3.m_position.x + _local10); _local15 = (_local3.m_position.y + _local11); _local16 = (_local4.m_position.x + _local12); _local17 = (_local4.m_position.y + _local13); _local18 = (_local16 - _local14); _local19 = (_local17 - _local15); _local9 = _local3.m_R; _local20 = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y)); _local21 = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y)); _local22 = ((_local20 * _local18) + (_local21 * _local19)); _local22 = b2Math.b2Clamp(_local22, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local23 = (-(m_linearMass) * _local22); _local3.m_position.x = (_local3.m_position.x + ((_local5 * _local23) * m_linearJacobian.linear1.x)); _local3.m_position.y = (_local3.m_position.y + ((_local5 * _local23) * m_linearJacobian.linear1.y)); _local3.m_rotation = (_local3.m_rotation + ((_local7 * _local23) * m_linearJacobian.angular1)); _local4.m_position.x = (_local4.m_position.x + ((_local6 * _local23) * m_linearJacobian.linear2.x)); _local4.m_position.y = (_local4.m_position.y + ((_local6 * _local23) * m_linearJacobian.linear2.y)); _local4.m_rotation = (_local4.m_rotation + ((_local8 * _local23) * m_linearJacobian.angular2)); _local24 = b2Math.b2Abs(_local22); _local25 = ((_local4.m_rotation - _local3.m_rotation) - m_initialAngle); _local25 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); _local26 = (-(m_angularMass) * _local25); _local3.m_rotation = (_local3.m_rotation - (_local3.m_invI * _local26)); _local3.m_R.Set(_local3.m_rotation); _local4.m_rotation = (_local4.m_rotation + (_local4.m_invI * _local26)); _local4.m_R.Set(_local4.m_rotation); _local27 = b2Math.b2Abs(_local25); if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local9 = _local3.m_R; _local10 = ((_local9.col1.x * m_localAnchor1.x) + (_local9.col2.x * m_localAnchor1.y)); _local11 = ((_local9.col1.y * m_localAnchor1.x) + (_local9.col2.y * m_localAnchor1.y)); _local9 = _local4.m_R; _local12 = ((_local9.col1.x * m_localAnchor2.x) + (_local9.col2.x * m_localAnchor2.y)); _local13 = ((_local9.col1.y * m_localAnchor2.x) + (_local9.col2.y * m_localAnchor2.y)); _local14 = (_local3.m_position.x + _local10); _local15 = (_local3.m_position.y + _local11); _local16 = (_local4.m_position.x + _local12); _local17 = (_local4.m_position.y + _local13); _local18 = (_local16 - _local14); _local19 = (_local17 - _local15); _local9 = _local3.m_R; _local28 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y)); _local29 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y)); _local30 = ((_local28 * _local18) + (_local29 * _local19)); _local31 = 0; if (m_limitState == e_equalLimits){ _local1 = b2Math.b2Clamp(_local30, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local31 = (-(m_motorMass) * _local1); _local24 = b2Math.b2Max(_local24, b2Math.b2Abs(_local25)); } else { if (m_limitState == e_atLowerLimit){ _local1 = (_local30 - m_lowerTranslation); _local24 = b2Math.b2Max(_local24, -(_local1)); _local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local31 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local31), 0); _local31 = (m_limitPositionImpulse - _local2); } else { if (m_limitState == e_atUpperLimit){ _local1 = (_local30 - m_upperTranslation); _local24 = b2Math.b2Max(_local24, _local1); _local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection); _local31 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local31), 0); _local31 = (m_limitPositionImpulse - _local2); }; }; }; _local3.m_position.x = (_local3.m_position.x + ((_local5 * _local31) * m_motorJacobian.linear1.x)); _local3.m_position.y = (_local3.m_position.y + ((_local5 * _local31) * m_motorJacobian.linear1.y)); _local3.m_rotation = (_local3.m_rotation + ((_local7 * _local31) * m_motorJacobian.angular1)); _local3.m_R.Set(_local3.m_rotation); _local4.m_position.x = (_local4.m_position.x + ((_local6 * _local31) * m_motorJacobian.linear2.x)); _local4.m_position.y = (_local4.m_position.y + ((_local6 * _local31) * m_motorJacobian.linear2.y)); _local4.m_rotation = (_local4.m_rotation + ((_local8 * _local31) * m_motorJacobian.angular2)); _local4.m_R.Set(_local4.m_rotation); }; return ((((_local24 <= b2Settings.b2_linearSlop)) && ((_local27 <= b2Settings.b2_angularSlop)))); } public function GetJointSpeed():Number{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:b2Vec2; var _local17:b2Vec2; var _local18:Number; var _local19:Number; var _local20:Number; _local1 = m_body1; _local2 = m_body2; _local3 = _local1.m_R; _local4 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y)); _local5 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y)); _local3 = _local2.m_R; _local6 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y)); _local7 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y)); _local8 = (_local1.m_position.x + _local4); _local9 = (_local1.m_position.y + _local5); _local10 = (_local2.m_position.x + _local6); _local11 = (_local2.m_position.y + _local7); _local12 = (_local10 - _local8); _local13 = (_local11 - _local9); _local3 = _local1.m_R; _local14 = ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y)); _local15 = ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y)); _local16 = _local1.m_linearVelocity; _local17 = _local2.m_linearVelocity; _local18 = _local1.m_angularVelocity; _local19 = _local2.m_angularVelocity; _local20 = (((_local12 * (-(_local18) * _local15)) + (_local13 * (_local18 * _local14))) + ((_local14 * (((_local17.x + (-(_local19) * _local7)) - _local16.x) - (-(_local18) * _local5))) + (_local15 * (((_local17.y + (_local19 * _local6)) - _local16.y) - (_local18 * _local4))))); return (_local20); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function GetMotorForce(_arg1:Number):Number{ return ((_arg1 * m_motorImpulse)); } public function SetMotorForce(_arg1:Number):void{ m_maxMotorForce = _arg1; } override public function GetReactionTorque(_arg1:Number):Number{ return ((_arg1 * m_angularImpulse)); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_invMass; _local5 = _local3.m_invMass; _local6 = _local2.m_invI; _local7 = _local3.m_invI; _local9 = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local10 = (-(m_linearMass) * _local9); m_linearImpulse = (m_linearImpulse + _local10); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local10) * m_linearJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local10) * m_linearJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local10) * m_linearJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local10) * m_linearJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local10) * m_linearJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local10) * m_linearJacobian.angular2)); _local11 = (_local3.m_angularVelocity - _local2.m_angularVelocity); _local12 = (-(m_angularMass) * _local11); m_angularImpulse = (m_angularImpulse + _local12); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local12)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local12)); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local13 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed); _local14 = (-(m_motorMass) * _local13); _local15 = m_motorImpulse; m_motorImpulse = b2Math.b2Clamp((m_motorImpulse + _local14), (-(_arg1.dt) * m_maxMotorForce), (_arg1.dt * m_maxMotorForce)); _local14 = (m_motorImpulse - _local15); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local14) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local14) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local14) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local14) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local14) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local14) * m_motorJacobian.angular2)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local16 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local17 = (-(m_motorMass) * _local16); if (m_limitState == e_equalLimits){ m_limitImpulse = (m_limitImpulse + _local17); } else { if (m_limitState == e_atLowerLimit){ _local8 = m_limitImpulse; m_limitImpulse = b2Math.b2Max((m_limitImpulse + _local17), 0); _local17 = (m_limitImpulse - _local8); } else { if (m_limitState == e_atUpperLimit){ _local8 = m_limitImpulse; m_limitImpulse = b2Math.b2Min((m_limitImpulse + _local17), 0); _local17 = (m_limitImpulse - _local8); }; }; }; _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local17) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local17) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local17) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local17) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local17) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local17) * m_motorJacobian.angular2)); }; } } }//package Box2D.Dynamics.Joints
Section 50
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2PrismaticJointDef extends b2JointDef { public var motorSpeed:Number; public var anchorPoint:b2Vec2; public var axis:b2Vec2; public var upperTranslation:Number; public var lowerTranslation:Number; public var enableMotor:Boolean; public var motorForce:Number; public var enableLimit:Boolean; public function b2PrismaticJointDef(){ type = b2Joint.e_prismaticJoint; anchorPoint = new b2Vec2(0, 0); axis = new b2Vec2(0, 0); lowerTranslation = 0; upperTranslation = 0; motorForce = 0; motorSpeed = 0; enableLimit = false; enableMotor = false; } } }//package Box2D.Dynamics.Joints
Section 51
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PulleyJoint extends b2Joint { public var m_ground:b2Body; public var m_maxLength2:Number; public var m_limitState1:int; public var m_maxLength1:Number; public var m_pulleyImpulse:Number; public var m_limitPositionImpulse1:Number; public var m_constant:Number; public var m_ratio:Number; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_limitPositionImpulse2:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_limitState2:int; public var m_limitMass2:Number; public var m_limitMass1:Number; public var m_limitImpulse2:Number; public var m_u1:b2Vec2; public var m_u2:b2Vec2; public var m_limitImpulse1:Number; public var m_pulleyMass:Number; public static var b2_minPulleyLength:Number = 30; public function b2PulleyJoint(_arg1:b2PulleyJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8: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.groundPoint1.x - m_ground.m_position.x); m_groundAnchor1.y = (_arg1.groundPoint1.y - m_ground.m_position.y); m_groundAnchor2.x = (_arg1.groundPoint2.x - m_ground.m_position.x); m_groundAnchor2.y = (_arg1.groundPoint2.y - m_ground.m_position.y); _local2 = m_body1.m_R; _local3 = (_arg1.anchorPoint1.x - m_body1.m_position.x); _local4 = (_arg1.anchorPoint1.y - m_body1.m_position.y); m_localAnchor1.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)); m_localAnchor1.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)); _local2 = m_body2.m_R; _local3 = (_arg1.anchorPoint2.x - m_body2.m_position.x); _local4 = (_arg1.anchorPoint2.y - m_body2.m_position.y); m_localAnchor2.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)); m_localAnchor2.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)); m_ratio = _arg1.ratio; _local3 = (_arg1.groundPoint1.x - _arg1.anchorPoint1.x); _local4 = (_arg1.groundPoint1.y - _arg1.anchorPoint1.y); _local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4))); _local3 = (_arg1.groundPoint2.x - _arg1.anchorPoint2.x); _local4 = (_arg1.groundPoint2.y - _arg1.anchorPoint2.y); _local6 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4))); _local7 = b2Math.b2Max((0.5 * b2_minPulleyLength), _local5); _local8 = b2Math.b2Max((0.5 * b2_minPulleyLength), _local6); m_constant = (_local7 + (m_ratio * _local8)); m_maxLength1 = b2Math.b2Clamp(_arg1.maxLength1, _local7, (m_constant - (m_ratio * b2_minPulleyLength))); m_maxLength2 = b2Math.b2Clamp(_arg1.maxLength2, _local8, ((m_constant - b2_minPulleyLength) / m_ratio)); m_pulleyImpulse = 0; m_limitImpulse1 = 0; m_limitImpulse2 = 0; } public function GetLength1():Number{ var _local1:b2Mat22; var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local1 = m_body1.m_R; _local2 = (m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y))); _local3 = (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y))); _local4 = (_local2 - (m_ground.m_position.x + m_groundAnchor1.x)); _local5 = (_local3 - (m_ground.m_position.y + m_groundAnchor1.y)); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } override public function GetAnchor1():b2Vec2{ var _local1:b2Mat22; _local1 = m_body1.m_R; return (new b2Vec2((m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y))), (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y))))); } override public function GetAnchor2():b2Vec2{ var _local1:b2Mat22; _local1 = m_body2.m_R; return (new b2Vec2((m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y))), (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y))))); } override public function PrepareVelocitySolver():void{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; _local1 = m_body1; _local2 = m_body2; _local3 = _local1.m_R; _local4 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y)); _local5 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y)); _local3 = _local2.m_R; _local6 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y)); _local7 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y)); _local8 = (_local1.m_position.x + _local4); _local9 = (_local1.m_position.y + _local5); _local10 = (_local2.m_position.x + _local6); _local11 = (_local2.m_position.y + _local7); _local12 = (m_ground.m_position.x + m_groundAnchor1.x); _local13 = (m_ground.m_position.y + m_groundAnchor1.y); _local14 = (m_ground.m_position.x + m_groundAnchor2.x); _local15 = (m_ground.m_position.y + m_groundAnchor2.y); m_u1.Set((_local8 - _local12), (_local9 - _local13)); m_u2.Set((_local10 - _local14), (_local11 - _local15)); _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(); }; if (_local16 < m_maxLength1){ m_limitState1 = e_inactiveLimit; m_limitImpulse1 = 0; } else { m_limitState1 = e_atUpperLimit; m_limitPositionImpulse1 = 0; }; if (_local17 < m_maxLength2){ m_limitState2 = e_inactiveLimit; m_limitImpulse2 = 0; } else { m_limitState2 = e_atUpperLimit; m_limitPositionImpulse2 = 0; }; _local18 = ((_local4 * m_u1.y) - (_local5 * m_u1.x)); _local19 = ((_local6 * m_u2.y) - (_local7 * m_u2.x)); m_limitMass1 = (_local1.m_invMass + ((_local1.m_invI * _local18) * _local18)); m_limitMass2 = (_local2.m_invMass + ((_local2.m_invI * _local19) * _local19)); 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); _local20 = ((-(m_pulleyImpulse) - m_limitImpulse1) * m_u1.x); _local21 = ((-(m_pulleyImpulse) - m_limitImpulse1) * m_u1.y); _local22 = (((-(m_ratio) * m_pulleyImpulse) - m_limitImpulse2) * m_u2.x); _local23 = (((-(m_ratio) * m_pulleyImpulse) - m_limitImpulse2) * m_u2.y); _local1.m_linearVelocity.x = (_local1.m_linearVelocity.x + (_local1.m_invMass * _local20)); _local1.m_linearVelocity.y = (_local1.m_linearVelocity.y + (_local1.m_invMass * _local21)); _local1.m_angularVelocity = (_local1.m_angularVelocity + (_local1.m_invI * ((_local4 * _local21) - (_local5 * _local20)))); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local22)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local23)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local23) - (_local7 * _local22)))); } override public function GetReactionForce(_arg1:Number):b2Vec2{ return (new b2Vec2()); } override public function SolvePositionConstraints():Boolean{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; _local1 = m_body1; _local2 = m_body2; _local4 = (m_ground.m_position.x + m_groundAnchor1.x); _local5 = (m_ground.m_position.y + m_groundAnchor1.y); _local6 = (m_ground.m_position.x + m_groundAnchor2.x); _local7 = (m_ground.m_position.y + m_groundAnchor2.y); _local21 = 0; _local3 = _local1.m_R; _local8 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y)); _local9 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y)); _local3 = _local2.m_R; _local10 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y)); _local11 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y)); _local12 = (_local1.m_position.x + _local8); _local13 = (_local1.m_position.y + _local9); _local14 = (_local2.m_position.x + _local10); _local15 = (_local2.m_position.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)); _local21 = b2Math.b2Max(_local21, Math.abs(_local18)); _local18 = b2Math.b2Clamp(_local18, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local19 = (-(m_pulleyMass) * _local18); _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_position.x = (_local1.m_position.x + (_local1.m_invMass * _local12)); _local1.m_position.y = (_local1.m_position.y + (_local1.m_invMass * _local13)); _local1.m_rotation = (_local1.m_rotation + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local2.m_position.x = (_local2.m_position.x + (_local2.m_invMass * _local14)); _local2.m_position.y = (_local2.m_position.y + (_local2.m_invMass * _local15)); _local2.m_rotation = (_local2.m_rotation + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local1.m_R.Set(_local1.m_rotation); _local2.m_R.Set(_local2.m_rotation); if (m_limitState1 == e_atUpperLimit){ _local3 = _local1.m_R; _local8 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y)); _local9 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y)); _local12 = (_local1.m_position.x + _local8); _local13 = (_local1.m_position.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); _local21 = b2Math.b2Max(_local21, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass1) * _local18); _local20 = m_limitPositionImpulse1; m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19)); _local19 = (m_limitPositionImpulse1 - _local20); _local12 = (-(_local19) * m_u1.x); _local13 = (-(_local19) * m_u1.y); _local1.m_position.x = (_local1.m_position.x + (_local1.m_invMass * _local12)); _local1.m_position.y = (_local1.m_position.y + (_local1.m_invMass * _local13)); _local1.m_rotation = (_local1.m_rotation + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local1.m_R.Set(_local1.m_rotation); }; if (m_limitState2 == e_atUpperLimit){ _local3 = _local2.m_R; _local10 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y)); _local11 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y)); _local14 = (_local2.m_position.x + _local10); _local15 = (_local2.m_position.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); _local21 = b2Math.b2Max(_local21, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass2) * _local18); _local20 = m_limitPositionImpulse2; m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19)); _local19 = (m_limitPositionImpulse2 - _local20); _local14 = (-(_local19) * m_u2.x); _local15 = (-(_local19) * m_u2.y); _local2.m_position.x = (_local2.m_position.x + (_local2.m_invMass * _local14)); _local2.m_position.y = (_local2.m_position.y + (_local2.m_invMass * _local15)); _local2.m_rotation = (_local2.m_rotation + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local2.m_R.Set(_local2.m_rotation); }; return ((_local21 < b2Settings.b2_linearSlop)); } public function GetGroundPoint1():b2Vec2{ return (new b2Vec2((m_ground.m_position.x + m_groundAnchor1.x), (m_ground.m_position.y + m_groundAnchor1.y))); } public function GetGroundPoint2():b2Vec2{ return (new b2Vec2((m_ground.m_position.x + m_groundAnchor2.x), (m_ground.m_position.y + m_groundAnchor2.y))); } override public function GetReactionTorque(_arg1:Number):Number{ return (0); } public function GetRatio():Number{ return (m_ratio); } public function GetLength2():Number{ var _local1:b2Mat22; var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local1 = m_body2.m_R; _local2 = (m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y))); _local3 = (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y))); _local4 = (_local2 - (m_ground.m_position.x + m_groundAnchor2.x)); _local5 = (_local3 - (m_ground.m_position.y + m_groundAnchor2.y)); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_R; _local5 = ((_local4.col1.x * m_localAnchor1.x) + (_local4.col2.x * m_localAnchor1.y)); _local6 = ((_local4.col1.y * m_localAnchor1.x) + (_local4.col2.y * m_localAnchor1.y)); _local4 = _local3.m_R; _local7 = ((_local4.col1.x * m_localAnchor2.x) + (_local4.col2.x * m_localAnchor2.y)); _local8 = ((_local4.col1.y * m_localAnchor2.x) + (_local4.col2.y * m_localAnchor2.y)); _local9 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local10 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local11 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local8)); _local12 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local7)); _local17 = (-(((m_u1.x * _local9) + (m_u1.y * _local10))) - (m_ratio * ((m_u2.x * _local11) + (m_u2.y * _local12)))); _local18 = (-(m_pulleyMass) * _local17); m_pulleyImpulse = (m_pulleyImpulse + _local18); _local13 = (-(_local18) * m_u1.x); _local14 = (-(_local18) * m_u1.y); _local15 = ((-(m_ratio) * _local18) * m_u2.x); _local16 = ((-(m_ratio) * _local18) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local13)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local14)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local14) - (_local6 * _local13)))); _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 * ((_local7 * _local16) - (_local8 * _local15)))); if (m_limitState1 == e_atUpperLimit){ _local9 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local10 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local17 = -(((m_u1.x * _local9) + (m_u1.y * _local10))); _local18 = (-(m_limitMass1) * _local17); _local19 = m_limitImpulse1; m_limitImpulse1 = b2Math.b2Max(0, (m_limitImpulse1 + _local18)); _local18 = (m_limitImpulse1 - _local19); _local13 = (-(_local18) * m_u1.x); _local14 = (-(_local18) * m_u1.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local13)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local14)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local14) - (_local6 * _local13)))); }; if (m_limitState2 == e_atUpperLimit){ _local11 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local8)); _local12 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local7)); _local17 = -(((m_u2.x * _local11) + (m_u2.y * _local12))); _local18 = (-(m_limitMass2) * _local17); _local19 = m_limitImpulse2; m_limitImpulse2 = b2Math.b2Max(0, (m_limitImpulse2 + _local18)); _local18 = (m_limitImpulse2 - _local19); _local15 = (-(_local18) * m_u2.x); _local16 = (-(_local18) * m_u2.y); _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 * ((_local7 * _local16) - (_local8 * _local15)))); }; } } }//package Box2D.Dynamics.Joints
Section 52
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2PulleyJointDef extends b2JointDef { public var groundPoint1:b2Vec2; public var groundPoint2:b2Vec2; public var ratio:Number; public var maxLength1:Number; public var maxLength2:Number; public var anchorPoint1:b2Vec2; public var anchorPoint2:b2Vec2; public function b2PulleyJointDef(){ groundPoint1 = new b2Vec2(); groundPoint2 = new b2Vec2(); anchorPoint1 = new b2Vec2(); anchorPoint2 = new b2Vec2(); super(); type = b2Joint.e_pulleyJoint; groundPoint1.Set(-1, 1); groundPoint2.Set(1, 1); anchorPoint1.Set(-1, 0); anchorPoint2.Set(1, 0); maxLength1 = (0.5 * b2PulleyJoint.b2_minPulleyLength); maxLength2 = (0.5 * b2PulleyJoint.b2_minPulleyLength); ratio = 1; collideConnected = true; } } }//package Box2D.Dynamics.Joints
Section 53
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2RevoluteJoint extends b2Joint { public var m_intialAngle:Number; public var m_enableLimit:Boolean; public var m_limitState:int; public var m_ptpMass:b2Mat22; 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_limitImpulse:Number; public var m_motorImpulse:Number; public var m_enableMotor:Boolean; public var m_lowerAngle:Number; public var m_limitPositionImpulse:Number; public var m_maxMotorTorque:Number; public var m_upperAngle:Number; public var m_motorSpeed:Number; public var m_ptpImpulse:b2Vec2; public static var tImpulse:b2Vec2 = new b2Vec2(); public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); K3 = new b2Mat22(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_ptpImpulse = new b2Vec2(); m_ptpMass = new b2Mat22(); super(_arg1); _local2 = m_body1.m_R; _local3 = (_arg1.anchorPoint.x - m_body1.m_position.x); _local4 = (_arg1.anchorPoint.y - m_body1.m_position.y); m_localAnchor1.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)); m_localAnchor1.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)); _local2 = m_body2.m_R; _local3 = (_arg1.anchorPoint.x - m_body2.m_position.x); _local4 = (_arg1.anchorPoint.y - m_body2.m_position.y); m_localAnchor2.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)); m_localAnchor2.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)); m_intialAngle = (m_body2.m_rotation - m_body1.m_rotation); m_ptpImpulse.Set(0, 0); m_motorImpulse = 0; m_limitImpulse = 0; m_limitPositionImpulse = 0; m_lowerAngle = _arg1.lowerAngle; m_upperAngle = _arg1.upperAngle; m_maxMotorTorque = _arg1.motorTorque; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function GetAnchor1():b2Vec2{ var _local1:b2Mat22; _local1 = m_body1.m_R; return (new b2Vec2((m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y))), (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y))))); } override public function GetAnchor2():b2Vec2{ var _local1:b2Mat22; _local1 = m_body2.m_R; return (new b2Vec2((m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y))), (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y))))); } override public function PrepareVelocitySolver():void{ var _local1:b2Body; var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; _local1 = m_body1; _local2 = m_body2; _local3 = _local1.m_R; _local4 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y)); _local5 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y)); _local3 = _local2.m_R; _local6 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y)); _local7 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y)); _local8 = _local1.m_invMass; _local9 = _local2.m_invMass; _local10 = _local1.m_invI; _local11 = _local2.m_invI; K1.col1.x = (_local8 + _local9); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local8 + _local9); K2.col1.x = ((_local10 * _local5) * _local5); K2.col2.x = ((-(_local10) * _local4) * _local5); K2.col1.y = ((-(_local10) * _local4) * _local5); K2.col2.y = ((_local10 * _local4) * _local4); K3.col1.x = ((_local11 * _local7) * _local7); K3.col2.x = ((-(_local11) * _local6) * _local7); K3.col1.y = ((-(_local11) * _local6) * _local7); K3.col2.y = ((_local11 * _local6) * _local6); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Invert(m_ptpMass); m_motorMass = (1 / (_local10 + _local11)); if (m_enableMotor == false){ m_motorImpulse = 0; }; if (m_enableLimit){ _local12 = ((_local2.m_rotation - _local1.m_rotation) - m_intialAngle); if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){ m_limitState = e_equalLimits; } else { if (_local12 <= m_lowerAngle){ if (m_limitState != e_atLowerLimit){ m_limitImpulse = 0; }; m_limitState = e_atLowerLimit; } else { if (_local12 >= m_upperAngle){ if (m_limitState != e_atUpperLimit){ m_limitImpulse = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitImpulse = 0; }; }; }; } else { m_limitImpulse = 0; }; if (b2World.s_enableWarmStarting){ _local1.m_linearVelocity.x = (_local1.m_linearVelocity.x - (_local8 * m_ptpImpulse.x)); _local1.m_linearVelocity.y = (_local1.m_linearVelocity.y - (_local8 * m_ptpImpulse.y)); _local1.m_angularVelocity = (_local1.m_angularVelocity - (_local10 * ((((_local4 * m_ptpImpulse.y) - (_local5 * m_ptpImpulse.x)) + m_motorImpulse) + m_limitImpulse))); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local9 * m_ptpImpulse.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local9 * m_ptpImpulse.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local11 * ((((_local6 * m_ptpImpulse.y) - (_local7 * m_ptpImpulse.x)) + m_motorImpulse) + m_limitImpulse))); } else { m_ptpImpulse.SetZero(); m_motorImpulse = 0; m_limitImpulse = 0; }; m_limitPositionImpulse = 0; } override public function GetReactionForce(_arg1:Number):b2Vec2{ var _local2:b2Vec2; _local2 = m_ptpImpulse.Copy(); _local2.Multiply(_arg1); return (_local2); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local3:b2Body; var _local4:b2Body; var _local5:Number; var _local6:b2Mat22; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; _local3 = m_body1; _local4 = m_body2; _local5 = 0; _local6 = _local3.m_R; _local7 = ((_local6.col1.x * m_localAnchor1.x) + (_local6.col2.x * m_localAnchor1.y)); _local8 = ((_local6.col1.y * m_localAnchor1.x) + (_local6.col2.y * m_localAnchor1.y)); _local6 = _local4.m_R; _local9 = ((_local6.col1.x * m_localAnchor2.x) + (_local6.col2.x * m_localAnchor2.y)); _local10 = ((_local6.col1.y * m_localAnchor2.x) + (_local6.col2.y * m_localAnchor2.y)); _local11 = (_local3.m_position.x + _local7); _local12 = (_local3.m_position.y + _local8); _local13 = (_local4.m_position.x + _local9); _local14 = (_local4.m_position.y + _local10); _local15 = (_local13 - _local11); _local16 = (_local14 - _local12); _local5 = Math.sqrt(((_local15 * _local15) + (_local16 * _local16))); _local17 = _local3.m_invMass; _local18 = _local4.m_invMass; _local19 = _local3.m_invI; _local20 = _local4.m_invI; K1.col1.x = (_local17 + _local18); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local17 + _local18); K2.col1.x = ((_local19 * _local8) * _local8); K2.col2.x = ((-(_local19) * _local7) * _local8); K2.col1.y = ((-(_local19) * _local7) * _local8); K2.col2.y = ((_local19 * _local7) * _local7); K3.col1.x = ((_local20 * _local10) * _local10); K3.col2.x = ((-(_local20) * _local9) * _local10); K3.col1.y = ((-(_local20) * _local9) * _local10); K3.col2.y = ((_local20 * _local9) * _local9); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Solve(tImpulse, -(_local15), -(_local16)); _local21 = tImpulse.x; _local22 = tImpulse.y; _local3.m_position.x = (_local3.m_position.x - (_local3.m_invMass * _local21)); _local3.m_position.y = (_local3.m_position.y - (_local3.m_invMass * _local22)); _local3.m_rotation = (_local3.m_rotation - (_local3.m_invI * ((_local7 * _local22) - (_local8 * _local21)))); _local3.m_R.Set(_local3.m_rotation); _local4.m_position.x = (_local4.m_position.x + (_local4.m_invMass * _local21)); _local4.m_position.y = (_local4.m_position.y + (_local4.m_invMass * _local22)); _local4.m_rotation = (_local4.m_rotation + (_local4.m_invI * ((_local9 * _local22) - (_local10 * _local21)))); _local4.m_R.Set(_local4.m_rotation); _local23 = 0; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local24 = ((_local4.m_rotation - _local3.m_rotation) - m_intialAngle); _local25 = 0; if (m_limitState == e_equalLimits){ _local2 = b2Math.b2Clamp(_local24, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); _local25 = (-(m_motorMass) * _local2); _local23 = b2Math.b2Abs(_local2); } else { if (m_limitState == e_atLowerLimit){ _local2 = (_local24 - m_lowerAngle); _local23 = b2Math.b2Max(0, -(_local2)); _local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0); _local25 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local25), 0); _local25 = (m_limitPositionImpulse - _local1); } else { if (m_limitState == e_atUpperLimit){ _local2 = (_local24 - m_upperAngle); _local23 = b2Math.b2Max(0, _local2); _local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection); _local25 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local25), 0); _local25 = (m_limitPositionImpulse - _local1); }; }; }; _local3.m_rotation = (_local3.m_rotation - (_local3.m_invI * _local25)); _local3.m_R.Set(_local3.m_rotation); _local4.m_rotation = (_local4.m_rotation + (_local4.m_invI * _local25)); _local4.m_R.Set(_local4.m_rotation); }; return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local23 <= b2Settings.b2_angularSlop)))); } public function GetJointSpeed():Number{ return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity)); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function SetMotorTorque(_arg1:Number):void{ m_maxMotorTorque = _arg1; } public function GetJointAngle():Number{ return ((m_body2.m_rotation - m_body1.m_rotation)); } public function GetMotorTorque(_arg1:Number):Number{ return ((_arg1 * m_motorImpulse)); } override public function GetReactionTorque(_arg1:Number):Number{ return ((_arg1 * m_limitImpulse)); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_R; _local5 = ((_local4.col1.x * m_localAnchor1.x) + (_local4.col2.x * m_localAnchor1.y)); _local6 = ((_local4.col1.y * m_localAnchor1.x) + (_local4.col2.y * m_localAnchor1.y)); _local4 = _local3.m_R; _local7 = ((_local4.col1.x * m_localAnchor2.x) + (_local4.col2.x * m_localAnchor2.y)); _local8 = ((_local4.col1.y * m_localAnchor2.x) + (_local4.col2.y * m_localAnchor2.y)); _local10 = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local8)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local6)); _local11 = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local7)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local5)); _local12 = -(((m_ptpMass.col1.x * _local10) + (m_ptpMass.col2.x * _local11))); _local13 = -(((m_ptpMass.col1.y * _local10) + (m_ptpMass.col2.y * _local11))); m_ptpImpulse.x = (m_ptpImpulse.x + _local12); m_ptpImpulse.y = (m_ptpImpulse.y + _local13); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local12)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local13)); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local5 * _local13) - (_local6 * _local12)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local12)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local13)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local7 * _local13) - (_local8 * _local12)))); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local14 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed); _local15 = (-(m_motorMass) * _local14); _local16 = m_motorImpulse; m_motorImpulse = b2Math.b2Clamp((m_motorImpulse + _local15), (-(_arg1.dt) * m_maxMotorTorque), (_arg1.dt * m_maxMotorTorque)); _local15 = (m_motorImpulse - _local16); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * _local15)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * _local15)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local17 = (_local3.m_angularVelocity - _local2.m_angularVelocity); _local18 = (-(m_motorMass) * _local17); if (m_limitState == e_equalLimits){ m_limitImpulse = (m_limitImpulse + _local18); } else { if (m_limitState == e_atLowerLimit){ _local9 = m_limitImpulse; m_limitImpulse = b2Math.b2Max((m_limitImpulse + _local18), 0); _local18 = (m_limitImpulse - _local9); } else { if (m_limitState == e_atUpperLimit){ _local9 = m_limitImpulse; m_limitImpulse = b2Math.b2Min((m_limitImpulse + _local18), 0); _local18 = (m_limitImpulse - _local9); }; }; }; _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * _local18)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * _local18)); }; } } }//package Box2D.Dynamics.Joints
Section 54
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2RevoluteJointDef extends b2JointDef { public var upperAngle:Number; public var lowerAngle:Number; public var motorSpeed:Number; public var anchorPoint:b2Vec2; public var motorTorque:Number; public var enableMotor:Boolean; public var enableLimit:Boolean; public function b2RevoluteJointDef(){ type = b2Joint.e_revoluteJoint; anchorPoint = new b2Vec2(0, 0); lowerAngle = 0; upperAngle = 0; motorTorque = 0; motorSpeed = 0; enableLimit = false; enableMotor = false; } } }//package Box2D.Dynamics.Joints
Section 55
//b2Body (Box2D.Dynamics.b2Body) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.Contacts.*; import Box2D.Common.*; public class b2Body { public var m_next:b2Body; public var m_mass:Number; public var m_contactList:b2ContactNode; public var m_angularVelocity:Number; public var m_rotation:Number; public var m_shapeList:b2Shape; public var m_R:b2Mat22; public var m_force:b2Vec2; public var m_torque:Number; public var m_rotation0:Number; public var m_userData; public var m_linearVelocity:b2Vec2; public var m_invMass:Number; public var m_position:b2Vec2; public var m_flags:uint; public var m_invI:Number; public var m_linearDamping:Number; public var m_prev:b2Body; public var m_world:b2World; public var m_angularDamping:Number; public var m_position0:b2Vec2; private var sMat0:b2Mat22; public var m_center:b2Vec2; public var m_sleepTime:Number; public var m_shapeCount:int; public var m_I:Number; public var m_jointList:b2JointNode; public static var e_frozenFlag:uint = 2; public static var e_sleepFlag:uint = 8; public static var e_islandFlag:uint = 4; public static var e_destroyFlag:uint = 32; public static var e_allowSleepFlag:uint = 16; public static var e_staticFlag:uint = 1; public function b2Body(_arg1:b2BodyDef, _arg2:b2World){ var _local3:int; var _local4:b2ShapeDef; var _local5:b2MassData; var _local6:Array; var _local7:b2Vec2; var _local8:b2Shape; sMat0 = new b2Mat22(); m_position = new b2Vec2(); m_R = new b2Mat22(0); m_position0 = new b2Vec2(); super(); m_flags = 0; m_position.SetV(_arg1.position); m_rotation = _arg1.rotation; m_R.Set(m_rotation); m_position0.SetV(m_position); m_rotation0 = m_rotation; m_world = _arg2; m_linearDamping = b2Math.b2Clamp((1 - _arg1.linearDamping), 0, 1); m_angularDamping = b2Math.b2Clamp((1 - _arg1.angularDamping), 0, 1); m_force = new b2Vec2(0, 0); m_torque = 0; m_mass = 0; _local6 = new Array(b2Settings.b2_maxShapesPerBody); _local3 = 0; while (_local3 < b2Settings.b2_maxShapesPerBody) { _local6[_local3] = new b2MassData(); _local3++; }; m_shapeCount = 0; m_center = new b2Vec2(0, 0); _local3 = 0; while (_local3 < b2Settings.b2_maxShapesPerBody) { _local4 = _arg1.shapes[_local3]; if (_local4 == null){ break; }; _local5 = _local6[_local3]; _local4.ComputeMass(_local5); m_mass = (m_mass + _local5.mass); m_center.x = (m_center.x + (_local5.mass * (_local4.localPosition.x + _local5.center.x))); m_center.y = (m_center.y + (_local5.mass * (_local4.localPosition.y + _local5.center.y))); m_shapeCount++; _local3++; }; if (m_mass > 0){ m_center.Multiply((1 / m_mass)); m_position.Add(b2Math.b2MulMV(m_R, m_center)); } else { m_flags = (m_flags | e_staticFlag); }; m_I = 0; _local3 = 0; while (_local3 < m_shapeCount) { _local4 = _arg1.shapes[_local3]; _local5 = _local6[_local3]; m_I = (m_I + _local5.I); _local7 = b2Math.SubtractVV(b2Math.AddVV(_local4.localPosition, _local5.center), m_center); m_I = (m_I + (_local5.mass * b2Math.b2Dot(_local7, _local7))); _local3++; }; if (m_mass > 0){ m_invMass = (1 / m_mass); } else { m_invMass = 0; }; if ((((m_I > 0)) && ((_arg1.preventRotation == false)))){ m_invI = (1 / m_I); } else { m_I = 0; m_invI = 0; }; m_linearVelocity = b2Math.AddVV(_arg1.linearVelocity, b2Math.b2CrossFV(_arg1.angularVelocity, m_center)); m_angularVelocity = _arg1.angularVelocity; m_jointList = null; m_contactList = null; m_prev = null; m_next = null; m_shapeList = null; _local3 = 0; while (_local3 < m_shapeCount) { _local4 = _arg1.shapes[_local3]; _local8 = b2Shape.Create(_local4, this, m_center); _local8.m_next = m_shapeList; m_shapeList = _local8; _local3++; }; m_sleepTime = 0; if (_arg1.allowSleep){ m_flags = (m_flags | e_allowSleepFlag); }; if (_arg1.isSleeping){ m_flags = (m_flags | e_sleepFlag); }; if ((((m_flags & e_sleepFlag)) || ((m_invMass == 0)))){ m_linearVelocity.Set(0, 0); m_angularVelocity = 0; }; m_userData = _arg1.userData; } public function SetCenterPosition(_arg1:b2Vec2, _arg2:Number):void{ var _local3:b2Shape; if (IsFrozen()){ return; }; m_rotation = _arg2; m_R.Set(m_rotation); m_position.SetV(_arg1); m_position0.SetV(m_position); m_rotation0 = m_rotation; _local3 = m_shapeList; while (_local3 != null) { _local3.Synchronize(m_position, m_R, m_position, m_R); _local3 = _local3.m_next; }; m_world.m_broadPhase.Commit(); } public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{ return (b2Math.AddVV(m_position, b2Math.b2MulMV(m_R, _arg1))); } public function SetLinearVelocity(_arg1:b2Vec2):void{ m_linearVelocity.SetV(_arg1); } public function IsFrozen():Boolean{ return (((m_flags & e_frozenFlag) == e_frozenFlag)); } public function IsSleeping():Boolean{ return (((m_flags & e_sleepFlag) == e_sleepFlag)); } public function QuickSyncShapes():void{ var _local1:b2Shape; _local1 = m_shapeList; while (_local1 != null) { _local1.QuickSync(m_position, m_R); _local1 = _local1.m_next; }; } public function GetInertia():Number{ return (m_I); } public function GetLocalVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulTMV(m_R, _arg1)); } public function GetLinearVelocity():b2Vec2{ return (m_linearVelocity); } public function GetJointList():b2JointNode{ return (m_jointList); } public function GetRotationMatrix():b2Mat22{ return (m_R); } public function Freeze():void{ var _local1:b2Shape; m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local1 = m_shapeList; while (_local1 != null) { _local1.DestroyProxy(); _local1 = _local1.m_next; }; } public function SetAngularVelocity(_arg1:Number):void{ m_angularVelocity = _arg1; } public function SynchronizeShapes():void{ var _local1:b2Shape; sMat0.Set(m_rotation0); _local1 = m_shapeList; while (_local1 != null) { _local1.Synchronize(m_position0, sMat0, m_position, m_R); _local1 = _local1.m_next; }; } public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping() == false){ m_force.Add(_arg1); m_torque = (m_torque + b2Math.b2CrossVV(b2Math.SubtractVV(_arg2, m_position), _arg1)); }; } public function GetOriginPosition():b2Vec2{ return (b2Math.SubtractVV(m_position, b2Math.b2MulMV(m_R, m_center))); } public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping() == false){ m_linearVelocity.Add(b2Math.MulFV(m_invMass, _arg1)); m_angularVelocity = (m_angularVelocity + (m_invI * b2Math.b2CrossVV(b2Math.SubtractVV(_arg2, m_position), _arg1))); }; } public function GetContactList():b2ContactNode{ return (m_contactList); } public function GetAngularVelocity():Number{ return (m_angularVelocity); } public function GetMass():Number{ return (m_mass); } public function GetShapeList():b2Shape{ return (m_shapeList); } public function SetOriginPosition(_arg1:b2Vec2, _arg2:Number):void{ var _local3:b2Shape; if (IsFrozen()){ return; }; m_rotation = _arg2; m_R.Set(m_rotation); m_position = b2Math.AddVV(_arg1, b2Math.b2MulMV(m_R, m_center)); m_position0.SetV(m_position); m_rotation0 = m_rotation; _local3 = m_shapeList; while (_local3 != null) { _local3.Synchronize(m_position, m_R, m_position, m_R); _local3 = _local3.m_next; }; m_world.m_broadPhase.Commit(); } public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulTMV(m_R, b2Math.SubtractVV(_arg1, m_position))); } public function GetRotation():Number{ return (m_rotation); } public function IsStatic():Boolean{ return (((m_flags & e_staticFlag) == e_staticFlag)); } public function Destroy():void{ var _local1:b2Shape; var _local2:b2Shape; _local1 = m_shapeList; while (_local1) { _local2 = _local1; _local1 = _local1.m_next; b2Shape.Destroy(_local2); }; } public function GetWorldVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulMV(m_R, _arg1)); } public function GetNext():b2Body{ return (m_next); } public function IsConnected(_arg1:b2Body):Boolean{ var _local2:b2JointNode; _local2 = m_jointList; while (_local2 != null) { if (_local2.other == _arg1){ return ((_local2.joint.m_collideConnected == false)); }; _local2 = _local2.next; }; return (false); } public function GetUserData(){ return (m_userData); } public function GetCenterPosition():b2Vec2{ return (m_position); } public function ApplyTorque(_arg1:Number):void{ if (IsSleeping() == false){ m_torque = (m_torque + _arg1); }; } public function AllowSleeping(_arg1:Boolean):void{ if (_arg1){ m_flags = (m_flags | e_allowSleepFlag); } else { m_flags = (m_flags & ~(e_allowSleepFlag)); WakeUp(); }; } public function WakeUp():void{ m_flags = (m_flags & ~(e_sleepFlag)); m_sleepTime = 0; } } }//package Box2D.Dynamics
Section 56
//b2BodyDef (Box2D.Dynamics.b2BodyDef) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2BodyDef { public var angularDamping:Number; public var rotation:Number; public var allowSleep:Boolean; public var userData; public var linearDamping:Number; public var angularVelocity:Number; public var linearVelocity:b2Vec2; public var position:b2Vec2; public var shapes:Array; public var isSleeping:Boolean; public var preventRotation:Boolean; public function b2BodyDef(){ var _local1:int; shapes = new Array(); super(); userData = null; _local1 = 0; while (_local1 < b2Settings.b2_maxShapesPerBody) { shapes[_local1] = null; _local1++; }; position = new b2Vec2(0, 0); rotation = 0; linearVelocity = new b2Vec2(0, 0); angularVelocity = 0; linearDamping = 0; angularDamping = 0; allowSleep = true; isSleeping = false; preventRotation = false; } public function AddShape(_arg1:b2ShapeDef):void{ var _local2:int; _local2 = 0; while (_local2 < b2Settings.b2_maxShapesPerBody) { if (shapes[_local2] == null){ shapes[_local2] = _arg1; break; }; _local2++; }; } } }//package Box2D.Dynamics
Section 57
//b2CollisionFilter (Box2D.Dynamics.b2CollisionFilter) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; public class b2CollisionFilter { public static var b2_defaultFilter:b2CollisionFilter = new (b2CollisionFilter); ; public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{ var _local3:Boolean; if ((((_arg1.m_groupIndex == _arg2.m_groupIndex)) && (!((_arg1.m_groupIndex == 0))))){ return ((_arg1.m_groupIndex > 0)); }; _local3 = ((!(((_arg1.m_maskBits & _arg2.m_categoryBits) == 0))) && (!(((_arg1.m_categoryBits & _arg2.m_maskBits) == 0)))); return (_local3); } } }//package Box2D.Dynamics
Section 58
//b2ContactManager (Box2D.Dynamics.b2ContactManager) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class b2ContactManager extends b2PairCallback { public var m_world:b2World; public var m_destroyImmediate:Boolean; public var m_nullContact:b2NullContact; public function b2ContactManager(){ m_nullContact = new b2NullContact(); super(); m_world = null; m_destroyImmediate = false; } public function Collide():void{ var _local1:b2Body; var _local2:b2Body; var _local3:b2ContactNode; var _local4:b2ContactNode; var _local5:b2Contact; var _local6:int; var _local7:int; _local5 = m_world.m_contactList; while (_local5 != null) { if (((_local5.m_shape1.m_body.IsSleeping()) && (_local5.m_shape2.m_body.IsSleeping()))){ } else { _local6 = _local5.GetManifoldCount(); _local5.Evaluate(); _local7 = _local5.GetManifoldCount(); if ((((_local6 == 0)) && ((_local7 > 0)))){ _local1 = _local5.m_shape1.m_body; _local2 = _local5.m_shape2.m_body; _local3 = _local5.m_node1; _local4 = _local5.m_node2; _local3.contact = _local5; _local3.other = _local2; _local3.prev = null; _local3.next = _local1.m_contactList; if (_local3.next != null){ _local3.next.prev = _local5.m_node1; }; _local1.m_contactList = _local5.m_node1; _local4.contact = _local5; _local4.other = _local1; _local4.prev = null; _local4.next = _local2.m_contactList; if (_local4.next != null){ _local4.next.prev = _local4; }; _local2.m_contactList = _local4; } else { if ((((_local6 > 0)) && ((_local7 == 0)))){ _local1 = _local5.m_shape1.m_body; _local2 = _local5.m_shape2.m_body; _local3 = _local5.m_node1; _local4 = _local5.m_node2; if (_local3.prev){ _local3.prev.next = _local3.next; }; if (_local3.next){ _local3.next.prev = _local3.prev; }; if (_local3 == _local1.m_contactList){ _local1.m_contactList = _local3.next; }; _local3.prev = null; _local3.next = null; if (_local4.prev){ _local4.prev.next = _local4.next; }; if (_local4.next){ _local4.next.prev = _local4.prev; }; if (_local4 == _local2.m_contactList){ _local2.m_contactList = _local4.next; }; _local4.prev = null; _local4.next = null; }; }; }; _local5 = _local5.m_next; }; } public function DestroyContact(_arg1:b2Contact):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2ContactNode; var _local5:b2ContactNode; 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; }; if (_arg1.GetManifoldCount() > 0){ _local2 = _arg1.m_shape1.m_body; _local3 = _arg1.m_shape2.m_body; _local4 = _arg1.m_node1; _local5 = _arg1.m_node2; _local2.WakeUp(); _local3.WakeUp(); if (_local4.prev){ _local4.prev.next = _local4.next; }; if (_local4.next){ _local4.next.prev = _local4.prev; }; if (_local4 == _local2.m_contactList){ _local2.m_contactList = _local4.next; }; _local4.prev = null; _local4.next = null; if (_local5.prev){ _local5.prev.next = _local5.next; }; if (_local5.next){ _local5.next.prev = _local5.prev; }; if (_local5 == _local3.m_contactList){ _local3.m_contactList = _local5.next; }; _local5.prev = null; _local5.next = null; }; b2Contact.Destroy(_arg1, m_world.m_blockAllocator); m_world.m_contactCount--; } override public function PairAdded(_arg1, _arg2){ var _local3:b2Shape; var _local4:b2Shape; var _local5:b2Body; var _local6:b2Body; var _local7:b2Contact; var _local8:b2Shape; var _local9:b2Body; _local3 = (_arg1 as b2Shape); _local4 = (_arg2 as b2Shape); _local5 = _local3.m_body; _local6 = _local4.m_body; if (((_local5.IsStatic()) && (_local6.IsStatic()))){ return (m_nullContact); }; if (_local3.m_body == _local4.m_body){ return (m_nullContact); }; if (_local6.IsConnected(_local5)){ return (m_nullContact); }; if (((!((m_world.m_filter == null))) && ((m_world.m_filter.ShouldCollide(_local3, _local4) == false)))){ return (m_nullContact); }; if (_local6.m_invMass == 0){ _local8 = _local3; _local3 = _local4; _local4 = _local8; _local9 = _local5; _local5 = _local6; _local6 = _local9; }; _local7 = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator); if (_local7 == null){ return (m_nullContact); }; _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; m_world.m_contactCount++; return (_local7); } public function CleanContactList():void{ var _local1:b2Contact; var _local2:b2Contact; _local1 = m_world.m_contactList; while (_local1 != null) { _local2 = _local1; _local1 = _local1.m_next; if ((_local2.m_flags & b2Contact.e_destroyFlag)){ DestroyContact(_local2); _local2 = null; }; }; } override public function PairRemoved(_arg1, _arg2, _arg3):void{ var _local4:b2Contact; if (_arg3 == null){ return; }; _local4 = (_arg3 as b2Contact); if (_local4 != m_nullContact){ if (m_destroyImmediate == true){ DestroyContact(_local4); _local4 = null; } else { _local4.m_flags = (_local4.m_flags | b2Contact.e_destroyFlag); }; }; } } }//package Box2D.Dynamics
Section 59
//b2Island (Box2D.Dynamics.b2Island) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.Contacts.*; import Box2D.Common.*; public class b2Island { public var m_positionError:Number; 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; public static var m_positionIterationCount:uint; public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4):void{ var _local5:int; super(); m_bodyCapacity = _arg1; m_contactCapacity = _arg2; m_jointCapacity = _arg3; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_bodies = new Array(_arg1); _local5 = 0; while (_local5 < _arg1) { m_bodies[_local5] = null; _local5++; }; m_contacts = new Array(_arg2); _local5 = 0; while (_local5 < _arg2) { m_contacts[_local5] = null; _local5++; }; m_joints = new Array(_arg3); _local5 = 0; while (_local5 < _arg3) { m_joints[_local5] = null; _local5++; }; m_allocator = _arg4; } 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 Solve(_arg1:b2TimeStep, _arg2:b2Vec2):void{ var _local3:int; var _local4:b2Body; var _local5:b2ContactSolver; var _local6:int; var _local7:Boolean; var _local8:Boolean; var _local9:Boolean; _local3 = 0; while (_local3 < m_bodyCount) { _local4 = m_bodies[_local3]; if (_local4.m_invMass == 0){ } else { _local4.m_linearVelocity.Add(b2Math.MulFV(_arg1.dt, b2Math.AddVV(_arg2, b2Math.MulFV(_local4.m_invMass, _local4.m_force)))); _local4.m_angularVelocity = (_local4.m_angularVelocity + ((_arg1.dt * _local4.m_invI) * _local4.m_torque)); _local4.m_linearVelocity.Multiply(_local4.m_linearDamping); _local4.m_angularVelocity = (_local4.m_angularVelocity * _local4.m_angularDamping); _local4.m_position0.SetV(_local4.m_position); _local4.m_rotation0 = _local4.m_rotation; }; _local3++; }; _local5 = new b2ContactSolver(m_contacts, m_contactCount, m_allocator); _local5.PreSolve(); _local3 = 0; while (_local3 < m_jointCount) { m_joints[_local3].PrepareVelocitySolver(); _local3++; }; _local3 = 0; while (_local3 < _arg1.iterations) { _local5.SolveVelocityConstraints(); _local6 = 0; while (_local6 < m_jointCount) { m_joints[_local6].SolveVelocityConstraints(_arg1); _local6++; }; _local3++; }; _local3 = 0; while (_local3 < m_bodyCount) { _local4 = m_bodies[_local3]; if (_local4.m_invMass == 0){ } else { _local4.m_position.x = (_local4.m_position.x + (_arg1.dt * _local4.m_linearVelocity.x)); _local4.m_position.y = (_local4.m_position.y + (_arg1.dt * _local4.m_linearVelocity.y)); _local4.m_rotation = (_local4.m_rotation + (_arg1.dt * _local4.m_angularVelocity)); _local4.m_R.Set(_local4.m_rotation); }; _local3++; }; _local3 = 0; while (_local3 < m_jointCount) { m_joints[_local3].PreparePositionSolver(); _local3++; }; if (b2World.s_enablePositionCorrection){ m_positionIterationCount = 0; while (m_positionIterationCount < _arg1.iterations) { _local7 = _local5.SolvePositionConstraints(b2Settings.b2_contactBaumgarte); _local8 = true; _local3 = 0; while (_local3 < m_jointCount) { _local9 = m_joints[_local3].SolvePositionConstraints(); _local8 = ((_local8) && (_local9)); _local3++; }; if (((_local7) && (_local8))){ break; }; m_positionIterationCount++; }; }; _local5.PostSolve(); _local3 = 0; while (_local3 < m_bodyCount) { _local4 = m_bodies[_local3]; if (_local4.m_invMass == 0){ } else { _local4.m_R.Set(_local4.m_rotation); _local4.SynchronizeShapes(); _local4.m_force.Set(0, 0); _local4.m_torque = 0; }; _local3++; }; } public function AddContact(_arg1:b2Contact):void{ var _local2 = m_contactCount++; m_contacts[_local2] = _arg1; } public function Clear():void{ m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; } public function UpdateSleep(_arg1:Number):void{ var _local2:int; var _local3:b2Body; var _local4:Number; var _local5:Number; var _local6:Number; _local4 = Number.MAX_VALUE; _local5 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance); _local6 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance); _local2 = 0; while (_local2 < m_bodyCount) { _local3 = m_bodies[_local2]; if (_local3.m_invMass == 0){ } else { if ((_local3.m_flags & b2Body.e_allowSleepFlag) == 0){ _local3.m_sleepTime = 0; _local4 = 0; }; if (((((((_local3.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local3.m_angularVelocity * _local3.m_angularVelocity) > _local6)))) || ((b2Math.b2Dot(_local3.m_linearVelocity, _local3.m_linearVelocity) > _local5)))){ _local3.m_sleepTime = 0; _local4 = 0; } else { _local3.m_sleepTime = (_local3.m_sleepTime + _arg1); _local4 = b2Math.b2Min(_local4, _local3.m_sleepTime); }; }; _local2++; }; if (_local4 >= b2Settings.b2_timeToSleep){ _local2 = 0; while (_local2 < m_bodyCount) { _local3 = m_bodies[_local2]; _local3.m_flags = (_local3.m_flags | b2Body.e_sleepFlag); _local2++; }; }; } } }//package Box2D.Dynamics
Section 60
//b2TimeStep (Box2D.Dynamics.b2TimeStep) package Box2D.Dynamics { public class b2TimeStep { public var dt:Number; public var iterations:int; public var inv_dt:Number; } }//package Box2D.Dynamics
Section 61
//b2World (Box2D.Dynamics.b2World) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class b2World { public var m_filter:b2CollisionFilter; public var m_blockAllocator; public var m_contactList:b2Contact; public var m_broadPhase:b2BroadPhase; public var m_allowSleep:Boolean; public var m_jointCount:int; public var m_bodyCount:int; public var m_listener:b2WorldListener; private var step:b2TimeStep; public var m_positionIterationCount:int; public var m_groundBody:b2Body; public var m_contactCount:int; public var m_bodyDestroyList:b2Body; public var m_bodyList:b2Body; public var m_stackAllocator; public var m_gravity:b2Vec2; public var m_jointList:b2Joint; public var m_contactManager:b2ContactManager; public static var s_enableWarmStarting:int = 1; public static var s_enablePositionCorrection:int = 1; public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){ var _local4:b2BodyDef; step = new b2TimeStep(); m_contactManager = new b2ContactManager(); super(); m_listener = null; m_filter = b2CollisionFilter.b2_defaultFilter; m_bodyList = null; m_contactList = null; m_jointList = null; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_bodyDestroyList = null; m_allowSleep = _arg3; m_gravity = _arg2; m_contactManager.m_world = this; m_broadPhase = new b2BroadPhase(_arg1, m_contactManager); _local4 = new b2BodyDef(); m_groundBody = CreateBody(_local4); } public function SetListener(_arg1:b2WorldListener):void{ m_listener = _arg1; } public function DestroyBody(_arg1:b2Body):void{ if ((_arg1.m_flags & b2Body.e_destroyFlag)){ return; }; 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; }; _arg1.m_flags = (_arg1.m_flags | b2Body.e_destroyFlag); m_bodyCount--; _arg1.m_prev = null; _arg1.m_next = m_bodyDestroyList; m_bodyDestroyList = _arg1; } public function GetGroundBody():b2Body{ return (m_groundBody); } public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{ var _local4:Array; var _local5:int; var _local6:int; _local4 = new Array(); _local5 = m_broadPhase.QueryAABB(_arg1, _local4, _arg3); _local6 = 0; while (_local6 < _local5) { _arg2[_local6] = (_local4[_local6] as b2Shape); _local6++; }; return (_local5); } public function CleanBodyList():void{ var _local1:b2Body; var _local2:b2Body; var _local3:b2JointNode; var _local4:b2JointNode; m_contactManager.m_destroyImmediate = true; _local1 = m_bodyDestroyList; while (_local1) { _local2 = _local1; _local1 = _local1.m_next; _local3 = _local2.m_jointList; while (_local3) { _local4 = _local3; _local3 = _local3.next; if (m_listener){ m_listener.NotifyJointDestroyed(_local4.joint); }; DestroyJoint(_local4.joint); }; _local2.Destroy(); }; m_bodyDestroyList = null; m_contactManager.m_destroyImmediate = false; } public function GetJointList():b2Joint{ return (m_jointList); } public function GetBodyList():b2Body{ return (m_bodyList); } public function GetContactList():b2Contact{ return (m_contactList); } public function CreateJoint(_arg1:b2JointDef):b2Joint{ var _local2:b2Joint; var _local3:b2Body; var _local4:b2Shape; _local2 = b2Joint.Create(_arg1, m_blockAllocator); _local2.m_prev = null; _local2.m_next = m_jointList; if (m_jointList){ m_jointList.m_prev = _local2; }; m_jointList = _local2; m_jointCount++; _local2.m_node1.joint = _local2; _local2.m_node1.other = _local2.m_body2; _local2.m_node1.prev = null; _local2.m_node1.next = _local2.m_body1.m_jointList; if (_local2.m_body1.m_jointList){ _local2.m_body1.m_jointList.prev = _local2.m_node1; }; _local2.m_body1.m_jointList = _local2.m_node1; _local2.m_node2.joint = _local2; _local2.m_node2.other = _local2.m_body1; _local2.m_node2.prev = null; _local2.m_node2.next = _local2.m_body2.m_jointList; if (_local2.m_body2.m_jointList){ _local2.m_body2.m_jointList.prev = _local2.m_node2; }; _local2.m_body2.m_jointList = _local2.m_node2; if (_arg1.collideConnected == false){ _local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2; _local4 = _local3.m_shapeList; while (_local4) { _local4.ResetProxy(m_broadPhase); _local4 = _local4.m_next; }; }; return (_local2); } public function DestroyJoint(_arg1:b2Joint):void{ var _local2:Boolean; var _local3:b2Body; var _local4:b2Body; var _local5:b2Body; var _local6:b2Shape; _local2 = _arg1.m_collideConnected; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_jointList){ m_jointList = _arg1.m_next; }; _local3 = _arg1.m_body1; _local4 = _arg1.m_body2; _local3.WakeUp(); _local4.WakeUp(); if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local3.m_jointList){ _local3.m_jointList = _arg1.m_node1.next; }; _arg1.m_node1.prev = null; _arg1.m_node1.next = null; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local4.m_jointList){ _local4.m_jointList = _arg1.m_node2.next; }; _arg1.m_node2.prev = null; _arg1.m_node2.next = null; b2Joint.Destroy(_arg1, m_blockAllocator); m_jointCount--; if (_local2 == false){ _local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4; _local6 = _local5.m_shapeList; while (_local6) { _local6.ResetProxy(m_broadPhase); _local6 = _local6.m_next; }; }; } public function SetFilter(_arg1:b2CollisionFilter):void{ m_filter = _arg1; } public function CreateBody(_arg1:b2BodyDef):b2Body{ var _local2:b2Body; _local2 = new b2Body(_arg1, this); _local2.m_prev = null; _local2.m_next = m_bodyList; if (m_bodyList){ m_bodyList.m_prev = _local2; }; m_bodyList = _local2; m_bodyCount++; return (_local2); } public function Step(_arg1:Number, _arg2:int):void{ var _local3:b2Body; var _local4:b2Body; var _local5:b2Island; var _local6:b2Contact; var _local7:b2Joint; var _local8:int; var _local9:Array; var _local10:int; var _local11:b2Body; var _local12:int; var _local13:int; var _local14:b2ContactNode; var _local15:b2JointNode; var _local16:uint; step.dt = _arg1; step.iterations = _arg2; if (_arg1 > 0){ step.inv_dt = (1 / _arg1); } else { step.inv_dt = 0; }; m_positionIterationCount = 0; m_contactManager.CleanContactList(); CleanBodyList(); m_contactManager.Collide(); _local5 = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator); _local3 = m_bodyList; while (_local3 != null) { _local3.m_flags = (_local3.m_flags & ~(b2Body.e_islandFlag)); _local3 = _local3.m_next; }; _local6 = m_contactList; while (_local6 != null) { _local6.m_flags = (_local6.m_flags & ~(b2Contact.e_islandFlag)); _local6 = _local6.m_next; }; _local7 = m_jointList; while (_local7 != null) { _local7.m_islandFlag = false; _local7 = _local7.m_next; }; _local8 = m_bodyCount; _local9 = new Array(m_bodyCount); _local10 = 0; while (_local10 < m_bodyCount) { _local9[_local10] = null; _local10++; }; _local11 = m_bodyList; while (_local11 != null) { if ((_local11.m_flags & (((b2Body.e_staticFlag | b2Body.e_islandFlag) | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){ } else { _local5.Clear(); _local12 = 0; var _temp1 = _local12; _local12 = (_local12 + 1); var _local17 = _temp1; _local9[_local17] = _local11; _local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag); while (_local12 > 0) { --_local12; _local3 = _local9[_local12]; _local5.AddBody(_local3); _local3.m_flags = (_local3.m_flags & ~(b2Body.e_sleepFlag)); if ((_local3.m_flags & b2Body.e_staticFlag)){ } else { _local14 = _local3.m_contactList; while (_local14 != null) { if ((_local14.contact.m_flags & b2Contact.e_islandFlag)){ } else { _local5.AddContact(_local14.contact); _local14.contact.m_flags = (_local14.contact.m_flags | b2Contact.e_islandFlag); _local4 = _local14.other; if ((_local4.m_flags & b2Body.e_islandFlag)){ } else { var _temp2 = _local12; _local12 = (_local12 + 1); var _local18 = _temp2; _local9[_local18] = _local4; _local4.m_flags = (_local4.m_flags | b2Body.e_islandFlag); }; }; _local14 = _local14.next; }; _local15 = _local3.m_jointList; while (_local15 != null) { if (_local15.joint.m_islandFlag == true){ } else { _local5.AddJoint(_local15.joint); _local15.joint.m_islandFlag = true; _local4 = _local15.other; if ((_local4.m_flags & b2Body.e_islandFlag)){ } else { var _temp3 = _local12; _local12 = (_local12 + 1); _local18 = _temp3; _local9[_local18] = _local4; _local4.m_flags = (_local4.m_flags | b2Body.e_islandFlag); }; }; _local15 = _local15.next; }; }; }; _local5.Solve(step, m_gravity); m_positionIterationCount = b2Math.b2Max(m_positionIterationCount, b2Island.m_positionIterationCount); if (m_allowSleep){ _local5.UpdateSleep(_arg1); }; _local13 = 0; while (_local13 < _local5.m_bodyCount) { _local3 = _local5.m_bodies[_local13]; if ((_local3.m_flags & b2Body.e_staticFlag)){ _local3.m_flags = (_local3.m_flags & ~(b2Body.e_islandFlag)); }; if (((_local3.IsFrozen()) && (m_listener))){ _local16 = m_listener.NotifyBoundaryViolated(_local3); if (_local16 == b2WorldListener.b2_destroyBody){ DestroyBody(_local3); _local3 = null; _local5.m_bodies[_local13] = null; }; }; _local13++; }; }; _local11 = _local11.m_next; }; m_broadPhase.Commit(); } } }//package Box2D.Dynamics
Section 62
//b2WorldListener (Box2D.Dynamics.b2WorldListener) package Box2D.Dynamics { import Box2D.Dynamics.Joints.*; public class b2WorldListener { public static var b2_freezeBody:uint = 0; public static var b2_destroyBody:uint = 1; public function NotifyBoundaryViolated(_arg1:b2Body):uint{ return (b2_freezeBody); } public function NotifyJointDestroyed(_arg1:b2Joint):void{ } } }//package Box2D.Dynamics
Section 63
//OCache (ENGINE.CORE.OCache) package ENGINE.CORE { import flash.utils.*; public dynamic class OCache { public function Pack():ByteArray{ var _local1:ByteArray; _local1 = new ByteArray(); _local1.writeObject(this); _local1.compress(); return (_local1); } public function AddCategoryArr(_arg1:String, _arg2:String):Array{ var _local3:OCache; _local3 = ((this[_arg1])==undefined) ? AddCategory(_arg1) : this[_arg1]; return (_local3.AddArr(_arg2)); } public function GetArrItem(_arg1:String, _arg2:int){ if ((((this[_arg1] == undefined)) || ((this[_arg1][_arg2] == undefined)))){ return (null); }; return (this[_arg1][_arg2]); } public function DeleteArrItem(_arg1:String, _arg2:int):void{ if (this[_arg1] == undefined){ return; }; this[_arg1].splice(_arg2, 1); } public function IsCategoryArrItem(_arg1:String, _arg2:String, _arg3:int):Boolean{ if (this[_arg1] == undefined){ return (false); }; return (this[_arg1].IsArrItem(_arg2, _arg3)); } public function GetCategoryItem(_arg1:String, _arg2:String){ if (this[_arg1] == undefined){ return (null); }; return (this[_arg1].GetItem(_arg2)); } public function SetCategoryItem(_arg1:String, _arg2:String, _arg3):void{ if (this[_arg1] == undefined){ this[_arg1] = new OCache(); }; this[_arg1].SetItem(_arg2, _arg3); } public function SetCategoryArrItem(_arg1:String, _arg2:String, _arg3:int, _arg4):void{ if (this[_arg1] == undefined){ this[_arg1] = new OCache(); }; this[_arg1].SetArrItem(_arg2, _arg3, _arg4); } public function IsCategoryItem(_arg1:String, _arg2:String):Boolean{ if (this[_arg1] == undefined){ return (false); }; return (this[_arg1].IsItem(_arg2)); } public function DeleteCategoryItem(_arg1:String, _arg2:String):void{ if (this[_arg1] == undefined){ return; }; this[_arg1].DeleteItem(_arg2); } public function AddCategory(_arg1:String):OCache{ this[_arg1] = new OCache(); return (this[_arg1]); } public function GetCategoryArrItem(_arg1:String, _arg2:String, _arg3:int){ if (this[_arg1] == undefined){ return (null); }; return (GetArrItem(_arg2, _arg3)); } public function GetCategoryNames(_arg1:String):Array{ var _local2:Array; var _local3:String; if (this[_arg1] == undefined){ return (null); }; _local2 = new Array(); for (_local3 in this[_arg1]) { _local2.push(_local3); }; return ((_local2.length) ? _local2.sort() : null); } public function AddArr(_arg1:String):Array{ this[_arg1] = new Array(); return (this[_arg1]); } public function GetItem(_arg1:String){ if (this[_arg1] == undefined){ return (null); }; return (this[_arg1]); } public function IsArrItem(_arg1:String, _arg2:int):Boolean{ return (((!((this[_arg1] == undefined))) && (!((this[_arg1][_arg2] == undefined))))); } public function DeleteCategoryArrItem(_arg1:String, _arg2:String, _arg3:int):void{ if (this[_arg1] == undefined){ return; }; this[_arg1].DeleteArrItem(_arg2, _arg3); } public function Clear():void{ var _local1:String; for (_local1 in this) { delete this[_local1]; }; } public function SetArrItem(_arg1:String, _arg2:int, _arg3):void{ if (this[_arg1] == undefined){ this[_arg1] = new Array(); }; this[_arg1][_arg2] = _arg3; } public function SetItem(_arg1:String, _arg2):void{ this[_arg1] = _arg2; } public function GetNames():Array{ var _local1:Array; var _local2:String; _local1 = new Array(); for (_local2 in this) { _local1.push(_local2); }; return ((_local1.length) ? _local1.sort() : null); } public function IsItem(_arg1:String):Boolean{ return (!((this[_arg1] == undefined))); } public function DeleteItem(_arg1:String):void{ if (this[_arg1] == undefined){ return; }; delete this[_arg1]; } } }//package ENGINE.CORE
Section 64
//OGlobal (ENGINE.CORE.OGlobal) package ENGINE.CORE { import flash.display.*; import flash.geom.*; import flash.net.*; public class OGlobal { private static var iFPS:int = 60; private static var iDomain:String; private static var iSRect:Rectangle = new Rectangle(); private static var iVRect:Rectangle = new Rectangle(0, 0, 800, 600); private static var iStage:Stage; private static var iScale:Number = 1; private static var iAppName:String; private static var iOldScale:Number = 1; public static function get FPS():int{ return (OGlobal.iFPS); } public static function CheckDomain(_arg1:String):Boolean{ var _local2:int; _local2 = OGlobal.iDomain.indexOf(_arg1); return ((((_local2 >= 0)) && ((_local2 <= 4)))); } public static function ToLocal(_arg1:Number):Number{ return ((_arg1 / OGlobal.iScale)); } public static function set FPS(_arg1:int):void{ OGlobal.iFPS = _arg1; if (OGlobal.iStage){ OGlobal.iStage.frameRate = _arg1; }; } public static function Rescale(_arg1:Sprite, _arg2:Boolean=true):void{ var _local3:Number; _local3 = (((OGlobal.iStage.stageWidth / OGlobal.iStage.stageHeight))<=(800 / 600)) ? (OGlobal.iStage.stageWidth / 800) : (OGlobal.iStage.stageHeight / 600); OGlobal.iSRect.x = 0; OGlobal.iSRect.y = 0; OGlobal.iSRect.width = OGlobal.iStage.stageWidth; OGlobal.iSRect.height = OGlobal.iStage.stageHeight; OGlobal.iVRect.width = Math.round((800 * _local3)); OGlobal.iVRect.height = Math.round((600 * _local3)); OGlobal.iVRect.x = Math.floor(((OGlobal.iStage.stageWidth - OGlobal.iVRect.width) / 2)); OGlobal.iVRect.y = Math.floor(((OGlobal.iStage.stageHeight - OGlobal.iVRect.height) / 2)); if (_arg2){ _arg1.x = OGlobal.iVRect.x; _arg1.y = OGlobal.iVRect.y; }; OGlobal.iScale = _local3; } public static function get prStage():Stage{ return (OGlobal.iStage); } public static function ClearScale():void{ OGlobal.iOldScale = OGlobal.iScale; OGlobal.iScale = 1; OGlobal.iVRect = OGlobal.iSRect.clone(); } public static function ToGlobal(_arg1:Number):Number{ return ((_arg1 * OGlobal.iScale)); } public static function set AppName(_arg1:String):void{ OGlobal.iAppName = ("WellGames_" + _arg1); } public static function get Domain():String{ return (OGlobal.iDomain); } public static function SetDomain():void{ var _local1:LocalConnection; _local1 = new LocalConnection(); OGlobal.iDomain = _local1.domain; } public static function get StageRect():Rectangle{ return (OGlobal.iSRect); } public static function ScaleFloor(_arg1:Number):Number{ return ((Math.floor((_arg1 * OGlobal.iScale)) / OGlobal.iScale)); } public static function get Scale():Number{ return (OGlobal.iScale); } public static function get ViewporRect():Rectangle{ return (OGlobal.iVRect); } public static function get AppName():String{ return (OGlobal.iAppName); } public static function set prStage(_arg1:Stage):void{ OGlobal.iStage = _arg1; } public static function RestoreScale():void{ OGlobal.iScale = OGlobal.iOldScale; } public static function ScaleMod(_arg1:Number):Number{ var _local2:Number; _local2 = (_arg1 * OGlobal.iScale); return (((_local2 - Math.floor(_local2)) / OGlobal.iScale)); } } }//package ENGINE.CORE
Section 65
//OSound (ENGINE.CORE.OSound) package ENGINE.CORE { import flash.events.*; import flash.utils.*; import flash.net.*; import flash.media.*; public class OSound { private static var iMusicInd:int = 0; private static var iSoundsObjects:Array; private static var iSounds:Dictionary = new Dictionary(true); private static var iMusicPlayList:Array = new Array(); private static var iSoundVolume:Number = 1; private static var iMusicChannel:SoundChannel; private static var iMusicVolume:Number = 1; private static var iMusic:Sound; public static function PlaySoundInd(_arg1:int, _arg2:Number=0):Boolean{ if (OSound.iSoundVolume == 0){ return (false); }; _arg1 = Math.max(_arg1, 0); _arg1 = Math.min(_arg1, (OSound.iSoundsObjects.length - 1)); return (OSound.PlaySound(OSound.iSoundsObjects[_arg1], _arg2)); } public static function set MusicVolume(_arg1:Number):void{ var _local2:SoundTransform; OSound.iMusicVolume = _arg1; if (OSound.iMusicChannel){ if (_arg1 == 0){ OSound.StopMusic(); } else { _local2 = OSound.iMusicChannel.soundTransform; _local2.volume = _arg1; OSound.iMusicChannel.soundTransform = _local2; }; } else { if (OSound.iMusicVolume > 0){ OSound.PlayMusic(); }; }; } private static function OnMusicLoadComplete(_arg1:Event):void{ if (OSound.iMusicVolume == 0){ return; }; OSound.iMusicChannel = iMusic.play(0, 0, new SoundTransform(OSound.iMusicVolume, 0)); OSound.RemoveMusic(); OSound.iMusicChannel.addEventListener(Event.SOUND_COMPLETE, OnMusicComplete); } public static function set SoundVolume(_arg1:Number):void{ OSound.iSoundVolume = _arg1; } private static function OnMusicLoadIOError(_arg1:Event):void{ OSound.RemoveMusic(); OSound.iMusicPlayList.splice(OSound.iMusicInd, 1); OSound.iMusicInd = ((OSound.iMusicInd > (OSound.iMusicPlayList.length - 1))) ? (OSound.iMusicPlayList.length - 1) : OSound.iMusicInd; OSound.PlayMusic(); } private static function OnMusicComplete(_arg1:Event):void{ PlayMusic(); } public static function PlaySound(_arg1:Class, _arg2:Number=0):Boolean{ var _local3:Sound; if (OSound.iSoundVolume == 0){ return (false); }; _local3 = OSound.iSounds[_arg1]; if (_local3 != null){ _local3.play(0, 0, new SoundTransform(OSound.iSoundVolume, _arg2)); }; return (!((_local3 == null))); } private static function RemoveMusic():void{ if (OSound.iMusic){ OSound.iMusic.removeEventListener(Event.COMPLETE, OSound.OnMusicLoadComplete); OSound.iMusic.removeEventListener(IOErrorEvent.IO_ERROR, OSound.OnMusicLoadIOError); OSound.iMusic = null; }; } public static function StopMusic():void{ if (OSound.iMusicChannel){ OSound.iMusicChannel.removeEventListener(Event.SOUND_COMPLETE, OnMusicComplete); OSound.iMusicChannel.stop(); OSound.iMusicChannel = null; }; } public static function get SoundVolume():Number{ return (OSound.iSoundVolume); } public static function PlayListClear():void{ OSound.iMusicPlayList = new Array(); } public static function PlayListAdd(_arg1:String):void{ OSound.iMusicPlayList.push(_arg1); OSound.iMusicInd = (OSound.iMusicPlayList.length - 1); } public static function PlayMusic():void{ var request:URLRequest; if ((((OSound.iMusicVolume == 0)) || (!(OSound.iMusicPlayList.length)))){ return; }; OSound.StopMusic(); OSound.iMusicInd = ((OSound.iMusicInd + 1) % OSound.iMusicPlayList.length); request = new URLRequest(OSound.iMusicPlayList[OSound.iMusicInd]); OSound.iMusic = new Sound(); OSound.iMusic.addEventListener(Event.COMPLETE, OSound.OnMusicLoadComplete); OSound.iMusic.addEventListener(IOErrorEvent.IO_ERROR, OSound.OnMusicLoadIOError); try { OSound.iMusic.load(request); } catch(e:Error) { }; } public static function RegisterEmbedSounds(_arg1:Array):Boolean{ var _local2:int; var _local3:Sound; OSound.iSoundsObjects = _arg1; _local2 = 0; while (_local2 < _arg1.length) { _local3 = (new (_arg1[_local2]) as Sound); OSound.iSounds[_arg1[_local2]] = _local3; _local2++; }; return (true); } public static function PlaySoundRandom(_arg1:Number=0, _arg2:int=0, _arg3:int=-1):Boolean{ var _local4:int; if (OSound.iSoundVolume == 0){ return (false); }; _arg2 = Math.max(_arg2, 0); _arg2 = Math.min(_arg2, (OSound.iSoundsObjects.length - 1)); if (_arg3 < 0){ _arg3 = (OSound.iSoundsObjects.length - 1); }; _arg3 = Math.max(_arg3, 0); _arg3 = Math.min(_arg3, (OSound.iSoundsObjects.length - 1)); _local4 = OUtils.Random(_arg2, _arg3); return (OSound.PlaySound(OSound.iSoundsObjects[_local4], _arg1)); } public static function get MusicVolume():Number{ return (OSound.iMusicVolume); } } }//package ENGINE.CORE
Section 66
//OSystem (ENGINE.CORE.OSystem) package ENGINE.CORE { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.text.*; import flash.system.*; public class OSystem extends Sprite { private var iLastTime:int; private var iCount:int; private var iText:TextField; private var iSTimer:String; public static var iUserText1:String = ""; public static var iUserText:String = ""; public static var iUserText2:String = ""; public function OSystem(){ this.iText = new TextField(); this.iText.autoSize = TextFieldAutoSize.LEFT; this.iText.mouseEnabled = false; this.addChild(this.iText); this.addEventListener(Event.ENTER_FRAME, OnEnterFrame); this.iLastTime = getTimer(); this.iSTimer = ""; } public function OnEnterFrame(_arg1:Event):void{ var _local2:uint; var _local3:int; _local2 = System.totalMemory; _local3 = (getTimer() - this.iLastTime); this.iCount++; if (_local3 >= 1000){ this.iSTimer = String((Math.round(((_local3 / this.iCount) * 100)) / 100)); this.iLastTime = getTimer(); this.iCount = 0; }; iText.text = ((((((((((_local2.toString() + " ") + this.iSTimer) + " ") + OGlobal.prStage.frameRate) + " | ") + OSystem.iUserText) + " ") + OSystem.iUserText1) + " ") + OSystem.iUserText2); } } }//package ENGINE.CORE
Section 67
//OUtils (ENGINE.CORE.OUtils) package ENGINE.CORE { import ENGINE.DISPLAY.*; import flash.geom.*; public class OUtils { public static function AddZero(_arg1:String, _arg2:int):String{ var _local3:String; var _local4:int; _local3 = ""; _local4 = _arg1.length; while (_local4 < _arg2) { _local3 = (_local3 + "0"); _local4++; }; _local3 = (_local3 + _arg1); return (_local3); } public static function Random(_arg1:Number, _arg2:Number):Number{ return ((_arg1 + ((_arg2 - _arg1) * Math.random()))); } public static function StringToTarget(_arg1:Class, _arg2:int, _arg3:String, _arg4:String, _arg5:int):String{ var _local6:Number; var _local7:Rectangle; var _local8:String; var _local9:String; var _local10:int; _local6 = Math.round((1 + (_arg2 / 70))); _local8 = ((_arg4)==null) ? "" : ((" (" + _arg4) + ")"); _local9 = (_arg3 + _local8); _local7 = ODisplay.TextRect(_arg1, _arg2, _local6, _local9); if (_local7.width <= _arg5){ return (_local9); }; _local8 = ("..." + _local8); _local10 = (_arg3.length - 1); while (_local10 > 0) { _local9 = (_arg3.substr(0, _local10) + _local8); _local7 = ODisplay.TextRect(_arg1, _arg2, _local6, _local9); if (_local7.width <= _arg5){ return (_local9); }; _local10--; }; return ((_arg3.substr(0, 1) + _local8)); } public static function ClearString(_arg1:String):String{ var _local2:String; var _local3:String; var _local4:int; _local2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 "; _local3 = ""; _local4 = 0; while (_local4 < _arg1.length) { if (_local2.indexOf(_arg1.charAt(_local4)) > -1){ _local3 = (_local3 + _arg1.charAt(_local4)); }; _local4++; }; return (_local3); } } }//package ENGINE.CORE
Section 68
//OEffect (ENGINE.DISPLAY.EFFECTS.OEffect) package ENGINE.DISPLAY.EFFECTS { import ENGINE.DISPLAY.*; import flash.filters.*; import ENGINE.CORE.*; public class OEffect { protected var iColors:OCache; protected var iFilters:OCache; public function OEffect(){ this.iColors = new OCache(); this.iFilters = new OCache(); } public function RegisterColor(_arg1:String, _arg2):void{ this.iColors.SetItem(_arg1, _arg2); } public function Init(_arg1:String, _arg2:String, _arg3:Number=1):void{ } public function RegisterFilter(_arg1:String, _arg2):void{ this.iFilters.SetItem(_arg1, _arg2); } public function Apply(_arg1:Array, _arg2:Number=1, _arg3:Number=0, _arg4:Number=0):OBM{ return (null); } public static function MakeBevelFilter(_arg1:Array):BevelFilter{ return (new BevelFilter(_arg1[1], _arg1[2], _arg1[3], _arg1[4], _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9], _arg1[10], _arg1[11], _arg1[12])); } } }//package ENGINE.DISPLAY.EFFECTS
Section 69
//OEffects (ENGINE.DISPLAY.EFFECTS.OEffects) package ENGINE.DISPLAY.EFFECTS { import ENGINE.DISPLAY.*; import ENGINE.CORE.*; public class OEffects { private static var iEffects:OCache = new OCache(); public static function RegisterColor(_arg1:String, _arg2:String, _arg3):void{ var _local4:OEffect; _local4 = iEffects.GetItem(_arg1); if (_local4 == null){ return; }; _local4.RegisterColor(_arg2, _arg3); } public static function RegisterEffect(_arg1:String, _arg2:OEffect):void{ iEffects.SetItem(_arg1, _arg2); } public static function Make(_arg1:Array):OBM{ var _local2:OEffect; _local2 = iEffects.GetItem(_arg1[3]); if (_local2 == null){ return (null); }; _local2.Init(_arg1[4], _arg1[5], _arg1[6]); return (_local2.Apply(_arg1[1], _arg1[2], _arg1[7], _arg1[8])); } public static function GetEffect(_arg1:String):OEffect{ return (iEffects.GetItem(_arg1)); } public static function RegisterFilter(_arg1:String, _arg2:String, _arg3):void{ var _local4:OEffect; _local4 = iEffects.GetItem(_arg1); if (_local4 == null){ return; }; _local4.RegisterFilter(_arg2, _arg3); } public static function Apply(_arg1, _arg2:Number, _arg3:String, _arg4:String, _arg5:String, _arg6:Number=1, _arg7:Number=0, _arg8:Number=0):OBM{ var _local9:OEffect; _local9 = iEffects.GetItem(_arg3); if (_local9 == null){ return (null); }; _local9.Init(_arg4, _arg5, _arg6); return (_local9.Apply([ODisplay.SpriteLib, _arg1], _arg2, _arg7, _arg8)); } } }//package ENGINE.DISPLAY.EFFECTS
Section 70
//IDisplayObject (ENGINE.DISPLAY.IDisplayObject) package ENGINE.DISPLAY { public interface IDisplayObject { function set prVisible(_arg1:Boolean):void; function get prWidth():Number; function get prHeight():Number; function set prX(_arg1:Number):void; function set prY(_arg1:Number):void; function get prVisible():Boolean; function Move(_arg1:Number, _arg2:Number):void; function Pos(_arg1:Number, _arg2:Number):void; function get prX():Number; function get prY():Number; } }//package ENGINE.DISPLAY
Section 71
//OBitmap (ENGINE.DISPLAY.OBitmap) package ENGINE.DISPLAY { import flash.display.*; import flash.geom.*; import ENGINE.DISPLAY.EFFECTS.*; import ENGINE.CORE.*; import flash.text.*; public class OBitmap extends Bitmap implements IDisplayObject { protected var iY:Number;// = 0 protected var iX:Number;// = 0 protected var iOBM:OBM;// = null public function OBitmap(_arg1:OBM=null, _arg2:Number=0, _arg3:Number=0){ iX = 0; iY = 0; iOBM = null; super(); this.iX = _arg2; this.iY = _arg3; Init(_arg1); } public function get prVisible():Boolean{ return (this.visible); } public function set prX(_arg1:Number):void{ this.iX = _arg1; Pos(this.iX, this.iY); } public function Clear():void{ this.Init(null); } public function set prOBM(_arg1:OBM):void{ this.Init(_arg1); } public function Pos(_arg1:Number, _arg2:Number):void{ this.iX = _arg1; this.iY = _arg2; if (this.iOBM){ this.x = ((this.iX * OGlobal.Scale) + this.iOBM.iX); this.y = ((this.iY * OGlobal.Scale) + this.iOBM.iY); } else { this.x = (this.iX * OGlobal.Scale); this.y = (this.iY * OGlobal.Scale); }; } public function set prY(_arg1:Number):void{ this.iY = _arg1; Pos(this.iX, this.iY); } public function Init(_arg1:OBM):void{ this.iOBM = _arg1; this.bitmapData = (_arg1) ? _arg1.iBM : null; this.Pos(this.iX, this.iY); } public function set prVisible(_arg1:Boolean):void{ this.visible = _arg1; } public function Clone():OBitmap{ return (new OBitmap(this.iOBM.Clone(), this.iX, this.iY)); } public function get prX():Number{ return (this.iX); } public function get prY():Number{ return (this.iY); } public function get prOBM():OBM{ return (this.iOBM); } public function get prHeight():Number{ return ((this.iOBM) ? (this.iOBM.iHeight / OGlobal.Scale) : 0); } public function get prWidth():Number{ return ((this.iOBM) ? (this.iOBM.iWidth / OGlobal.Scale) : 0); } public function CopyFrom(_arg1:OBitmap):void{ this.iX = _arg1.iX; this.iY = _arg1.iY; this.Init(_arg1.iOBM); } public function Move(_arg1:Number, _arg2:Number):void{ Pos((this.iX + _arg1), (this.iY + _arg2)); } public static function MakeEffectFromListP(_arg1:Array):OBitmap{ var _local2:Sprite; var _local3:Sprite; _local2 = ((_arg1[1] is Sprite)) ? (_arg1[1] as Sprite) : new ((_arg1[1] as Class)); _local3 = (_local2.getChildAt(_arg1[2]) as Sprite); return (OBitmap.MakeEffect(_local3, _arg1[3], _arg1[4], _arg1[5], _arg1[6], _arg1[7], _local3.x, _local3.y)); } public static function MakeEffectP(_arg1:Array):OBitmap{ return (OBitmap.MakeEffect(_arg1[1], _arg1[2], _arg1[3], _arg1[4], _arg1[5], _arg1[6], _arg1[7], _arg1[8])); } public static function MakeEffectTextInRectP(_arg1:Array):OBitmap{ var _local2:Sprite; var _local3:Rectangle; var _local4:Number; var _local5:Number; var _local6:TextField; var _local7:TextFormat; _local2 = ((_arg1[1] is Sprite)) ? (_arg1[1] as Sprite) : new ((_arg1[1] as Class)); if ((_local2.getChildAt(0) is TextField)){ _local6 = (_local2.getChildAt(0) as TextField); _local6.autoSize = TextFieldAutoSize.LEFT; _local6.text = _arg1[4]; _local7 = _local6.defaultTextFormat; _local7.size = _arg1[2]; _local7.letterSpacing = _arg1[3]; _local6.setTextFormat(_local7); } else { return (null); }; _local3 = _local2.getBounds(_local2); _local4 = ((_arg1[9] - _local3.width) / 2); _local5 = ((_arg1[10] - _local3.height) / 2); return (OBitmap.MakeEffect(_local2, 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], (_arg1[11] + _local4), (_arg1[12] + _local5))); } public static function MakeEffectTextP(_arg1:Array):OBitmap{ var _local2:Sprite; var _local3:TextField; var _local4:TextFormat; _local2 = ((_arg1[1] is Sprite)) ? (_arg1[1] as Sprite) : new ((_arg1[1] as Class)); if ((_local2.getChildAt(0) is TextField)){ _local3 = (_local2.getChildAt(0) as TextField); _local3.autoSize = TextFieldAutoSize.LEFT; _local3.text = _arg1[4]; _local4 = _local3.defaultTextFormat; _local4.size = _arg1[2]; _local4.letterSpacing = _arg1[3]; _local3.setTextFormat(_local4); } else { return (null); }; return (OBitmap.MakeEffect(_local2, 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9], _arg1[10])); } public static function MakeRoundRectBorderEffectP(_arg1:Array):OBitmap{ var _local2:Sprite; _local2 = new Sprite(); _local2.graphics.beginFill(0); _local2.graphics.drawRoundRect(0, 0, _arg1[1], _arg1[2], _arg1[3]); _local2.graphics.drawRoundRect(_arg1[4], _arg1[4], (_arg1[1] - (_arg1[4] * 2)), (_arg1[2] - (_arg1[4] * 2)), (_arg1[3] - _arg1[4])); return (OBitmap.MakeEffect(_local2, 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9], _arg1[10])); } public static function MakeEffectInRectP(_arg1:Array):OBitmap{ var _local2:Number; var _local3:Sprite; var _local4:Rectangle; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; _local2 = Math.min(_arg1[7], _arg1[8]); _local3 = ((_arg1[1] is Sprite)) ? (_arg1[1] as Sprite) : new ((_arg1[1] as Class)); _local4 = _local3.getBounds(_local3); _local5 = Math.max(_local4.width, _local4.height); _local6 = ((_local2 / _local5) * _arg1[2]); _local7 = ((_arg1[7] - (_local4.width * _local6)) / 2); _local8 = ((_arg1[8] - (_local4.height * _local6)) / 2); return (OBitmap.MakeEffect(_local3, _local6, _arg1[3], _arg1[4], _arg1[5], _arg1[6], (_arg1[9] + _local7), (_arg1[10] + _local8))); } public static function MakeTmp(_arg1, _arg2:Number=1, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0):OBitmap{ var _local6:OBM; _local6 = OBM.Make([null, [ODisplay.SpriteLib, _arg1], _arg2, _arg3, _arg4, _arg5]); return (new OBitmap(_local6, _arg3, _arg4)); } public static function MakeP(_arg1:Array):OBitmap{ return (OBitmap.MakeTmp(_arg1[1], _arg1[2], _arg1[3], _arg1[4])); } public static function MakeRoundRectEffectP(_arg1:Array):OBitmap{ var _local2:Sprite; _local2 = new Sprite(); _local2.graphics.beginFill(0); _local2.graphics.drawRoundRect(0, 0, _arg1[1], _arg1[2], _arg1[3]); return (OBitmap.MakeEffect(_local2, 1, _arg1[4], _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9])); } public static function Make(_arg1:Array):OBitmap{ return (new OBitmap(_arg1[1][0](_arg1[1]), _arg1[2], _arg1[3])); } public static function MakeEffect(_arg1, _arg2:Number, _arg3:String, _arg4:String, _arg5:String, _arg6:Number=1, _arg7:Number=0, _arg8:Number=0):OBitmap{ var _local9:OBM; _local9 = OEffects.Apply(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8); return (new OBitmap(_local9, _arg7, _arg8)); } } }//package ENGINE.DISPLAY
Section 72
//OBM (ENGINE.DISPLAY.OBM) package ENGINE.DISPLAY { import flash.display.*; import flash.geom.*; import ENGINE.CORE.*; public class OBM { public var iX:Number; public var iHeight:Number; public var iBM:BitmapData; public var iY:Number; public var iWidth:Number; public function OBM(_arg1:BitmapData=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0){ this.iBM = _arg1; this.iX = _arg2; this.iY = _arg3; this.iWidth = _arg4; this.iHeight = _arg5; } public function Clone():OBM{ var _local1:BitmapData; _local1 = this.iBM.clone(); return (new OBM(_local1, this.iX, this.iY, this.iWidth, this.iHeight)); } public static function MakeFill(_arg1:Array):OBM{ var _local2:Sprite; var _local3:Sprite; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Rectangle; var _local8:Sprite; var _local9:int; var _local10:int; var _local11:Number; var _local12:Number; var _local13:BitmapData; var _local14:Matrix; _local2 = new Sprite(); _local3 = _arg1[1][0](_arg1[1]); _local4 = (OGlobal.Scale * _arg1[2]); _local5 = OGlobal.ToGlobal(_arg1[4]); _local6 = OGlobal.ToGlobal(_arg1[5]); _local3.scaleX = _local4; _local3.scaleY = _local4; _local3.x = (_local3.x * OGlobal.Scale); _local3.y = (_local3.y * OGlobal.Scale); _local3.x = (_local3.x + _local5); _local3.y = (_local3.y + _local6); _local2.addChild(_local3); _local7 = _local3.getBounds(_local2); _local2.removeChild(_local3); _local8 = new Sprite(); _local8.graphics.beginBitmapFill(_arg1[3]); _local8.graphics.drawRect((_local7.x - 1), (_local7.y - 1), (_local7.width + 2), (_local7.height + 2)); _local8.graphics.endFill(); _local8.mask = _local3; _local2.addChild(_local8); _local9 = ((_local7.width + 4) + (_arg1[6] * 2)); _local10 = ((_local7.height + 4) + (_arg1[6] * 2)); _local11 = Math.floor(_local7.x); _local12 = Math.floor(_local7.y); _local13 = new BitmapData(_local9, _local10, true, 0); _local14 = new Matrix(1, 0, 0, 1, ((-(_local11) + 1) + _arg1[6]), ((-(_local12) + 1) + _arg1[6])); _local13.draw(_local2, _local14); return (new OBM(_local13, (((_local11 - _local5) - 1) - _arg1[6]), (((_local12 - _local6) - 1) - _arg1[6]), _local7.width, _local7.height)); } public static function Make(_arg1:Array):OBM{ var _local2:Sprite; var _local3:Sprite; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Rectangle; var _local8:int; var _local9:int; var _local10:Number; var _local11:Number; var _local12:BitmapData; var _local13:Matrix; _local2 = new Sprite(); _local3 = _arg1[1][0](_arg1[1]); _local4 = (OGlobal.Scale * _arg1[2]); _local5 = OGlobal.ToGlobal(_arg1[3]); _local6 = OGlobal.ToGlobal(_arg1[4]); _local3.scaleX = _local4; _local3.scaleY = _local4; _local3.x = (_local3.x * OGlobal.Scale); _local3.y = (_local3.y * OGlobal.Scale); _local3.x = (_local3.x + _local5); _local3.y = (_local3.y + _local6); _local2.addChild(_local3); _local7 = _local3.getBounds(_local2); _local8 = ((_local7.width + 4) + (_arg1[5] * 2)); _local9 = ((_local7.height + 4) + (_arg1[5] * 2)); _local10 = Math.floor(_local7.x); _local11 = Math.floor(_local7.y); _local12 = new BitmapData(_local8, _local9, true, 0); _local13 = new Matrix(1, 0, 0, 1, ((-(_local10) + 1) + _arg1[5]), ((-(_local11) + 1) + _arg1[5])); _local12.draw(_local2, _local13); return (new OBM(_local12, (((_local10 - _local5) - 1) - _arg1[5]), (((_local11 - _local6) - 1) - _arg1[5]), _local7.width, _local7.height)); } } }//package ENGINE.DISPLAY
Section 73
//ODisplay (ENGINE.DISPLAY.ODisplay) package ENGINE.DISPLAY { import flash.display.*; import flash.geom.*; import ENGINE.DISPLAY.EFFECTS.*; import ENGINE.CORE.*; import flash.text.*; public class ODisplay { public static function SpriteErase(_arg1:Array):Sprite{ var _local2:Sprite; var _local3:Sprite; var _local4:Sprite; var _local5:Sprite; _local2 = new Sprite(); _local3 = new Sprite(); _local3.blendMode = BlendMode.LAYER; _local4 = _arg1[1][0](_arg1[1]); _local5 = _arg1[2][0](_arg1[2]); _local5.blendMode = BlendMode.ERASE; _local3.addChild(_local4); _local3.addChild(_local5); _local2.addChild(_local3); return (_local2); } public static function HSBToRGB(_arg1:Number, _arg2:Number, _arg3:Number):uint{ var _local4:int; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:int; var _local11:int; var _local12:int; _arg1 = (_arg1 % 360); if (_arg2 > 1){ _arg2 = 1; }; if (_arg3 > 1){ _arg3 = 1; }; if (_arg2 == 0){ _local4 = (_arg3 * 0xFF); return ((((_local4 << 16) | (_local4 << 8)) | _local4)); }; if (_arg1 == 360){ _arg1 = 0; } else { _arg1 = (_arg1 / 60); }; _local5 = Math.floor(_arg1); _local6 = (_arg1 - _local5); _local7 = (_arg3 * (1 - _arg2)); _local8 = (_arg3 * (1 - (_arg2 * _local6))); _local9 = (_arg3 * (1 - (_arg2 * (1 - _local6)))); switch (_local5){ case 0: _local10 = (_arg3 * 0xFF); _local11 = (_local9 * 0xFF); _local12 = (_local7 * 0xFF); break; case 1: _local10 = (_local8 * 0xFF); _local11 = (_arg3 * 0xFF); _local12 = (_local7 * 0xFF); break; case 2: _local10 = (_local7 * 0xFF); _local11 = (_arg3 * 0xFF); _local12 = (_local9 * 0xFF); break; case 3: _local10 = (_local7 * 0xFF); _local11 = (_local8 * 0xFF); _local12 = (_arg3 * 0xFF); break; case 4: _local10 = (_local9 * 0xFF); _local11 = (_local7 * 0xFF); _local12 = (_arg3 * 0xFF); break; case 5: _local10 = (_arg3 * 0xFF); _local11 = (_local7 * 0xFF); _local12 = (_local8 * 0xFF); break; }; return ((((_local10 << 16) | (_local11 << 8)) | _local12)); } public static function OBitmapXBorderSprite(_arg1:Array):OBitmap{ return (ODisplay.OBitmapList([null, [[null, [ODisplay.SpriteXBorder, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[15], _arg1[16]], [null, [ODisplay.SpriteInRect, [ODisplay.SpriteLib, _arg1[9]], _arg1[10], _arg1[1], _arg1[2]], _arg1[9], _arg1[11], _arg1[12], _arg1[13], _arg1[14], _arg1[15], _arg1[16]]]])); } public static function OBitmapAngleFrameSprite(_arg1:Array):OBitmap{ return (ODisplay.OBitmapList([null, [[null, [ODisplay.SpriteAngleRect, (_arg1[1] - (_arg1[4] * 2)), (_arg1[2] - (_arg1[4] * 2)), ((_arg1[3] * (_arg1[1] - (_arg1[4] * 2))) / _arg1[1])], 1, _arg1[5], _arg1[9], _arg1[10], _arg1[11], (_arg1[18] + _arg1[4]), (_arg1[19] + _arg1[4])], [null, [ODisplay.SpriteAngleBorder, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[18], _arg1[19]], [null, [ODisplay.SpriteInRect, [ODisplay.SpriteLib, _arg1[12]], _arg1[13], _arg1[1], _arg1[2]], _arg1[13], _arg1[14], _arg1[15], _arg1[16], _arg1[17], _arg1[18], _arg1[19]]]])); } public static function OBitmapXBorder(_arg1:Array):OBitmap{ return (OBitmapMake([null, [SpriteXBorder, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9], _arg1[10]])); } public static function OBitmapAngleFrameText(_arg1:Array):OBitmap{ return (ODisplay.OBitmapList([null, [[null, [ODisplay.SpriteAngleRect, (_arg1[1] - (_arg1[4] * 2)), (_arg1[2] - (_arg1[4] * 2)), ((_arg1[3] * (_arg1[1] - (_arg1[4] * 2))) / _arg1[1])], 1, _arg1[5], _arg1[9], _arg1[10], _arg1[11], (_arg1[20] + _arg1[4]), (_arg1[21] + _arg1[4])], [null, [ODisplay.SpriteAngleBorder, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[20], _arg1[21]], [null, [ODisplay.SpriteTextInRect, _arg1[12], _arg1[13], _arg1[14], _arg1[15], _arg1[1], _arg1[2]], 1, _arg1[16], _arg1[17], _arg1[18], _arg1[19], _arg1[20], _arg1[21]]]])); } public static function OBitmapRoundFrameText(_arg1:Array):OBitmap{ if (_arg1[4]){ return (ODisplay.OBitmapList([null, [[null, [ODisplay.SpriteRoundBorder, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[20], _arg1[21]], [null, [ODisplay.SpriteRoundRect, (_arg1[1] - (_arg1[4] * 2)), (_arg1[2] - (_arg1[4] * 2)), ((_arg1[3] - _arg1[4]) - 2)], 1, _arg1[5], _arg1[9], _arg1[10], _arg1[11], (_arg1[20] + _arg1[4]), (_arg1[21] + _arg1[4])], [null, [ODisplay.SpriteTextInRect, _arg1[12], _arg1[13], _arg1[14], _arg1[15], _arg1[1], _arg1[2]], 1, _arg1[16], _arg1[17], _arg1[18], _arg1[19], _arg1[20], _arg1[21]]]])); }; return (ODisplay.OBitmapList([null, [[null, [ODisplay.SpriteRoundRect, _arg1[1], _arg1[2], _arg1[3]], 1, _arg1[5], _arg1[9], _arg1[10], _arg1[11], (_arg1[20] + _arg1[4]), (_arg1[21] + _arg1[4])], [null, [ODisplay.SpriteTextInRect, _arg1[12], _arg1[13], _arg1[14], _arg1[15], _arg1[1], _arg1[2]], 1, _arg1[16], _arg1[17], _arg1[18], _arg1[19], _arg1[20], _arg1[21]]]])); } public static function SpriteFillRect(_arg1:Array):Sprite{ var _local2:Sprite; var _local3:Sprite; var _local4:Rectangle; var _local5:Number; _local2 = new Sprite(); _local3 = _arg1[1][0](_arg1[1]); _local2.addChild(_local3); _local4 = _local3.getBounds(_local2); _local5 = (Math.max(_arg1[2], _arg1[3]) / Math.max(_local4.width, _local4.height)); _local3.scaleX = _local5; _local3.scaleY = _local5; _local4 = _local3.getBounds(_local2); _local2.removeChild(_local3); _local3.x = (_local3.x + ((_arg1[2] - _local4.width) / 2)); _local3.y = (_local3.y + ((_arg1[3] - _local4.height) / 2)); return (_local3); } public static function TextRect(_arg1, _arg2:Number, _arg3:Number, _arg4:String):Rectangle{ var _local5:Sprite; var _local6:TextField; var _local7:TextFormat; _local5 = ((_arg1 is Sprite)) ? (_arg1 as Sprite) : new ((_arg1 as Class)); if ((_local5.getChildAt(0) is TextField)){ _local6 = (_local5.getChildAt(0) as TextField); _local6.autoSize = TextFieldAutoSize.LEFT; _local6.text = _arg4; _local7 = _local6.defaultTextFormat; _local7.size = _arg2; _local7.letterSpacing = _arg3; _local6.setTextFormat(_local7); } else { return (null); }; return (_local5.getBounds(_local5)); } public static function OBitmapXBorderText(_arg1:Array):OBitmap{ return (ODisplay.OBitmapList([null, [[null, [ODisplay.SpriteXBorder, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[17], _arg1[18]], [null, [ODisplay.SpriteTextInRect, _arg1[9], _arg1[10], _arg1[11], _arg1[12], _arg1[1], _arg1[2]], 1, _arg1[13], _arg1[14], _arg1[15], _arg1[16], _arg1[17], _arg1[18]]]])); } public static function OBitmapRoundRect(_arg1:Array):OBitmap{ return (OBitmapMake([null, [SpriteRoundRect, _arg1[1], _arg1[2], _arg1[3]], 1, _arg1[4], _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9]])); } public static function OBitmapAngleFrame(_arg1:Array):OBitmap{ return (ODisplay.OBitmapList([null, [[null, [ODisplay.SpriteAngleBorder, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[12], _arg1[13]], [null, [ODisplay.SpriteAngleRect, (_arg1[1] - (_arg1[4] * 2)), (_arg1[2] - (_arg1[4] * 2)), ((_arg1[3] * (_arg1[1] - (_arg1[4] * 2))) / _arg1[1])], 1, _arg1[5], _arg1[9], _arg1[10], _arg1[11], (_arg1[12] + _arg1[4]), (_arg1[13] + _arg1[4])]]])); } public static function HSBAToRGBA(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):uint{ var _local5:uint; var _local6:uint; _local5 = HSBToRGB(_arg1, _arg2, _arg3); _local6 = (0xFF * _arg4); _local6 = (_local6 << 24); return ((_local5 + _local6)); } public static function OBitmapTextAlign(_arg1:Array):OBitmap{ return (OBitmapMake([null, [ODisplay.SpriteTextAlign, _arg1[1], _arg1[2], _arg1[3], _arg1[4], _arg1[5], _arg1[6], _arg1[11], _arg1[12]], 1, _arg1[7], _arg1[8], _arg1[9], _arg1[10], _arg1[13], _arg1[14]])); } public static function OBitmapList(_arg1:Array):OBitmap{ var _local2:OBM; var _local3:Number; var _local4:Number; var _local5:int; var _local6:OBM; var _local7:Matrix; _local2 = OEffects.Make(_arg1[1][0]); _local3 = (_local2.iX + (_arg1[1][0][7] * OGlobal.Scale)); _local4 = (_local2.iY + (_arg1[1][0][8] * OGlobal.Scale)); _local5 = 1; while (_local5 < _arg1[1].length) { _local6 = OEffects.Make(_arg1[1][_local5]); _local7 = new Matrix(1, 0, 0, 1, (((_arg1[1][_local5][7] * OGlobal.Scale) + _local6.iX) - _local3), (((_arg1[1][_local5][8] * OGlobal.Scale) + _local6.iY) - _local4)); _local2.iBM.draw(_local6.iBM, _local7); _local5++; }; return (new OBitmap(_local2, _arg1[1][0][7], _arg1[1][0][8])); } public static function SpriteLibList(_arg1:Array):Sprite{ var _local2:Sprite; _local2 = ((_arg1[1] is Sprite)) ? (_arg1[1] as Sprite) : new ((_arg1[1] as Class)); if (_arg1[2] >= _local2.numChildren){ return (null); }; return ((_local2.getChildAt(_arg1[2]) as Sprite)); } public static function SpriteXBorder(_arg1:Array):Sprite{ var _local2:Sprite; _local2 = new Sprite(); _local2.graphics.lineStyle(_arg1[4]); _local2.graphics.moveTo(0, _arg1[3]); _local2.graphics.lineTo(_arg1[1], _arg1[3]); _local2.graphics.moveTo(0, (_arg1[2] - _arg1[3])); _local2.graphics.lineTo(_arg1[1], (_arg1[2] - _arg1[3])); _local2.graphics.moveTo(_arg1[3], 0); _local2.graphics.lineTo(_arg1[3], _arg1[2]); _local2.graphics.moveTo((_arg1[1] - _arg1[3]), 0); _local2.graphics.lineTo((_arg1[1] - _arg1[3]), _arg1[2]); return (_local2); } public static function SpriteLib(_arg1:Array):Sprite{ return (((_arg1[1] is Sprite)) ? (_arg1[1] as Sprite) : new ((_arg1[1] as Class))); } public static function OBitmapAngleBorder(_arg1:Array):OBitmap{ return (OBitmapMake([null, [SpriteAngleBorder, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9], _arg1[10]])); } public static function OBitmapRoundBorder(_arg1:Array):OBitmap{ return (OBitmapMake([null, [SpriteRoundBorder, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9], _arg1[10]])); } public static function SpriteScale(_arg1:Array):Sprite{ var _local2:Sprite; _local2 = _arg1[1][0](_arg1[1]); _local2.scaleX = _arg1[2]; _local2.scaleY = _arg1[2]; return (_local2); } public static function IDisplayObjectMake(_arg1:Array){ var _local2:IDisplayObject; _local2 = _arg1[1][0](_arg1[1]); _local2.Pos(_arg1[2], _arg1[3]); return (_local2); } public static function SpriteAlign(_arg1:Array):Sprite{ var _local2:Sprite; var _local3:Sprite; var _local4:Rectangle; _local2 = new Sprite(); _local3 = _arg1[1][0](_arg1[1]); _local3.scaleX = _arg1[2]; _local3.scaleY = _arg1[2]; _local2.addChild(_local3); _local4 = _local3.getBounds(_local2); _local2.removeChild(_local3); switch (_arg1[3]){ case 1: _local3.x = (_local3.x + ((_arg1[5] - _local4.width) / 2)); break; case 2: _local3.x = (_local3.x + (_arg1[5] - _local4.width)); break; }; switch (_arg1[4]){ case 1: _local3.y = (_local3.y + ((_arg1[6] - _local4.height) / 2)); break; case 2: _local3.y = (_local3.y + (_arg1[6] - _local4.height)); break; }; return (_local3); } public static function OBitmapAngleRect(_arg1:Array):OBitmap{ return (OBitmapMake([null, [SpriteAngleRect, _arg1[1], _arg1[2], _arg1[3]], 1, _arg1[4], _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9]])); } public static function SpriteRect(_arg1:Array):Sprite{ var _local2:Sprite; _local2 = new Sprite(); _local2.graphics.beginFill(0); _local2.graphics.drawRect(0, 0, _arg1[1], _arg1[2]); return (_local2); } public static function OBitmapSpriteFillRect(_arg1:Array):OBitmap{ var _local2:Sprite; _local2 = ODisplay.SpriteFillRect([null, _arg1[3], _arg1[1], _arg1[2]]); return (OBitmapMake([null, [ODisplay.SpriteFillRect, _arg1[3], _arg1[1], _arg1[2]], _local2.scaleX, _arg1[4], _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9]])); } public static function OBitmapText(_arg1:Array):OBitmap{ return (OBitmapMake([null, [ODisplay.SpriteText, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9], _arg1[10]])); } public static function OBitmapMake(_arg1:Array):OBitmap{ return (new OBitmap(OEffects.Make(_arg1), _arg1[7], _arg1[8])); } public static function SpriteRoundRect(_arg1:Array):Sprite{ var _local2:Sprite; _local2 = new Sprite(); _local2.graphics.beginFill(0); _local2.graphics.drawRoundRect(0, 0, _arg1[1], _arg1[2], _arg1[3]); return (_local2); } public static function SpriteInRect(_arg1:Array):Sprite{ var _local2:Sprite; var _local3:Sprite; var _local4:Rectangle; _local2 = new Sprite(); _local3 = _arg1[1][0](_arg1[1]); _local3.scaleX = _arg1[2]; _local3.scaleY = _arg1[2]; _local2.addChild(_local3); _local4 = _local3.getBounds(_local2); _local2.removeChild(_local3); _local3.x = (_local3.x + ((_arg1[3] - _local4.width) / 2)); _local3.y = (_local3.y + ((_arg1[4] - _local4.height) / 2)); return (_local3); } public static function SpriteScaleRotate(_arg1:Array):Sprite{ var _local2:Sprite; var _local3:Number; var _local4:Number; var _local5:Matrix; var _local6:Matrix; var _local7:Sprite; _local2 = _arg1[1][0](_arg1[1]); _local3 = (_arg1[4] * _arg1[2]); _local4 = (_arg1[5] * _arg1[2]); _local5 = new Matrix(); _local5.scale(_arg1[2], _arg1[2]); _local5.translate(-(_local3), -(_local4)); _local5.rotate(((Math.PI / 180) * _arg1[3])); _local6 = new Matrix(); _local6.translate(_local3, _local4); _local5.concat(_local6); _local7 = new Sprite(); _local7.addChild(_local2); _local2.transform.matrix = _local5; return (_local7); } public static function OBitmapRoundFrameSprite(_arg1:Array):OBitmap{ return (ODisplay.OBitmapList([null, [[null, [ODisplay.SpriteRoundBorder, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[18], _arg1[19]], [null, [ODisplay.SpriteRoundRect, (_arg1[1] - (_arg1[4] * 2)), (_arg1[2] - (_arg1[4] * 2)), ((_arg1[3] - _arg1[4]) - 2)], 1, _arg1[5], _arg1[9], _arg1[10], _arg1[11], (_arg1[18] + _arg1[4]), (_arg1[19] + _arg1[4])], [null, [ODisplay.SpriteInRect, [ODisplay.SpriteLib, _arg1[12]], _arg1[13], _arg1[1], _arg1[2]], _arg1[13], _arg1[14], _arg1[15], _arg1[16], _arg1[17], _arg1[18], _arg1[19]]]])); } public static function SpriteText(_arg1:Array):Sprite{ var _local2:Sprite; var _local3:TextField; var _local4:TextFormat; _local2 = ((_arg1[1] is Sprite)) ? (_arg1[1] as Sprite) : new ((_arg1[1] as Class)); if ((_local2.getChildAt(0) is TextField)){ _local3 = (_local2.getChildAt(0) as TextField); _local3.autoSize = TextFieldAutoSize.LEFT; _local3.text = _arg1[4]; _local4 = _local3.defaultTextFormat; _local4.size = _arg1[2]; _local4.letterSpacing = _arg1[3]; _local3.setTextFormat(_local4); } else { return (null); }; return (_local2); } public static function SpriteTextAlign(_arg1:Array):Sprite{ return (ODisplay.SpriteAlign([null, [ODisplay.SpriteText, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8]])); } public static function OBitmapTextInRect(_arg1:Array):OBitmap{ return (OBitmapMake([null, [ODisplay.SpriteTextInRect, _arg1[1], _arg1[2], _arg1[3], _arg1[4], _arg1[9], _arg1[10]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[11], _arg1[12]])); } public static function SpriteRoundBorder(_arg1:Array):Sprite{ var _local2:Sprite; _local2 = new Sprite(); _local2.graphics.beginFill(0); _local2.graphics.drawRoundRect(0, 0, _arg1[1], _arg1[2], _arg1[3]); _local2.graphics.drawRoundRect(_arg1[4], _arg1[4], (_arg1[1] - (_arg1[4] * 2)), (_arg1[2] - (_arg1[4] * 2)), (_arg1[3] - _arg1[4])); return (_local2); } public static function SpriteAngleRect(_arg1:Array):Sprite{ var _local2:Sprite; _local2 = new Sprite(); _local2.graphics.beginFill(0); _local2.graphics.moveTo(_arg1[3], 0); _local2.graphics.lineTo((_arg1[1] - _arg1[3]), 0); _local2.graphics.lineTo(_arg1[1], _arg1[3]); _local2.graphics.lineTo(_arg1[1], (_arg1[2] - _arg1[3])); _local2.graphics.lineTo((_arg1[1] - _arg1[3]), _arg1[2]); _local2.graphics.lineTo(_arg1[3], _arg1[2]); _local2.graphics.lineTo(0, (_arg1[2] - _arg1[3])); _local2.graphics.lineTo(0, _arg1[3]); _local2.graphics.endFill(); return (_local2); } public static function SpriteAngleBorder(_arg1:Array):Sprite{ var _local2:Sprite; var _local3:Number; var _local4:Number; var _local5:Number; _local2 = new Sprite(); _local2.graphics.beginFill(0); _local2.graphics.moveTo(_arg1[3], 0); _local2.graphics.lineTo((_arg1[1] - _arg1[3]), 0); _local2.graphics.lineTo(_arg1[1], _arg1[3]); _local2.graphics.lineTo(_arg1[1], (_arg1[2] - _arg1[3])); _local2.graphics.lineTo((_arg1[1] - _arg1[3]), _arg1[2]); _local2.graphics.lineTo(_arg1[3], _arg1[2]); _local2.graphics.lineTo(0, (_arg1[2] - _arg1[3])); _local2.graphics.lineTo(0, _arg1[3]); _local3 = (_arg1[1] - (_arg1[4] * 2)); _local4 = (_arg1[2] - (_arg1[4] * 2)); _local5 = ((_arg1[3] * _local3) / _arg1[1]); _local2.graphics.moveTo((_arg1[4] + _local5), (_arg1[4] + 0)); _local2.graphics.lineTo(((_arg1[4] + _local3) - _local5), (_arg1[4] + 0)); _local2.graphics.lineTo((_arg1[4] + _local3), (_arg1[4] + _local5)); _local2.graphics.lineTo((_arg1[4] + _local3), ((_arg1[4] + _local4) - _local5)); _local2.graphics.lineTo(((_arg1[4] + _local3) - _local5), (_arg1[4] + _local4)); _local2.graphics.lineTo((_arg1[4] + _local5), (_arg1[4] + _local4)); _local2.graphics.lineTo((_arg1[4] + 0), ((_arg1[4] + _local4) - _local5)); _local2.graphics.lineTo((_arg1[4] + 0), (_arg1[4] + _local5)); return (_local2); } public static function SpriteTextInRect(_arg1:Array):Sprite{ return (ODisplay.SpriteInRect([null, [ODisplay.SpriteText, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6]])); } public static function OBitmapRoundFrame(_arg1:Array):OBitmap{ return (ODisplay.OBitmapList([null, [[null, [ODisplay.SpriteRoundBorder, _arg1[1], _arg1[2], _arg1[3], _arg1[4]], 1, _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[12], _arg1[13]], [null, [ODisplay.SpriteRoundRect, (_arg1[1] - (_arg1[4] * 2)), (_arg1[2] - (_arg1[4] * 2)), ((_arg1[3] - _arg1[4]) - 2)], 1, _arg1[5], _arg1[9], _arg1[10], _arg1[11], (_arg1[12] + _arg1[4]), (_arg1[13] + _arg1[4])]]])); } } }//package ENGINE.DISPLAY
Section 74
//OSprite (ENGINE.DISPLAY.OSprite) package ENGINE.DISPLAY { import flash.display.*; import ENGINE.CORE.*; public class OSprite extends Sprite implements IDisplayObject { private var iY:Number;// = 0 private var iX:Number;// = 0 public function OSprite(){ iX = 0; iY = 0; super(); } public function get prVisible():Boolean{ return (this.visible); } public function set prX(_arg1:Number):void{ this.iX = _arg1; this.x = (_arg1 * OGlobal.Scale); } public function set prY(_arg1:Number):void{ this.iY = _arg1; this.y = (_arg1 * OGlobal.Scale); } public function Pos(_arg1:Number, _arg2:Number):void{ this.iX = _arg1; this.iY = _arg2; this.x = (this.iX * OGlobal.Scale); this.y = (this.iY * OGlobal.Scale); } public function set prVisible(_arg1:Boolean):void{ this.visible = _arg1; } public function lineStyle(_arg1:Number, _arg2:uint=0, _arg3:Number=1, _arg4:Boolean=false, _arg5:String="normal", _arg6:String=null, _arg7:String=null, _arg8:Number=3):void{ this.graphics.lineStyle((_arg1 * OGlobal.Scale), _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, (_arg8 * OGlobal.Scale)); } public function drawCircle(_arg1:Number, _arg2:Number, _arg3:Number):void{ this.graphics.drawCircle((_arg1 * OGlobal.Scale), (_arg2 * OGlobal.Scale), (_arg3 * OGlobal.Scale)); } public function moveTo(_arg1:Number, _arg2:Number):void{ this.graphics.moveTo((_arg1 * OGlobal.Scale), (_arg2 * OGlobal.Scale)); } public function get prX():Number{ return (this.iX); } public function get prY():Number{ return (this.iY); } public function Free():void{ var _local1:DisplayObject; while (this.numChildren) { _local1 = this.getChildAt(0); if ((_local1 is OSprite)){ (_local1 as OSprite).Free(); }; this.removeChildAt(0); }; } public function lineTo(_arg1:Number, _arg2:Number):void{ this.graphics.lineTo((_arg1 * OGlobal.Scale), (_arg2 * OGlobal.Scale)); } public function get prHeight():Number{ return ((this.height / OGlobal.Scale)); } public function get prWidth():Number{ return ((this.width / OGlobal.Scale)); } public function Move(_arg1:Number, _arg2:Number):void{ Pos((this.iX + _arg1), (this.iY + _arg2)); } public static function Make(_arg1:Array):OSprite{ var _local2:OSprite; var _local3:int; var _local4:int; _local2 = new (OSprite); _local3 = _arg1[1].length; _local4 = 0; while (_local4 < _local3) { _local2.addChild(_arg1[1][_local4][0](_arg1[1][_local4])); _local4++; }; _local2.Pos(_arg1[2], _arg1[3]); return (_local2); } } }//package ENGINE.DISPLAY
Section 75
//OGame (ENGINE.GAME.OGame) package ENGINE.GAME { import ENGINE.CORE.*; import flash.utils.*; import flash.net.*; public class OGame { protected var iSTableSize:int; protected var iCache:OCache; protected var iPlayer:OPlayer; protected var iRNDFactor:int; protected var iModes:int; protected var iScores:OScoresTable; public static const catGlobal:String = "Global"; public static const catTmp:String = "Tmp"; protected static const strgMusicVolume:String = "Music Volume"; protected static const strgResX:String = "ResX"; protected static const strgResY:String = "ResY"; protected static const strgСurPlayer:String = "Current Player"; protected static const strgFullScreen:String = "Full Screen"; protected static const strgSoundVolume:String = "Sound Volume"; protected static const strgLocalScores:String = "Local Scores"; public static const catPlayers:String = "Players"; public function OGame(_arg1:int=1, _arg2:int=10, _arg3:int=10){ var _local4:String; super(); this.iModes = _arg1; this.iSTableSize = _arg2; registerClassAlias("OCacheClass", OCache); registerClassAlias("OGameParamsClass", OGameParams); registerClassAlias("OScoreParamsClass", OScoreParams); registerClassAlias("OScoresTableClass", OScoresTable); registerClassAlias("OPlayerClass", OPlayer); this.LoadCache(); _local4 = this.iCache.GetCategoryItem(catGlobal, strgСurPlayer); if (_local4){ this.iPlayer = this.iCache.GetCategoryItem(catPlayers, _local4); this.iScores = this.iCache.GetCategoryItem(catGlobal, strgLocalScores); this.InitAfterLoadCache(); } else { this.iScores = new OScoresTable(_arg1, this.iSTableSize); this.DefaultInitLocalScores(); this.iCache.SetCategoryItem(catGlobal, strgLocalScores, this.iScores); this.iCache.SetCategoryItem(catGlobal, strgSoundVolume, 1); this.iCache.SetCategoryItem(catGlobal, strgMusicVolume, 1); this.iCache.SetCategoryItem(catGlobal, strgResX, OGlobal.StageRect.width); this.iCache.SetCategoryItem(catGlobal, strgResY, OGlobal.StageRect.height); this.iCache.SetCategoryItem(catGlobal, strgFullScreen, false); }; OSound.SoundVolume = this.prSoundVolume; OSound.MusicVolume = this.prMusicVolume; } public function set prFullScreen(_arg1:Boolean):void{ this.iCache.SetCategoryItem(catGlobal, strgFullScreen, _arg1); } public function set prMode(_arg1:int):void{ this.iPlayer.iMode = _arg1; } public function get prGamesStartCount():int{ return (this.iPlayer.iGParams[this.iPlayer.iMode].iCGamesStart); } public function get prLevelScore():int{ return (this.iPlayer.iGParams[this.iPlayer.iMode].iLevelScore); } public function set prPassword(_arg1:String):void{ this.iPlayer.iPassword = _arg1; } public function DeletePlayer(_arg1:String):String{ var _local2:String; var _local3:Array; _local2 = (this.iPlayer) ? this.iPlayer.iName : ""; this.iCache.DeleteCategoryItem(catPlayers, _arg1); if (_arg1 == _local2){ _local3 = this.iCache.GetCategoryNames(catPlayers); if (!_local3){ this.iPlayer = null; return (null); }; this.iPlayer = this.iCache.GetCategoryItem(catPlayers, _local3[0]); this.iCache.SetCategoryItem(catGlobal, strgСurPlayer, _local3[0]); }; return ((this.iPlayer) ? this.iPlayer.iName : null); } public function get prPlayerNames():Array{ return (this.iCache.GetCategoryNames(catPlayers)); } public function ClearPersonalScores(_arg1:int):void{ this.iPlayer.iScoreTable.Clear(_arg1); } public function GetPersonalRecord(_arg1:int):int{ return (this.iPlayer.iScoreTable.GetRecord(_arg1)); } public function InitAfterLoadCache():void{ } public function AddScore(_arg1:int):void{ this.iPlayer.iGParams[this.iPlayer.iMode].iScore = (this.iPlayer.iGParams[this.iPlayer.iMode].iScore + _arg1); } public function get prPlayersData(){ var _local1:OCache; var _local2:ByteArray; _local1 = this.iCache.GetItem(catPlayers); _local2 = _local1.Pack(); _local2.uncompress(); _local1 = _local2.readObject(); return (_local1); } public function IsPersonalRecord(_arg1:int, _arg2:int):Boolean{ return (this.iPlayer.iScoreTable.IsRecord(_arg1, _arg2)); } public function LoadCache():void{ var so:SharedObject; var a:ByteArray; so = SharedObject.getLocal(OGlobal.AppName); if (so.data.iData == undefined){ this.iCache = new OCache(); } else { try { a = so.data.iData; a.uncompress(); this.iCache = a.readObject(); } catch(error:Error) { this.iCache = new OCache(); }; }; so.close(); } public function NewGame():void{ this.iPlayer.iGParams[this.iPlayer.iMode].iLevel = 0; this.iPlayer.iGParams[this.iPlayer.iMode].iScore = 0; this.iPlayer.iGParams[this.iPlayer.iMode].iLevelScore = 0; this.iPlayer.iGParams[this.iPlayer.iMode].iSavedGame = null; this.iPlayer.iGParams[this.iPlayer.iMode].iCGamesStart++; } public function get prLevel():int{ return (this.iPlayer.iGParams[this.iPlayer.iMode].iLevel); } public function get prSoundVolume():Number{ return (this.iCache.GetCategoryItem(catGlobal, strgSoundVolume)); } public function get prPlayerName():String{ return ((this.iPlayer) ? this.iPlayer.iName : ""); } public function get prScore():int{ return (this.iPlayer.iGParams[this.iPlayer.iMode].iScore); } public function NextLevel():Boolean{ this.iPlayer.iGParams[this.iPlayer.iMode].iLevel++; return (true); } public function set prPlayersData(_arg1):void{ this.iCache.SetItem(catPlayers, _arg1); } public function Read(_arg1:String, _arg2:String){ return (this.iCache.GetCategoryItem(_arg1, _arg2)); } public function get prSavedGame():String{ return (this.iPlayer.iGParams[this.iPlayer.iMode].iSavedGame); } public function set prResX(_arg1:int):void{ this.iCache.SetCategoryItem(catGlobal, strgResX, _arg1); } public function get prRNDFactor():int{ return (this.iPlayer.iRNDFactor); } public function get prMusicVolume():Number{ return (this.iCache.GetCategoryItem(catGlobal, strgMusicVolume)); } public function Write(_arg1:String, _arg2:String, _arg3):void{ this.iCache.SetCategoryItem(_arg1, _arg2, _arg3); } public function Start():void{ this.iPlayer.iGParams[this.iPlayer.iMode].iCGamesStart++; } public function get prPassword():String{ return ((this.iPlayer.iPassword) ? this.iPlayer.iPassword : ""); } public function get prMode():int{ return (this.iPlayer.iMode); } public function End():void{ this.iPlayer.iGParams[this.iPlayer.iMode].iCGamesEnd++; } public function set prSoundVolume(_arg1:Number):void{ OSound.SoundVolume = _arg1; this.iCache.SetCategoryItem(catGlobal, strgSoundVolume, _arg1); } public function SetLevelScore(_arg1:int):void{ this.iPlayer.iGParams[this.iPlayer.iMode].iLevelScore = _arg1; } public function GetLocalScores(_arg1:int, _arg2:int):OScoreParams{ return (this.iScores.GetScore(_arg1, _arg2)); } public function GetPersonalScores(_arg1:int, _arg2:int):OScoreParams{ return (this.iPlayer.iScoreTable.GetScore(_arg1, _arg2)); } public function AddScoreInTable(_arg1:int):Boolean{ var _local2:Boolean; _local2 = false; if (this.iScores.AddScore(this.prPlayerName, _arg1, this.prMode, this.prLevel)){ this.iCache.SetCategoryItem(OGame.catGlobal, OGame.strgLocalScores, this.iScores); _local2 = true; }; if (this.iPlayer.iScoreTable.AddScore(this.prPlayerName, _arg1, this.prMode, this.prLevel, true)){ this.iCache.SetCategoryItem(OGame.catPlayers, this.prPlayerName, this.iPlayer); _local2 = true; }; return (_local2); } public function get prResX():int{ return (this.iCache.GetCategoryItem(catGlobal, strgResX)); } public function get prResY():int{ return (this.iCache.GetCategoryItem(catGlobal, strgResY)); } public function set prPlayerName(_arg1:String):void{ var _local2:OPlayer; _local2 = this.iCache.GetCategoryItem(catPlayers, _arg1); if (!_local2){ _local2 = new OPlayer(_arg1, "", this.iModes, this.iSTableSize); this.iCache.SetCategoryItem(catPlayers, _arg1, _local2); }; this.iPlayer = _local2; this.iCache.SetCategoryItem(catGlobal, strgСurPlayer, _arg1); } public function DefaultInitLocalScores():void{ this.iScores.Clear(0); this.iScores.AddScore("Emily", (int(((Math.random() * 100) + 50)) * 50), 0, int(((Math.random() * 5) + 3))); this.iScores.AddScore("Michael", (int(((Math.random() * 100) + 50)) * 50), 0, int(((Math.random() * 5) + 3))); this.iScores.AddScore("Jacob", (int(((Math.random() * 100) + 50)) * 50), 0, int(((Math.random() * 5) + 3))); this.iScores.AddScore("Isabella", (int(((Math.random() * 100) + 50)) * 50), 0, int(((Math.random() * 5) + 3))); this.iScores.AddScore("Madison", (int(((Math.random() * 100) + 50)) * 50), 0, int(((Math.random() * 5) + 3))); this.iScores.SortOn(0); } public function SaveCache():Boolean{ var _local1:SharedObject; var _local2:String; _local1 = SharedObject.getLocal(OGlobal.AppName); _local1.data.iData = this.iCache.Pack(); _local2 = _local1.flush(); _local1.close(); return ((_local2 == SharedObjectFlushStatus.FLUSHED)); } public function set prResY(_arg1:int):void{ this.iCache.SetCategoryItem(catGlobal, strgResY, _arg1); } public function SetSaveGame(_arg1:String):void{ this.iPlayer.iGParams[this.iPlayer.iMode].iSavedGame = _arg1; } public function get prGamesEndCount():int{ return (this.iPlayer.iGParams[this.iPlayer.iMode].iCGamesEnd); } public function set prMusicVolume(_arg1:Number):void{ OSound.MusicVolume = _arg1; this.iCache.SetCategoryItem(catGlobal, strgMusicVolume, _arg1); } public function get prFullScreen():Boolean{ return (this.iCache.GetCategoryItem(catGlobal, strgFullScreen)); } public function ClearLocalScores(_arg1:int):void{ this.iScores.Clear(_arg1); } } }//package ENGINE.GAME
Section 76
//OGameParams (ENGINE.GAME.OGameParams) package ENGINE.GAME { public class OGameParams { public var iLevel:int; public var iScore:int; public var iSavedGame:String; public var iCGamesEnd:int; public var iLevelScore:int; public var iCGamesStart:int; } }//package ENGINE.GAME
Section 77
//OPlayer (ENGINE.GAME.OPlayer) package ENGINE.GAME { public class OPlayer { public var iPassword:String; public var iScoreTable:OScoresTable; public var iGParams:Array; public var iMode:int; public var iRNDFactor:int; public var iName:String; public function OPlayer(_arg1:String=null, _arg2:String=null, _arg3:int=1, _arg4:int=10, _arg5:int=10){ var _local6:int; super(); this.iName = _arg1; this.iPassword = _arg2; this.iGParams = new Array(_arg3); this.iRNDFactor = Math.round((Math.random() * (_arg5 - 1))); _local6 = 0; while (_local6 < _arg3) { this.iGParams[_local6] = new OGameParams(); _local6++; }; this.iScoreTable = new OScoresTable(_arg3, _arg4); } } }//package ENGINE.GAME
Section 78
//OScoreParams (ENGINE.GAME.OScoreParams) package ENGINE.GAME { public class OScoreParams { public var iScore:int; public var iName:String; public var iLevel:int; public var iTime:Number; public function OScoreParams(_arg1:String=null, _arg2:int=0, _arg3:int=0){ var _local4:Date; super(); this.iName = _arg1; this.iScore = _arg2; _local4 = new Date(); this.iTime = _local4.time; } } }//package ENGINE.GAME
Section 79
//OScoresTable (ENGINE.GAME.OScoresTable) package ENGINE.GAME { public class OScoresTable { public var iTable:Array; public var iMaxElements:int; public function OScoresTable(_arg1:int=1, _arg2:int=10){ var _local3:int; super(); this.iMaxElements = _arg2; this.iTable = new Array(); _local3 = 0; while (_local3 < _arg1) { this.iTable[_local3] = new Array(); _local3++; }; } public function FindByName(_arg1:int, _arg2:String):int{ var _local3:int; _local3 = 0; while (_local3 < this.iTable[_arg1].length) { if (this.iTable[_arg1][_local3].iName == _arg2){ return (_local3); }; _local3++; }; return (-1); } public function Clear(_arg1:int):void{ this.iTable[_arg1] = new Array(); } public function GetRecord(_arg1:int):int{ if (!this.iTable[_arg1].length){ return (0); }; return (this.iTable[_arg1][0].iScore); } public function AddScore(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:Boolean=false):Boolean{ var _local6:Array; var _local7:int; _local6 = this.iTable[_arg3]; if ((((_local6.length < this.iMaxElements)) || ((_local6[(_local6.length - 1)].iScore < _arg2)))){ _local7 = (_arg5) ? -1 : this.FindByName(_arg3, _arg1); if (_local7 >= 0){ if (_arg2 < _local6[_local7].iScore){ return (false); }; _local6[_local7] = new OScoreParams(_arg1, _arg2, _arg4); this.SortOn(_arg3); return (true); }; if (_local6.length < this.iMaxElements){ _local6[_local6.length] = new OScoreParams(_arg1, _arg2, _arg4); this.SortOn(_arg3); return (true); }; if (_local6[(_local6.length - 1)].iScore > _arg2){ return (false); }; _local6[(_local6.length - 1)] = new OScoreParams(_arg1, _arg2, _arg4); this.SortOn(_arg3); return (true); }; return (false); } public function IsRecord(_arg1:int, _arg2:int):Boolean{ if (!this.iTable[_arg1].length){ return (true); }; return ((_arg2 >= this.iTable[_arg1][0].iScore)); } public function GetScore(_arg1:int, _arg2:int):OScoreParams{ return (this.iTable[_arg1][_arg2]); } public function SortOn(_arg1:int):void{ this.iTable[_arg1] = this.iTable[_arg1].sortOn("iScore", (Array.DESCENDING | Array.NUMERIC)); } } }//package ENGINE.GAME
Section 80
//OA_Alpha (ENGINE.INTERFACE.ANIMATORS.OA_Alpha) package ENGINE.INTERFACE.ANIMATORS { import ENGINE.INTERFACE.*; public class OA_Alpha extends OAnimator { public var iEAlpha:Number; private var iDAlpha:Number; public var iSAlpha:Number; private var iEndAlpha:Number; public var iPIter:int; public function OA_Alpha(_arg1:Object, _arg2:OIObject=null){ super(_arg1, _arg2); } override protected function Start():int{ var _local1:Number; _local1 = ((this.iSAlpha)>=0) ? this.iSAlpha : this.iTarget.alpha; this.iEndAlpha = ((this.iEAlpha)>=0) ? this.iEAlpha : this.iTarget.alpha; this.iDAlpha = ((this.iEndAlpha - _local1) / iPIter); this.iTarget.visible = true; this.iTarget.alpha = _local1; return (((Math.abs(this.iDAlpha) > 0.001)) ? stPlay : stEnd); } override public function Play():void{ var _local1:Number; _local1 = (this.iTarget.alpha + this.iDAlpha); if ((((((this.iDAlpha > 0)) && ((_local1 >= this.iEndAlpha)))) || ((((this.iDAlpha <= 0)) && ((_local1 <= this.iEndAlpha)))))){ this.iTarget.alpha = this.iEndAlpha; if (this.iTarget.alpha == 0){ this.iTarget.visible = false; }; this.State = OAnimator.stEnd; } else { this.iTarget.alpha = _local1; }; } public static function Make(_arg1:Object, _arg2:OIObject=null):OA_Alpha{ return (new OA_Alpha(_arg1, _arg2)); } } }//package ENGINE.INTERFACE.ANIMATORS
Section 81
//OA_AlphaFade (ENGINE.INTERFACE.ANIMATORS.OA_AlphaFade) package ENGINE.INTERFACE.ANIMATORS { import flash.display.*; import ENGINE.INTERFACE.*; public class OA_AlphaFade extends OAnimator { public var iEAlpha:Number; public var iEInd:Array; private var iEndAlpha:Array; private var iCurAlpha:Number; private var iDAlpha:Array; private var iStartAlpha:Array; public var iSInd:Array; public var iSAlpha:Number; public var iPIter:int; public function OA_AlphaFade(_arg1:Object, _arg2:OIObject=null){ super(_arg1, _arg2); } override protected function Start():int{ var _local1:int; var _local2:int; var _local3:DisplayObject; var _local4:DisplayObject; if ((((this.iSInd == null)) && ((this.iEInd == null)))){ return (OAnimator.stEnd); }; if (this.iSInd.length != this.iEInd.length){ return (OAnimator.stEnd); }; _local1 = this.iSInd.length; this.iStartAlpha = new Array(_local1); this.iEndAlpha = new Array(_local1); this.iDAlpha = new Array(_local1); _local2 = 0; while (_local2 < _local1) { _local3 = this.iTarget.getChildAt(this.iSInd[_local2]); _local4 = this.iTarget.getChildAt(this.iEInd[_local2]); this.iStartAlpha[_local2] = ((this.iSAlpha)>=0) ? this.iSAlpha : _local3.alpha; this.iEndAlpha[_local2] = ((this.iEAlpha)>=0) ? this.iEAlpha : _local4.alpha; this.iDAlpha[_local2] = ((this.iEndAlpha[_local2] - this.iStartAlpha[_local2]) / iPIter); _local3.alpha = this.iStartAlpha[_local2]; _local3.visible = true; _local4.alpha = this.iEndAlpha[_local2]; _local4.visible = true; _local2++; }; this.iCurAlpha = this.iStartAlpha[0]; return (OAnimator.stPlay); } override public function Play():void{ var _local1:DisplayObject; var _local2:DisplayObject; var _local3:int; var _local4:int; this.iCurAlpha = (this.iCurAlpha + this.iDAlpha[0]); _local3 = this.iSInd.length; if ((((((this.iDAlpha[0] > 0)) && ((this.iCurAlpha >= this.iEndAlpha[0])))) || ((((this.iDAlpha[0] <= 0)) && ((this.iCurAlpha <= this.iEndAlpha[0])))))){ _local4 = 0; while (_local4 < _local3) { _local1 = this.iTarget.getChildAt(this.iSInd[_local4]); _local2 = this.iTarget.getChildAt(this.iEInd[_local4]); _local1.alpha = this.iEndAlpha[_local4]; if (_local1.alpha == 0){ _local1.visible = false; }; _local2.alpha = this.iStartAlpha[_local4]; if (_local2.alpha == 0){ _local2.visible = false; }; _local4++; }; this.State = OAnimator.stEnd; } else { _local4 = 0; while (_local4 < _local3) { _local1 = this.iTarget.getChildAt(this.iSInd[_local4]); _local2 = this.iTarget.getChildAt(this.iEInd[_local4]); _local1.alpha = (_local1.alpha + this.iDAlpha[_local4]); _local2.alpha = (_local2.alpha - this.iDAlpha[_local4]); _local4++; }; }; } public static function Make(_arg1:Object, _arg2:OIObject=null):OA_AlphaFade{ return (new OA_AlphaFade(_arg1, _arg2)); } } }//package ENGINE.INTERFACE.ANIMATORS
Section 82
//OA_AlphaInd (ENGINE.INTERFACE.ANIMATORS.OA_AlphaInd) package ENGINE.INTERFACE.ANIMATORS { import flash.display.*; import ENGINE.INTERFACE.*; public class OA_AlphaInd extends OAnimator { public var iEAlpha:Number; private var iCurAlpha:Number; private var iEndAlpha:Array; private var iDAlpha:Array; public var iInd:Array; public var iSAlpha:Number; public var iPIter:int; public function OA_AlphaInd(_arg1:Object, _arg2:OIObject=null){ super(_arg1, _arg2); } override protected function Start():int{ var _local1:int; var _local2:int; var _local3:DisplayObject; var _local4:Number; if (((!(this.iInd)) || ((this.iInd.length == 0)))){ return (stEnd); }; _local1 = this.iInd.length; this.iEndAlpha = new Array(_local1); this.iDAlpha = new Array(_local1); _local2 = 0; while (_local2 < _local1) { _local3 = this.iTarget.getChildAt(this.iInd[_local2]); _local4 = ((this.iSAlpha)>=0) ? this.iSAlpha : _local3.alpha; this.iEndAlpha[_local2] = ((this.iEAlpha)>=0) ? this.iEAlpha : _local3.alpha; this.iDAlpha[_local2] = ((this.iEndAlpha[_local2] - _local4) / iPIter); _local3.visible = true; _local3.alpha = _local4; _local2++; }; this.iCurAlpha = this.iTarget.getChildAt(this.iInd[0]).alpha; return (((Math.abs(this.iDAlpha[0]) > 0.001)) ? stPlay : stEnd); } override public function Play():void{ var _local1:int; var _local2:int; var _local3:DisplayObject; this.iCurAlpha = (this.iCurAlpha + this.iDAlpha[0]); _local1 = this.iInd.length; if ((((((this.iDAlpha[0] > 0)) && ((this.iCurAlpha >= this.iEndAlpha[0])))) || ((((this.iDAlpha[0] <= 0)) && ((this.iCurAlpha <= this.iEndAlpha[0])))))){ _local2 = 0; while (_local2 < _local1) { _local3 = this.iTarget.getChildAt(this.iInd[_local2]); _local3.alpha = this.iEndAlpha[_local2]; _local3.visible = (_local3.alpha > 0); _local2++; }; this.State = stEnd; } else { _local2 = 0; while (_local2 < _local1) { _local3 = this.iTarget.getChildAt(this.iInd[_local2]); _local3.alpha = (_local3.alpha + this.iDAlpha[_local2]); _local2++; }; }; } public static function Make(_arg1:Object, _arg2:OIObject=null):OA_AlphaInd{ return (new OA_AlphaInd(_arg1, _arg2)); } } }//package ENGINE.INTERFACE.ANIMATORS
Section 83
//OA_Scale (ENGINE.INTERFACE.ANIMATORS.OA_Scale) package ENGINE.INTERFACE.ANIMATORS { import ENGINE.INTERFACE.*; public class OA_Scale extends OAnimator { public var iSScale:Number; private var iEndScale:Number; public var iEScale:Number; private var iDScale:Number; public var iPIter:int; public function OA_Scale(_arg1:Object, _arg2:OIObject=null){ super(_arg1, _arg2); } override protected function Start():int{ var _local1:Number; var _local2:Number; var _local3:Number; _local1 = ((this.iSScale)>=0) ? this.iSScale : this.iTarget.scaleX; this.iEndScale = ((this.iEScale)>=0) ? this.iEScale : this.iTarget.scaleX; this.iDScale = ((this.iEndScale - _local1) / iPIter); _local2 = this.iTarget.prWidth; _local3 = this.iTarget.prHeight; this.iTarget.scaleX = _local1; this.iTarget.scaleY = _local1; this.iTarget.Move(((_local2 - this.iTarget.prWidth) / 2), ((_local3 - this.iTarget.prHeight) / 2)); return (((Math.abs(this.iDScale) > 1E-5)) ? stPlay : stEnd); } override public function Play():void{ var _local1:Number; var _local2:Number; var _local3:Number; _local1 = this.iTarget.prWidth; _local2 = this.iTarget.prHeight; _local3 = (this.iTarget.scaleX + this.iDScale); if ((((((this.iDScale > 0)) && ((_local3 >= this.iEndScale)))) || ((((this.iDScale <= 0)) && ((_local3 <= this.iEndScale)))))){ this.iTarget.scaleX = this.iEndScale; this.iTarget.scaleY = this.iEndScale; this.State = OAnimator.stEnd; } else { this.iTarget.scaleX = (this.iTarget.scaleX + this.iDScale); this.iTarget.scaleY = (this.iTarget.scaleY + this.iDScale); }; this.iTarget.Move(((_local1 - this.iTarget.prWidth) / 2), ((_local2 - this.iTarget.prHeight) / 2)); } public static function Make(_arg1:Object, _arg2:OIObject=null):OA_Scale{ return (new OA_Scale(_arg1, _arg2)); } } }//package ENGINE.INTERFACE.ANIMATORS
Section 84
//OAnimator (ENGINE.INTERFACE.ANIMATORS.OAnimator) package ENGINE.INTERFACE.ANIMATORS { import ENGINE.INTERFACE.*; public class OAnimator { private var iState:int; protected var iTarget:OIObject; public static const stStart:int = 1; public static const stEnd:int = 3; public static const stPause:int = 0; public static const stReturn:int = 4; public static const stPlay:int = 2; public function OAnimator(_arg1:Object, _arg2:OIObject=null){ var _local3:String; super(); for (_local3 in _arg1) { if (this.hasOwnProperty(_local3)){ this[_local3] = _arg1[_local3]; }; }; this.iTarget = _arg2; this.State = stPause; } public function set State(_arg1:int):void{ this.iState = _arg1; switch (this.iState){ case stStart: this.State = this.Start(); break; case stReturn: this.State = Return(); break; }; } public function Play():void{ this.State = stEnd; } public function set prTarget(_arg1:OIObject):void{ this.iTarget = _arg1; } protected function Start():int{ return (stPlay); } public function get State():int{ return (this.iState); } public function Return():int{ return (stPlay); } public function OnEnterFrame():void{ if (this.iState == stPlay){ Play(); }; } } }//package ENGINE.INTERFACE.ANIMATORS
Section 85
//OAnimatorManager (ENGINE.INTERFACE.ANIMATORS.OAnimatorManager) package ENGINE.INTERFACE.ANIMATORS { import ENGINE.INTERFACE.*; public class OAnimatorManager { private var iPlaying:Array; private var iTarget:OIObject; public static const anActivate:int = 2; public static const anDeactivate:int = 3; public static const anShow:int = 0; public static const iAnimatorsCount:int = 10; public static const anHide:int = 1; public static const anPress:int = 8; public static const anRoolOver:int = 6; public static const anUnpress:int = 9; public static const anFocusOut:int = 5; public static const anRoolOut:int = 7; public static const anUncheck:int = 10; public static const anCheck:int = 9; public static const anFocusIn:int = 4; public static const iNullAnimators:Array = [null, null, null, null, null, null, null, null, null, null]; public function OAnimatorManager(_arg1:OIObject){ this.iTarget = _arg1; this.iPlaying = new Array(); } public function get prAnimation():Boolean{ return ((iPlaying.length > 0)); } public function AddAnimator(_arg1:Object):void{ var _local2:*; if (_arg1 == null){ return; }; if (this.iPlaying.length > 0){ this.iPlaying[0].Return(); }; _local2 = _arg1.F(_arg1); _local2.prTarget = this.iTarget; this.iPlaying.push(_local2); } public function OnEnterFrame():void{ if (this.iPlaying.length == 0){ return; }; switch (this.iPlaying[0].State){ case OAnimator.stEnd: this.iPlaying[0] = null; this.iPlaying.splice(0, 1); break; case OAnimator.stPause: this.iPlaying[0].State = OAnimator.stStart; break; case OAnimator.stPlay: this.iPlaying[0].Play(); break; }; } public function Free():void{ this.iTarget = null; this.iPlaying = null; } } }//package ENGINE.INTERFACE.ANIMATORS
Section 86
//OHtmlTextField (ENGINE.INTERFACE.ELEMENTS.OHtmlTextField) package ENGINE.INTERFACE.ELEMENTS { import ENGINE.DISPLAY.*; import flash.display.*; import ENGINE.CORE.*; import flash.text.*; public class OHtmlTextField extends TextField { private var iTextFormat:TextFormat; public function OHtmlTextField(_arg1:Number, _arg2:Number, _arg3, _arg4:Number, _arg5:Number, _arg6:Boolean, _arg7:Array, _arg8:String, _arg9:Number, _arg10:Number, _arg11:Boolean=true){ var _local12:Number; var _local13:Sprite; super(); _local12 = (_arg11) ? OGlobal.Scale : 1; this.type = TextFieldType.DYNAMIC; this.autoSize = TextFieldAutoSize.NONE; this.multiline = true; this.wordWrap = true; this.selectable = false; if (_arg3){ _local13 = ((_arg3 is Sprite)) ? (_arg3 as Sprite) : new ((_arg3 as Class)); if ((_local13.getChildAt(0) is TextField)){ this.iTextFormat = (_local13.getChildAt(0) as TextField).getTextFormat(); } else { this.iTextFormat = this.defaultTextFormat; }; } else { this.iTextFormat = this.defaultTextFormat; }; this.iTextFormat.size = (_arg4 * _local12); this.iTextFormat.letterSpacing = (_arg5 * _local12); this.iTextFormat.color = ODisplay.HSBToRGB(_arg7[0], _arg7[1], _arg7[2]); this.iTextFormat.align = TextFormatAlign.LEFT; this.defaultTextFormat = this.iTextFormat; this.prText = _arg8; this.width = (_arg1 * _local12); this.height = (_arg2 * _local12); this.x = (_arg9 * _local12); this.y = (_arg10 * _local12); this.border = _arg6; } public function set prText(_arg1:String):void{ this.htmlText = _arg1; } public function set prFormat(_arg1:TextFormat):void{ this.iTextFormat = _arg1; this.defaultTextFormat = _arg1; this.setTextFormat(this.iTextFormat); } public function get prText():String{ return (this.htmlText); } public function get prFormat():TextFormat{ return (this.iTextFormat); } } }//package ENGINE.INTERFACE.ELEMENTS
Section 87
//OInputTextField (ENGINE.INTERFACE.ELEMENTS.OInputTextField) package ENGINE.INTERFACE.ELEMENTS { import ENGINE.DISPLAY.*; import flash.events.*; import flash.display.*; import ENGINE.CORE.*; import flash.text.*; public class OInputTextField extends TextField { private var iTextFormat:TextFormat; public function OInputTextField(_arg1:Number, _arg2:Number, _arg3, _arg4:Number, _arg5:Number, _arg6:Boolean, _arg7:Array, _arg8:String, _arg9:int, _arg10:Number, _arg11:Number){ var _local12:Number; var _local13:Sprite; super(); _local12 = OGlobal.Scale; this.type = TextFieldType.INPUT; this.autoSize = TextFieldAutoSize.NONE; this.embedFonts = true; _local13 = ((_arg3 is Sprite)) ? (_arg3 as Sprite) : new ((_arg3 as Class)); if ((_local13.getChildAt(0) is TextField)){ this.iTextFormat = (_local13.getChildAt(0) as TextField).getTextFormat(); } else { this.iTextFormat = this.defaultTextFormat; }; this.iTextFormat.size = (_arg4 * _local12); this.iTextFormat.letterSpacing = (_arg5 * _local12); this.iTextFormat.color = ODisplay.HSBToRGB(_arg7[0], _arg7[1], _arg7[2]); this.defaultTextFormat = this.iTextFormat; this.prText = _arg8; this.width = (_arg1 * _local12); this.height = (_arg2 * _local12); this.x = (_arg10 * _local12); this.y = (_arg11 * _local12); this.border = _arg6; this.maxChars = _arg9; this.restrict = "A-Za-z0-9 @._\\-"; this.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, OnFocusIn); } public function set prText(_arg1:String):void{ this.text = (((!(_arg1)) || ((_arg1 == "")))) ? " " : _arg1; } protected function OnFocusIn(_arg1:FocusEvent):void{ this.setTextFormat(this.iTextFormat); } public function set prFormat(_arg1:TextFormat):void{ this.iTextFormat = _arg1; this.defaultTextFormat = _arg1; this.setTextFormat(this.iTextFormat); } public function get prText():String{ var _local1:String; _local1 = this.text; while (_local1.charAt() == " ") { _local1 = _local1.substr(1); }; while (_local1.charAt((_local1.length - 1)) == " ") { _local1 = _local1.substr(0, (_local1.length - 1)); }; return (_local1); } public function get prFormat():TextFormat{ return (this.iTextFormat); } } }//package ENGINE.INTERFACE.ELEMENTS
Section 88
//OListBoxElement (ENGINE.INTERFACE.ELEMENTS.OListBoxElement) package ENGINE.INTERFACE.ELEMENTS { import flash.events.*; import ENGINE.INTERFACE.*; import ENGINE.INTERFACE.ANIMATORS.*; public class OListBoxElement extends OButton { public static const iDefAnimators:Array = [{F:OA_Alpha.Make, iSAlpha:0, iEAlpha:1, iPIter:3}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0, iPIter:3}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:3}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.2, iPIter:3}, null, null, {F:OA_AlphaInd.Make, iSAlpha:-1, iEAlpha:0.6, iInd:[1], iPIter:3}, {F:OA_AlphaInd.Make, iSAlpha:-1, iEAlpha:1, iInd:[1], iPIter:3}, {F:OA_AlphaInd.Make, iSAlpha:0, iEAlpha:1, iInd:[0], iPIter:9}, {F:OA_AlphaInd.Make, iSAlpha:-1, iEAlpha:0, iInd:[0], iPIter:9}]; public function OListBoxElement(_arg1:Array, _arg2:Array=null){ var _local3:Array; _local3 = (_arg2) ? _arg2 : iDefAnimators; super(_arg1, _local3); } override public function OnMouseUp(_arg1:MouseEvent):void{ } override public function OnRollOut(_arg1:MouseEvent):void{ this.prRool = false; } override public function OnMouseDown(_arg1:MouseEvent):void{ if (((this.prPress) && ((this.parent is OIObject)))){ (this.parent as OIObject).OnPress(_arg1, this); return; }; super.OnMouseDown(_arg1); } } }//package ENGINE.INTERFACE.ELEMENTS
Section 89
//OAlert (ENGINE.INTERFACE.OAlert) package ENGINE.INTERFACE { import flash.events.*; public class OAlert extends ODialog { protected var iMessages:Array; public var iButtons:Array; public function OAlert(_arg1:Array, _arg2:Array, _arg3:Array=null){ var _local4:Array; this.iMessages = _arg2; _local4 = (_arg3) ? _arg3 : ODialog.iDefAnimators; super(_arg1, _local4); } override public function Init():void{ this.iButtons = new Array(); super.Init(); } override public function OnPress(_arg1:Event, _arg2):void{ var _local3:int; var _local4:int; if (((!(this.iMessages)) || (!(this.iButtons)))){ this.prVisible = false; return; }; _local3 = 0; _local4 = 0; while (_local4 < this.iButtons.length) { if ((((_arg2 == this.iButtons[_local4])) && ((_local4 < this.iMessages.length)))){ if ((this.parent is OIObject)){ (this.parent as OIObject).OnPress(null, iMessages[_local4]); }; this.prVisible = false; return; }; _local4++; }; } override public function Free():void{ this.iButtons = null; super.Free(); } } }//package ENGINE.INTERFACE
Section 90
//OApplication (ENGINE.INTERFACE.OApplication) package ENGINE.INTERFACE { import flash.events.*; import flash.display.*; import ENGINE.CORE.*; import flash.external.*; public class OApplication extends OWindow { private var iStaged:Boolean;// = false protected var iBackground:OBackground; protected var iMenuItem:Array; public function OApplication(_arg1:String){ iStaged = false; OGlobal.AppName = _arg1; if (this.stage){ OGlobal.SetDomain(); this.InitStage(); }; super(null); if (!this.iStaged){ this.addEventListener(Event.ENTER_FRAME, NotStagedEnterFrame); }; } private function NotStagedEnterFrame(_arg1:Event):void{ if (!iStaged){ if (!this.stage){ return; }; OGlobal.SetDomain(); this.InitStage(); this.Init(); this.removeEventListener(Event.ENTER_FRAME, NotStagedEnterFrame); this.iStaged = true; }; } override public function Init():void{ if (!this.stage){ return; }; super.Init(); this.iMenuItem = new Array(); this.iStaged = true; this.visible = true; } protected function OnMenuItem():void{ } public function get prMenuItem():int{ return ((this.iMenuItem.length) ? this.iMenuItem.pop() : -1); } public function set prMenuItem(_arg1:int):void{ this.iMenuItem.push(_arg1); } public function OnResize(_arg1:Event):void{ this.Free(); this.InitStage(); this.Init(); } override public function Free():void{ OGlobal.prStage.removeEventListener(Event.DEACTIVATE, OnDeactivate); OGlobal.prStage.removeEventListener(Event.RESIZE, OnResize); this.iMenuItem = null; super.Free(); } public function InitBackground(_arg1:Array, _arg2:int=0):void{ this.iBackground = new OBackground(_arg1, _arg2); this.addChildAt(this.iBackground, 0); } protected function OnDeactivate(_arg1:Event):void{ } public function InitStage(_arg1:Stage=null):void{ var s:String; var b:int; var aStage = _arg1; if (((aStage) || (this.stage))){ OGlobal.prStage = (aStage) ? aStage : this.stage; }; if (!OGlobal.prStage){ return; }; OGlobal.prStage.scaleMode = StageScaleMode.NO_SCALE; OGlobal.prStage.align = StageAlign.TOP_LEFT; OGlobal.prStage.quality = StageQuality.BEST; OGlobal.prStage.stageFocusRect = false; OGlobal.Rescale(this); OGlobal.FPS = 60; if (ExternalInterface.available){ s = ("function getInternetExplorerVersion() { var rv = -1; if (navigator.appName == \"Microsoft Internet Explorer\") { var ua = navigator.userAgent;" + "var re = new RegExp(\"MSIE ([0-9]{1,}[.0-9]{0,})\"); if (re.exec(ua) != null) rv = parseFloat( RegExp.$1 ); } return rv; }"); b = 0; try { b = ExternalInterface.call(s); } catch(e:Error) { OGlobal.prStage.frameRate = OGlobal.FPS; }; if (b > 0){ OGlobal.FPS = (OGlobal.FPS * 2); }; }; OGlobal.prStage.frameRate = OGlobal.FPS; OGlobal.prStage.addEventListener(Event.RESIZE, OnResize); OGlobal.prStage.addEventListener(Event.DEACTIVATE, OnDeactivate); } } }//package ENGINE.INTERFACE
Section 91
//OBackground (ENGINE.INTERFACE.OBackground) package ENGINE.INTERFACE { import ENGINE.DISPLAY.*; import flash.display.*; import flash.geom.*; import ENGINE.CORE.*; public class OBackground extends OSprite { protected var iImages:Array; protected var iIInd:int;// = 0 public function OBackground(_arg1:Array, _arg2:int=0){ iIInd = 0; super(); this.iImages = _arg1; this.prIInd = _arg2; } public function Make():void{ var _local1:Sprite; var _local2:BitmapData; var _local3:OBM; var _local4:Rectangle; var _local5:Rectangle; var _local6:int; var _local7:int; var _local8:Number; var _local9:int; var _local10:Bitmap; var _local11:int; var _local12:OBitmap; if (this.iImages == null){ return; }; this.Free(); if ((this.iImages[this.iIInd] is Class)){ _local1 = new (this.iImages[this.iIInd]); _local2 = new BitmapData(_local1.width, _local1.height, false, 4294967295); _local2.draw(_local1); }; if ((this.iImages[this.iIInd] is BitmapData)){ _local2 = this.iImages[this.iIInd]; _local1 = new Sprite(); _local10 = new Bitmap(_local2); _local1.addChild(_local10); }; _local3 = new OBM(_local2, 0, 0, _local1.width, _local1.height); _local4 = OGlobal.ViewporRect; _local5 = OGlobal.StageRect; this.x = -(_local4.x); this.y = -(_local4.y); _local6 = Math.floor((_local5.width / _local1.width)); if (_local6 == 0){ return; }; _local7 = Math.floor((_local5.height / _local1.height)); if (_local7 == 0){ return; }; if ((_local5.width - (_local6 * _local1.width)) > 0){ _local6++; }; if ((_local5.height - (_local7 * _local1.height)) > 0){ _local7++; }; _local8 = OGlobal.Scale; _local9 = 0; while (_local9 < _local7) { _local11 = 0; while (_local11 < _local6) { _local12 = new OBitmap(_local3, ((_local11 * _local1.width) / _local8), ((_local9 * _local1.height) / _local8)); this.addChild(_local12); _local11++; }; _local9++; }; } override public function Free():void{ super.Free(); } public function set prIInd(_arg1:int):void{ this.iIInd = _arg1; if (this.iImages == null){ this.iIInd = -1; return; }; if (this.iIInd >= (this.iImages.length - 1)){ this.iIInd = (this.iImages.length - 1); }; Make(); } public function get prIInd():int{ return (this.iIInd); } } }//package ENGINE.INTERFACE
Section 92
//OButton (ENGINE.INTERFACE.OButton) package ENGINE.INTERFACE { import ENGINE.DISPLAY.*; import flash.events.*; import ENGINE.INTERFACE.ANIMATORS.*; public class OButton extends OIObject { public var iHit:OSprite; public static const iDefAnimators:Array = [{F:OA_Alpha.Make, iSAlpha:0, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.2, iPIter:6}, null, null, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.6, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:6}, {F:OA_Scale.Make, iSScale:1, iEScale:0.8, iPIter:6}, {F:OA_Scale.Make, iSScale:0.8, iEScale:1, iPIter:6}]; public function OButton(_arg1:Array, _arg2:Array=null){ var _local3:Array; _local3 = ((_arg2)==null) ? OButton.iDefAnimators : _arg2; super(_arg1, _local3); } override public function OnRollOver(_arg1:MouseEvent):void{ this.prRool = true; } override public function Init():void{ this.useHandCursor = true; this.buttonMode = true; super.Init(); if (this.iHit){ this.iHit.visible = false; this.hitArea = this.iHit; }; } override public function OnMouseUp(_arg1:MouseEvent):void{ this.prPress = false; } override public function OnRollOut(_arg1:MouseEvent):void{ if (this.prPress){ this.prPress = false; }; this.prRool = false; } override public function Free():void{ this.iHit = null; super.Free(); } override public function OnMouseDown(_arg1:MouseEvent):void{ this.prPress = true; if ((this.parent is OIObject)){ (this.parent as OIObject).OnPress(_arg1, this); }; } } }//package ENGINE.INTERFACE
Section 93
//OCounter (ENGINE.INTERFACE.OCounter) package ENGINE.INTERFACE { import ENGINE.INTERFACE.ANIMATORS.*; public class OCounter extends OIObject { public var iSeparator:OIObject; public var iDigits0:Array; public var iDigits:Array; protected var iValue:int; protected var iValue0:int; protected var iWidth:Number; protected var iHeight:Number; public static const iDefAnimators:Array = [{F:OA_Alpha.Make, iSAlpha:0, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.2, iPIter:6}, null, null, null, null, null, null]; public function OCounter(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Array=null){ var _local5:Array; this.iWidth = _arg2; this.iHeight = _arg3; _local5 = (_arg4) ? _arg4 : iDefAnimators; super(_arg1, _local5); } public function set prValue0(_arg1:int):void{ this.iValue0 = Math.max(_arg1, 0); if (!this.iDigits0){ return; }; this.iValue0 = Math.min(this.iValue0, (Math.pow(10, this.iDigits0.length) - 1)); Draw(); } public function set prValue(_arg1:int):void{ this.iValue = Math.max(_arg1, 0); if (!this.iDigits){ return; }; this.iValue = Math.min(this.iValue, (Math.pow(10, this.iDigits.length) - 1)); Draw(); } override public function Init():void{ this.iDigits = new Array(); this.iDigits0 = new Array(); super.Init(); } private function Draw():void{ var _local1:Number; var _local2:String; var _local3:String; var _local4:int; var _local5:Number; var _local6:int; _local1 = 0; _local2 = this.iValue0.toString(); _local3 = this.iValue.toString(); _local4 = 0; while (_local4 < this.iDigits0.length) { this.iDigits0[_local4].prAnimationEnabled = this.iAEnabled; _local4++; }; _local4 = 0; while (_local4 < this.iDigits.length) { this.iDigits[_local4].prAnimationEnabled = this.iAEnabled; _local4++; }; if (this.iDigits0.length){ _local4 = (_local2.length - 1); while (_local4 >= 0) { this.iDigits0[_local4].prValue = (_local2.charCodeAt(_local4) - 47); _local4--; }; _local6 = (this.iDigits0.length - _local2.length); _local4 = 0; while (_local4 < _local6) { if (this.iDigits0[_local4].prValue){ this.iDigits0[_local4].prValue = 0; }; _local4++; }; }; if (this.iDigits.length){ _local4 = 0; while (_local4 < _local3.length) { this.iDigits[_local4].prValue = (_local3.charCodeAt(_local4) - 47); _local4++; }; _local6 = this.iDigits.length; _local4 = _local3.length; while (_local4 < _local6) { if (this.iDigits[_local4].prValue){ this.iDigits[_local4].prValue = 0; }; _local4++; }; }; if (this.iDigits0.length){ _local4 = (_local2.length - 1); while (_local4 >= 0) { _local1 = (_local1 + this.iDigits0[_local4].prWidth); _local4--; }; }; if (this.iSeparator){ _local1 = (_local1 + this.iSeparator.prWidth); }; if (this.iDigits.length){ _local4 = 0; while (_local4 < _local3.length) { _local1 = (_local1 + this.iDigits[_local4].prWidth); _local4++; }; }; _local5 = ((this.iWidth - _local1) / 2); if (this.iDigits0.length){ _local4 = 0; while (_local4 < this.iDigits0.length) { if (this.iDigits0[_local4].prValue){ this.iDigits0[_local4].PosValue(_local5, ((this.iWidth - this.iDigits0[_local4].prHeight) / 2)); _local5 = (_local5 + this.iDigits0[_local4].prWidth); }; _local4++; }; }; if (this.iSeparator){ this.iSeparator.Pos(_local5, ((this.iHeight - this.iSeparator.prHeight) / 2)); _local5 = (_local5 + this.iSeparator.prWidth); }; if (this.iDigits.length){ _local4 = 0; while (_local4 < this.iDigits.length) { if (this.iDigits[_local4].prValue){ this.iDigits[_local4].PosValue(_local5, ((this.iHeight - this.iDigits[_local4].prHeight) / 2)); _local5 = (_local5 + this.iDigits[_local4].prWidth); }; _local4++; }; }; } public function get prValue0():int{ return (this.iValue0); } override public function Free():void{ this.iDigits = null; this.iDigits0 = null; this.iSeparator = null; super.Free(); } public function get prValue():int{ return (this.iValue); } } }//package ENGINE.INTERFACE
Section 94
//ODialog (ENGINE.INTERFACE.ODialog) package ENGINE.INTERFACE { import ENGINE.INTERFACE.ANIMATORS.*; public class ODialog extends OWindow { public static const iDefAnimators:Array = [{F:OA_Alpha.Make, iSAlpha:0, iEAlpha:1, iPIter:12}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0, iPIter:12}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:12}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.2, iPIter:12}, null, null, null, null, null, null]; public function ODialog(_arg1:Array, _arg2:Array=null){ var _local3:Array; _local3 = (_arg2) ? _arg2 : ODialog.iDefAnimators; super(_arg1, _local3); } override public function Init():void{ super.Init(); this.SetVisible(false); this.PosCenter(); this.prVisible = true; } } }//package ENGINE.INTERFACE
Section 95
//OInput (ENGINE.INTERFACE.OInput) package ENGINE.INTERFACE { import flash.events.*; import ENGINE.INTERFACE.ELEMENTS.*; import ENGINE.INTERFACE.ANIMATORS.*; public class OInput extends OIObject { public var iText:OInputTextField; public static const iDefAnimators:Array = [{F:OA_Alpha.Make, iSAlpha:0, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.2, iPIter:6}, null, null, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.5, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:6}, null, null]; public function OInput(_arg1:Array, _arg2:Array=null){ var _local3:Array; _local3 = ((_arg2)==null) ? OInput.iDefAnimators : _arg2; super(_arg1, _local3); } public function set prText(_arg1:String):void{ this.iText.prText = _arg1; } override public function Init():void{ super.Init(); this.addEventListener(KeyboardEvent.KEY_UP, OnKeyUp); } public function get prText():String{ return (this.iText.prText); } protected function OnKeyUp(_arg1:KeyboardEvent):void{ if ((((_arg1.keyCode == 13)) && ((this.parent is OWindow)))){ (this.parent as OWindow).OnPress(null, this); }; } } }//package ENGINE.INTERFACE
Section 96
//OInterface (ENGINE.INTERFACE.OInterface) package ENGINE.INTERFACE { import ENGINE.INTERFACE.ELEMENTS.*; import ENGINE.INTERFACE.ANIMATORS.*; public class OInterface { public static const iDefLBButtonAnimators:Array = [{F:OA_Alpha.Make, iSAlpha:0, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.2, iPIter:6}, null, null, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.6, iPIter:4}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:4}, {F:OA_Scale.Make, iSScale:1, iEScale:0.8, iPIter:4}, {F:OA_Scale.Make, iSScale:0.8, iEScale:1, iPIter:4}]; public static const iDefAnimators:Array = [{F:OA_Alpha.Make, iSAlpha:0, iEAlpha:1, iPIter:12}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0, iPIter:12}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:12}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.2, iPIter:12}, null, null, null, null, null, null]; public static const iDefSlowAnimators:Array = [{F:OA_Alpha.Make, iSAlpha:0, iEAlpha:1, iPIter:30}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0, iPIter:30}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:30}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.2, iPIter:30}, null, null, null, null, null, null]; public static function OHtmlTextFieldMake(_arg1:Array):OHtmlTextField{ return (new OHtmlTextField(_arg1[1], _arg1[2], _arg1[3], _arg1[4], _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9], _arg1[10])); } public static function OIObjectMake(_arg1:Array):OIObject{ var _local2:OIObject; _local2 = new OIObject(_arg1[1], _arg1[2]); _local2.Pos(_arg1[3], _arg1[4]); return (_local2); } public static function OProgressMake(_arg1:Array):OProgress{ return (new OProgress(_arg1[1], _arg1[2])); } public static function OInputTextFieldMake(_arg1:Array):OInputTextField{ return (new OInputTextField(_arg1[1], _arg1[2], _arg1[3], _arg1[4], _arg1[5], _arg1[6], _arg1[7], _arg1[8], _arg1[9], _arg1[10], _arg1[11])); } public static function OTabMake(_arg1:Array):OTab{ return (new OTab(_arg1[1], _arg1[2], _arg1[3], _arg1[4], _arg1[5])); } public static function OCounterMake(_arg1:Array):OCounter{ return (new OCounter(_arg1[1], _arg1[2], _arg1[3], _arg1[4])); } } }//package ENGINE.INTERFACE
Section 97
//OIObject (ENGINE.INTERFACE.OIObject) package ENGINE.INTERFACE { import ENGINE.DISPLAY.*; import flash.events.*; import flash.display.*; import flash.geom.*; import ENGINE.INTERFACE.ANIMATORS.*; import ENGINE.CORE.*; public class OIObject extends OSprite { protected var iTrigger:uint; protected var iAEnabled:Boolean;// = true protected var iAManager:OAnimatorManager; protected var iState:int; protected var iAParams:Array; protected var iParam:Array; public static var trActive:uint = 2; public static var trPress:uint = 16; public static var trRool:uint = 8; public static var trFocus:uint = 3; public static var trVisible:uint = 1; public function OIObject(_arg1:Array, _arg2:Array=null){ iTrigger = (trVisible | trActive); iAEnabled = true; super(); this.iParam = _arg1; this.iAParams = _arg2; this.Init(); } public function get prMouseEnabled():Boolean{ return (((this.prVisible) && (this.prActive))); } public function get prRool():Boolean{ return (((this.iTrigger & trRool) > 0)); } public function set prFocus(_arg1:Boolean):void{ if (_arg1){ this.iTrigger = (this.iTrigger | trFocus); if (this.iAManager){ this.AddAnimator(this.iAParams[OAnimatorManager.anFocusIn]); }; } else { this.iTrigger = (this.iTrigger & ~(trFocus)); if (this.iAManager){ this.AddAnimator(this.iAParams[OAnimatorManager.anFocusOut]); }; }; } override public function get prVisible():Boolean{ return (((this.iTrigger & trVisible) > 0)); } public function set prRool(_arg1:Boolean):void{ if (_arg1){ this.iTrigger = (this.iTrigger | trRool); if (this.iAManager){ this.AddAnimator(this.iAParams[OAnimatorManager.anRoolOver]); }; } else { this.iTrigger = (this.iTrigger & ~(trRool)); if (this.iAManager){ this.AddAnimator(this.iAParams[OAnimatorManager.anRoolOut]); }; }; } override public function set prVisible(_arg1:Boolean):void{ if (_arg1){ this.iTrigger = (this.iTrigger | trVisible); if (this.iAManager){ this.AddAnimator(this.iAParams[OAnimatorManager.anShow], false); }; } else { this.iTrigger = (this.iTrigger & ~(trVisible)); if (this.iAManager){ this.AddAnimator(this.iAParams[OAnimatorManager.anHide], false); }; }; if (((!(this.iAManager)) || (!(this.iAEnabled)))){ this.visible = _arg1; }; this.mouseEnabled = this.prMouseEnabled; this.mouseChildren = this.mouseEnabled; } public function OnRollOver(_arg1:MouseEvent):void{ this.prRool = true; } public function Init():void{ var _local1:int; var _local2:int; var _local3:int; var _local4:DisplayObject; var _local5:String; if (this.iParam){ _local1 = this.iParam.length; _local2 = 0; while (_local2 < _local1) { _local3 = this.iParam[_local2].length; _local4 = this.iParam[_local2][0](this.iParam[_local2]); _local5 = this.iParam[_local2][(_local3 - 3)]; if (_local5){ if ((this[_local5] is Array)){ this[_local5][this.iParam[_local2][(_local3 - 2)]] = _local4; } else { this[_local5] = _local4; }; }; if ((_local4 is OIObject)){ (_local4 as OIObject).SetVisible(this.iParam[_local2][(_local3 - 1)]); } else { if ((_local4 is IDisplayObject)){ (_local4 as IDisplayObject).prVisible = this.iParam[_local2][(_local3 - 1)]; } else { _local4.visible = this.iParam[_local2][(_local3 - 1)]; }; }; this.addChild(_local4); _local2++; }; }; this.iAManager = (this.iAParams) ? new OAnimatorManager(this) : null; this.tabEnabled = false; this.addEventListener(Event.ENTER_FRAME, OnEnterFrame); this.addEventListener(MouseEvent.ROLL_OVER, OnRollOver); this.addEventListener(MouseEvent.ROLL_OUT, OnRollOut); this.addEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown); this.addEventListener(MouseEvent.MOUSE_UP, OnMouseUp); } public function get prAnimationEnabled():Boolean{ return (this.iAEnabled); } public function set prActive(_arg1:Boolean):void{ if (_arg1){ this.iTrigger = (this.iTrigger | trActive); if (this.iAManager){ this.AddAnimator(this.iAParams[OAnimatorManager.anActivate]); }; } else { this.iTrigger = (this.iTrigger & ~(trActive)); if (this.iAManager){ this.AddAnimator(this.iAParams[OAnimatorManager.anDeactivate]); }; }; this.mouseEnabled = this.prMouseEnabled; this.mouseChildren = this.mouseEnabled; } public function OnMouseUp(_arg1:MouseEvent):void{ this.prPress = false; } public function get prPress():Boolean{ return (((this.iTrigger & trPress) > 0)); } public function get State():int{ return (this.iState); } public function OnPress(_arg1:Event, _arg2):void{ } public function OnRollOut(_arg1:MouseEvent):void{ this.prRool = false; } override public function Free():void{ this.removeEventListener(MouseEvent.MOUSE_UP, OnMouseUp); this.removeEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown); this.removeEventListener(MouseEvent.ROLL_OUT, OnRollOut); this.removeEventListener(MouseEvent.ROLL_OVER, OnRollOver); this.removeEventListener(Event.ENTER_FRAME, OnEnterFrame); super.Free(); if (this.iAManager){ this.iAManager.Free(); }; this.iAManager = null; } public function get prAnimation():Boolean{ var _local1:int; if (((this.iAManager) && (this.iAManager.prAnimation))){ return (true); }; _local1 = 0; while (_local1 < this.numChildren) { if (!(this.getChildAt(_local1) is OIObject)){ } else { if ((this.getChildAt(_local1) as OIObject).prAnimation){ return (true); }; }; _local1++; }; return (false); } public function get prActive():Boolean{ return (((this.iTrigger & trActive) > 0)); } public function PosCenter(_arg1:Number=800, _arg2:Number=600):void{ var _local3:Rectangle; _local3 = this.getBounds(this); this.Pos(OGlobal.ScaleFloor((((_arg1 - this.prWidth) - (OGlobal.ToLocal(_local3.x) * 2)) / 2)), OGlobal.ScaleFloor((((_arg2 - this.prHeight) - (OGlobal.ToLocal(_local3.y) * 2)) / 2))); } public function AddAnimator(_arg1:Object, _arg2:Boolean=true):void{ var _local3:Boolean; _local3 = (_arg2) ? ((((this.iAManager) && (this.prVisible))) && (this.iAEnabled)) : ((this.iAManager) && (this.iAEnabled)); if (_local3){ this.iAManager.AddAnimator(_arg1); }; } public function set prAnimationEnabled(_arg1:Boolean):void{ this.iAEnabled = _arg1; } public function set prPress(_arg1:Boolean):void{ if (_arg1){ this.iTrigger = (this.iTrigger | trPress); if (this.iAManager){ this.AddAnimator(this.iAParams[OAnimatorManager.anPress]); }; } else { this.iTrigger = (this.iTrigger & ~(trPress)); if (this.iAManager){ this.AddAnimator(this.iAParams[OAnimatorManager.anUnpress]); }; }; } public function OnMouseDown(_arg1:MouseEvent):void{ this.prPress = true; } public function OnEnterFrame(_arg1:Event):void{ if (this.iAManager){ this.iAManager.OnEnterFrame(); }; } public function SetVisible(_arg1:Boolean):void{ this.prAnimationEnabled = false; this.prVisible = _arg1; this.prAnimationEnabled = true; } public function set prAnimatorParams(_arg1:Array):void{ this.iAParams = _arg1; if (!this.iAManager){ this.iAManager = new OAnimatorManager(this); }; } public function set State(_arg1:int):void{ this.iState = _arg1; } public function get prAnimatorParams():Array{ return (this.iAParams); } public function get prFocus():Boolean{ return (((this.iTrigger & trFocus) > 0)); } } }//package ENGINE.INTERFACE
Section 98
//OListBox (ENGINE.INTERFACE.OListBox) package ENGINE.INTERFACE { import flash.events.*; import ENGINE.INTERFACE.ELEMENTS.*; import ENGINE.INTERFACE.ANIMATORS.*; import ENGINE.CORE.*; public class OListBox extends OIObject { private var iLBParams:Array; private var iEGenP:Function; private var iElements:Array; public var iDown:OButton; private var iEGen:Array; public var iUp:OButton; private var iEShowInd:int; private var iSelection:Boolean;// = true private var iECoord:Array; private var iECount:int; private var iCycling:Boolean; private var iECurInd:int; private var iPageScrool:Boolean; public static const iDefAnimators:Array = [{F:OA_Alpha.Make, iSAlpha:0, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.2, iPIter:6}, null, null, {F:OA_AlphaInd.Make, iSAlpha:-1, iEAlpha:0.6, iInd:[0], iPIter:6}, {F:OA_AlphaInd.Make, iSAlpha:-1, iEAlpha:1, iInd:[0], iPIter:6}, null, null]; public function OListBox(_arg1:Array, _arg2:Array, _arg3:Function, _arg4:Array, _arg5:Array, _arg6:Array=null){ var _local7:Array; iSelection = true; _local7 = (_arg6) ? _arg6 : iDefAnimators; this.iEGen = _arg2; this.iEGenP = _arg3; this.iECoord = _arg4; this.iLBParams = _arg5; this.iECount = this.iECoord.length; super(_arg1, _local7); } public function SetCurrentElement(_arg1, _arg2:Array=null):void{ var _local3:int; if (((!(_arg1)) && (!(_arg2)))){ this.FreeElements(); this.iLBParams = null; this.iECurInd = 0; this.iEShowInd = 0; return; }; if (_arg2){ this.iLBParams = _arg2; }; if (!this.iLBParams){ return; }; this.iECurInd = 0; _local3 = 0; while (_local3 < this.iLBParams.length) { if (_arg1 == this.iLBParams[_local3]){ this.iECurInd = _local3; break; }; _local3++; }; this.iEShowInd = this.iECurInd; if ((this.iEShowInd + this.iECount) >= this.iLBParams.length){ this.iEShowInd = (this.iLBParams.length - this.iECount); }; if (this.iEShowInd < 0){ this.iEShowInd = 0; }; InitElements(); } protected function UnpressElements(_arg1:OListBoxElement):void{ var _local2:int; _local2 = 0; while (_local2 < this.iElements.length) { if (!this.iElements[_local2]){ } else { if (this.iElements[_local2] == _arg1){ this.iECurInd = (this.iEShowInd + _local2); } else { if (this.iElements[_local2].prPress){ this.iElements[_local2].prPress = false; }; }; }; _local2++; }; } public function get prPageScrool():Boolean{ return (this.iPageScrool); } protected function InitElements():void{ var _local1:int; var _local2:int; var _local3:int; var _local4:Boolean; this.FreeElements(); if (this.iLBParams == null){ return; }; _local1 = 0; _local2 = (((this.iEShowInd + this.iECount) <= this.iLBParams.length)) ? (this.iEShowInd + this.iECount) : this.iLBParams.length; _local3 = this.iEShowInd; while (_local3 < _local2) { this.iEGenP(this.iEGen, this.iLBParams[_local3]); this.iElements[_local1] = this.iEGen[0](this.iEGen); this.iElements[_local1].Pos(OGlobal.ScaleFloor(this.iECoord[_local1][0]), OGlobal.ScaleFloor(this.iECoord[_local1][1])); this.iElements[_local1].mouseEnabled = this.iSelection; this.addChild(this.iElements[_local1]); if ((((this.iECurInd == _local3)) && (this.iSelection))){ this.iElements[_local1].prPress = true; }; _local1++; _local3++; }; if (((this.iUp) && (this.iDown))){ if (this.iCycling){ _local4 = (this.iLBParams) ? (this.iLBParams.length > this.iECount) : false; if (this.iUp.prVisible != _local4){ this.iUp.prVisible = _local4; }; if (this.iDown.prVisible != _local4){ this.iDown.prVisible = _local4; }; } else { if ((((this.iEShowInd == 0)) && (this.iUp.prVisible))){ if (this.iUp.prPress){ this.iUp.prPress = false; }; this.iUp.prVisible = false; }; if ((((this.iEShowInd > 0)) && (!(this.iUp.prVisible)))){ this.iUp.prVisible = true; }; if (((((this.iEShowInd + this.iECount) >= this.iLBParams.length)) && (this.iDown.prVisible))){ if (this.iDown.prPress){ this.iDown.prPress = false; }; this.iDown.prVisible = false; }; if (((((this.iEShowInd + this.iECount) < this.iLBParams.length)) && (!(this.iDown.prVisible)))){ this.iDown.prVisible = true; }; }; }; } public function set prPageScrool(_arg1:Boolean):void{ this.iPageScrool = _arg1; } override public function Free():void{ this.iUp = null; this.iDown = null; this.iElements = null; super.Free(); } public function set prCurrentInd(_arg1:int):void{ if (!this.iLBParams){ return; }; this.SetCurrentElement(this.iLBParams[_arg1]); } override public function Init():void{ super.Init(); this.iElements = new Array(); this.InitElements(); } public function set prLBParams(_arg1:Array):void{ this.iLBParams = _arg1; this.iECurInd = 0; this.iEShowInd = 0; this.InitElements(); } public function get prCurrentInd():int{ return (this.iECurInd); } public function set prSelection(_arg1:Boolean):void{ this.iSelection = _arg1; InitElements(); } public function set prCycling(_arg1:Boolean):void{ this.iCycling = _arg1; InitElements(); } override public function OnPress(_arg1:Event, _arg2):void{ if ((_arg2 is OListBoxElement)){ this.UnpressElements((_arg2 as OListBoxElement)); }; if ((((_arg2 == this.iUp)) && (this.SkipElements((this.iPageScrool) ? -(this.iECount) : -1)))){ this.InitElements(); }; if ((((_arg2 == this.iDown)) && (this.SkipElements((this.iPageScrool) ? this.iECount : 1)))){ this.InitElements(); }; if ((this.parent is OIObject)){ (this.parent as OIObject).OnPress(_arg1, this); }; } public function get prSelection():Boolean{ return (this.iSelection); } protected function FreeElements():void{ var _local1:int; _local1 = 0; while (_local1 < this.iElements.length) { if (!this.iElements[_local1]){ } else { this.removeChild(this.iElements[_local1]); this.iElements[_local1].Free(); this.iElements[_local1] = null; }; _local1++; }; } protected function SkipElements(_arg1:int):Boolean{ var _local2:int; if (!this.iLBParams){ return (false); }; _local2 = (this.iEShowInd + _arg1); if ((_local2 + this.iECount) >= this.iLBParams.length){ _local2 = (this.iCycling) ? (_local2 - this.iLBParams.length) : (this.iLBParams.length - this.iECount); }; if (_local2 < 0){ _local2 = (this.iCycling) ? (this.iLBParams.length + _local2) : 0; }; if (this.iEShowInd == _local2){ return (false); }; this.iEShowInd = _local2; if (!this.iSelection){ this.iECurInd = this.iEShowInd; }; return (true); } public function get prCurrentLBParam(){ return ((this.iLBParams) ? this.iLBParams[this.iECurInd] : null); } public function get prCycling():Boolean{ return (this.iCycling); } } }//package ENGINE.INTERFACE
Section 99
//OProgress (ENGINE.INTERFACE.OProgress) package ENGINE.INTERFACE { import ENGINE.DISPLAY.*; import flash.geom.*; public class OProgress extends OIObject { public var iProgressBG:OBitmap; private var iPBG:OBitmap; public var iProgress:OBitmap; private var iValue:Number; public function OProgress(_arg1:Array, _arg2:Array=null){ super(_arg1, _arg2); } public function set prValue(_arg1:Number):void{ var _local2:int; var _local3:Rectangle; var _local4:Rectangle; if (_arg1 < 0){ _arg1 = 0; } else { if (_arg1 > 100){ _arg1 = 100; }; }; if (this.iValue != _arg1){ _local2 = Math.round(((iProgressBG.prOBM.iBM.width * _arg1) / 100)); _local3 = new Rectangle(0, 0, _local2, this.iProgressBG.prOBM.iBM.height); _local4 = new Rectangle(_local2, 0, (iProgressBG.prOBM.iBM.width - _local2), this.iProgressBG.prOBM.iBM.height); this.iProgressBG.prOBM.iBM.fillRect(this.iPBG.prOBM.iBM.rect, 0); this.iProgressBG.prOBM.iBM.copyPixels(this.iProgress.prOBM.iBM, _local3, new Point(0, 0)); this.iProgressBG.prOBM.iBM.copyPixels(this.iPBG.prOBM.iBM, _local4, new Point(_local2, 0)); }; this.iValue = _arg1; } override public function Init():void{ super.Init(); if (this.iProgressBG){ this.iPBG = this.iProgressBG.Clone(); }; } override public function Free():void{ this.iProgressBG = null; this.iProgress = null; super.Free(); } public function get prValue():Number{ return (this.iValue); } } }//package ENGINE.INTERFACE
Section 100
//OTab (ENGINE.INTERFACE.OTab) package ENGINE.INTERFACE { import ENGINE.DISPLAY.*; import ENGINE.INTERFACE.ANIMATORS.*; public class OTab extends OIObject { private var iVAnimator:Object; private var iCurInd:int; protected var iWidth:Number; protected var iHeight:Number; public static const iDefAnimators:Array = [{F:OA_Alpha.Make, iSAlpha:0, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:1, iPIter:6}, {F:OA_Alpha.Make, iSAlpha:-1, iEAlpha:0.2, iPIter:6}, null, null, null, null, null, null]; public static const iDefVAnimator:Object = {F:OA_AlphaFade.Make, iSAlpha:-1, iEAlpha:0, iSInd:[0], iEInd:[1], iPIter:3}; public function OTab(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Object=null, _arg5:Array=null){ var _local6:Array; this.iWidth = _arg2; this.iHeight = _arg3; this.iVAnimator = (_arg4) ? _arg4 : iDefVAnimator; _local6 = (_arg5) ? _arg5 : iDefAnimators; super(_arg1, _local6); } override public function get prWidth():Number{ return (this.iWidth); } public function get prElements():int{ return (this.numChildren); } public function set prValue(_arg1:int):void{ if (_arg1 < 0){ _arg1 = 0; } else { if (_arg1 >= this.numChildren){ _arg1 = (this.numChildren - 1); }; }; if (((this.iAEnabled) && (this.iVAnimator))){ if (this.iCurInd == _arg1){ return; }; this.iVAnimator.iSInd = [this.iCurInd]; this.iVAnimator.iEInd = [_arg1]; this.AddAnimator(this.iVAnimator, false); } else { if ((this.getChildAt(this.iCurInd) is IDisplayObject)){ (this.getChildAt(this.iCurInd) as IDisplayObject).prVisible = false; }; if ((this.getChildAt(_arg1) is IDisplayObject)){ (this.getChildAt(_arg1) as IDisplayObject).prVisible = true; }; }; this.iCurInd = _arg1; } override public function Init():void{ super.Init(); (this.getChildAt(0) as IDisplayObject).prVisible = true; } public function get prValue():int{ return (this.iCurInd); } override public function get prHeight():Number{ return (this.iHeight); } public function PosValue(_arg1:Number, _arg2:Number):void{ (this.getChildAt(this.iCurInd) as IDisplayObject).Pos((_arg1 - this.prX), (_arg2 - this.prY)); } } }//package ENGINE.INTERFACE
Section 101
//OWindow (ENGINE.INTERFACE.OWindow) package ENGINE.INTERFACE { public class OWindow extends OIObject { public function OWindow(_arg1:Array, _arg2:Array=null){ super(_arg1, _arg2); } } }//package ENGINE.INTERFACE
Section 102
//OEffectInk (ENGINE.SKIN.OEffectInk) package ENGINE.SKIN { import ENGINE.DISPLAY.*; import flash.display.*; import flash.geom.*; import ENGINE.DISPLAY.EFFECTS.*; import flash.filters.*; import ENGINE.CORE.*; public class OEffectInk extends OEffect { private var iShadow:DropShadowFilter; private var iAlpha:Number;// = 1 private var iBlur:BlurFilter; private var iColor:uint;// = 0 private var iBorder:Number;// = 0 public function OEffectInk(){ iColor = 0; iAlpha = 1; iBorder = 0; super(); } override public function Apply(_arg1:Array, _arg2:Number=1, _arg3:Number=0, _arg4:Number=0):OBM{ var _local5:OBM; var _local6:Number; var _local7:Number; var _local8:Sprite; var _local9:Sprite; var _local10:ColorTransform; var _local11:Bitmap; var _local12:Array; var _local13:BitmapData; _local5 = OBM.Make([null, _arg1, _arg2, _arg3, _arg4, 0]); _local6 = OGlobal.Scale; _local7 = this.iAlpha; _local8 = new Sprite(); _local9 = new Sprite(); _local9.x = iBorder; _local9.y = iBorder; _local9.alpha = _local7; _local8.addChild(_local9); _local10 = new ColorTransform(0, 0, 0); _local10.color = this.iColor; _local11 = new Bitmap(_local5.iBM); _local11.transform.colorTransform = _local10; _local12 = new Array(); if (this.iBlur){ _local12.push(this.iBlur); }; if (this.iShadow){ _local12.push(this.iShadow); }; _local11.filters = _local12; _local9.addChild(_local11); _local13 = new BitmapData((_local8.width + (this.iBorder * 2)), (_local8.height + (this.iBorder * 2)), true, 0); _local13.draw(_local8); return (new OBM(_local13, (-(this.iBorder) + _local5.iX), (-(this.iBorder) + _local5.iY), _local5.iWidth, _local5.iHeight)); } override public function Init(_arg1:String, _arg2:String, _arg3:Number=1):void{ var _local4:Object; var _local5:Object; var _local6:Number; var _local7:int; var _local8:int; var _local9:Array; var _local10:Array; _local4 = this.iColors.GetItem(_arg1); _local5 = this.iFilters.GetItem(_arg2); if (_local5 == null){ return; }; _local6 = (OGlobal.Scale * _arg3); if (_local4 == null){ _local4 = new Object(); if (_arg1.search(/,/) < 0){ _local4.iCH = Number(_arg1); if (_local4.iCH == undefined){ return; }; _local4.iCH = (_local4.iCH % 360); _local7 = Math.floor((_local4.iCH / 30)); _local8 = ((_local7 + 1) % 12); _local9 = [75, 75, 90, 90, 75, 75, 60, 60, 45, 45, 60, 60]; _local4.iCS = ((_local9[_local7] + ((_local9[_local8] - _local9[_local7]) * ((_local4.iCH / 30) - _local7))) * 0.01); _local4.iCB = 0.9; _local4.iCA = 0.9; } else { _local10 = _arg1.split(/,/); _local4.iCH = _local10[0]; _local4.iCS = _local10[1]; _local4.iCB = _local10[2]; _local4.iCA = _local10[3]; }; }; if (_local5.iFSD > 0){ this.iShadow = new DropShadowFilter((_local5.iFSD * _local6), _local5.iAngle, ODisplay.HSBToRGB(_local4.iCH, _local4.iCS, (_local4.iCB * 0.5)), (0.25 * _local4.iCA), (_local5.iFSB * _local6), (_local5.iFSB * _local6), 1, 2, false, true, true); } else { this.iShadow = null; }; if (_local5.iFB > 0){ this.iBlur = new BlurFilter((_local5.iFB * _local6), (_local5.iFB * _local6)); } else { this.iBlur = null; }; this.iColor = ODisplay.HSBToRGB(_local4.iCH, _local4.iCS, _local4.iCB); this.iAlpha = _local4.iCA; this.iBorder = Math.ceil((_local5.iBorder * _local6)); } } }//package ENGINE.SKIN
Section 103
//OMultiplayer (ENGINE.SMARTFOX.OMultiplayer) package ENGINE.SMARTFOX { import it.gotoandplay.smartfoxserver.handlers.*; import it.gotoandplay.smartfoxserver.data.*; import it.gotoandplay.smartfoxserver.*; import it.gotoandplay.smartfoxserver.util.*; import ENGINE.CORE.*; import flash.utils.*; public class OMultiplayer extends SmartFoxClient { private var iCmd:String; private var iError:String; private var iConnection:Boolean;// = false private var iUsersCount:int; private var iErrorsCount:int; private var iPassword:String; private var iAdress:String; private var iXTName:String; private var iTimer:int; private var iGameParams:Array; private var iCMessages:Array; private var iOpponentID:int; private var iOpponentName:String; private var iName:String; private var iTurn:Array; private var iState:int; private var iGRoomParams:Array; private var iZoneName:String; public static const stInGame:int = 13; public static const stLogin:int = 3; public static const cmdJoinGameRoom:String = "jgr"; public static const cmdZoneUsersCount:String = "zuc"; public static const stNone:int = 0; public static const stMainRoomError:int = 6; public static const stGameError:int = 12; public static const cmdJoinGame:String = "jgm"; public static const cmdJoinMainRoom:String = "jmr"; public static const stConnection:int = 1; public static const stLoginError:int = 4; public static const cmdMakeTurn:String = "m"; public static const cmdCmd:String = "cmd"; public static const stConnectionError:int = 2; public static const stInZone:int = 7; public static const stInGameRoom:int = 10; public static const cmdChatMessage:String = "c"; public static const stJoinGameRoom:int = 8; public static const stGameRoomError:int = 9; public static const stJoinGame:int = 11; public static const stJoinMainRoom:int = 5; public function OMultiplayer(_arg1:Boolean=false){ iConnection = false; super(_arg1); this.State = stNone; } private function OnConnectionLost(_arg1:SFSEvent):void{ this.iConnection = false; this.State = stNone; } public function get prActiveRoomID():int{ return (this.activeRoomId); } public function get prErrorsCount():int{ return (this.iErrorsCount); } public function get prError():String{ return (this.iError); } public function get prChatMessage():String{ return (((this.iCMessages.length)==0) ? null : this.iCMessages.shift()); } public function ClearChatMessage(_arg1:Boolean=false):void{ if (_arg1){ this.iCMessages = new Array(); } else { if (this.iCMessages[0]){ this.iCMessages.shift(); }; }; } public function Init(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:String, _arg6:String=""):void{ if (((!(OGlobal.CheckDomain(_arg1))) || (!((this.iState == stNone))))){ return; }; this.iAdress = _arg2; this.iZoneName = _arg3; this.iXTName = _arg4; this.iName = _arg5; this.iPassword = _arg6; this.iTurn = new Array(); this.iCMessages = new Array(); addEventListener(SFSEvent.onConnection, OnConnection); addEventListener(SFSEvent.onConnectionLost, OnConnectionLost); addEventListener(SFSEvent.onExtensionResponse, OnExtensionResponse); this.State = stConnection; } private function OnConnection(_arg1:SFSEvent):void{ if (!_arg1.params.success){ this.iError = _arg1.params.error; this.iErrorsCount++; this.iConnection = false; }; this.State = (_arg1.params.success) ? stLogin : stConnectionError; } public function set prGRoomParams(_arg1:Array):void{ this.iGRoomParams = _arg1; } public function ClearOpponentTurn(_arg1:Boolean=false):void{ if (_arg1){ this.iTurn = new Array(); } else { if (this.iTurn[0]){ this.iTurn.shift(); }; }; } private function OnExtensionResponse(_arg1:SFSEvent):void{ var _local2:Array; if (_arg1.params.type != "str"){ return; }; _local2 = _arg1.params.dataObj; if (_local2 == null){ return; }; switch (_local2[0]){ case "logOK": this.myUserId = int(_local2[2]); this.myUserName = _local2[3]; this.amIModerator = (Number(_local2[4]) > 0); this.State = stJoinMainRoom; break; case "logKO": this.iError = _local2[2]; this.State = stLoginError; this.iErrorsCount++; break; case cmdJoinMainRoom: if (_local2[2]){ this.activeRoomId = _local2[3]; this.State = stInZone; } else { this.State = stMainRoomError; }; break; case cmdZoneUsersCount: this.iUsersCount = _local2[2]; break; case cmdJoinGameRoom: if (_local2[2] < 0){ this.activeRoomId = -1; this.State = OMultiplayer.stGameRoomError; } else { this.activeRoomId = _local2[2]; this.State = stInGameRoom; }; break; case cmdJoinGame: if (_local2[2] < 0){ this.activeRoomId = -1; this.playerId = -1; this.iOpponentID = -1; this.iOpponentName = null; this.State = OMultiplayer.stGameError; } else { this.activeRoomId = _local2[2]; this.playerId = _local2[3]; this.iOpponentID = _local2[4]; this.iOpponentName = _local2[5]; this.State = OMultiplayer.stInGame; }; break; case cmdMakeTurn: this.iTurn.push(_local2[2]); break; case cmdChatMessage: this.iCMessages.push(_local2[2]); break; case cmdCmd: this.iCmd = _local2[2]; break; }; } public function ChatMessage(_arg1:Array=null):void{ this.sendXtMessage(this.iXTName, OMultiplayer.cmdChatMessage, (_arg1) ? [_arg1.toString()] : ["0"], "str"); } public function get State():int{ return (this.iState); } public function set prGameParams(_arg1:Array):void{ this.iGameParams = _arg1; } public function get prUsersCount():int{ return (this.iUsersCount); } public function Free():void{ if (this.iConnection){ this.disconnect(); }; this.iConnection = false; this.iCMessages = null; removeEventListener(SFSEvent.onConnection, OnConnection); removeEventListener(SFSEvent.onConnectionLost, OnConnectionLost); removeEventListener(SFSEvent.onExtensionResponse, OnExtensionResponse); } public function Turn(_arg1:Array=null):void{ if (this.iState > stLoginError){ this.sendXtMessage(this.iXTName, OMultiplayer.cmdMakeTurn, (_arg1) ? [_arg1.toString(), this.iOpponentID] : ["0", this.iOpponentID], "str"); }; } public function get prOpponentTurn():String{ return (((this.iTurn.length)>0) ? this.iTurn[0] : null); } public function get prGRoomParams():Array{ return (this.iGRoomParams); } public function get prOpponentName():String{ return ((this.iOpponentName) ? this.iOpponentName.slice(0, (this.iOpponentName.length - 3)) : "..."); } public function get prGameParams():Array{ return (this.iGameParams); } public function ClearCmd():void{ this.iCmd = null; } public function OnEnterFrame():void{ if (((!(this.isConnected)) && ((this.iState > stConnection)))){ this.iState = stNone; }; switch (this.iState){ case stInZone: if ((getTimer() - this.iTimer) > 180000){ this.cmdSend(cmdZoneUsersCount); this.iTimer = getTimer(); }; break; }; } public function get prCmd():String{ return (this.iCmd); } public function get prFullOpponentName():String{ return ((this.iOpponentName) ? this.iOpponentName : "..."); } public function get prPlayerID():int{ return (this.playerId); } public function set State(_arg1:int):void{ var aState = _arg1; if ((((aState > stConnectionError)) && (!(this.isConnected)))){ return; }; this.iState = aState; switch (aState){ case stNone: this.iError = null; this.iUsersCount = 0; this.myUserId = -1; this.myUserName = null; this.amIModerator = false; this.playerId = -1; this.activeRoomId = -1; this.Free(); break; case stConnection: try { this.connect(this.iAdress, 9339); this.iConnection = true; } catch(error:Error) { OSystem.iUserText2 = "connect error"; this.State = stConnectionError; }; break; case stLogin: this.login(this.iZoneName, this.iName, this.iPassword); break; case stJoinMainRoom: this.cmdSend(cmdJoinMainRoom); break; case stInZone: this.playerId = -1; this.iOpponentID = -1; this.iOpponentName = null; this.iTimer = getTimer(); this.cmdSend(cmdZoneUsersCount); break; case stJoinGameRoom: this.cmdSend(cmdJoinGameRoom, this.iGRoomParams); break; case stJoinGame: this.cmdSend(cmdJoinGame, this.iGameParams); break; }; } public function cmdSend(_arg1:String, _arg2:Array=null):void{ if (this.iState > stLoginError){ this.sendXtMessage(this.iXTName, _arg1, (_arg2) ? _arg2 : [], "str"); }; } } }//package ENGINE.SMARTFOX
Section 104
//Room (it.gotoandplay.smartfoxserver.data.Room) package it.gotoandplay.smartfoxserver.data { public class Room { private var maxUsers:int; private var userList:Array; private var name:String; private var userCount:int; private var specCount:int; private var id:int; private var myPlayerIndex:int; private var priv:Boolean; private var temp:Boolean; private var limbo:Boolean; private var maxSpectators:int; private var game:Boolean; private var variables:Array; public function Room(_arg1:int, _arg2:String, _arg3:int, _arg4:int, _arg5:Boolean, _arg6:Boolean, _arg7:Boolean, _arg8:Boolean, _arg9:int=0, _arg10:int=0){ this.id = _arg1; this.name = _arg2; this.maxSpectators = _arg4; this.maxUsers = _arg3; this.temp = _arg5; this.game = _arg6; this.priv = _arg7; this.limbo = _arg8; this.userCount = _arg9; this.specCount = _arg10; this.userList = []; this.variables = []; } public function getVariable(_arg1:String):Object{ return (variables[_arg1]); } public function addUser(_arg1:User, _arg2:int):void{ userList[_arg2] = _arg1; userCount++; } public function getName():String{ return (this.name); } public function getId():int{ return (this.id); } public function setIsLimbo(_arg1:Boolean):void{ this.limbo = _arg1; } public function clearVariables():void{ this.variables = []; } public function isTemp():Boolean{ return (this.temp); } public function getMaxSpectators():int{ return (this.maxSpectators); } public function setVariables(_arg1:Array):void{ this.variables = _arg1; } public function isGame():Boolean{ return (this.game); } public function getUser(_arg1):User{ var _local2:User; var _local3:String; var _local4:User; _local2 = null; if (typeof(_arg1) == "number"){ _local2 = userList[_arg1]; } else { if (typeof(_arg1) == "string"){ for (_local3 in userList) { _local4 = this.userList[_local3]; if (_local4.getName() == _arg1){ _local2 = _local4; break; }; }; }; }; return (_local2); } public function setUserCount(_arg1:int):void{ this.userCount = _arg1; } public function getVariables():Array{ return (variables); } public function getUserCount():int{ return (this.userCount); } public function isLimbo():Boolean{ return (this.limbo); } public function getSpectatorCount():int{ return (this.specCount); } public function setSpectatorCount(_arg1:int):void{ this.specCount = _arg1; } public function setMyPlayerIndex(_arg1:int):void{ this.myPlayerIndex = _arg1; } public function removeUser(_arg1:int):void{ delete userList[_arg1]; userCount--; } public function getMyPlayerIndex():int{ return (this.myPlayerIndex); } public function isPrivate():Boolean{ return (this.priv); } public function getMaxUsers():int{ return (this.maxUsers); } public function getUserList():Array{ return (this.userList); } } }//package it.gotoandplay.smartfoxserver.data
Section 105
//User (it.gotoandplay.smartfoxserver.data.User) package it.gotoandplay.smartfoxserver.data { public class User { private var isSpec:Boolean; private var name:String; private var id:int; private var pId:int; private var variables:Array; private var isMod:Boolean; public function User(_arg1:int, _arg2:String){ this.id = _arg1; this.name = _arg2; this.variables = []; this.isSpec = false; this.isMod = false; } public function setModerator(_arg1:Boolean):void{ this.isMod = _arg1; } public function getName():String{ return (this.name); } public function getVariables():Array{ return (this.variables); } public function getId():int{ return (this.id); } public function getPlayerId():int{ return (this.pId); } public function setPlayerId(_arg1:int):void{ this.pId = _arg1; } public function setIsSpectator(_arg1:Boolean):void{ this.isSpec = _arg1; } public function isSpectator():Boolean{ return (this.isSpec); } public function clearVariables():void{ this.variables = []; } public function getVariable(_arg1:String):Object{ return (this.variables[_arg1]); } public function setVariables(_arg1:Array):void{ this.variables = _arg1; } public function isModerator():Boolean{ return (this.isMod); } } }//package it.gotoandplay.smartfoxserver.data
Section 106
//ExtHandler (it.gotoandplay.smartfoxserver.handlers.ExtHandler) package it.gotoandplay.smartfoxserver.handlers { import it.gotoandplay.smartfoxserver.*; import it.gotoandplay.smartfoxserver.util.*; public class ExtHandler implements IMessageHandler { private var sfs:SmartFoxClient; public function ExtHandler(_arg1:SmartFoxClient){ this.sfs = _arg1; } public function handleMessage(_arg1:Object, _arg2:String):void{ var _local3:Object; var _local4:SFSEvent; var _local5:XML; var _local6:String; var _local7:int; var _local8:String; var _local9:Object; if (_arg2 == SmartFoxClient.XTMSG_TYPE_XML){ _local5 = (_arg1 as XML); _local6 = _local5.body.@action; _local7 = int(_local5.body.@id); if (_local6 == "xtRes"){ _local8 = _local5.body.toString(); _local9 = ObjectSerializer.getInstance().deserialize(_local8); _local3 = {}; _local3.dataObj = _local9; _local3.type = _arg2; _local4 = new SFSEvent(SFSEvent.onExtensionResponse, _local3); sfs.dispatchEvent(_local4); }; } else { if (_arg2 == SmartFoxClient.XTMSG_TYPE_JSON){ _local3 = {}; _local3.dataObj = _arg1.o; _local3.type = _arg2; _local4 = new SFSEvent(SFSEvent.onExtensionResponse, _local3); sfs.dispatchEvent(_local4); } else { if (_arg2 == SmartFoxClient.XTMSG_TYPE_STR){ _local3 = {}; _local3.dataObj = _arg1; _local3.type = _arg2; _local4 = new SFSEvent(SFSEvent.onExtensionResponse, _local3); sfs.dispatchEvent(_local4); }; }; }; } } }//package it.gotoandplay.smartfoxserver.handlers
Section 107
//IMessageHandler (it.gotoandplay.smartfoxserver.handlers.IMessageHandler) package it.gotoandplay.smartfoxserver.handlers { public interface IMessageHandler { function handleMessage(_arg1:Object, _arg2:String):void; } }//package it.gotoandplay.smartfoxserver.handlers
Section 108
//SysHandler (it.gotoandplay.smartfoxserver.handlers.SysHandler) package it.gotoandplay.smartfoxserver.handlers { import it.gotoandplay.smartfoxserver.data.*; import it.gotoandplay.smartfoxserver.*; import it.gotoandplay.smartfoxserver.util.*; import flash.utils.*; public class SysHandler implements IMessageHandler { private var sfs:SmartFoxClient; private var handlersTable:Array; public function SysHandler(_arg1:SmartFoxClient){ this.sfs = _arg1; handlersTable = []; handlersTable["apiOK"] = this.handleApiOK; handlersTable["apiKO"] = this.handleApiKO; handlersTable["logOK"] = this.handleLoginOk; handlersTable["logKO"] = this.handleLoginKo; handlersTable["rmList"] = this.handleRoomList; handlersTable["uCount"] = this.handleUserCountChange; handlersTable["joinOK"] = this.handleJoinOk; handlersTable["joinKO"] = this.handleJoinKo; handlersTable["uER"] = this.handleUserEnterRoom; handlersTable["userGone"] = this.handleUserLeaverRoom; handlersTable["pubMsg"] = this.handlePublicMessage; handlersTable["prvMsg"] = this.handlePrivateMessage; handlersTable["dmnMsg"] = this.handleAdminMessage; handlersTable["modMsg"] = this.handleModMessage; handlersTable["dataObj"] = this.handleASObject; handlersTable["rVarsUpdate"] = this.handleRoomVarsUpdate; handlersTable["roomAdd"] = this.handleRoomAdded; handlersTable["roomDel"] = this.handleRoomDeleted; handlersTable["rndK"] = this.handleRandomKey; handlersTable["roundTripRes"] = this.handleRoundTripBench; handlersTable["uVarsUpdate"] = this.handleUserVarsUpdate; handlersTable["createRmKO"] = this.handleCreateRoomError; handlersTable["bList"] = this.handleBuddyList; handlersTable["bUpd"] = this.handleBuddyListUpdate; handlersTable["bAdd"] = this.handleBuddyAdded; handlersTable["roomB"] = this.handleBuddyRoom; handlersTable["leaveRoom"] = this.handleLeaveRoom; handlersTable["swSpec"] = this.handleSpectatorSwitched; } private function handleRoomDeleted(_arg1:Object):void{ var _local2:int; var _local3:Array; var _local4:Object; var _local5:SFSEvent; _local2 = int(_arg1.body.rm.@id); _local3 = sfs.getAllRooms(); _local4 = {}; _local4.room = _local3[_local2]; delete _local3[_local2]; _local5 = new SFSEvent(SFSEvent.onRoomDeleted, _local4); sfs.dispatchEvent(_local5); } public function handleMessage(_arg1:Object, _arg2:String):void{ var _local3:XML; var _local4:String; var _local5:Function; _local3 = (_arg1 as XML); _local4 = _local3.body.@action; _local5 = handlersTable[_local4]; if (_local5 != null){ _local5.apply(this, [_arg1]); } else { trace(("Unknown sys command: " + _local4)); }; } public function handleUserEnterRoom(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:String; var _local5:Boolean; var _local6:Boolean; var _local7:int; var _local8:XMLList; var _local9:Room; var _local10:User; var _local11:Object; var _local12:SFSEvent; _local2 = int(_arg1.body.@r); _local3 = int(_arg1.body.u.@i); _local4 = _arg1.body.u.n; _local5 = (_arg1.body.u.@m == "1"); _local6 = (_arg1.body.u.@s == "1"); _local7 = ((_arg1.body.u.@p)!=null) ? int(_arg1.body.u.@p) : -1; _local8 = _arg1.body.u.vars["var"]; _local9 = sfs.getRoom(_local2); _local10 = new User(_local3, _local4); _local10.setModerator(_local5); _local10.setIsSpectator(_local6); _local10.setPlayerId(_local7); _local9.addUser(_local10, _local3); if (_arg1.body.u.vars.toString().length > 0){ populateVariables(_local10.getVariables(), _arg1.body.u); }; _local11 = {}; _local11.roomId = _local2; _local11.user = _local10; _local12 = new SFSEvent(SFSEvent.onUserEnterRoom, _local11); sfs.dispatchEvent(_local12); } public function handleUserVarsUpdate(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:User; var _local5:Array; var _local6:Object; var _local7:SFSEvent; _local2 = int(_arg1.body.@r); _local3 = int(_arg1.body.user.@id); _local4 = sfs.getRoom(_local2).getUser(_local3); _local5 = []; if (_arg1.body.vars.toString().length > 0){ populateVariables(_local4.getVariables(), _arg1.body, _local5); }; _local6 = {}; _local6.user = _local4; _local6.changedVars = _local5; _local7 = new SFSEvent(SFSEvent.onUserVariablesUpdate, _local6); sfs.dispatchEvent(_local7); } public function handleUserLeaverRoom(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:Room; var _local5:String; var _local6:Object; var _local7:SFSEvent; _local2 = int(_arg1.body.user.@id); _local3 = int(_arg1.body.@r); _local4 = sfs.getRoom(_local3); _local5 = _local4.getUser(_local2).getName(); _local4.removeUser(_local2); _local6 = {}; _local6.roomId = _local3; _local6.userId = _local2; _local6.userName = _local5; _local7 = new SFSEvent(SFSEvent.onUserLeaveRoom, _local6); sfs.dispatchEvent(_local7); } public function handlePrivateMessage(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:String; var _local5:User; var _local6:Object; var _local7:SFSEvent; _local2 = int(_arg1.body.@r); _local3 = int(_arg1.body.user.@id); _local4 = _arg1.body.txt; _local5 = sfs.getRoom(_local2).getUser(_local3); _local6 = {}; _local6.message = Entities.decodeEntities(_local4); _local6.sender = _local5; _local6.roomId = _local2; _local6.userId = _local3; _local7 = new SFSEvent(SFSEvent.onPrivateMessage, _local6); sfs.dispatchEvent(_local7); } private function handleCreateRoomError(_arg1:Object):void{ var _local2:String; var _local3:Object; var _local4:SFSEvent; _local2 = _arg1.body.room.@e; _local3 = {}; _local3.error = _local2; _local4 = new SFSEvent(SFSEvent.onCreateRoomError, _local3); sfs.dispatchEvent(_local4); } private function handleBuddyRoom(_arg1:Object):void{ var _local2:String; var _local3:Array; var _local4:int; var _local5:Object; var _local6:SFSEvent; _local2 = _arg1.body.br.@r; _local3 = _local2.split(","); _local4 = 0; while (_local4 < _local3.length) { _local3[_local4] = int(_local3[_local4]); _local4++; }; _local5 = {}; _local5.idList = _local3; _local6 = new SFSEvent(SFSEvent.onBuddyRoom, _local5); sfs.dispatchEvent(_local6); } private function handleBuddyListUpdate(_arg1:Object):void{ var _local2:Object; var _local3:SFSEvent; var _local4:Object; var _local5:XMLList; var _local6:Object; var _local7:Boolean; var _local8:String; var _local9:XML; _local2 = {}; _local3 = null; if (_arg1.body.b != null){ _local4 = {}; _local4.isOnline = ((_arg1.body.b.@s == "1")) ? true : false; _local4.name = _arg1.body.b.n.toString(); _local4.id = _arg1.body.b.@i; _local4.variables = {}; _local5 = _arg1.body.b.vs; if (_local5.toString().length > 0){ for each (_local9 in _local5.v) { _local4.variables[_local9.@n.toString()] = _local9.v.toString(); }; }; _local6 = null; _local7 = false; for (_local8 in sfs.buddyList) { _local6 = sfs.buddyList[_local8]; if (_local6.name == _local4.name){ sfs.buddyList[_local8] = _local4; _local7 = true; break; }; }; _local2.buddy = _local4; _local3 = new SFSEvent(SFSEvent.onBuddyListUpdate, _local2); sfs.dispatchEvent(_local3); } else { _local2.error = _arg1.body.err.toString(); _local3 = new SFSEvent(SFSEvent.onBuddyListError, _local2); sfs.dispatchEvent(_local3); }; } public function handleUserCountChange(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:int; var _local5:Room; var _local6:Object; var _local7:SFSEvent; _local2 = int(_arg1.body.@u); _local3 = int(_arg1.body.@s); _local4 = int(_arg1.body.@r); _local5 = sfs.getAllRooms()[_local4]; if (_local5 != null){ _local5.setUserCount(_local2); _local5.setSpectatorCount(_local3); _local6 = {}; _local6.room = _local5; _local7 = new SFSEvent(SFSEvent.onUserCountChange, _local6); sfs.dispatchEvent(_local7); }; } private function handleRandomKey(_arg1:Object):void{ var _local2:String; var _local3:Object; var _local4:SFSEvent; _local2 = _arg1.body.k.toString(); _local3 = {}; _local3.key = _local2; _local4 = new SFSEvent(SFSEvent.onRandomKey, _local3); sfs.dispatchEvent(_local4); } public function handlePublicMessage(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:String; var _local5:User; var _local6:Object; var _local7:SFSEvent; _local2 = int(_arg1.body.@r); _local3 = int(_arg1.body.user.@id); _local4 = _arg1.body.txt; _local5 = sfs.getRoom(_local2).getUser(_local3); _local6 = {}; _local6.message = Entities.decodeEntities(_local4); _local6.sender = _local5; _local6.roomId = _local2; _local7 = new SFSEvent(SFSEvent.onPublicMessage, _local6); sfs.dispatchEvent(_local7); } public function handleAdminMessage(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:String; var _local5:Object; var _local6:SFSEvent; _local2 = int(_arg1.body.@r); _local3 = int(_arg1.body.user.@id); _local4 = _arg1.body.txt; _local5 = {}; _local5.message = Entities.decodeEntities(_local4); _local6 = new SFSEvent(SFSEvent.onAdminMessage, _local5); sfs.dispatchEvent(_local6); } public function dispatchDisconnection():void{ var _local1:SFSEvent; _local1 = new SFSEvent(SFSEvent.onConnectionLost, null); sfs.dispatchEvent(_local1); } private function handleSpectatorSwitched(_arg1:Object):void{ var _local2:int; var _local3:Object; var _local4:SFSEvent; _local2 = int(_arg1.body.rm.@id); sfs.playerId = int(_arg1.body.pid.@id); _local3 = {}; _local3.success = (sfs.playerId > 0); _local3.newId = sfs.playerId; _local3.room = sfs.getRoom(_local2); _local4 = new SFSEvent(SFSEvent.onSpectatorSwitched, _local3); sfs.dispatchEvent(_local4); } public function handleLoginOk(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:String; var _local5:Object; var _local6:SFSEvent; _local2 = int(_arg1.body.login.@id); _local3 = int(_arg1.body.login.@mod); _local4 = _arg1.body.login.@n; sfs.amIModerator = (_local3 == 1); sfs.myUserId = _local2; sfs.myUserName = _local4; sfs.playerId = -1; _local5 = {}; _local5.success = true; _local5.name = _local4; _local5.error = ""; _local6 = new SFSEvent(SFSEvent.onLogin, _local5); sfs.dispatchEvent(_local6); sfs.getRoomList(); } public function handleRoomVarsUpdate(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:Room; var _local5:Array; var _local6:Object; var _local7:SFSEvent; _local2 = int(_arg1.body.@r); _local3 = int(_arg1.body.user.@id); _local4 = sfs.getRoom(_local2); _local5 = []; if (_arg1.body.vars.toString().length > 0){ populateVariables(_local4.getVariables(), _arg1.body, _local5); }; _local6 = {}; _local6.room = _local4; _local6.changedVars = _local5; _local7 = new SFSEvent(SFSEvent.onRoomVariablesUpdate, _local6); sfs.dispatchEvent(_local7); } public function handleRoomList(_arg1:Object):void{ var _local2:Array; var _local3:XML; var _local4:Object; var _local5:SFSEvent; var _local6:int; var _local7:Room; _local2 = sfs.getAllRooms(); for each (_local3 in _arg1.body.rmList.rm) { _local6 = int(_local3.@id); _local7 = new Room(_local6, _local3.n, int(_local3.@maxu), int(_local3.@maxs), (_local3.@temp == "1"), (_local3.@game == "1"), (_local3.@priv == "1"), (_local3.@lmb == "1"), int(_local3.@ucnt), int(_local3.@scnt)); if (_local3.vars.toString().length > 0){ populateVariables(_local7.getVariables(), _local3); }; _local2[_local6] = _local7; }; _local4 = {}; _local4.roomList = _local2; _local5 = new SFSEvent(SFSEvent.onRoomListUpdate, _local4); sfs.dispatchEvent(_local5); } private function handleBuddyAdded(_arg1:Object):void{ var _local2:Object; var _local3:XMLList; var _local4:Object; var _local5:SFSEvent; var _local6:XML; _local2 = {}; _local2.isOnline = ((_arg1.body.b.@s == "1")) ? true : false; _local2.name = _arg1.body.b.n.toString(); _local2.id = _arg1.body.b.@i; _local2.variables = {}; _local3 = _arg1.body.b.vs; if (_local3.toString().length > 0){ for each (_local6 in _local3.v) { _local2.variables[_local6.@n.toString()] = _local6.v.toString(); }; }; sfs.buddyList.push(_local2); _local4 = {}; _local4.list = sfs.buddyList; _local5 = new SFSEvent(SFSEvent.onBuddyList, _local4); sfs.dispatchEvent(_local5); } private function handleRoomAdded(_arg1:Object):void{ var _local2:int; var _local3:String; var _local4:int; var _local5:int; var _local6:Boolean; var _local7:Boolean; var _local8:Boolean; var _local9:Boolean; var _local10:Room; var _local11:Array; var _local12:Object; var _local13:SFSEvent; _local2 = int(_arg1.body.rm.@id); _local3 = _arg1.body.rm.name; _local4 = int(_arg1.body.rm.@max); _local5 = int(_arg1.body.rm.@spec); _local6 = ((_arg1.body.rm.@temp == "1")) ? true : false; _local7 = ((_arg1.body.rm.@game == "1")) ? true : false; _local8 = ((_arg1.body.rm.@priv == "1")) ? true : false; _local9 = ((_arg1.body.rm.@limbo == "1")) ? true : false; _local10 = new Room(_local2, _local3, _local4, _local5, _local6, _local7, _local8, _local9); _local11 = sfs.getAllRooms(); _local11[_local2] = _local10; if (_arg1.body.rm.vars.toString().length > 0){ populateVariables(_local10.getVariables(), _arg1.body.rm); }; _local12 = {}; _local12.room = _local10; _local13 = new SFSEvent(SFSEvent.onRoomAdded, _local12); sfs.dispatchEvent(_local13); } private function populateVariables(_arg1:Array, _arg2:Object, _arg3:Array=null):void{ var _local4:XML; var _local5:String; var _local6:String; var _local7:String; for each (_local4 in _arg2.vars["var"]) { _local5 = _local4.@n; _local6 = _local4.@t; _local7 = _local4; if (_arg3 != null){ _arg3.push(_local5); _arg3[_local5] = true; }; if (_local6 == "b"){ _arg1[_local5] = Boolean(_local7); } else { if (_local6 == "n"){ _arg1[_local5] = Number(_local7); } else { if (_local6 == "s"){ _arg1[_local5] = _local7; } else { if (_local6 == "x"){ delete _arg1[_local5]; }; }; }; }; }; } private function handleLeaveRoom(_arg1:Object):void{ var _local2:int; var _local3:Object; var _local4:SFSEvent; _local2 = int(_arg1.body.rm.@id); _local3 = {}; _local3.roomId = _local2; _local4 = new SFSEvent(SFSEvent.onRoomLeft, _local3); sfs.dispatchEvent(_local4); } public function handleLoginKo(_arg1:Object):void{ var _local2:Object; var _local3:SFSEvent; _local2 = {}; _local2.success = false; _local2.error = _arg1.body.login.@e; _local3 = new SFSEvent(SFSEvent.onLogin, _local2); sfs.dispatchEvent(_local3); } public function handleModMessage(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:String; var _local5:User; var _local6:Object; var _local7:SFSEvent; _local2 = int(_arg1.body.@r); _local3 = int(_arg1.body.user.@id); _local4 = _arg1.body.txt; _local5 = sfs.getRoom(_local2).getUser(_local3); _local6 = {}; _local6.message = Entities.decodeEntities(_local4); _local6.sender = _local5; _local7 = new SFSEvent(SFSEvent.onModeratorMessage, _local6); sfs.dispatchEvent(_local7); } public function handleApiOK(_arg1:Object):void{ var _local2:SFSEvent; sfs.isConnected = true; _local2 = new SFSEvent(SFSEvent.onConnection, {success:true}); sfs.dispatchEvent(_local2); } private function handleRoundTripBench(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:Object; var _local5:SFSEvent; _local2 = getTimer(); _local3 = (_local2 - sfs.getBenchStartTime()); _local4 = {}; _local4.elapsed = _local3; _local5 = new SFSEvent(SFSEvent.onRoundTripResponse, _local4); sfs.dispatchEvent(_local5); } public function handleJoinOk(_arg1:Object):void{ var _local2:int; var _local3:XMLList; var _local4:XMLList; var _local5:int; var _local6:Room; var _local7:XML; var _local8:Object; var _local9:SFSEvent; var _local10:String; var _local11:int; var _local12:Boolean; var _local13:Boolean; var _local14:int; var _local15:User; _local2 = int(_arg1.body.@r); _local3 = _arg1.body; _local4 = _arg1.body.uLs.u; _local5 = int(_arg1.body.pid.@id); sfs.activeRoomId = _local2; _local6 = sfs.getRoom(_local2); sfs.playerId = _local5; _local6.setMyPlayerIndex(_local5); if (_local3.vars.toString().length > 0){ _local6.clearVariables(); populateVariables(_local6.getVariables(), _local3); }; for each (_local7 in _local4) { _local10 = _local7.n; _local11 = int(_local7.@i); _local12 = ((_local7.@m == "1")) ? true : false; _local13 = ((_local7.@s == "1")) ? true : false; _local14 = ((_local7.p == undefined)) ? -1 : int(_local7.p); _local15 = new User(_local11, _local10); _local15.setModerator(_local12); _local15.setIsSpectator(_local13); _local15.setPlayerId(_local14); if (_local7.vars.toString().length > 0){ populateVariables(_local15.getVariables(), _local7); }; _local6.addUser(_local15, _local11); }; sfs.changingRoom = false; _local8 = {}; _local8.room = _local6; _local9 = new SFSEvent(SFSEvent.onJoinRoom, _local8); sfs.dispatchEvent(_local9); } public function handleJoinKo(_arg1:Object):void{ var _local2:Object; var _local3:SFSEvent; sfs.changingRoom = false; _local2 = {}; _local2.error = _arg1.body.error.@msg; _local3 = new SFSEvent(SFSEvent.onJoinRoomError, _local2); sfs.dispatchEvent(_local3); } public function handleASObject(_arg1:Object):void{ var _local2:int; var _local3:int; var _local4:String; var _local5:User; var _local6:Object; var _local7:Object; var _local8:SFSEvent; _local2 = int(_arg1.body.@r); _local3 = int(_arg1.body.user.@id); _local4 = _arg1.body.dataObj; _local5 = sfs.getRoom(_local2).getUser(_local3); _local6 = ObjectSerializer.getInstance().deserialize(new XML(_local4)); _local7 = {}; _local7.obj = _local6; _local7.sender = _local5; _local8 = new SFSEvent(SFSEvent.onObjectReceived, _local7); sfs.dispatchEvent(_local8); } private function handleBuddyList(_arg1:Object):void{ var _local2:XMLList; var _local3:Object; var _local4:Object; var _local5:SFSEvent; var _local6:XML; var _local7:XMLList; var _local8:XML; _local2 = _arg1.body.bList; _local4 = {}; _local5 = null; if (((!((_local2 == null))) && (!((_local2.b.length == null))))){ if (_local2.toString().length > 0){ for each (_local6 in _local2.b) { _local3 = {}; _local3.isOnline = ((_local6.@s == "1")) ? true : false; _local3.name = _local6.n.toString(); _local3.id = _local6.@i; _local3.variables = {}; _local7 = _local6.vs; if (_local7.toString().length > 0){ for each (_local8 in _local7.v) { _local3.variables[_local8.@n.toString()] = _local8.v.toString(); }; }; sfs.buddyList.push(_local3); }; }; _local4.list = sfs.buddyList; _local5 = new SFSEvent(SFSEvent.onBuddyList, _local4); sfs.dispatchEvent(_local5); } else { _local4.error = _arg1.body.err.toString(); _local5 = new SFSEvent(SFSEvent.onBuddyListError, _local4); sfs.dispatchEvent(_local5); }; } public function handleApiKO(_arg1:Object):void{ var _local2:Object; var _local3:SFSEvent; _local2 = {}; _local2.success = false; _local2.error = "API are obsolete, please upgrade"; _local3 = new SFSEvent(SFSEvent.onConnection, _local2); sfs.dispatchEvent(_local3); } } }//package it.gotoandplay.smartfoxserver.handlers
Section 109
//JSON (it.gotoandplay.smartfoxserver.json.JSON) package it.gotoandplay.smartfoxserver.json { public class JSON { public static function decode(_arg1:String):Object{ var _local2:JSONDecoder; _local2 = new JSONDecoder(_arg1); return (_local2.getObject()); } public static function encode(_arg1:Object):String{ var _local2:JSONEncoder; _local2 = new JSONEncoder(_arg1); return (_local2.getString()); } } }//package it.gotoandplay.smartfoxserver.json
Section 110
//JSONDecoder (it.gotoandplay.smartfoxserver.json.JSONDecoder) package it.gotoandplay.smartfoxserver.json { public class JSONDecoder { private var tokenizer:JSONTokenizer; private var token:JSONToken; private var obj:Object; public function JSONDecoder(_arg1:String){ tokenizer = new JSONTokenizer(_arg1); nextToken(); obj = parseValue(); } private function parseValue():Object{ switch (token.type){ case JSONTokenType.LEFT_BRACE: return (parseObject()); case JSONTokenType.LEFT_BRACKET: return (parseArray()); case JSONTokenType.STRING: case JSONTokenType.NUMBER: case JSONTokenType.TRUE: case JSONTokenType.FALSE: case JSONTokenType.NULL: return (token.value); default: tokenizer.parseError(("Unexpected " + token.value)); }; return (null); } private function nextToken():JSONToken{ return ((token = tokenizer.getNextToken())); } private function parseObject():Object{ var _local1:Object; var _local2:String; _local1 = new Object(); nextToken(); if (token.type == JSONTokenType.RIGHT_BRACE){ return (_local1); }; while (true) { if (token.type == JSONTokenType.STRING){ _local2 = String(token.value); nextToken(); if (token.type == JSONTokenType.COLON){ nextToken(); _local1[_local2] = parseValue(); nextToken(); if (token.type == JSONTokenType.RIGHT_BRACE){ return (_local1); }; if (token.type == JSONTokenType.COMMA){ nextToken(); } else { tokenizer.parseError(("Expecting } or , but found " + token.value)); }; } else { tokenizer.parseError(("Expecting : but found " + token.value)); }; } else { tokenizer.parseError(("Expecting string but found " + token.value)); }; }; return (null); } private function parseArray():Array{ var _local1:Array; _local1 = new Array(); nextToken(); if (token.type == JSONTokenType.RIGHT_BRACKET){ return (_local1); }; while (true) { _local1.push(parseValue()); nextToken(); if (token.type == JSONTokenType.RIGHT_BRACKET){ return (_local1); }; if (token.type == JSONTokenType.COMMA){ nextToken(); } else { tokenizer.parseError(("Expecting ] or , but found " + token.value)); }; }; return (null); } public function getObject():Object{ return (obj); } } }//package it.gotoandplay.smartfoxserver.json
Section 111
//JSONEncoder (it.gotoandplay.smartfoxserver.json.JSONEncoder) package it.gotoandplay.smartfoxserver.json { public class JSONEncoder { private var jsonString:String; public function JSONEncoder(_arg1:Object){ jsonString = convertToString(_arg1); } private function arrayToString(_arg1:Array):String{ var _local2:String; var _local3:int; _local2 = ""; _local3 = 0; while (_local3 < _arg1.length) { if (_local2.length > 0){ _local2 = (_local2 + ","); }; _local2 = (_local2 + convertToString(_arg1[_local3])); _local3++; }; return ((("[" + _local2) + "]")); } private function convertToString(_arg1:Object):String{ if ((_arg1 is String)){ return (escapeString((_arg1 as String))); }; if ((_arg1 is Number)){ return ((isFinite((_arg1 as Number))) ? _arg1.toString() : "null"); } else { if ((_arg1 is Boolean)){ return ((_arg1) ? "true" : "false"); } else { if ((_arg1 is Array)){ return (arrayToString((_arg1 as Array))); }; if ((((_arg1 is Object)) && (!((_arg1 == null))))){ return (objectToString(_arg1)); }; }; }; return ("null"); } private function escapeString(_arg1:String):String{ var _local2:String; var _local3:String; var _local4:Number; var _local5:int; var _local6:String; var _local7:String; _local2 = ""; _local4 = _arg1.length; _local5 = 0; while (_local5 < _local4) { _local3 = _arg1.charAt(_local5); switch (_local3){ case "\"": _local2 = (_local2 + "\\\""); break; case "\\": _local2 = (_local2 + "\\\\"); break; case "\b": _local2 = (_local2 + "\\b"); break; case "\f": _local2 = (_local2 + "\\f"); break; case "\n": _local2 = (_local2 + "\\n"); break; case "\r": _local2 = (_local2 + "\\r"); break; case "\t": _local2 = (_local2 + "\\t"); break; default: if (_local3 < " "){ _local6 = _local3.charCodeAt(0).toString(16); _local7 = ((_local6.length == 2)) ? "00" : "000"; _local2 = (_local2 + (("\\u" + _local7) + _local6)); } else { _local2 = (_local2 + _local3); }; }; _local5++; }; return ((("\"" + _local2) + "\"")); } private function objectToString(_arg1:Object):String{ var _local2:String; var _local3:Object; var _local4:String; _local2 = ""; for (_local4 in _arg1) { _local3 = _arg1[_local4]; if ((_local3 is Function)){ } else { if (_local2.length > 0){ _local2 = (_local2 + ","); }; _local2 = (_local2 + ((escapeString(_local4) + ":") + convertToString(_local3))); }; }; return ((("{" + _local2) + "}")); } public function getString():String{ return (jsonString); } } }//package it.gotoandplay.smartfoxserver.json
Section 112
//JSONParseError (it.gotoandplay.smartfoxserver.json.JSONParseError) package it.gotoandplay.smartfoxserver.json { public class JSONParseError extends Error { private var _text:String; private var _location:int; public function JSONParseError(_arg1:String="", _arg2:int=0, _arg3:String=""){ super(_arg1); _location = _arg2; _text = _arg3; } public function get text():String{ return (_text); } public function get location():int{ return (_location); } } }//package it.gotoandplay.smartfoxserver.json
Section 113
//JSONToken (it.gotoandplay.smartfoxserver.json.JSONToken) package it.gotoandplay.smartfoxserver.json { public class JSONToken { private var _value:Object; private var _type:int; public function JSONToken(_arg1:int=-1, _arg2:Object=null){ _type = _arg1; _value = _arg2; } public function set value(_arg1:Object):void{ _value = _arg1; } public function get value():Object{ return (_value); } public function set type(_arg1:int):void{ _type = _arg1; } public function get type():int{ return (_type); } } }//package it.gotoandplay.smartfoxserver.json
Section 114
//JSONTokenizer (it.gotoandplay.smartfoxserver.json.JSONTokenizer) package it.gotoandplay.smartfoxserver.json { public class JSONTokenizer { private var loc:int; private var ch:String; private var obj:Object; private var jsonString:String; public function JSONTokenizer(_arg1:String){ jsonString = _arg1; loc = 0; nextChar(); } private function skipComments():void{ if (ch == "/"){ nextChar(); switch (ch){ case "/": do { nextChar(); } while (((!((ch == "\n"))) && (!((ch == ""))))); nextChar(); break; case "*": nextChar(); while (true) { if (ch == "*"){ nextChar(); if (ch == "/"){ nextChar(); break; }; } else { nextChar(); }; if (ch == ""){ parseError("Multi-line comment not closed"); }; }; break; default: parseError((("Unexpected " + ch) + " encountered (expecting '/' or '*' )")); }; }; } private function isDigit(_arg1:String):Boolean{ return ((((_arg1 >= "0")) && ((_arg1 <= "9")))); } private function readNumber():JSONToken{ var _local1:JSONToken; var _local2:String; var _local3:Number; _local1 = new JSONToken(); _local1.type = JSONTokenType.NUMBER; _local2 = ""; if (ch == "-"){ _local2 = (_local2 + "-"); nextChar(); }; while (isDigit(ch)) { _local2 = (_local2 + ch); nextChar(); }; if (ch == "."){ _local2 = (_local2 + "."); nextChar(); while (isDigit(ch)) { _local2 = (_local2 + ch); nextChar(); }; }; _local3 = Number(_local2); if (isFinite(_local3)){ _local1.value = _local3; return (_local1); }; parseError((("Number " + _local3) + " is not valid!")); return (null); } private function nextChar():String{ return ((ch = jsonString.charAt(loc++))); } private function isHexDigit(_arg1:String):Boolean{ var _local2:String; _local2 = _arg1.toUpperCase(); return (((isDigit(_arg1)) || ((((_local2 >= "A")) && ((_local2 <= "F")))))); } public function getNextToken():JSONToken{ var _local1:JSONToken; var _local2:String; var _local3:String; var _local4:String; _local1 = new JSONToken(); skipIgnored(); switch (ch){ case "{": _local1.type = JSONTokenType.LEFT_BRACE; _local1.value = "{"; nextChar(); break; case "}": _local1.type = JSONTokenType.RIGHT_BRACE; _local1.value = "}"; nextChar(); break; case "[": _local1.type = JSONTokenType.LEFT_BRACKET; _local1.value = "["; nextChar(); break; case "]": _local1.type = JSONTokenType.RIGHT_BRACKET; _local1.value = "]"; nextChar(); break; case ",": _local1.type = JSONTokenType.COMMA; _local1.value = ","; nextChar(); break; case ":": _local1.type = JSONTokenType.COLON; _local1.value = ":"; nextChar(); break; case "t": _local2 = ((("t" + nextChar()) + nextChar()) + nextChar()); if (_local2 == "true"){ _local1.type = JSONTokenType.TRUE; _local1.value = true; nextChar(); } else { parseError(("Expecting 'true' but found " + _local2)); }; break; case "f": _local3 = (((("f" + nextChar()) + nextChar()) + nextChar()) + nextChar()); if (_local3 == "false"){ _local1.type = JSONTokenType.FALSE; _local1.value = false; nextChar(); } else { parseError(("Expecting 'false' but found " + _local3)); }; break; case "n": _local4 = ((("n" + nextChar()) + nextChar()) + nextChar()); if (_local4 == "null"){ _local1.type = JSONTokenType.NULL; _local1.value = null; nextChar(); } else { parseError(("Expecting 'null' but found " + _local4)); }; break; case "\"": _local1 = readString(); break; default: if (((isDigit(ch)) || ((ch == "-")))){ _local1 = readNumber(); } else { if (ch == ""){ return (null); }; parseError((("Unexpected " + ch) + " encountered")); }; }; return (_local1); } private function skipWhite():void{ while (isSpace(ch)) { nextChar(); }; } public function parseError(_arg1:String):void{ throw (new JSONParseError(_arg1, loc, jsonString)); } private function skipIgnored():void{ skipWhite(); skipComments(); skipWhite(); } private function isSpace(_arg1:String):Boolean{ return ((((_arg1 == " ")) || ((_arg1 == "\t")))); } private function readString():JSONToken{ var _local1:JSONToken; var _local2:String; var _local3:String; var _local4:int; _local1 = new JSONToken(); _local1.type = JSONTokenType.STRING; _local2 = ""; nextChar(); while (((!((ch == "\""))) && (!((ch == ""))))) { if (ch == "\\"){ nextChar(); switch (ch){ case "\"": _local2 = (_local2 + "\""); break; case "/": _local2 = (_local2 + "/"); break; case "\\": _local2 = (_local2 + "\\"); break; case "b": _local2 = (_local2 + "\b"); break; case "f": _local2 = (_local2 + "\f"); break; case "n": _local2 = (_local2 + "\n"); break; case "r": _local2 = (_local2 + "\r"); break; case "t": _local2 = (_local2 + "\t"); break; case "u": _local3 = ""; _local4 = 0; while (_local4 < 4) { if (!isHexDigit(nextChar())){ parseError((" Excepted a hex digit, but found: " + ch)); }; _local3 = (_local3 + ch); _local4++; }; _local2 = (_local2 + String.fromCharCode(parseInt(_local3, 16))); break; default: _local2 = (_local2 + ("\\" + ch)); }; } else { _local2 = (_local2 + ch); }; nextChar(); }; if (ch == ""){ parseError("Unterminated string literal"); }; nextChar(); _local1.value = _local2; return (_local1); } } }//package it.gotoandplay.smartfoxserver.json
Section 115
//JSONTokenType (it.gotoandplay.smartfoxserver.json.JSONTokenType) package it.gotoandplay.smartfoxserver.json { public class JSONTokenType { public static const NUMBER:int = 11; public static const FALSE:int = 8; public static const RIGHT_BRACKET:int = 4; public static const NULL:int = 9; public static const TRUE:int = 7; public static const RIGHT_BRACE:int = 2; public static const UNKNOWN:int = -1; public static const COMMA:int = 0; public static const LEFT_BRACKET:int = 3; public static const STRING:int = 10; public static const LEFT_BRACE:int = 1; public static const COLON:int = 6; } }//package it.gotoandplay.smartfoxserver.json
Section 116
//Entities (it.gotoandplay.smartfoxserver.util.Entities) package it.gotoandplay.smartfoxserver.util { public class Entities { private static var hexTable:Array = new Array(); private static var ascTab:Array = []; private static var ascTabRev:Array = []; public static function decodeEntities(_arg1:String):String{ var _local2:String; var _local3:String; var _local4:String; var _local5:String; var _local6:String; var _local7:int; _local7 = 0; _local2 = ""; while (_local7 < _arg1.length) { _local3 = _arg1.charAt(_local7); if (_local3 == "&"){ _local4 = _local3; do { _local7++; _local5 = _arg1.charAt(_local7); _local4 = (_local4 + _local5); } while (_local5 != ";"); _local6 = ascTabRev[_local4]; if (_local6 != null){ _local2 = (_local2 + _local6); } else { _local2 = (_local2 + String.fromCharCode(getCharCode(_local4))); }; } else { _local2 = (_local2 + _local3); }; _local7++; }; trace(((("DECODE: " + _arg1) + ", ") + _local2)); return (_local2); } public static function encodeEntities(_arg1:String):String{ var _local2:String; var _local3:int; var _local4:String; var _local5:int; _local2 = ""; _local3 = 0; while (_local3 < _arg1.length) { _local4 = _arg1.charAt(_local3); _local5 = _arg1.charCodeAt(_local3); if ((((((_local5 == 9)) || ((_local5 == 10)))) || ((_local5 == 13)))){ _local2 = (_local2 + _local4); } else { if ((((_local5 >= 32)) && ((_local5 <= 126)))){ if (ascTab[_local4] != null){ _local2 = (_local2 + ascTab[_local4]); } else { _local2 = (_local2 + _local4); }; } else { _local2 = (_local2 + _local4); }; }; _local3++; }; return (_local2); } public static function getCharCode(_arg1:String):Number{ var _local2:String; _local2 = _arg1.substr(3, _arg1.length); _local2 = _local2.substr(0, (_local2.length - 1)); return (Number(("0x" + _local2))); } ascTab[">"] = "&gt;"; ascTab["<"] = "&lt;"; ascTab["&"] = "&amp;"; ascTab["'"] = "&apos;"; ascTab["\""] = "&quot;"; ascTabRev["&gt;"] = ">"; ascTabRev["&lt;"] = "<"; ascTabRev["&amp;"] = "&"; ascTabRev["&apos;"] = "'"; ascTabRev["&quot;"] = "\""; hexTable["0"] = 0; hexTable["1"] = 1; hexTable["2"] = 2; hexTable["3"] = 3; hexTable["4"] = 4; hexTable["5"] = 5; hexTable["6"] = 6; hexTable["7"] = 7; hexTable["8"] = 8; hexTable["9"] = 9; hexTable["A"] = 10; hexTable["B"] = 11; hexTable["C"] = 12; hexTable["D"] = 13; hexTable["E"] = 14; hexTable["F"] = 15; } }//package it.gotoandplay.smartfoxserver.util
Section 117
//ObjectSerializer (it.gotoandplay.smartfoxserver.util.ObjectSerializer) package it.gotoandplay.smartfoxserver.util { public class ObjectSerializer { private var eof:String; private var debug:Boolean; private var tabs:String; private static var instance:ObjectSerializer; public function ObjectSerializer(_arg1:Boolean=false){ this.tabs = "\t\t\t\t\t\t\t\t\t\t\t\t\t"; setDebug(_arg1); } public function serialize(_arg1:Object):String{ var _local2:Object; _local2 = {}; obj2xml(_arg1, _local2); return (_local2.xmlStr); } private function obj2xml(_arg1:Object, _arg2:Object, _arg3:int=0, _arg4:String=""):void{ var _local5:String; var _local6:String; var _local7:String; var _local8:*; if (_arg3 == 0){ _arg2.xmlStr = ("<dataObj>" + this.eof); } else { if (this.debug){ _arg2.xmlStr = (_arg2.xmlStr + this.tabs.substr(0, _arg3)); }; _local6 = ((_arg1 is Array)) ? "a" : "o"; _arg2.xmlStr = (_arg2.xmlStr + ((((("<obj t='" + _local6) + "' o='") + _arg4) + "'>") + this.eof)); }; for (_local5 in _arg1) { _local7 = typeof(_arg1[_local5]); _local8 = _arg1[_local5]; if ((((((((_local7 == "boolean")) || ((_local7 == "number")))) || ((_local7 == "string")))) || ((_local7 == "null")))){ if (_local7 == "boolean"){ _local8 = Number(_local8); } else { if (_local7 == "null"){ _local7 = "x"; _local8 = ""; } else { if (_local7 == "string"){ _local8 = Entities.encodeEntities(_local8); }; }; }; if (this.debug){ _arg2.xmlStr = (_arg2.xmlStr + this.tabs.substr(0, (_arg3 + 1))); }; _arg2.xmlStr = (_arg2.xmlStr + ((((((("<var n='" + _local5) + "' t='") + _local7.substr(0, 1)) + "'>") + _local8) + "</var>") + this.eof)); } else { if (_local7 == "object"){ obj2xml(_local8, _arg2, (_arg3 + 1), _local5); if (this.debug){ _arg2.xmlStr = (_arg2.xmlStr + this.tabs.substr(0, (_arg3 + 1))); }; _arg2.xmlStr = (_arg2.xmlStr + ("</obj>" + this.eof)); }; }; }; if (_arg3 == 0){ _arg2.xmlStr = (_arg2.xmlStr + ("</dataObj>" + this.eof)); }; } private function setDebug(_arg1:Boolean):void{ this.debug = _arg1; if (this.debug){ this.eof = "\n"; } else { this.eof = ""; }; } private function xml2obj(_arg1:XML, _arg2:Object):void{ var _local3:int; var _local4:XMLList; var _local5:String; var _local6:XML; var _local7:String; var _local8:String; var _local9:String; var _local10:String; var _local11:String; _local3 = 0; _local4 = _arg1.children(); for each (_local6 in _local4) { _local5 = _local6.name().toString(); if (_local5 == "obj"){ _local7 = _local6.@o; _local8 = _local6.@t; if (_local8 == "a"){ _arg2[_local7] = []; } else { if (_local8 == "o"){ _arg2[_local7] = {}; }; }; xml2obj(_local6, _arg2[_local7]); } else { if (_local5 == "var"){ _local9 = _local6.@n; _local10 = _local6.@t; _local11 = _local6.toString(); if (_local10 == "b"){ _arg2[_local9] = ((_local11 == "0")) ? false : true; } else { if (_local10 == "n"){ _arg2[_local9] = Number(_local11); } else { if (_local10 == "s"){ _arg2[_local9] = _local11; } else { if (_local10 == "x"){ _arg2[_local9] = null; }; }; }; }; }; }; }; } private function encodeEntities(_arg1:String):String{ return (_arg1); } public function deserialize(_arg1:String):Object{ var _local2:XML; var _local3:Object; _local2 = new XML(_arg1); _local3 = {}; xml2obj(_local2, _local3); return (_local3); } public static function getInstance(_arg1:Boolean=false):ObjectSerializer{ if (instance == null){ instance = new ObjectSerializer(_arg1); }; return (instance); } } }//package it.gotoandplay.smartfoxserver.util
Section 118
//SFSEvent (it.gotoandplay.smartfoxserver.SFSEvent) package it.gotoandplay.smartfoxserver { import flash.events.*; public class SFSEvent extends Event { public var params:Object; public static const onRoomLeft:String = "onRoomLeft"; public static const onBuddyListUpdate:String = "onBuddyListUpdate"; public static const onUserLeaveRoom:String = "onUserLeaveRoom"; public static const onRoomListUpdate:String = "onRoomListUpdate"; public static const onRoundTripResponse:String = "onRoundTripResponse"; public static const onExtensionResponse:String = "onExtensionResponse"; public static const onConnection:String = "onConnection"; public static const onBuddyListError:String = "onBuddyListError"; public static const onJoinRoom:String = "onJoinRoom"; public static const onUserEnterRoom:String = "onUserEnterRoom"; public static const onBuddyRoom:String = "onBuddyRoom"; public static const onAdminMessage:String = "onAdminMessage"; public static const onPublicMessage:String = "onPublicMessage"; public static const onModeratorMessage:String = "onModMessage"; public static const onPrivateMessage:String = "onPrivateMessage"; public static const onJoinRoomError:String = "onJoinRoomError"; public static const onRoomAdded:String = "onRoomAdded"; public static const onLogin:String = "onLogin"; public static const onSpectatorSwitched:String = "onSpectatorSwitched"; public static const onRoomDeleted:String = "onRoomDeleted"; public static const onConnectionLost:String = "onConnectionLost"; public static const onBuddyList:String = "onBuddyList"; public static const onRoomVariablesUpdate:String = "onRoomVariablesUpdate"; public static const onCreateRoomError:String = "onCreateRoomError"; public static const onUserCountChange:String = "onUserCountChange"; public static const onUserVariablesUpdate:String = "onUserVariablesUpdate"; public static const onRandomKey:String = "onRandomKey"; public static const onObjectReceived:String = "onObjectReceived"; public function SFSEvent(_arg1:String, _arg2:Object){ super(_arg1); this.params = _arg2; } override public function toString():String{ return (formatToString("SFSEvent", "type", "bubbles", "cancelable", "eventPhase", "params")); } override public function clone():Event{ return (new SFSEvent(this.type, this.params)); } } }//package it.gotoandplay.smartfoxserver
Section 119
//SmartFoxClient (it.gotoandplay.smartfoxserver.SmartFoxClient) package it.gotoandplay.smartfoxserver { import flash.events.*; import it.gotoandplay.smartfoxserver.handlers.*; import it.gotoandplay.smartfoxserver.data.*; import it.gotoandplay.smartfoxserver.util.*; import flash.utils.*; import it.gotoandplay.smartfoxserver.json.*; import flash.net.*; public class SmartFoxClient extends EventDispatcher { private var connected:Boolean; private var benchStartTime:int; public var myUserId:int; private var roomList:Array; private var minVersion:Number; public var buddyVars:Array; public var debug:Boolean; private var byteBuffer:ByteArray; private var subVersion:Number; public var buddyList:Array; private var messageHandlers:Array; private var majVersion:Number; private var socketConnection:Socket; private var sysHandler:SysHandler; public var myUserName:String; public var playerId:int; public var amIModerator:Boolean; public var changingRoom:Boolean; private var extHandler:ExtHandler; public var activeRoomId:int; private static const EOM:int = 0; private static const MSG_JSON:String = "{"; public static const XTMSG_TYPE_STR:String = "str"; public static const MODMSG_TO_USER:String = "u"; public static const MODMSG_TO_ZONE:String = "z"; private static const MSG_STR:String = "%"; private static const MSG_XML:String = "<"; public static const XTMSG_TYPE_JSON:String = "json"; public static const XTMSG_TYPE_XML:String = "xml"; public static const MODMSG_TO_ROOM:String = "r"; public function SmartFoxClient(_arg1:Boolean=false){ this.majVersion = 1; this.minVersion = 3; this.subVersion = 4; this.activeRoomId = -1; this.debug = _arg1; this.messageHandlers = []; setupMessageHandlers(); socketConnection = new Socket(); socketConnection.addEventListener(Event.CONNECT, handleSocketConnection); socketConnection.addEventListener(Event.CLOSE, handleSocketDisconnection); socketConnection.addEventListener(ErrorEvent.ERROR, handleSocketError); socketConnection.addEventListener(IOErrorEvent.IO_ERROR, handleIOError); socketConnection.addEventListener(ProgressEvent.SOCKET_DATA, handleSocketData); socketConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleSecurityError); byteBuffer = new ByteArray(); } private function getXmlUserVariable(_arg1:Object):String{ var _local2:String; var _local3:*; var _local4:String; var _local5:String; var _local6:String; _local2 = "<vars>"; for (_local6 in _arg1) { _local3 = _arg1[_local6]; _local5 = typeof(_local3); if (_local5 == "boolean"){ _local4 = "b"; _local3 = (_local3) ? "1" : "0"; } else { if (_local5 == "number"){ _local4 = "n"; } else { if (_local5 == "string"){ _local4 = "s"; } else { if (_local5 == "null"){ _local4 = "x"; }; }; }; }; if (_local4 != null){ _local2 = (_local2 + (((((("<var n='" + _local6) + "' t='") + _local4) + "'><![CDATA[") + _local3) + "]]></var>")); }; }; _local2 = (_local2 + "</vars>"); return (_local2); } private function checkBuddyDuplicates(_arg1:String):Boolean{ var _local2:Boolean; var _local3:Object; _local2 = false; for each (_local3 in buddyList) { if (_local3.name == _arg1){ _local2 = true; break; }; }; return (_local2); } public function getBuddyRoom(_arg1:Object):void{ if (_arg1.id != -1){ send({t:"sys", bid:_arg1.id}, "roomB", -1, (("<b id='" + _arg1.id) + "' />")); }; } private function handleSocketData(_arg1:Event):void{ var _local2:int; var _local3:int; _local2 = socketConnection.bytesAvailable; while (--_local2 >= 0) { _local3 = socketConnection.readByte(); if (_local3 != 0){ byteBuffer.writeByte(_local3); } else { handleMessage(byteBuffer.toString()); byteBuffer = new ByteArray(); }; }; } private function handleSocketError(_arg1:Event):void{ trace("SOCKET ERROR!!!"); } private function getXmlRoomVariable(_arg1:Object):String{ var _local2:String; var _local3:*; var _local4:String; var _local5:String; var _local6:String; _local2 = _arg1.name.toString(); _local3 = _arg1.val.toString(); _local4 = (_arg1.priv) ? "1" : "0"; _local5 = (_arg1.persistent) ? "1" : "0"; _local6 = null; if (typeof(_local3) == "boolean"){ _local6 = "b"; _local3 = (_local3) ? "1" : "0"; } else { if (typeof(_local3) == "number"){ _local6 = "n"; } else { if (typeof(_local3) == "string"){ _local6 = "s"; } else { if (typeof(_local3) == "null"){ _local6 = "x"; }; }; }; }; if (_local6 != null){ return ((((((((((("<var n='" + _local2) + "' t='") + _local6) + "' pr='") + _local4) + "' pe='") + _local5) + "'><![CDATA[") + _local3) + "]]></var>")); }; return (""); } private function handleSocketDisconnection(_arg1:Event):void{ var _local2:SFSEvent; initialize(); _local2 = new SFSEvent(SFSEvent.onConnectionLost, {}); dispatchEvent(_local2); } private function xmlReceived(_arg1:String):void{ var _local2:XML; var _local3:String; var _local4:String; var _local5:int; var _local6:IMessageHandler; _local2 = new XML(_arg1); _local3 = _local2.@t; _local4 = _local2.body.@action; _local5 = _local2.body.@r; _local6 = messageHandlers[_local3]; if (_local6 != null){ _local6.handleMessage(_local2, XTMSG_TYPE_XML); }; } public function switchSpectator(_arg1:int=-1):void{ if (_arg1 == -1){ _arg1 = activeRoomId; }; send({t:"sys"}, "swSpec", _arg1, ""); } public function roundTripBench():void{ this.benchStartTime = getTimer(); send({t:"sys"}, "roundTrip", activeRoomId, ""); } public function joinRoom(_arg1, _arg2:String="", _arg3:Boolean=false, _arg4:Boolean=false, _arg5:int=-1):void{ var _local6:int; var _local7:int; var _local8:Room; var _local9:Object; var _local10:String; var _local11:int; var _local12:String; _local6 = -1; _local7 = (_arg3) ? 1 : 0; if (!this.changingRoom){ if (typeof(_arg1) == "number"){ _local6 = int(_arg1); } else { if (typeof(_arg1) == "string"){ for each (_local8 in roomList) { if (_local8.getName() == _arg1){ _local6 = _local8.getId(); break; }; }; }; }; if (_local6 != -1){ _local9 = {t:"sys"}; _local10 = (_arg4) ? "0" : "1"; _local11 = ((_arg5 > -1)) ? _arg5 : activeRoomId; if (activeRoomId == -1){ _local10 = "0"; _local11 = -1; }; _local12 = (((((((((("<room id='" + _local6) + "' pwd='") + _arg2) + "' spec='") + _local7) + "' leave='") + _local10) + "' old='") + _local11) + "' />"); send(_local9, "joinRoom", activeRoomId, _local12); changingRoom = true; } else { trace("SmartFoxError: requested room to join does not exist!"); }; }; } public function getActiveRoom():Room{ return (roomList[activeRoomId]); } private function makeXmlHeader(_arg1:Object):String{ var _local2:String; var _local3:String; _local2 = "<msg"; for (_local3 in _arg1) { _local2 = (_local2 + ((((" " + _local3) + "='") + _arg1[_local3]) + "'")); }; _local2 = (_local2 + ">"); return (_local2); } private function strReceived(_arg1:String):void{ var _local2:Array; var _local3:String; var _local4:IMessageHandler; _local2 = _arg1.substr(1, (_arg1.length - 2)).split(MSG_STR); _local3 = _local2[0]; _local4 = messageHandlers[_local3]; if (_local4 != null){ _local4.handleMessage(_local2.splice(1, (_local2.length - 1)), XTMSG_TYPE_STR); }; } public function getRoomByName(_arg1:String):Room{ var _local2:Room; var _local3:Room; _local2 = null; for each (_local3 in roomList) { if (_local3.getName() == _arg1){ _local2 = _local3; break; }; }; return (_local2); } public function loadBuddyList():void{ send({t:"sys"}, "loadB", -1, ""); } public function leaveRoom(_arg1:int):void{ var _local2:Object; var _local3:String; _local2 = {t:"sys"}; _local3 = (("<rm id='" + _arg1) + "' />"); send(_local2, "leaveRoom", _arg1, _local3); } private function addMessageHandler(_arg1:String, _arg2:IMessageHandler):void{ if (this.messageHandlers[_arg1] == null){ this.messageHandlers[_arg1] = _arg2; } else { trace((("Warning, message handler called: " + _arg1) + " already exist!")); }; } public function getAllRooms():Array{ return (roomList); } public function setBuddyVariables(_arg1:Array):void{ var _local2:Object; var _local3:String; var _local4:String; var _local5:String; _local2 = {t:"sys"}; _local3 = "<vars>"; for (_local4 in _arg1) { _local5 = _arg1[_local4]; if (buddyVars[_local4] != _local5){ buddyVars[_local4] = _local5; _local3 = (_local3 + (((("<var n='" + _local4) + "'><![CDATA[") + _local5) + "]]></var>")); }; }; _local3 = (_local3 + "</vars>"); this.send(_local2, "setBvars", -1, _local3); } public function getRoom(_arg1:int):Room{ return (roomList[_arg1]); } private function handleSecurityError(_arg1:Event):void{ trace("SECURITY ERROR!!!"); } private function handleIOError(_arg1:Event):void{ var _local2:SFSEvent; var _local3:Object; if (!connected){ _local3 = {}; _local3.success = false; _local3.error = "I/O Error"; _local2 = new SFSEvent(SFSEvent.onConnection, _local3); dispatchEvent(_local2); } else { trace("I/O Error during connected session"); }; } private function setupMessageHandlers():void{ sysHandler = new SysHandler(this); extHandler = new ExtHandler(this); addMessageHandler("sys", sysHandler); addMessageHandler("xt", extHandler); } public function login(_arg1:String, _arg2:String, _arg3:String):void{ var _local4:Object; var _local5:String; _local4 = {t:"sys"}; _local5 = (((((("<login z='" + _arg1) + "'><nick><![CDATA[") + _arg2) + "]]></nick><pword><![CDATA[") + _arg3) + "]]></pword></login>"); send(_local4, "login", 0, _local5); } public function autoJoin():void{ var _local1:Object; _local1 = {t:"sys"}; this.send(_local1, "autoJoin", (this.activeRoomId) ? this.activeRoomId : -1, ""); } private function send(_arg1:Object, _arg2:String, _arg3:Number, _arg4:String):void{ var _local5:String; _local5 = makeXmlHeader(_arg1); _local5 = (_local5 + ((((((("<body action='" + _arg2) + "' r='") + _arg3) + "'>") + _arg4) + "</body>") + closeHeader())); if (this.debug){ trace((("[Sending]: " + _local5) + "\n")); }; writeToSocket(_local5); } public function getRoomList():void{ var _local1:Object; _local1 = {t:"sys"}; send(_local1, "getRmList", activeRoomId, ""); } private function initialize():void{ this.changingRoom = false; this.amIModerator = false; this.playerId = -1; this.connected = false; this.roomList = []; this.buddyList = []; this.buddyVars = []; } public function setRoomVariables(_arg1:Array, _arg2:int=-1, _arg3:Boolean=true):void{ var _local4:Object; var _local5:String; var _local6:Object; if (_arg2 == -1){ _arg2 = activeRoomId; }; _local4 = {t:"sys"}; if (_arg3){ _local5 = "<vars>"; } else { _local5 = "<vars so='0'>"; }; for each (_local6 in _arg1) { _local5 = (_local5 + getXmlRoomVariable(_local6)); }; _local5 = (_local5 + "</vars>"); send(_local4, "setRvars", _arg2, _local5); } public function disconnect():void{ socketConnection.close(); connected = false; sysHandler.dispatchDisconnection(); } public function sendJson(_arg1:String):void{ if (this.debug){ trace((("[Sending - JSON]: " + _arg1) + "\n")); }; writeToSocket(_arg1); } private function closeHeader():String{ return ("</msg>"); } public function getVersion():String{ return (((((this.majVersion + ".") + this.minVersion) + ".") + this.subVersion)); } public function setUserVariables(_arg1:Object, _arg2:int=-1):void{ var _local3:Object; var _local4:Room; var _local5:User; var _local6:String; if (_arg2 == -1){ _arg2 = activeRoomId; }; _local3 = {t:"sys"}; _local4 = getActiveRoom(); _local5 = _local4.getUser(myUserId); _local6 = getXmlUserVariable(_arg1); send(_local3, "setUvars", _arg2, _local6); } public function addBuddy(_arg1:String):void{ var _local2:String; if (((!((_arg1 == myUserName))) && (!(checkBuddyDuplicates(_arg1))))){ _local2 = (("<n>" + _arg1) + "</n>"); send({t:"sys"}, "addB", -1, _local2); }; } public function sendPrivateMessage(_arg1:String, _arg2:int, _arg3:int=-1):void{ var _local4:Object; var _local5:String; if (_arg3 == -1){ _arg3 = activeRoomId; }; _local4 = {t:"sys"}; _local5 = (((("<txt rcp='" + _arg2) + "'><![CDATA[") + Entities.encodeEntities(_arg1)) + "]]></txt>"); send(_local4, "prvMsg", _arg3, _local5); } public function sendPublicMessage(_arg1:String, _arg2:int=-1):void{ var _local3:Object; var _local4:String; if (_arg2 == -1){ _arg2 = activeRoomId; }; _local3 = {t:"sys"}; _local4 = (("<txt><![CDATA[" + Entities.encodeEntities(_arg1)) + "]]></txt>"); send(_local3, "pubMsg", _arg2, _local4); } public function clearBuddyList():void{ var _local1:Object; var _local2:SFSEvent; buddyList = []; send({t:"sys"}, "clearB", -1, ""); _local1 = {}; _local1.list = buddyList; _local2 = new SFSEvent(SFSEvent.onBuddyList, _local1); dispatchEvent(_local2); } public function sendString(_arg1:String):void{ if (this.debug){ trace((("[Sending - STR]: " + _arg1) + "\n")); }; writeToSocket(_arg1); } public function removeBuddy(_arg1:String):void{ var _local2:Boolean; var _local3:Object; var _local4:String; var _local5:Object; var _local6:String; var _local7:Object; var _local8:SFSEvent; _local2 = false; for (_local4 in buddyList) { _local3 = buddyList[_local4]; if (_local3.name == _arg1){ delete buddyList[_local4]; _local2 = true; break; }; }; if (_local2){ _local5 = {t:"sys"}; _local6 = (("<n>" + _arg1) + "</n>"); send(_local5, "remB", -1, _local6); _local7 = {}; _local7.list = buddyList; _local8 = new SFSEvent(SFSEvent.onBuddyList, _local7); dispatchEvent(_local8); }; } private function handleMessage(_arg1:String):void{ var _local2:String; if (this.debug){ trace((((("[ RECEIVED ]: " + _arg1) + ", (len: ") + _arg1.length) + ")")); }; _local2 = _arg1.charAt(0); if (_local2 == MSG_XML){ if ((((_arg1.substr(0, 4) == "<msg")) && (!((_arg1.substr(-6) == "</msg>"))))){ _arg1 = (_arg1 + "</body></msg>"); }; xmlReceived(_arg1); } else { if (_local2 == MSG_STR){ strReceived(_arg1); } else { if (_local2 == MSG_JSON){ jsonReceived(_arg1); }; }; }; } public function sendXtMessage(_arg1:String, _arg2:String, _arg3, _arg4:String="xml", _arg5:int=-1):void{ var _local6:Object; var _local7:Object; var _local8:String; var _local9:String; var _local10:Number; var _local11:Object; var _local12:Object; var _local13:String; if (_arg5 == -1){ _arg5 = activeRoomId; }; if (_arg4 == XTMSG_TYPE_XML){ _local6 = {t:"xt"}; _local7 = {name:_arg1, cmd:_arg2, param:_arg3}; _local8 = (("<![CDATA[" + ObjectSerializer.getInstance().serialize(_local7)) + "]]>"); send(_local6, "xtReq", _arg5, _local8); } else { if (_arg4 == XTMSG_TYPE_STR){ _local9 = (((((("%xt%" + _arg1) + "%") + _arg2) + "%") + _arg5) + "%"); _local10 = 0; while (_local10 < _arg3.length) { _local9 = (_local9 + (_arg3[_local10].toString() + "%")); _local10++; }; sendString(_local9); } else { if (_arg4 == XTMSG_TYPE_JSON){ _local11 = {}; _local11.x = _arg1; _local11.c = _arg2; _local11.r = _arg5; _local11.p = _arg3; _local12 = {}; _local12.t = "xt"; _local12.b = _local11; _local13 = JSON.encode(_local12); sendJson(_local13); }; }; }; } private function writeToSocket(_arg1:String):void{ var _local2:ByteArray; _local2 = new ByteArray(); _local2.writeMultiByte(_arg1, "utf-8"); _local2.writeByte(0); socketConnection.writeBytes(_local2); socketConnection.flush(); } public function sendObjectToGroup(_arg1:Object, _arg2:Array, _arg3:int):void{ var _local4:String; var _local5:String; var _local6:Object; var _local7:String; if (_arg3 == -1){ _arg3 = activeRoomId; }; _local4 = ""; for (_local5 in _arg2) { if (!isNaN(_arg2[_local5])){ _local4 = (_local4 + (_arg2[_local5] + ",")); }; }; _local4 = _local4.substr(0, (_local4.length - 1)); _arg1._$$_ = _local4; _local6 = {t:"sys"}; _local7 = (("<![CDATA[" + ObjectSerializer.getInstance().serialize(_arg1)) + "]]>"); send(_local6, "asObjG", _arg3, _local7); } public function getRandomKey():void{ send({t:"sys"}, "rndK", -1, ""); } public function sendObject(_arg1:Object, _arg2:int=-1):void{ var _local3:String; var _local4:Object; if (_arg2 == -1){ _arg2 = activeRoomId; }; _local3 = (("<![CDATA[" + ObjectSerializer.getInstance().serialize(_arg1)) + "]]>"); _local4 = {t:"sys"}; send(_local4, "asObj", _arg2, _local3); } private function jsonReceived(_arg1:String):void{ var _local2:Object; var _local3:String; var _local4:IMessageHandler; _local2 = JSON.decode(_arg1); _local3 = _local2["t"]; _local4 = messageHandlers[_local3]; if (_local4 != null){ _local4.handleMessage(_local2["b"], XTMSG_TYPE_JSON); }; } public function connect(_arg1:String, _arg2:int):void{ if (!connected){ initialize(); socketConnection.connect(_arg1, _arg2); } else { trace("*** ALREADY CONNECTED ***"); }; } public function sendModeratorMessage(_arg1:String, _arg2:int, _arg3:int=-1):void{ var _local4:Object; var _local5:String; _local4 = {t:"sys"}; _local5 = (((((("<txt t='" + _arg2) + "' id='") + _arg3) + "'><![CDATA[") + Entities.encodeEntities(_arg1)) + "]]></txt>"); send(_local4, "modMsg", activeRoomId, _local5); } public function getBenchStartTime():int{ return (this.benchStartTime); } public function createRoom(_arg1:Object, _arg2:int=-1):void{ var _local3:Object; var _local4:String; var _local5:String; var _local6:String; var _local7:String; var _local8:String; var _local9:String; if (_arg2 == -1){ _arg2 = activeRoomId; }; _local3 = {t:"sys"}; _local4 = (_arg1.isGame) ? "1" : "0"; _local5 = "1"; _local6 = ((_arg1.maxUsers == null)) ? "0" : String(_arg1.maxUsers); _local7 = ((_arg1.maxSpectators == null)) ? "0" : String(_arg1.maxSpectators); if (((_arg1.isGame) && (!((_arg1.exitCurrent == null))))){ _local5 = (_arg1.exitCurrent) ? "1" : "0"; }; _local8 = (((((("<room tmp='1' gam='" + _local4) + "' spec='") + _local7) + "' exit='") + _local5) + "'>"); _local8 = (_local8 + (("<name><![CDATA[" + ((_arg1.name == null)) ? "" : _arg1.name) + "]]></name>")); _local8 = (_local8 + (("<pwd><![CDATA[" + ((_arg1.password == null)) ? "" : _arg1.password) + "]]></pwd>")); _local8 = (_local8 + (("<max>" + _local6) + "</max>")); if (_arg1.uCount != null){ _local8 = (_local8 + (("<uCnt>" + (_arg1.uCount) ? "1" : "0") + "</uCnt>")); }; if (_arg1.extension != null){ _local8 = (_local8 + ("<xt n='" + _arg1.extension.name)); _local8 = (_local8 + (("' s='" + _arg1.extension.script) + "' />")); }; if (_arg1.vars == null){ _local8 = (_local8 + "<vars></vars>"); } else { _local8 = (_local8 + "<vars>"); for (_local9 in _arg1.vars) { _local8 = (_local8 + getXmlRoomVariable(_arg1.vars[_local9])); }; _local8 = (_local8 + "</vars>"); }; _local8 = (_local8 + "</room>"); send(_local3, "createRoom", _arg2, _local8); } private function handleSocketConnection(_arg1:Event):void{ var _local2:Object; var _local3:String; _local2 = {t:"sys"}; _local3 = (((("<ver v='" + this.majVersion.toString()) + this.minVersion.toString()) + this.subVersion.toString()) + "' />"); send(_local2, "verChk", 0, _local3); } public function set isConnected(_arg1:Boolean):void{ this.connected = _arg1; } public function get isConnected():Boolean{ return (this.connected); } } }//package it.gotoandplay.smartfoxserver
Section 120
//FlexMovieClip (mx.core.FlexMovieClip) package mx.core { import flash.display.*; import mx.utils.*; public class FlexMovieClip extends MovieClip { mx_internal static const VERSION:String = "2.0.1.0"; public function FlexMovieClip(){ super(); try { name = NameUtil.createUniqueName(this); } catch(e:Error) { }; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 121
//FlexSprite (mx.core.FlexSprite) package mx.core { import flash.display.*; import mx.utils.*; public class FlexSprite extends Sprite { mx_internal static const VERSION:String = "2.0.1.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 122
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 123
//IFlexDisplayObject (mx.core.IFlexDisplayObject) package mx.core { import flash.events.*; import flash.display.*; public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher { function get name():String; function set width(_arg1:Number):void; function get measuredHeight():Number; function set height(_arg1:Number):void; function get scaleY():Number; function move(_arg1:Number, _arg2:Number):void; function get scaleX():Number; function set mask(_arg1:DisplayObject):void; function set scaleX(_arg1:Number):void; function set name(_arg1:String):void; function set scaleY(_arg1:Number):void; function get visible():Boolean; function get measuredWidth():Number; function set visible(_arg1:Boolean):void; function get alpha():Number; function get height():Number; function get width():Number; function get parent():DisplayObjectContainer; function get mask():DisplayObject; function set x(_arg1:Number):void; function setActualSize(_arg1:Number, _arg2:Number):void; function set y(_arg1:Number):void; function get x():Number; function get y():Number; function set alpha(_arg1:Number):void; } }//package mx.core
Section 124
//IRepeaterClient (mx.core.IRepeaterClient) package mx.core { public interface IRepeaterClient { function set instanceIndices(_arg1:Array):void; function get isDocument():Boolean; function get repeaters():Array; function get instanceIndices():Array; function set repeaters(_arg1:Array):void; function initializeRepeaterArrays(_arg1:IRepeaterClient):void; function set repeaterIndices(_arg1:Array):void; function get repeaterIndices():Array; } }//package mx.core
Section 125
//MovieClipAsset (mx.core.MovieClipAsset) package mx.core { public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject { private var _measuredWidth:Number; private var _measuredHeight:Number; mx_internal static const VERSION:String = "2.0.1.0"; public function MovieClipAsset(){ _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; } } }//package mx.core
Section 126
//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 127
//SoundAsset (mx.core.SoundAsset) package mx.core { import flash.media.*; public class SoundAsset extends Sound implements IFlexAsset { mx_internal static const VERSION:String = "2.0.1.0"; } }//package mx.core
Section 128
//SpriteAsset (mx.core.SpriteAsset) package mx.core { public class SpriteAsset extends FlexSprite implements IFlexAsset, IFlexDisplayObject { private var _measuredWidth:Number; private var _measuredHeight:Number; mx_internal static const VERSION:String = "2.0.1.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; } } }//package mx.core
Section 129
//NameUtil (mx.utils.NameUtil) package mx.utils { import flash.display.*; import flash.utils.*; import mx.core.*; public class NameUtil { mx_internal static const VERSION:String = "2.0.1.0"; private static var counter:int = 0; public static function displayObjectToString(_arg1:DisplayObject):String{ var _local2:String; var _local3:DisplayObject; var _local4:String; var _local5:Array; _local3 = _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{ var _local2:String; var _local3:int; var _local4:int; if (!_arg1){ return (null); }; _local2 = getQualifiedClassName(_arg1); _local3 = _local2.indexOf("::"); if (_local3 != -1){ _local2 = _local2.substr((_local3 + 2)); }; _local4 = _local2.charCodeAt((_local2.length - 1)); if ((((_local4 >= 48)) && ((_local4 <= 57)))){ _local2 = (_local2 + "_"); }; return ((_local2 + counter++)); } } }//package mx.utils
Section 130
//OField (RES.OBJECTS.OField) package RES.OBJECTS { import ENGINE.DISPLAY.*; import flash.events.*; import flash.display.*; import ENGINE.INTERFACE.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import ENGINE.CORE.*; import flash.utils.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; import Box2D.Common.*; public class OField extends OSprite { private var iVY:int; private var iRecord:ORecord; private var iMouseX:Number; private var iMinY:int;// = 800 private var iMouseJoint:b2MouseJoint; private var iCounter:OCounter; private var iMouseY:Number; private var iMinX:int;// = 800 private var iMaxVel:Number;// = 0 private var iMinTower:int;// = 255 private var iTimer:int; private var iHTower:int;// = 8 private var iMaxX:int;// = -800 private var iImage:Array; private var iState:int; private var iWorld:b2World; private var iColor:uint;// = 0 private var iMouseDown:Boolean;// = false private var iRTimer:int; private var iLRTimier:int; private var iMouseBody:b2Body; private var iMousePVec:b2Vec2; private var iMaxY:int;// = -800 private var iBImage:Array; public static const stInitField:int = 0; private static const iDoSleep:Boolean = true; private static const iGravity:Number = 500; public static const stGameOver:int = 2; private static const iTimeStep:Number = (1 / OGlobal.FPS); private static const iIterations:int = 15; public static const stNormal:int = 1; private static const iWinSize:Number = 600; private static const iMaxSize:Number = 2000; public static const iLevels:Array = [[[0], [-1, 1], [1.5]], [[-1, 1], [-2, 0, 2], [2.5]], [[-1, 1], [-2, 0, 2], [-1, 1], [1.5]], [[0], [-1, 1], [-2, 0, 2], [-1, 1], [0], [1.5]], [[0], [-1, 1], [-2, 0, 2], [-1, 1], [-2, 0, 2], [2.5]], [[-1, 1], [-2, 0, 2], [-1, 1], [-2, 0, 2], [-1, 1], [0], [1.5]], [[0], [-1, 1], [-2, 0, 2], [-3, -1, 1, 3], [-2, 0, 2], [-1, 1], [1.5]], [[-1, 1], [-2, 0, 2], [-1, 1, 3], [0, 2, 4], [-1, 1, 3], [-2, 0, 2], [2.5]], [[-2, 0, 2], [-3, -1, 1, 3], [-4, -2, 0, 2, 4], [-3, -1, 1, 3], [-2, 0, 2], [2.5]], [[0], [-3, -1, 1, 3], [-4, -2, 2, 4], [-5, -3, 3, 5], [-4, -2, 2, 4], [-3, -1, 1, 3], [3.5]], [[0], [-1, 1], [-2, 0, 2], [-3, -1, 1, 3], [-4, -2, 2, 4], [-3, -1, 1, 3], [-2, 0, 2], [-1, 1], [1.5]], [[-2, 2], [-3, -1, 1, 3], [-2, 0, 2], [-3, -1, 1, 3], [-4, -2, 2, 4], [-5, -3, 3, 5], [-4, -2, 2, 4], [4.5]], [[-3, 3], [-3, 3], [-4, -2, 2, 4], [-3, 3], [-4, -2, 2, 4], [-5, -3, 3, 5], [-4, -2, 2, 4], [-3, -1, 1, 3], [3.5]], [[-4, 4], [-5, -3, 3, 5], [-4, -2, 2, 4], [-5, -3, 3, 5], [-4, -2, 2, 4], [-5, -3, 3, 5], [-4, -2, 0, 2, 4], [4.5]], [[-3, -1, 1, 3], [-4, -2, 0, 2, 4], [-5, -3, -1, 1, 3, 5], [-4, -2, 0, 2, 4], [-3, -1, 1, 3], [-2, 2], [-1, 1], [2.5]], [[-3, 3], [-4, -2, 0, 2, 4], [-3, -1, 1, 3], [-4, -2, 0, 2, 4], [-3, -1, 1, 3], [-4, -2, 0, 2, 4], [-3, -1, 1, 3], [3.5]], [[-3, -1, 1, 3], [-4, -2, 2, 4], [-5, -3, 3, 5], [-6, -4, -2, 2, 4, 6], [-7, -5, -3, 3, 5, 7], [-6, -4, -2, 2, 4, 6], [5.5]], [[-3, 3], [-4, -2, 0, 2, 4], [-3, -1, 1, 3], [-4, -2, 2, 4], [-5, -3, 3, 5], [-6, -4, 4, 6], [-5, -3, 3, 5], [-4, -2, 2, 4], [4.5]], [[-1, 1], [-2, 0, 2], [-3, -1, 1, 3], [-4, -2, 0, 2, 4], [-5, -3, -1, 1, 3, 5], [-4, -2, 0, 2, 4], [-3, -1, 1, 3], [-2, 0, 2], [2.5]], [[-4, 4], [-4, 4], [-5, -3, 3, 5], [-6, -4, -2, 2, 4, 6], [-7, -5, -3, 3, 5, 7], [-6, -4, 4, 6], [-5, -3, 3, 5], [-4, -2, 0, 2, 4], [5.5]]]; public function OField(_arg1:OCounter){ var _local2:Sprite; var _local3:b2AABB; iMouseDown = false; iMousePVec = new b2Vec2(); iColor = 0; iMinY = 800; iMaxY = -800; iMinX = 800; iMaxX = -800; iMinTower = ((OField.iWinSize - 25) - (8 * 40)); iMaxVel = 0; iHTower = 8; super(); this.iCounter = _arg1; this.iColor = ODisplay.HSBToRGB(210, 0.6, 0.9); this.iRecord = new ORecord(); _local2 = new Sprite(); _local2.graphics.beginFill(0, 0); _local2.graphics.drawRect(0, 0, (OField.iWinSize * OGlobal.Scale), (OField.iWinSize * OGlobal.Scale)); _local2.graphics.endFill(); this.addChild(_local2); _local3 = new b2AABB(); _local3.minVertex.Set(-(OField.iMaxSize), -(OField.iMaxSize)); _local3.maxVertex.Set(OField.iMaxSize, OField.iMaxSize); this.iWorld = new b2World(_local3, new b2Vec2(0, OField.iGravity), OField.iDoSleep); this.prVisible = false; this.addEventListener(MouseEvent.MOUSE_UP, OnMouseUp); this.addEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown); this.addEventListener(MouseEvent.MOUSE_MOVE, OnMouseMove); this.addEventListener(MouseEvent.MOUSE_OUT, OnMouseOut); this.addEventListener(Event.ENTER_FRAME, OnEnterFrame); } public function set State(_arg1:int):void{ this.iState = _arg1; switch (this.iState){ case stInitField: this.MakeLevel(Cubiz2L.iGAME.prLevel); Redraw(); this.State = stNormal; break; case stGameOver: if (!prTowerComplete){ break; }; }; } private function Redraw():void{ var _local1:b2Body; var _local2:b2Shape; var _local3:int; this.iWorld.Step(OField.iTimeStep, OField.iIterations); this.graphics.clear(); this.iMinY = 800; this.iMaxY = -800; this.iMinX = 800; this.iMaxX = -800; this.iMinTower = 800; this.iMaxVel = 0; _local1 = this.iWorld.m_bodyList; while (_local1) { _local2 = _local1.GetShapeList(); while (_local2 != null) { DrawShape(_local2); _local2 = _local2.GetNext(); }; _local1 = _local1.m_next; }; if ((((this.iMaxVel < 75)) && (!(this.iMouseBody)))){ if (!this.iTimer){ this.iTimer = getTimer(); } else { if ((getTimer() - this.iTimer) > 3000){ _local3 = ((580 - this.iMinTower) / 40); if (_local3 > this.iCounter.prValue){ this.iCounter.prValue = _local3; }; this.iTimer = 0; }; }; } else { this.iTimer = 0; }; OFrameLimitter.LimitFrame(OGlobal.FPS); } private function GetBodyAtMouse(_arg1:Boolean=false):b2Body{ var _local2:b2AABB; var _local3:int; var _local4:Array; var _local5:int; var _local6:b2Body; var _local7:int; var _local8:Boolean; this.iMousePVec.Set(this.iMouseX, (this.iMouseY - this.iVY)); _local2 = new b2AABB(); _local2.minVertex.Set((this.iMouseX - 0.001), ((this.iMouseY - this.iVY) - 0.001)); _local2.maxVertex.Set((this.iMouseX + 0.001), ((this.iMouseY - this.iVY) + 0.001)); _local3 = 10; _local4 = new Array(); _local5 = this.iWorld.Query(_local2, _local4, _local3); _local6 = null; _local7 = 0; while (_local7 < _local5) { if ((((_local4[_local7].m_body.IsStatic() == false)) || (_arg1))){ _local8 = _local4[_local7].TestPoint(this.iMousePVec); if (_local8){ _local6 = _local4[_local7].m_body; break; }; }; _local7++; }; return (_local6); } public function get prRecord():String{ return (this.iRecord.prRecord); } public function MakeLevel(_arg1:int):void{ var _local2:b2BoxDef; var _local3:b2BodyDef; var _local4:Array; var _local5:Number; var _local6:int; var _local7:int; var _local8:Array; var _local9:int; var _local10:b2Body; _local2 = new b2BoxDef(); _local3 = new b2BodyDef(); _local3.AddShape(_local2); _local4 = OField.iLevels[_arg1]; _local5 = 20; _local2.extents.Set((_local5 * _local4[(_local4.length - 1)][0]), 10); _local3.position.Set((OField.iWinSize * 0.5), (OField.iWinSize - 15)); this.iWorld.CreateBody(_local3); this.iImage = new Array(); this.iBImage = new Array(); _local2.density = 1; _local2.friction = 0.5; _local2.extents.Set(_local5, _local5); _local6 = 0; this.iHTower = 0; _local7 = (_local4.length - 2); while (_local7 >= 0) { _local8 = _local4[_local7]; _local9 = 0; while (_local9 < _local8.length) { _local3.position.Set(((OField.iWinSize * 0.5) + (_local8[_local9] * _local5)), ((575 - _local5) - ((_local5 * 2) * _local6))); _local10 = this.iWorld.CreateBody(_local3); this.iBImage.push(_local10); this.iImage.push([_local10.m_position.x, _local10.m_position.y, ((Math.acos(_local10.m_R.col1.x) * 180) / Math.PI)]); _local9++; }; this.iHTower = (this.iHTower + _local8.length); _local6++; _local7--; }; this.iMinTower = ((OField.iWinSize - 25) - ((_local4.length - 1) * 40)); this.iCounter.prValue = (_local4.length - 1); this.iRTimer = getTimer(); this.iLRTimier = this.iRTimer; } private function SaveResult():void{ var _local1:Array; var _local2:b2Body; var _local3:b2Shape; var _local4:b2PolyShape; var _local5:int; var _local6:b2Vec2; _local1 = new Array(); this.iRecord.RecordAddStart(); _local2 = this.iWorld.m_bodyList; while (_local2) { _local3 = _local2.GetShapeList(); while (_local3 != null) { if (_local3.m_position.y > 580){ } else { _local4 = (_local3 as b2PolyShape); _local5 = 0; while (_local5 < _local4.m_vertexCount) { _local6 = b2Math.AddVV(_local4.m_position, b2Math.b2MulMV(_local4.m_R, _local4.m_vertices[_local5])); this.iRecord.RecordAddInt(_local6.x); this.iRecord.RecordAddInt(_local6.y); _local1.push(_local6.x); _local1.push(_local6.y); _local5++; }; }; _local3 = _local3.GetNext(); }; _local2 = _local2.m_next; }; } public function get State():int{ return (this.iState); } public function OnMouseUp(_arg1:MouseEvent):void{ if (this.iState != stNormal){ return; }; this.iMouseDown = false; OSound.PlaySoundInd(0); } private function MouseDrag():void{ var _local1:b2MouseJointDef; var _local2:b2Vec2; if (((this.iMouseDown) && (!(this.iMouseJoint)))){ this.iMouseBody = GetBodyAtMouse(); if (this.iMouseBody){ _local1 = new b2MouseJointDef(); _local1.body1 = this.iWorld.m_groundBody; _local1.body2 = this.iMouseBody; _local1.target.Set(this.iMouseX, (this.iMouseY - this.iVY)); _local1.maxForce = (30000 * this.iMouseBody.m_mass); _local1.timeStep = OField.iTimeStep; this.iMouseJoint = (this.iWorld.CreateJoint(_local1) as b2MouseJoint); this.iMouseBody.WakeUp(); }; }; if (((!(this.iMouseDown)) && (this.iMouseJoint))){ this.iWorld.DestroyJoint(this.iMouseJoint); this.iMouseJoint = null; this.iMouseBody = null; }; if (this.iMouseJoint){ _local2 = new b2Vec2(this.iMouseX, (this.iMouseY - this.iVY)); this.iMouseJoint.SetTarget(_local2); }; } private function RecordImage():void{ var _local1:Boolean; var _local2:int; var _local3:int; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Boolean; var _local9:int; _local1 = false; _local2 = getTimer(); _local3 = 0; while (_local3 < this.iBImage.length) { _local4 = ((Math.acos(this.iBImage[_local3].m_R.col1.x) * 180) / Math.PI); _local5 = (this.iBImage[_local3].m_position.x - this.iImage[_local3][0]); _local6 = (this.iBImage[_local3].m_position.y - this.iImage[_local3][1]); _local7 = (_local4 - this.iImage[_local3][2]); _local8 = (((((Math.abs(_local5) > 1)) || ((Math.abs(_local6) > 1)))) || ((Math.abs(_local7) > 1))); if (_local8){ if (!_local1){ _local9 = ((_local2 - this.iLRTimier) % 3000); this.iRecord.RecordAddInt(_local9); this.iLRTimier = _local2; _local1 = true; }; this.iRecord.RecordAddIntInd(_local3); if (Math.abs(_local5) > 1){ this.iRecord.RecordAddInt((this.iBImage[_local3].m_position.x * 2)); } else { this.iRecord.RecordAddInt(int.MAX_VALUE); }; if (Math.abs(_local6) > 1){ this.iRecord.RecordAddInt((this.iBImage[_local3].m_position.y * 2)); } else { this.iRecord.RecordAddInt(int.MAX_VALUE); }; if (Math.abs(_local7) > 1){ this.iRecord.RecordAddInt((_local4 * 4)); } else { this.iRecord.RecordAddInt(int.MAX_VALUE); }; this.iImage[_local3][0] = this.iBImage[_local3].m_position.x; this.iImage[_local3][1] = this.iBImage[_local3].m_position.y; this.iImage[_local3][2] = _local4; }; _local3++; }; if (_local1){ this.iRecord.RecordAddInt(int.MAX_VALUE); }; this.iRTimer = _local2; } public function get prTowerComplete():Boolean{ return ((this.iHTower == this.iCounter.prValue)); } override public function Free():void{ this.removeEventListener(Event.ENTER_FRAME, OnEnterFrame); this.removeEventListener(MouseEvent.MOUSE_OUT, OnMouseOut); this.removeEventListener(MouseEvent.MOUSE_MOVE, OnMouseMove); this.removeEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown); this.removeEventListener(MouseEvent.MOUSE_UP, OnMouseUp); super.Free(); } public function OnMouseOut(_arg1:MouseEvent):void{ if (this.iState != stNormal){ return; }; this.iMouseDown = false; if (this.iMouseBody){ this.iMouseBody.m_force = new b2Vec2(); this.iMouseBody.m_linearVelocity = new b2Vec2(); this.iMouseBody = null; }; } public function OnMouseDown(_arg1:MouseEvent):void{ if (this.iState != stNormal){ return; }; this.iMouseDown = true; } public function get prEndLevel():Boolean{ return ((Cubiz2L.iGAME.prLevel >= (OField.iLevels.length - 1))); } public function OnEnterFrame(_arg1:Event):void{ var _local2:int; switch (this.iState){ case stNormal: this.MouseDrag(); if ((((this.iMouseY < 100)) && (((this.iVY + this.iMinTower) < 200)))){ this.iVY = (this.iVY + 3); }; if ((((this.iMouseY > 500)) && ((this.iVY > 0)))){ this.iVY = (this.iVY - 3); }; Redraw(); _local2 = getTimer(); if ((_local2 - this.iRTimer) >= 300){ RecordImage(); }; if ((((((((this.iMinX <= -(iMaxSize))) || ((this.iMaxX >= iMaxSize)))) || ((this.iMinY <= -(iMaxSize))))) || ((this.iMaxY >= iMaxSize)))){ this.State = stGameOver; }; if (this.prTowerComplete){ this.State = stGameOver; }; break; case stGameOver: Redraw(); break; }; } private function DrawShape(_arg1:b2Shape):void{ var _local2:b2PolyShape; var _local3:Number; var _local4:b2Vec2; var _local5:int; var _local6:b2Vec2; _local2 = (_arg1 as b2PolyShape); _local3 = _local2.m_body.m_linearVelocity.Length(); if (_local3 > this.iMaxVel){ this.iMaxVel = _local3; }; _local4 = b2Math.AddVV(_local2.m_position, b2Math.b2MulMV(_local2.m_R, _local2.m_vertices[0])); this.graphics.lineStyle(OGlobal.ToGlobal(4), this.iColor, 1); this.moveTo(_local4.x, (_local4.y + this.iVY)); if (_local4.y > this.iMaxY){ this.iMaxY = _local4.y; } else { if (_local4.y < this.iMinY){ this.iMinY = _local4.y; }; }; if (_local4.x > this.iMaxX){ this.iMaxX = _local4.x; } else { if (_local4.x < this.iMinX){ this.iMinX = _local4.x; }; }; if (((!((_local2.m_body == this.iMouseBody))) && ((_local4.y < this.iMinTower)))){ this.iMinTower = _local4.y; }; _local5 = 1; while (_local5 < _local2.m_vertexCount) { _local6 = b2Math.AddVV(_local2.m_position, b2Math.b2MulMV(_local2.m_R, _local2.m_vertices[_local5])); this.lineTo(_local6.x, (_local6.y + this.iVY)); if (_local6.y > this.iMaxY){ this.iMaxY = _local6.y; } else { if (_local6.y < this.iMinY){ this.iMinY = _local6.y; }; }; if (_local6.x > this.iMaxX){ this.iMaxX = _local6.x; } else { if (_local6.x < this.iMinX){ this.iMinX = _local6.x; }; }; if (((!((_local2.m_body == this.iMouseBody))) && ((_local6.y < this.iMinTower)))){ this.iMinTower = _local6.y; }; _local5++; }; this.lineTo(_local4.x, (_local4.y + this.iVY)); } public function OnMouseMove(_arg1:MouseEvent):void{ if (this.iState != stNormal){ return; }; this.iMouseX = OGlobal.ToLocal(_arg1.localX); this.iMouseY = OGlobal.ToLocal(_arg1.localY); } public static function GetLevelHeight(_arg1:int):int{ var _local2:Array; var _local3:int; var _local4:int; _local2 = OField.iLevels[_arg1]; _local3 = 0; _local4 = (_local2.length - 2); while (_local4 >= 0) { _local3 = (_local3 + _local2[_local4].length); _local4--; }; return (_local3); } } }//package RES.OBJECTS
Section 131
//OFrameLimitter (RES.OBJECTS.OFrameLimitter) package RES.OBJECTS { import flash.utils.*; public class OFrameLimitter { private static var iNewT:uint = iOldT; private static var iOldT:uint = getTimer(); public static function LimitFrame(_arg1:uint):void{ var _local2:uint; _local2 = (1000 / _arg1); while (Math.abs((iNewT - iOldT)) < _local2) { iNewT = getTimer(); }; iOldT = getTimer(); } } }//package RES.OBJECTS
Section 132
//OInfoObject (RES.OBJECTS.OInfoObject) package RES.OBJECTS { import flash.events.*; import ENGINE.INTERFACE.*; public class OInfoObject extends OIObject { public function OInfoObject(_arg1:Array, _arg2:Array=null){ super(_arg1, _arg2); } override public function OnPress(_arg1:Event, _arg2):void{ (this.parent as OIObject).OnPress(_arg1, _arg2); } } }//package RES.OBJECTS
Section 133
//OLLoader (RES.OBJECTS.OLLoader) package RES.OBJECTS { import flash.events.*; import flash.display.*; import flash.net.*; public class OLLoader extends Sprite { private var iDRecord:String;// = "-1,,,," private var iLRecord:String;// = null private var iBState:int; private var iLState:int; private var iBLoader:URLLoader; private var iBRecord:String;// = null private var iLLoader:URLLoader; private static const stError:int = 3; private static const stStartLoad:int = 1; private static const stNone:int = 0; private static const stComplete:int = 2; public function OLLoader(){ iDRecord = "-1,,,,"; iLRecord = null; iBRecord = null; super(); this.StartLoad(); this.addEventListener(Event.ENTER_FRAME, OnEnterFrame); } public function get prLComplete():Boolean{ return ((this.iLState == stComplete)); } public function get prError():Boolean{ return ((((this.iBState == stError)) || ((this.iLState == stError)))); } public function StartLoad():void{ this.iBState = OLLoader.stNone; this.iLState = OLLoader.stNone; } public function get prLLoading():Boolean{ return ((this.iLState == stStartLoad)); } public function get prComplete():Boolean{ return ((((this.iBState == stComplete)) || ((this.iLState == stComplete)))); } public function get prBError():Boolean{ return ((this.iBState == stError)); } protected function OnBComplete(_arg1:Event):void{ this.iBState = stComplete; this.iBRecord = (this.iBLoader.data as String); } public function get prLRecord():String{ return (this.iLRecord); } protected function OnLComplete(_arg1:Event):void{ this.iLState = stComplete; this.iLRecord = (this.iLLoader.data as String); } public function get prLError():Boolean{ return ((this.iLState == stError)); } protected function OnLIOError(_arg1:Event):void{ this.iLState = stError; trace("lerror"); } public function get prBLoading():Boolean{ return ((this.iBState == stStartLoad)); } protected function OnEnterFrame(_arg1:Event):void{ var level:int; var request:URLRequest; var aEvent = _arg1; switch (this.iLState){ case stNone: if (this.iLLoader){ this.iLLoader.removeEventListener(Event.COMPLETE, OnLComplete); this.iLLoader.removeEventListener(IOErrorEvent.IO_ERROR, OnLIOError); this.iLLoader = null; }; level = ((Cubiz2L.iGAME.prPlayerName)!="") ? Cubiz2L.iGAME.prLevel : 0; this.iLRecord = this.iDRecord; this.iLLoader = new URLLoader(); request = new URLRequest(((("results" + level.toString()) + ".txt?") + Math.floor((Math.random() * 1000)).toString())); try { this.iLLoader.load(request); } catch(error:Error) { }; this.iLLoader.addEventListener(Event.COMPLETE, OnLComplete); this.iLLoader.addEventListener(IOErrorEvent.IO_ERROR, OnLIOError); this.iLState = stStartLoad; break; }; switch (this.iBState){ case stNone: if (this.iBLoader){ this.iBLoader.removeEventListener(Event.COMPLETE, OnBComplete); this.iBLoader.removeEventListener(IOErrorEvent.IO_ERROR, OnBIOError); this.iBLoader = null; }; this.iBRecord = this.iDRecord; this.iBLoader = new URLLoader(); request = new URLRequest(("results.txt?" + Math.floor((Math.random() * 1000)).toString())); try { this.iBLoader.load(request); } catch(error:Error) { }; this.iBLoader.addEventListener(Event.COMPLETE, OnBComplete); this.iBLoader.addEventListener(IOErrorEvent.IO_ERROR, OnBIOError); this.iBState = stStartLoad; break; }; } public function get prBComplete():Boolean{ return ((this.iBState == stComplete)); } public function get prLoading():Boolean{ return ((((this.iBState == stStartLoad)) || ((this.iLState == stStartLoad)))); } public function get prBRecord():String{ return (this.iBRecord); } protected function OnBIOError(_arg1:Event):void{ this.iBState = stError; trace("berror"); } } }//package RES.OBJECTS
Section 134
//ORecord (RES.OBJECTS.ORecord) package RES.OBJECTS { public class ORecord { private var iRecord:String;// = "" private var iPos:int;// = 0 private static var iNaN:String = "~"; public static var iMin:int = -3200; private static var iEString:String = "6coN7@)tkE!.sB;LX1hS:CfJzPHr4K-aw^M3T52Vm*{e+&Yld#WA$8GyRZnuj9_(U}OQ0pDIFgxqv=bi"; public function ORecord(){ iRecord = ""; iPos = 0; super(); } public function RecordAddIntInd(_arg1:int):void{ if (_arg1 > 80){ _arg1 = 80; }; this.iRecord = (this.iRecord + ((_arg1)!=int.MAX_VALUE) ? ORecord.iEString.charAt(_arg1) : ORecord.iNaN); this.iPos++; } public function set prRecord(_arg1:String):void{ this.iRecord = _arg1; this.iPos = 0; } public function RecordGetInt():int{ var _local1:String; var _local2:String; if (this.iPos >= this.iRecord.length){ return (int.MIN_VALUE); }; _local1 = this.iRecord.substr(this.iPos, 1); this.iPos++; if (_local1 == ORecord.iNaN){ return (int.MAX_VALUE); }; _local2 = this.iRecord.substr(this.iPos, 1); this.iPos++; return ((((ORecord.iEString.indexOf(_local1) * 80) + ORecord.iEString.indexOf(_local2)) + ORecord.iMin)); } public function RecordAddStart():void{ this.iRecord = ""; this.iPos = 0; } public function RecordGetIntInd():int{ var _local1:String; if (this.iPos >= this.iRecord.length){ return (int.MIN_VALUE); }; _local1 = this.iRecord.substr(this.iPos, 1); this.iPos++; if (_local1 == ORecord.iNaN){ return (int.MAX_VALUE); }; return (ORecord.iEString.indexOf(_local1)); } public function get prRecord():String{ return (this.iRecord); } public function RecordGetStart(_arg1:String=null):void{ if (_arg1){ this.iRecord = _arg1; }; this.iPos = 0; } public function RecordAddInt(_arg1:int):void{ var _local2:int; var _local3:int; if (_arg1 == int.MAX_VALUE){ this.iRecord = (this.iRecord + ORecord.iNaN); this.iPos++; return; }; if (_arg1 < -3200){ _arg1 = -3200; } else { if (_arg1 > 3199){ _arg1 = 3199; }; }; _arg1 = (_arg1 - ORecord.iMin); _local2 = (_arg1 / 80); _local3 = (_arg1 % 80); this.iRecord = (this.iRecord + ORecord.iEString.charAt(_local2)); this.iRecord = (this.iRecord + ORecord.iEString.charAt(_local3)); this.iPos = (this.iPos + 2); } public static function MakeDecodeString():String{ var _local1:Array; var _local2:String; var _local3:String; var _local4:int; var _local5:int; var _local6:int; var _local7:int; _local1 = new Array(); _local2 = "a"; _local3 = "z"; _local4 = _local2.charCodeAt(); while (_local4 <= _local3.charCodeAt()) { _local1.push(_local4); _local4++; }; _local2 = "A"; _local3 = "Z"; _local4 = _local2.charCodeAt(); while (_local4 <= _local3.charCodeAt()) { _local1.push(_local4); _local4++; }; _local2 = "0"; _local3 = "9"; _local4 = _local2.charCodeAt(); while (_local4 <= _local3.charCodeAt()) { _local1.push(_local4); _local4++; }; _local2 = "!@#$%&*()-+{}._;:="; _local4 = 0; while (_local4 < _local2.length) { _local1.push(_local2.charCodeAt(_local4)); _local4++; }; _local5 = 0; while (_local5 < 3) { _local4 = 0; while (_local4 < _local1.length) { _local6 = (int((Math.random() * _local1.length)) % _local1.length); _local7 = _local1[_local6]; _local1[_local6] = _local1[_local4]; _local1[_local4] = _local7; _local4++; }; _local5++; }; _local2 = ""; _local4 = 0; while (_local4 < _local1.length) { _local2 = (_local2 + String.fromCharCode(_local1[_local4])); _local4++; }; return (_local2); } } }//package RES.OBJECTS
Section 135
//OTPanel (RES.OBJECTS.OTPanel) package RES.OBJECTS { import ENGINE.DISPLAY.*; import flash.events.*; import ENGINE.CORE.*; import flash.utils.*; import Box2D.Common.Math.*; public class OTPanel extends OSprite { private var iS:String; private var iRecord:ORecord; private var iCube:Array; private var iDTime:int; private var iScale:Number; private var iImage:Array; private var iBSize:int; private var iColor:uint; private var iLevel:int; private var iTime:int; public function OTPanel(_arg1:uint){ this.iColor = _arg1; this.iRecord = new ORecord(); this.addEventListener(Event.ENTER_FRAME, OnEnterFrame); } public function Make(_arg1:int, _arg2:String):void{ var _local3:int; var _local4:Array; var _local5:int; var _local6:int; var _local7:Array; var _local8:int; this.iLevel = _arg1; this.iS = _arg2; _local3 = OField.GetLevelHeight(_arg1); this.iBSize = (400 / (_local3 * 2)); this.iScale = (this.iBSize / 20); if (this.iScale > 0.5){ this.iScale = 0.5; }; this.iRecord.prRecord = _arg2; this.iImage = new Array(); _local4 = OField.iLevels[_arg1]; _local5 = 0; _local6 = (_local4.length - 2); while (_local6 >= 0) { _local7 = _local4[_local6]; _local8 = 0; while (_local8 < _local7.length) { this.iImage.push([new b2Vec2((300 + (_local7[_local8] * 20)), ((575 - 20) - ((20 * 2) * _local5))), 0, new b2Mat22(0)]); _local8++; }; _local5++; _local6--; }; this.iCube = new Array(); this.iCube.push(new b2Vec2(-20, -20)); this.iCube.push(new b2Vec2(20, -20)); this.iCube.push(new b2Vec2(20, 20)); this.iCube.push(new b2Vec2(-20, 20)); this.Draw(); this.iTime = getTimer(); this.iDTime = this.iRecord.RecordGetInt(); } private function Draw():void{ var _local1:int; var _local2:int; var _local3:int; var _local4:b2Vec2; var _local5:int; var _local6:b2Vec2; this.graphics.clear(); this.graphics.lineStyle(OGlobal.ToGlobal(2.8), this.iColor); this.moveTo(0, 0); this.lineTo(200, 0); this.moveTo(0, 400); this.lineTo(200, 400); this.moveTo(5, -5); this.lineTo(5, 405); this.moveTo(195, -5); this.lineTo(195, 405); _local1 = ((-300 * this.iScale) + 100); _local2 = (400 - (575 * this.iScale)); _local3 = 0; while (_local3 < this.iImage.length) { _local4 = b2Math.AddVV(this.iImage[_local3][0], b2Math.b2MulMV(this.iImage[_local3][2], this.iCube[0])); this.moveTo(((_local4.x * this.iScale) + _local1), ((_local4.y * this.iScale) + _local2)); _local5 = 1; while (_local5 < 4) { _local6 = b2Math.AddVV(this.iImage[_local3][0], b2Math.b2MulMV(this.iImage[_local3][2], this.iCube[_local5])); this.lineTo(((_local6.x * this.iScale) + _local1), ((_local6.y * this.iScale) + _local2)); _local5++; }; this.lineTo(((_local4.x * this.iScale) + _local1), ((_local4.y * this.iScale) + _local2)); _local3++; }; } override public function Free():void{ this.removeEventListener(Event.ENTER_FRAME, OnEnterFrame); super.Free(); } public function OnEnterFrame(_arg1:Event):void{ var _local2:int; var _local3:int; var _local4:int; var _local5:int; var _local6:int; _local2 = getTimer(); if (this.iDTime == int.MIN_VALUE){ if ((_local2 - this.iTime) > 5000){ this.Make(this.iLevel, this.iS); }; return; }; if ((_local2 - this.iTime) >= this.iDTime){ while (((1) && ((this.iDTime > 0)))) { _local3 = this.iRecord.RecordGetIntInd(); if (_local3 == int.MAX_VALUE){ break; }; if ((((_local3 < 0)) || ((_local3 >= this.iImage.length)))){ break; }; _local4 = this.iRecord.RecordGetInt(); _local5 = this.iRecord.RecordGetInt(); _local6 = this.iRecord.RecordGetInt(); if (_local4 < int.MAX_VALUE){ this.iImage[_local3][0].x = (_local4 / 2); }; if (_local5 < int.MAX_VALUE){ this.iImage[_local3][0].y = (_local5 / 2); }; if (_local6 < int.MAX_VALUE){ this.iImage[_local3][1] = (_local6 / 4); this.iImage[_local3][2].Set(((this.iImage[_local3][1] * Math.PI) / 180)); }; }; this.iTime = _local2; this.iDTime = this.iRecord.RecordGetInt(); this.Draw(); }; } } }//package RES.OBJECTS
Section 136
//OWChoosePlayer (RES.WINDOWS.OWChoosePlayer) package RES.WINDOWS { import flash.events.*; import ENGINE.INTERFACE.*; public class OWChoosePlayer extends ODialog { public var iDelete:OButton; public var iNew:OButton; public var iCancel:OButton; private var iData; public var iListBox:OListBox; public var iAccept:OButton; private var iCurPlayer:String; public function OWChoosePlayer(){ super(Cubiz2L.OWChoosePlayer); } override public function Init():void{ super.Init(); this.iData = Cubiz2L.iGAME.prPlayersData; this.iCurPlayer = Cubiz2L.iGAME.prPlayerName; this.iListBox.SetCurrentElement(Cubiz2L.iGAME.prPlayerName, Cubiz2L.iGAME.prPlayerNames); } override public function set prActive(_arg1:Boolean):void{ if (_arg1){ this.iListBox.SetCurrentElement(Cubiz2L.iGAME.prPlayerName, Cubiz2L.iGAME.prPlayerNames); }; super.prActive = _arg1; } override public function OnPress(_arg1:Event, _arg2):void{ if (!this.prMouseEnabled){ return; }; if (_arg2 == this.iNew){ (this.parent as OWindow).OnPress(null, Cubiz2L.miEnterNewName); this.prActive = false; return; }; if (_arg2 == this.iDelete){ (this.parent as OWindow).OnPress(null, Cubiz2L.miDeletePlayerConfirm); this.prActive = false; return; }; if (_arg2 == this.iCancel){ Cubiz2L.iGAME.prPlayersData = this.iData; Cubiz2L.iGAME.prPlayerName = this.iCurPlayer; (this.parent as OWindow).OnPress(null, Cubiz2L.miMenu); this.prVisible = false; return; }; if (_arg2 == this.iAccept){ (this.parent as OWindow).OnPress(null, Cubiz2L.miMenu); this.prVisible = false; return; }; if ((((_arg2 == this.iListBox)) && (!((Cubiz2L.iGAME.prPlayerName == this.iListBox.prCurrentLBParam))))){ Cubiz2L.iGAME.prPlayerName = this.iListBox.prCurrentLBParam; return; }; } override public function Free():void{ this.iListBox = null; this.iNew = null; this.iDelete = null; this.iAccept = null; this.iCancel = null; super.Free(); } } }//package RES.WINDOWS
Section 137
//OWConnection (RES.WINDOWS.OWConnection) package RES.WINDOWS { import flash.events.*; import ENGINE.INTERFACE.*; import flash.utils.*; import ENGINE.SMARTFOX.*; public class OWConnection extends OWindow { private var iDAlpha:Number;// = 0.025 private var iTimer:int; private var iInfo:OIObject; public static const stLoaded:int = 4; public static const stInfo:int = 3; public static const stInitGraphics:int = 0; public static const stLoadLevel:int = 2; public static const stConnection:int = 1; public function OWConnection(){ iDAlpha = 0.025; super(null, ODialog.iDefAnimators); } private function AddBanner(_arg1:Boolean, _arg2:int=0, _arg3:int=0):void{ } override public function Init():void{ super.Init(); this.Pos(0, 0); this.State = OWGame.stInitGraphics; } override public function Free():void{ super.Free(); } private function AddInfo(_arg1:Array, _arg2:Boolean=true):void{ if (this.iInfo){ this.removeChild(this.iInfo); this.iInfo.Free(); this.iInfo = null; }; if (_arg1){ this.iInfo = _arg1[0](_arg1); if (_arg2){ this.iInfo.SetVisible(false); this.iInfo.prVisible = true; }; this.addChild(this.iInfo); }; } override public function OnEnterFrame(_arg1:Event):void{ var _local2:Boolean; var _local3:int; super.OnEnterFrame(_arg1); switch (this.iState){ case stInitGraphics: this.State = stLoadLevel; break; case stConnection: _local3 = (getTimer() - this.iTimer); _local2 = this.SplashInfo(); if ((((_local3 > 5000)) && (_local2))){ this.State = stLoadLevel; }; break; case stLoadLevel: _local2 = true; _local3 = 6000; if ((((((_local3 > 5000)) || (Cubiz2L.iLLoader.prLComplete))) && (_local2))){ this.AddBanner(false); this.AddInfo(null); this.State = ((Cubiz2L.iGAME.prScore == 0)) ? stInfo : stLoaded; }; break; case stInfo: _local3 = (getTimer() - this.iTimer); if (_local3 > 5000){ this.State = stLoaded; }; break; }; } private function SplashInfo():Boolean{ var _local1:Boolean; _local1 = false; if (this.iInfo.prAnimation){ return (false); }; this.iInfo.alpha = (this.iInfo.alpha + this.iDAlpha); if ((((this.iDAlpha > 0)) && ((this.iInfo.alpha >= 1)))){ this.iInfo.alpha = 1; this.iDAlpha = (this.iDAlpha * -1); }; if ((((this.iDAlpha < 0)) && ((this.iInfo.alpha <= 0)))){ this.iInfo.alpha = 0; this.iDAlpha = (this.iDAlpha * -1); _local1 = true; }; return (_local1); } override public function set State(_arg1:int):void{ this.iState = _arg1; switch (this.iState){ case stConnection: Cubiz2L.iMP.State = OMultiplayer.stNone; this.AddBanner(true, 800, 260); this.iTimer = getTimer(); if (((!((Cubiz2L.iMP.State == OMultiplayer.stConnection))) && (!((Cubiz2L.iMP.State == OMultiplayer.stInZone))))){ Cubiz2L.iMP.State = OMultiplayer.stNone; }; Cubiz2L.iLLoader.StartLoad(); break; case stLoadLevel: this.iTimer = getTimer(); break; case stInfo: Cubiz2L.iFirst = false; this.iTimer = getTimer(); this.iInfo = new OAlert(Cubiz2L.OWInstructionsP, null); this.addChild(iInfo); break; case stLoaded: this.prVisible = false; break; }; } } }//package RES.WINDOWS
Section 138
//OWEnterName (RES.WINDOWS.OWEnterName) package RES.WINDOWS { import flash.events.*; import ENGINE.INTERFACE.*; import ENGINE.CORE.*; public class OWEnterName extends ODialog { private var iHasCancel:Boolean; public var iCancel:OButton; public var iName:OInput; public var iAccept:OButton; public function OWEnterName(_arg1:Boolean=true){ this.iHasCancel = _arg1; super(Cubiz2L.OWEnterName); } override public function Init():void{ super.Init(); this.iName.prText = (Cubiz2L.iGAME.prPlayerName) ? Cubiz2L.iGAME.prPlayerName : ""; if (!this.iHasCancel){ this.iCancel.visible = false; this.iAccept.prX = 155; }; } public function set prName(_arg1:String):void{ this.iName.prText = _arg1; } override public function OnPress(_arg1:Event, _arg2):void{ var _local3:String; if (!this.prMouseEnabled){ return; }; if (_arg2 == this.iCancel){ this.prVisible = false; return; }; if (_arg2 == this.iAccept){ _local3 = OUtils.ClearString(this.iName.prText.toUpperCase()); if (_local3.length > 0){ Cubiz2L.iGAME.prPlayerName = _local3; this.prVisible = false; } else { this.iName.prText = ""; }; }; } override public function Free():void{ super.Free(); this.iName = null; this.iAccept = null; this.iCancel = null; } public function get prName():String{ return (this.iName.prText); } override public function OnEnterFrame(_arg1:Event):void{ super.OnEnterFrame(_arg1); SetNameFocus(); } private function SetNameFocus():void{ if (!this.stage){ return; }; if (this.stage.focus == this.iName.iText){ return; }; this.iName.iText.setSelection(this.iName.iText.length, this.iName.iText.length); this.stage.focus = this.iName.iText; } } }//package RES.WINDOWS
Section 139
//OWGame (RES.WINDOWS.OWGame) package RES.WINDOWS { import flash.events.*; import ENGINE.INTERFACE.*; import ENGINE.GAME.*; import flash.net.*; import ENGINE.SMARTFOX.*; import RES.OBJECTS.*; public class OWGame extends OWindow { private var iDAlpha:Number;// = 0.025 private var iField:OField; public var iSite:OButton; private var iTimer:int; public var iMenu:OButton; private var iInfoP:OWInfoPanel; private var iBPanel:OTPanel; private var iInfo:OIObject; public var iTHeightC:OCounter; public static const stLevelBad:int = 2; public static const stLevelGood:int = 3; public static const stInitGraphics:int = 0; public static const stGameOver:int = 4; public static const stNormal:int = 1; public function OWGame(_arg1:Boolean){ iDAlpha = 0.025; super(Cubiz2L.OWGame, ODialog.iDefAnimators); } override public function Init():void{ super.Init(); this.Pos(0, 0); this.iField = new OField(this.iTHeightC); this.addChild(this.iField); this.iField.visible = true; this.iField.State = OField.stInitField; this.iInfoP = new OWInfoPanel(); this.addChild(this.iInfoP); this.iInfoP.prVisible = true; this.State = OWGame.stInitGraphics; } override public function OnPress(_arg1:Event, _arg2):void{ if (_arg2 == this.iMenu){ this.prVisible = false; return; }; } override public function Free():void{ super.Free(); } private function MakePlayerTower():void{ var _local1:Array; var _local2:Date; _local1 = new Array(); _local1.push(Cubiz2L.iGAME.prLevel); _local1.push(Cubiz2L.iGAME.prPlayerName); _local2 = new Date(); _local1.push(((((_local2.getFullYear().toString() + "/") + (_local2.getMonth() + 1).toString()) + "/") + _local2.getDate().toString())); _local1.push(this.iTHeightC.prValue.toString()); _local1.push(this.iField.prRecord); Cubiz2L.iPRecord = _local1.toString(); trace(Cubiz2L.iPRecord); } private function AddInfo(_arg1:Array, _arg2:Boolean=true):void{ if (this.iInfo){ this.removeChild(this.iInfo); this.iInfo.Free(); this.iInfo = null; }; if (_arg1){ this.iInfo = _arg1[0](_arg1); if (_arg2){ this.iInfo.SetVisible(false); this.iInfo.prVisible = true; }; this.addChild(this.iInfo); }; } override public function OnEnterFrame(_arg1:Event):void{ super.OnEnterFrame(_arg1); switch (this.iState){ case stInitGraphics: if (!this.prAnimation){ this.State = stNormal; }; break; case stNormal: if (this.iField.State == OField.stGameOver){ if (this.iField.prTowerComplete){ this.State = (this.iField.prEndLevel) ? stGameOver : stLevelGood; } else { this.State = stLevelBad; }; }; break; case stLevelGood: break; case stLevelBad: break; case stGameOver: break; }; } private function SplashInfo():Boolean{ var _local1:Boolean; _local1 = false; if (this.iInfo.prAnimation){ return (false); }; this.iInfo.alpha = (this.iInfo.alpha + this.iDAlpha); if ((((this.iDAlpha > 0)) && ((this.iInfo.alpha >= 1)))){ this.iInfo.alpha = 1; this.iDAlpha = (this.iDAlpha * -1); }; if ((((this.iDAlpha < 0)) && ((this.iInfo.alpha <= 0)))){ this.iInfo.alpha = 0; this.iDAlpha = (this.iDAlpha * -1); _local1 = true; }; return (_local1); } override public function set State(_arg1:int):void{ var _local2:Array; var _local3:Array; this.iState = _arg1; switch (this.iState){ case stInitGraphics: if (Cubiz2L.iPRecord){ _local3 = Cubiz2L.iPRecord.split(/,/); if (Cubiz2L.iGAME.prLevel != Number(_local3[0])){ Cubiz2L.iPRecord = null; }; }; break; case stLevelGood: case stLevelBad: case stGameOver: Cubiz2L.iGAME.Write(OGame.catTmp, "GameOver", this.iState); Cubiz2L.iPPRecord = Cubiz2L.iPRecord; this.MakePlayerTower(); if (Cubiz2L.iGAME.prScore < this.iTHeightC.prValue){ Cubiz2L.iGAME.AddScore((this.iTHeightC.prValue - Cubiz2L.iGAME.prScore)); }; _local3 = Cubiz2L.iLLoader.prBRecord.split(/,/); _local2 = Cubiz2L.iPRecord.split(/,/); if ((((Cubiz2L.iMP.State == OMultiplayer.stInZone)) && ((((Number(_local2[3]) >= Number(_local3[3]))) || (!((this.State == stLevelBad))))))){ }; if (this.iState == stLevelGood){ Cubiz2L.iGAME.NextLevel(); }; (this.parent as OWindow).OnPress(null, Cubiz2L.miResults); this.prVisible = false; break; }; } } }//package RES.WINDOWS
Section 140
//OWInfoPanel (RES.WINDOWS.OWInfoPanel) package RES.WINDOWS { import flash.events.*; import ENGINE.INTERFACE.*; import flash.utils.*; import flash.net.*; import RES.OBJECTS.*; public class OWInfoPanel extends OIObject { private var iRecord:String; private var iTimer:int; private var iHeader:String; private var iBPanel:OTPanel; private var iInfo:OInfoObject; public static const stInit:int = 0; public static const stErrorConnect:int = 2; public static const stConnect:int = 1; public static const stShowTower:int = 3; public function OWInfoPanel(){ super(null); } override public function Init():void{ super.Init(); this.State = stInit; } override public function OnPress(_arg1:Event, _arg2):void{ var _local3:URLRequest; _local3 = new URLRequest(Cubiz2L.strConnect2URL); } override public function Free():void{ this.iInfo = null; super.Free(); } private function InitObject(_arg1:Array):void{ if (this.iInfo){ this.removeChild(this.iInfo); this.iInfo.Free(); this.iInfo = null; }; if (!_arg1){ return; }; this.iInfo = new OInfoObject(_arg1, OInterface.iDefSlowAnimators); this.addChild(this.iInfo); this.iInfo.SetVisible(false); this.iInfo.prVisible = true; } override public function OnEnterFrame(_arg1:Event):void{ super.OnEnterFrame(_arg1); switch (this.iState){ case stInit: if ((getTimer() - this.iTimer) >= 3000){ if (!Cubiz2L.iLLoader.prLComplete){ this.State = (Cubiz2L.iLLoader.prBError) ? stErrorConnect : stConnect; } else { this.State = stConnect; }; }; break; case stConnect: if (Cubiz2L.iLLoader.prLComplete){ this.iRecord = Cubiz2L.iLLoader.prLRecord; this.iHeader = Cubiz2L.strLastWorldTower; this.State = stShowTower; } else { if (Cubiz2L.iLLoader.prLError){ this.State = stErrorConnect; }; }; break; }; } override public function set State(_arg1:int):void{ this.iState = _arg1; switch (this.iState){ case stInit: this.InitObject(Cubiz2L.OWInfoPBanner); this.iTimer = getTimer(); break; case stConnect: break; case stErrorConnect: if (Cubiz2L.iPRecord){ this.iRecord = Cubiz2L.iPRecord; this.iHeader = Cubiz2L.strLastYourTower; this.State = stShowTower; }; break; case stShowTower: break; }; } } }//package RES.WINDOWS
Section 141
//OWIntro (RES.WINDOWS.OWIntro) package RES.WINDOWS { import ENGINE.DISPLAY.*; import flash.events.*; import flash.display.*; import ENGINE.INTERFACE.*; import ENGINE.CORE.*; public class OWIntro extends OWindow { public var iGameName:OIObject; public var iHeader:OBitmap; private var iTimer:Number; public var iHit:OSprite; public var iFooter:OBitmap; private var iAlpha1:Array; private var iAlpha:Array; public var iLogo:OWLogo; public var iGameName1:OIObject; public static var stShowFooter:int = 2; public static var stHide:int = 5; public static var stNormal:int = 4; public static var stShowName:int = 3; public static var stShowHeader:int = 1; public static var stInvisible:int = 6; public static var stLogo:int = 7; public static var stBeforeShow:int = 0; public function OWIntro(){ Cubiz2L.OWIntroParam[0][1] = [[ODisplay.SpriteRect, (800 * OGlobal.Scale), (600 * OGlobal.Scale)]]; super(Cubiz2L.OWIntroParam); } override public function Init():void{ var _local1:int; var _local2:int; var _local3:DisplayObject; super.Init(); this.iHeader.alpha = 0; this.iFooter.alpha = 0; _local1 = this.iGameName.numChildren; this.iAlpha = new Array(_local1); _local2 = 0; while (_local2 < _local1) { _local3 = this.iGameName.getChildAt(_local2); _local3.alpha = 0; this.iAlpha[_local2] = (-(_local2) * 0.3); _local2++; }; _local1 = this.iGameName1.numChildren; this.iAlpha1 = new Array(_local1); _local2 = 0; while (_local2 < _local1) { _local3 = this.iGameName1.getChildAt(_local2); _local3.alpha = 0; this.iAlpha1[_local2] = (-(_local2) * 0.3); _local2++; }; this.hitArea = this.iHit; iLogo = new OWLogo(); iLogo.SetVisible(false); this.addChild(iLogo); this.State = stLogo; } override public function Free():void{ super.Free(); this.iHeader = null; this.iFooter = null; } override public function OnMouseDown(_arg1:MouseEvent):void{ if (this.iState < OWIntro.stShowFooter){ return; }; this.prVisible = false; super.OnMouseDown(_arg1); } override public function OnEnterFrame(_arg1:Event):void{ var _local2:int; switch (this.iState){ case stBeforeShow: if (this.iTimer-- <= 0){ this.State = stShowHeader; }; break; case stShowHeader: if (this.iHeader.alpha >= 1){ this.iHeader.alpha = 1; this.State = stShowFooter; } else { this.iHeader.alpha = (this.iHeader.alpha + 0.025); }; break; case stShowFooter: if (this.iFooter.alpha >= 1){ this.iFooter.alpha = 1; this.State = stShowName; } else { this.iFooter.alpha = (this.iFooter.alpha + 0.025); }; break; case stShowName: if (this.iGameName1.getChildAt((this.iGameName1.numChildren - 1)).alpha >= 1){ this.State = stNormal; } else { _local2 = 0; while (_local2 < this.iGameName.numChildren) { this.iAlpha[_local2] = (this.iAlpha[_local2] + 0.025); if (this.iAlpha[_local2] > 1){ this.iAlpha[_local2] = 1; }; if (this.iAlpha[_local2] >= 0){ this.iGameName.getChildAt(_local2).alpha = this.iAlpha[_local2]; }; _local2++; }; }; _local2 = 0; while (_local2 < this.iGameName1.numChildren) { this.iAlpha1[_local2] = (this.iAlpha1[_local2] + 0.025); if (this.iAlpha1[_local2] > 1){ this.iAlpha1[_local2] = 1; }; if (this.iAlpha1[_local2] >= 0){ this.iGameName1.getChildAt(_local2).alpha = this.iAlpha1[_local2]; }; _local2++; }; break; case stNormal: if (this.iTimer-- <= 0){ this.State = stHide; }; break; case stHide: if (this.iFooter.alpha <= 0){ this.State = stInvisible; } else { this.iHeader.alpha = (this.iHeader.alpha - 0.05); this.iFooter.alpha = (this.iFooter.alpha - 0.05); this.iGameName.alpha = (this.iGameName.alpha - 0.05); this.iGameName1.alpha = (this.iGameName1.alpha - 0.05); }; break; case stLogo: if (this.iTimer-- <= 0){ this.State = stShowHeader; }; break; }; } override public function set State(_arg1:int):void{ this.iState = _arg1; switch (this.iState){ case stBeforeShow: this.iTimer = 20; break; case stShowHeader: iLogo.prVisible = false; break; case stNormal: this.iTimer = 180; break; case stLogo: iLogo.scaleX = OGlobal.Scale; iLogo.scaleY = OGlobal.Scale; iLogo.prVisible = true; this.iTimer = 100; break; case stInvisible: this.prVisible = false; break; }; } } }//package RES.WINDOWS
Section 142
//OWLevels (RES.WINDOWS.OWLevels) package RES.WINDOWS { import ENGINE.DISPLAY.*; import flash.events.*; import ENGINE.INTERFACE.*; import ENGINE.CORE.*; import RES.OBJECTS.*; public class OWLevels extends OWindow { public var iNext:OButton; public var iClose:OButton; public var iPrev:OButton; private var iInd:int; private var iColor:uint; private var iBColor:uint; public function OWLevels(){ super(Cubiz2L.OWLevels); } override public function Init():void{ super.Init(); this.iColor = ODisplay.HSBToRGB(0, 0, 0.75); this.iBColor = ODisplay.HSBToRGB(210, 0.6, 0.9); this.DrawLevels(); this.ShowButtons(); } private function drawRect(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{ this.graphics.drawRect(OGlobal.ToGlobal(_arg1), OGlobal.ToGlobal(_arg2), OGlobal.ToGlobal(_arg3), OGlobal.ToGlobal(_arg4)); } override public function OnPress(_arg1:Event, _arg2):void{ if (_arg2 == this.iClose){ this.prVisible = false; return; }; if (_arg2 == this.iPrev){ this.iInd = (this.iInd - 8); if (this.iInd < 0){ this.iInd = 0; }; this.DrawLevels(); this.ShowButtons(); return; }; if (_arg2 == this.iNext){ if ((this.iInd + 8) < OField.iLevels.length){ this.iInd = (this.iInd + 8); this.DrawLevels(); this.ShowButtons(); }; return; }; } private function DrawLevel(_arg1:int, _arg2:uint, _arg3:int, _arg4:int, _arg5:Boolean=false):void{ var _local6:Array; var _local7:int; var _local8:int; var _local9:int; var _local10:int; var _local11:Array; var _local12:int; _local6 = OField.iLevels[_arg1]; _local7 = 10; _local8 = 180; this.graphics.lineStyle(OGlobal.ToGlobal(2.8), _arg2); if (_arg5){ this.moveTo((_arg3 - 5), _arg4); this.lineTo(((_arg3 + _local8) + 5), _arg4); this.moveTo((_arg3 - 5), (_arg4 + _local8)); this.lineTo(((_arg3 + _local8) + 5), (_arg4 + _local8)); this.moveTo(_arg3, (_arg4 - 5)); this.lineTo(_arg3, ((_arg4 + _local8) + 5)); this.moveTo((_arg3 + _local8), (_arg4 - 5)); this.lineTo((_arg3 + _local8), ((_arg4 + _local8) + 5)); }; this.drawRect(((_arg3 + (_local8 / 2)) - (_local7 * _local6[(_local6.length - 1)][0])), ((_arg4 + _local8) - _local7), ((_local7 * _local6[(_local6.length - 1)][0]) * 2), _local7); _local9 = 2; _local10 = (_local6.length - 2); while (_local10 >= 0) { _local11 = _local6[_local10]; _local12 = 0; while (_local12 < _local11.length) { this.drawRect((((_arg3 + (_local8 / 2)) - _local7) + (_local7 * _local11[_local12])), (((_arg4 + _local8) - _local7) - (_local7 * _local9)), (_local7 * 2), (_local7 * 2)); _local12++; }; _local9 = (_local9 + 2); _local10--; }; } override public function Free():void{ super.Free(); } private function ShowButtons():void{ this.iPrev.SetVisible((this.iInd > 0)); this.iNext.SetVisible(((this.iInd + 8) < OField.iLevels.length)); } private function DrawLevels():void{ var _local1:int; var _local2:int; var _local3:int; var _local4:int; this.graphics.clear(); _local1 = this.iInd; _local2 = 0; while (_local2 < 2) { _local3 = 100; _local4 = 0; while (_local4 < 4) { if (_local1 >= OField.iLevels.length){ return; }; DrawLevel(_local1, ((_local1)<Cubiz2L.iGAME.prLevel) ? this.iBColor : this.iColor, (10 + (200 * _local4)), (100 + (200 * _local2)), true); _local1++; _local4++; }; _local2++; }; } } }//package RES.WINDOWS
Section 143
//OWLink (RES.WINDOWS.OWLink) package RES.WINDOWS { import flash.events.*; import ENGINE.INTERFACE.*; import flash.net.*; public class OWLink extends OIObject { public var iLink:String; public var iHit:OButton; public function OWLink(_arg1:Array, _arg2:Array=null){ super(_arg1, _arg2); } override public function OnPress(_arg1:Event, _arg2):void{ var _local3:URLRequest; if (_arg2 == iHit){ _local3 = new URLRequest(iLink); }; } } }//package RES.WINDOWS
Section 144
//OWMenu (RES.WINDOWS.OWMenu) package RES.WINDOWS { import flash.events.*; import ENGINE.INTERFACE.*; import flash.net.*; public class OWMenu extends ODialog { public var iPlayers:OIObject; public var iOptions:OButton; public var iMoreGames:OButton; public var iGameName:OIObject; public var iBName:OButton; public var iHall:OButton; public var iCPlayers:OCounter; public var iTimer:int; public var iShow:Boolean;// = false public var iInstructions:OButton; public var iInfo:OIObject; public var iPlayOnline:OButton; public function OWMenu(){ iShow = false; super(Cubiz2L.OWMenu); } private function ShowUserReiting(_arg1:Boolean):void{ var _local2:String; var _local3:Array; _local2 = Cubiz2L.OWColors[Math.round((Math.random() * (Cubiz2L.OWColors.length - 1)))]; Cubiz2L.OWMenuReiting[0][3] = _local2; if (_arg1){ Cubiz2L.OWMenuReiting[0][4] = ((Cubiz2L.strPlayerTower + " - ") + Cubiz2L.iGAME.prScore.toString()); this.InitObject(Cubiz2L.OWMenuReiting); return; }; _local3 = Cubiz2L.iLLoader.prBRecord.split(/,/); Cubiz2L.OWMenuReiting[0][4] = ((Cubiz2L.strBestWorldTower + " - ") + _local3[3]); this.InitObject(Cubiz2L.OWMenuReiting); } override public function set prVisible(_arg1:Boolean):void{ super.prVisible = _arg1; } override public function Init():void{ Cubiz2L.OWMenu[0][4] = ((Cubiz2L.strWelcome + " ") + Cubiz2L.iGAME.prPlayerName); super.Init(); if (Cubiz2L.iMP.prUsersCount == 0){ this.iPlayers.prAnimationEnabled = false; this.iPlayers.prVisible = false; this.iPlayers.prAnimationEnabled = true; this.iCPlayers.prAnimationEnabled = false; this.iCPlayers.prVisible = false; this.iPlayers.prAnimationEnabled = true; }; this.iCPlayers.prAnimationEnabled = false; this.iCPlayers.prValue = Cubiz2L.iMP.prUsersCount; this.iPlayers.prAnimationEnabled = true; this.iCPlayers.Pos((this.iPlayOnline.prX + 50), this.iCPlayers.prY); this.iPlayers.Pos((this.iCPlayers.prX + 90), this.iPlayers.prY); this.ShowUserReiting(true); this.Pos(0, 0); } override public function set prActive(_arg1:Boolean):void{ super.prActive = _arg1; } override public function OnPress(_arg1:Event, _arg2):void{ if (_arg2 == this.iBName){ (this.parent as OWindow).OnPress(null, Cubiz2L.miChoosePlayer); this.prVisible = false; return; }; if (_arg2 == this.iPlayOnline){ (this.parent as OWindow).OnPress(null, Cubiz2L.miStartGame); this.prVisible = false; return; }; if (_arg2 == this.iOptions){ (this.parent as OWindow).OnPress(null, Cubiz2L.miOptions); this.prActive = false; return; }; if (_arg2 == this.iInstructions){ (this.parent as OWindow).OnPress(null, Cubiz2L.miInstructions); this.prActive = false; return; }; if (_arg2 == this.iHall){ (this.parent as OWindow).OnPress(null, Cubiz2L.miHall); this.prVisible = false; return; }; if (_arg2 == this.iMoreGames){ navigateToURL(new URLRequest(Cubiz2L.strConnect2URL), "blank"); return; }; (this.parent as OWindow).OnPress(null, Cubiz2L.miCommingSoon); this.prActive = false; } override public function Free():void{ this.iBName = null; this.iGameName = null; this.iCPlayers = null; this.iPlayers = null; this.iPlayOnline = null; this.iOptions = null; this.iInstructions = null; this.iMoreGames = null; this.InitObject(null); super.Free(); } private function InitObject(_arg1:Array):void{ if (this.iInfo){ this.removeChild(this.iInfo); this.iInfo.Free(); this.iInfo = null; }; if (!_arg1){ return; }; this.iInfo = new OIObject(_arg1, OInterface.iDefSlowAnimators); this.addChild(this.iInfo); this.iInfo.SetVisible(false); this.iInfo.prVisible = true; } override public function OnEnterFrame(_arg1:Event):void{ if (this.iPlayers.prVisible){ this.iCPlayers.prVisible = false; this.iPlayers.prVisible = false; }; if (((!(this.iShow)) && (Cubiz2L.iLLoader.prComplete))){ ShowUserReiting(false); this.iShow = true; }; super.OnEnterFrame(_arg1); } } }//package RES.WINDOWS
Section 145
//OWOptions (RES.WINDOWS.OWOptions) package RES.WINDOWS { import flash.events.*; import ENGINE.INTERFACE.*; import ENGINE.CORE.*; import flash.system.*; public class OWOptions extends ODialog { public var iResolution:OListBox; public var iSound:OListBox; public var iFullScreen:OListBox; private var iSResList:Array; private var iSRes:Array; public var iMusic:OListBox; public var iCancel:OButton; public var iAccept:OButton; public function OWOptions(){ super(Cubiz2L.OWOptions); } private function AddResolution(_arg1:int, _arg2:int):void{ if ((((_arg1 <= Capabilities.screenResolutionX)) && ((_arg2 <= Capabilities.screenResolutionY)))){ this.iSRes.push([_arg1, _arg2]); this.iSResList.push(((_arg1.toString() + " X ") + _arg2.toString())); }; } override public function Init():void{ var _local1:int; var _local2:int; var _local3:Number; var _local4:int; var _local5:int; var _local6:Number; Cubiz2L.OWOptions[0][2] = 340; Cubiz2L.OWOptions[5][11] = 190; Cubiz2L.OWOptions[6][8] = 260; Cubiz2L.OWOptions[7][8] = 260; super.Init(); this.iResolution.prVisible = false; this.iSound.prCurrentInd = int((Cubiz2L.iGAME.prSoundVolume * 10)); this.iMusic.prCurrentInd = int((Cubiz2L.iGAME.prMusicVolume * 10)); this.InitResolutions(); this.iResolution.prLBParams = this.iSResList; _local1 = OGlobal.prStage.stageWidth; _local2 = OGlobal.prStage.stageHeight; _local3 = 10000; _local4 = 0; _local5 = 0; while (_local5 < this.iSRes.length) { _local6 = (Math.abs((this.iSRes[_local5][0] - _local1)) + Math.abs((this.iSRes[_local5][1] - _local2))); if (_local6 < _local3){ _local4 = _local5; _local3 = _local6; }; _local5++; }; this.iResolution.prCurrentInd = _local4; this.iFullScreen.prCurrentInd = ((((OGlobal.prStage.stageWidth == Capabilities.screenResolutionX)) && ((OGlobal.prStage.stageHeight == Capabilities.screenResolutionY)))) ? 1 : 0; } override public function OnPress(_arg1:Event, _arg2):void{ if (_arg2 == this.iCancel){ this.prVisible = false; return; }; if (_arg2 == this.iAccept){ this.prVisible = false; Cubiz2L.iGAME.prSoundVolume = (this.iSound.prCurrentInd / 10); Cubiz2L.iGAME.prMusicVolume = (this.iMusic.prCurrentInd / 10); Cubiz2L.iGAME.prResX = this.iSRes[this.iResolution.prCurrentInd][0]; Cubiz2L.iGAME.prResY = this.iSRes[this.iResolution.prCurrentInd][1]; Cubiz2L.iGAME.prFullScreen = (this.iFullScreen.prCurrentInd) ? true : false; fscommand("fullscreen", Cubiz2L.iGAME.prFullScreen.toString()); return; }; } override public function Free():void{ this.iSound = null; this.iMusic = null; this.iResolution = null; this.iFullScreen = null; this.iAccept = null; this.iCancel = null; this.iSRes = null; this.iSResList = null; super.Free(); } private function InitResolutions():void{ this.iSRes = new Array(); this.iSResList = new Array(); AddResolution(640, 480); AddResolution(800, 600); AddResolution(0x0400, 600); AddResolution(0x0400, 0x0300); AddResolution(0x0500, 0x0300); AddResolution(0x0500, 0x0400); AddResolution(Capabilities.screenResolutionX, Capabilities.screenResolutionY); } } }//package RES.WINDOWS
Section 146
//OWResults (RES.WINDOWS.OWResults) package RES.WINDOWS { import ENGINE.DISPLAY.*; import flash.events.*; import ENGINE.INTERFACE.*; import ENGINE.GAME.*; import RES.OBJECTS.*; public class OWResults extends OWindow { private var iPPanel:OTPanel; private var iBPanel:OTPanel; public function OWResults(){ super(Cubiz2L.OWResults, ODialog.iDefAnimators); } override public function Init():void{ var _local1:Array; var _local2:Array; var _local3:int; var _local4:String; var _local5:String; var _local6:String; var _local7:int; _local3 = Cubiz2L.iGAME.Read(OGame.catTmp, "GameOver"); if (Cubiz2L.iLLoader.prBComplete){ _local1 = Cubiz2L.iLLoader.prBRecord.split(/,/); _local4 = Cubiz2L.strBestWorldTower; } else { if (Cubiz2L.iPPRecord){ _local1 = Cubiz2L.iPPRecord.split(/,/); _local4 = Cubiz2L.strLastYourTower; } else { _local1 = new Array(); _local1.push(((_local3)==OWGame.stLevelBad) ? Cubiz2L.iGAME.prLevel : (Cubiz2L.iGAME.prLevel - 1)); _local1.push(""); _local1.push(""); _local1.push((OField.iLevels[_local1[0]].length - 1)); _local1.push(""); _local4 = Cubiz2L.strLastWorldTower; }; }; switch (_local3){ case OWGame.stLevelBad: _local5 = Cubiz2L.strTryAgain1; _local6 = Cubiz2L.strTryAgain; break; case OWGame.stLevelGood: _local5 = Cubiz2L.strLevelComplete; _local6 = Cubiz2L.strNextLevel; break; case OWGame.stGameOver: _local5 = Cubiz2L.strGameOver; _local6 = Cubiz2L.strNewGame; _local7 = Cubiz2L.iGAME.prScore; Cubiz2L.iGAME.NewGame(); Cubiz2L.iGAME.AddScore(_local7); break; }; _local2 = Cubiz2L.iPRecord.split(/,/); Cubiz2L.OWResults[0][4] = _local5; Cubiz2L.OWResults[2][4] = _local4; Cubiz2L.OWResults[3][4] = _local2[3]; Cubiz2L.OWResults[4][4] = _local1[3]; Cubiz2L.OWResults[5][6] = _local6; super.Init(); this.iPPanel = new OTPanel(ODisplay.HSBToRGB(30, 0.75, 0.9)); this.iPPanel.Make(_local2[0], _local2[4]); this.iPPanel.Pos(300, 120); this.addChild(this.iPPanel); this.Pos(0, 0); } override public function OnPress(_arg1:Event, _arg2):void{ this.prVisible = false; } override public function Free():void{ super.Free(); } } }//package RES.WINDOWS
Section 147
//Cubiz2 (Cubiz2) package { import flash.events.*; import flash.display.*; import ENGINE.INTERFACE.*; import RES.WINDOWS.*; import ENGINE.CORE.*; import ENGINE.SMARTFOX.*; public class Cubiz2 extends OApplication { private var iSystem:OSystem; private var iWindow:OWindow; public function Cubiz2(){ super("Cubiz2"); Cubiz2L.iGAME; OSound.PlayListAdd("music.mp3"); OSound.PlayMusic(); } override protected function OnMenuItem():void{ var _local1:int; var _local2:DisplayObject; _local1 = this.prMenuItem; switch (_local1){ case Cubiz2L.miNullWindow: return; case Cubiz2L.miLastWindow: _local2 = this.getChildAt((this.numChildren - 1)); this.iWindow = ((_local2 is OWindow)) ? (_local2 as OWindow) : null; if (this.iWindow){ this.iWindow.prActive = true; return; }; this.iWindow = new OWMenu(); this.prMenuItem = Cubiz2L.miNullWindow; break; case Cubiz2L.miIntro: this.iWindow = new OWIntro(); if (Cubiz2L.iGAME.prPlayerName == ""){ this.prMenuItem = Cubiz2L.miEnterNameFirst; } else { this.prMenuItem = Cubiz2L.miMenu; }; break; case Cubiz2L.miEnterNameFirst: this.iWindow = new OWEnterName(false); this.prMenuItem = Cubiz2L.miMenu; break; case Cubiz2L.miEnterNewName: this.iWindow = new OWEnterName(true); (this.iWindow as OWEnterName).prName = ""; this.prMenuItem = Cubiz2L.miLastWindow; break; case Cubiz2L.miMenu: switch (Cubiz2L.iMP.State){ case OMultiplayer.stNone: break; case OMultiplayer.stConnectionError: Cubiz2L.iMP.State = OMultiplayer.stNone; if (Cubiz2L.iMP.prErrorsCount < 5){ Cubiz2L.iMP.State = OMultiplayer.stNone; }; break; }; this.iWindow = new OWMenu(); this.prMenuItem = Cubiz2L.miNullWindow; break; case Cubiz2L.miCommingSoon: this.iWindow = new OAlert(Cubiz2L.OWCommingSoon, null); this.prMenuItem = Cubiz2L.miLastWindow; break; case Cubiz2L.miChoosePlayer: this.iWindow = new OWChoosePlayer(); this.prMenuItem = Cubiz2L.miMenu; break; case Cubiz2L.miDeletePlayerConfirm: this.iWindow = new OAlert(Cubiz2L.OWDeletePlayerConfirm, [Cubiz2L.miDeletePlayer, Cubiz2L.miLastWindow]); this.prMenuItem = Cubiz2L.miLastWindow; break; case Cubiz2L.miDeletePlayer: Cubiz2L.iGAME.DeletePlayer(Cubiz2L.iGAME.prPlayerName); if (Cubiz2L.iGAME.prPlayerName != ""){ this.OnMenuItem(); return; }; this.iWindow = new OWEnterName(false); this.prMenuItem = Cubiz2L.miLastWindow; break; case Cubiz2L.miOptions: this.iWindow = new OWOptions(); this.prMenuItem = Cubiz2L.miLastWindow; break; case Cubiz2L.miStartGame: Cubiz2L.iGAME.Start(); this.iWindow = new OWConnection(); this.prMenuItem = Cubiz2L.miPlayGame; break; case Cubiz2L.miPlayGame: this.iWindow = new OWGame(false); this.prMenuItem = Cubiz2L.miMenu; break; case Cubiz2L.miInstructions: this.iWindow = new OAlert(Cubiz2L.OWInstructions, null); this.prMenuItem = Cubiz2L.miLastWindow; break; case Cubiz2L.miResults: this.iWindow = new OWResults(); this.prMenuItem = Cubiz2L.miStartGame; break; case Cubiz2L.miHall: this.iWindow = new OWLevels(); this.prMenuItem = Cubiz2L.miLastWindow; break; }; this.addChild(this.iWindow); } override public function Init():void{ if (((((!(this.stage)) || ((this.stage.stageHeight == 0)))) || ((this.stage.stageWidth == 0)))){ return; }; Cubiz2L.iBGImage = Cubiz2S.MakeBackgroundImage(); this.InitBackground([Cubiz2L.iBGImage], 0); if (Cubiz2L.sDebug){ this.iSystem = new OSystem(); this.addChild(this.iSystem); }; super.Init(); if (Cubiz2L.iGAME.prPlayerName == ""){ this.prMenuItem = Cubiz2L.miIntro; } else { this.prMenuItem = Cubiz2L.miIntro; }; OnMenuItem(); } override public function OnPress(_arg1:Event, _arg2):void{ if (_arg1 == null){ this.prMenuItem = _arg2; }; } override protected function OnDeactivate(_arg1:Event):void{ Cubiz2L.iGAME.SaveCache(); } override public function OnEnterFrame(_arg1:Event):void{ super.OnEnterFrame(_arg1); if (Cubiz2L.sDebug){ OSystem.iUserText1 = (((((((((" : " + Cubiz2L.iMP.State.toString()) + " : ") + Cubiz2L.iMP.prActiveRoomID.toString()) + " ") + Cubiz2L.iMP.prPlayerID.toString()) + " : ") + Cubiz2L.iMP.prError) + " : ") + OGlobal.Domain); }; if (this.iWindow){ if (this.iWindow.prAnimation){ return; }; if (!this.iWindow.prVisible){ this.removeChild(this.iWindow); this.iWindow.Free(); this.iWindow = null; this.OnMenuItem(); } else { if (!this.iWindow.prActive){ this.OnMenuItem(); }; }; }; } private function MakeBackgroundImage():BitmapData{ var _local1:Sprite; var _local2:int; var _local3:int; var _local4:Number; var _local5:Number; var _local6:int; var _local7:BitmapData; _local1 = new Sprite(); _local2 = ((OGlobal.StageRect.width / 10) - 1); _local3 = ((OGlobal.StageRect.height / 10) - 1); _local4 = (Math.floor(((OGlobal.StageRect.width - (_local2 * 10)) / 2)) + 0.2); _local5 = (Math.floor(((OGlobal.StageRect.height - (_local3 * 10)) / 2)) + 0.2); _local1.graphics.beginFill(16710391); _local1.graphics.drawRect(0, 0, OGlobal.StageRect.width, OGlobal.StageRect.height); _local1.graphics.endFill(); _local1.graphics.lineStyle(0, 14474989); _local6 = 0; while (_local6 <= _local3) { _local1.graphics.moveTo(_local4, (_local5 + (_local6 * 10))); _local1.graphics.lineTo((_local4 + (_local2 * 10)), (_local5 + (_local6 * 10))); _local6++; }; _local6 = 0; while (_local6 <= _local2) { _local1.graphics.moveTo((_local4 + (_local6 * 10)), _local5); _local1.graphics.lineTo((_local4 + (_local6 * 10)), (_local5 + (_local3 * 10))); _local6++; }; _local7 = new BitmapData(OGlobal.StageRect.width, OGlobal.StageRect.height, false, 0); _local7.draw(_local1); return (_local7); } } }//package
Section 148
//Cubiz2L (Cubiz2L) package { import ENGINE.DISPLAY.*; import flash.display.*; import ENGINE.INTERFACE.*; import ENGINE.INTERFACE.ANIMATORS.*; import ENGINE.GAME.*; import ENGINE.CORE.*; import ENGINE.SMARTFOX.*; import RES.OBJECTS.*; public class Cubiz2L { public static const strPrev:String = "Prev"; public static const strCancel:String = "Cancel"; public static const miEnterNewName:int = 4; public static const strContinueGame:String = "Continue"; public static const strRemove:String = "Remove"; public static const strHall:String = "Hall of Fame"; public static const miDeletePlayer:int = 9; public static const strLevelComplete:String = "Level Complete"; public static const strBestWorldTower:String = "Best World Tower"; public static const miIntro:int = 2; public static const miDeleteScoresConfirm:int = 12; public static const strDefPlayerName:String = "WELL"; public static const strNewGame:String = "New Game"; public static const strClose:String = "Close"; public static const strEnterName:String = "please enter your name:"; public static const strFailedLevel:String = " Has Failed The Level With Score "; public static const strLastWorldTower:String = "Last World Tower"; public static const strLevelConfirm1:String = "more than"; public static const strLevelConfirm2:String = "score"; public static const strPresents:String = "presents"; public static const strMusic:String = "Music Volume"; public static const miCommingSoon:int = 6; public static const strInstructions:String = "Instructions"; public static const strConnect1URL:String = "http://www.wellgames.com/free_online/cubiz2/?g=cubiz2"; public static const strLevelScore:String = "'s Level Score Is "; public static const OSBubbleBangSInd:int = 0; public static const strAccept:String = "Accept"; public static const strClear:String = "Clear"; public static const strTowerHeight:String = "Max. Height:"; public static const strChoosePlayer:String = "Choose a Player"; public static const sBBannerPrefix:String = "bottom/"; public static const strAdd:String = "Add"; public static const strConnectionToServer:String = "Connection To Server..."; public static const strHeight:String = "Height: "; public static const miResults:int = 17; public static const strCreator:String = "WWWWWWWWWW"; public static const strBanner:String = "Go through 20 levels step by step and build the highest tower in the world!"; public static const sZone:String = "Cubiz2"; public static const strCommingSoon:String = "Coming Soon..."; public static const strDeletePlayerConfirm:String = "Are you sure you want to delete this profile?"; public static const strNext:String = "Next"; public static const strTotalScore:String = "Level Score"; public static const strBonusScore:String = "Bonus Score"; public static const strPlayersOnline1:String = "Players Online"; public static const strConnect2URL:String = "http://www.wellgames.com/?g=cubiz2"; public static const sBannerID:String = "cubiz2"; public static const strInstructionsText:String = (("Build the highest tower in the world without losing any cubes. " + "\nClick and drag to move the cubes with your mouse.") + "\nYour tower must stand by itself without help from your mouse."); public static const strScore:String = "Score:"; public static const miLastWindow:int = 1; public static const strFullScreen:String = "Full Screen"; private static const iWOptionsVolume:Array = [Cubiz2L.strOff, "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%"]; public static const strGameName:String = "CUBIZ! 2"; public static const strYes:String = "Yes"; public static const strSelectLevel:String = "Select Level"; public static const strGameName1:String = "Step by Step"; public static const strPlay:String = "Play"; public static const miPlayGame:int = 15; public static const strPublishReiting:String = "Publish Rating"; public static const strReiting:String = "Rating"; public static const sDomain:String = "wellgames.com"; public static const strSite:String = "WELLGAMES"; public static const strCompleteLevel:String = " Has Completed The Level With Score "; public static const miMenu:int = 5; public static const miHighScores:int = 11; public static const strNextLevel:String = "Next Level"; public static const miNullWindow:int = 0; public static const strOptions:String = "Options"; public static const strMenu:String = "Menu"; public static const strGlobal:String = "Global"; public static const strConnect3URL:String = "http://absolutist.com/cgi-bin/tell_a_friend.pl?url=http://wellgames.com/free_online/cubiz2/?g=cubiz2"; public static const strGameOver:String = "Game Over"; public static const strMoreGames:String = "More Games"; public static const strDelete:String = "Delete"; public static const strDeletePlayer:String = "Delete Player?"; public static const miStartGame:int = 14; public static const strTryAgain1:String = "Try Again"; public static const strOpponent1:String = "Opponent"; public static const strOpponent2:String = "In Game"; public static const OSBubbleBangEInd:int = 10; private static const iWOptionsOnOff:Array = [Cubiz2L.strOff, Cubiz2L.strOn]; public static const strAddMusic:String = "Add Music"; public static const strPlace:String = " Place"; public static const strSound:String = "Sound Volume"; public static const miOptions:int = 10; public static const miDeleteScores:int = 13; public static const strLevelConfirm:String = "To get to the next level you need"; public static const strNewPlayer:String = "NEW PLAYER!"; public static const miDeletePlayerConfirm:int = 8; public static const miInstructions:int = 16; public static const strHighScores:String = "High Scores"; public static const iPosXLabelGameOver:int = 90; public static const strDateCreation:String = "2008/16/01"; public static const strReiting2:String = "'s Rating Is "; public static const strWindow:String = "Window"; public static const strChangePlayer:String = "click to change player"; public static const strDeleteScoresConfirm:String = "Are you sure you want to delete scores table?"; public static const strOff:String = "Off"; public static const strCommingSoonI:String = "This option is not available at the moment"; public static const strPersonal:String = "Personal"; public static const miChoosePlayer:int = 7; public static const strHasReiting:String = "'s Rating Is "; public static const sServer:String = "www.wellgames.com"; public static const sDebug:Boolean = false; private static const OSoundParams:Array = [Cubiz2L.OSBubbleBang01, Cubiz2L.OSEEE, Cubiz2L.OSSmile01]; public static const strReiting1:String = " Place: "; public static const strNew:String = "New"; public static const strBox2D:String = "The game is using Box2D physical engine. Special thanks to Erin Catto and Matthew Bush."; public static const strTryAgain:String = "Try Again"; public static const strPlayOnline:String = "Play Online!"; public static const strLocal:String = "Local"; public static const strPlayerTower:String = "Your Tower"; public static const sTBannerPrefix:String = "top/"; public static const miEnterNameFirst:int = 3; public static const strBox2DLink:String = "http://www.box2d.org"; public static const strWinner:String = "Winner!!!"; public static const strNo:String = "No"; public static const strConnect1:String = "Play With Other Gamers In Multiplayer Mode!"; public static const strConnect2:String = "Try Other Multiplayer Games!"; public static const sXTName:String = "cb2"; public static const strYourReiting:String = "Your Rating"; public static const strConnect3:String = "Tell A Friend About Cubiz2!"; public static const strGainedScore:String = "Gained Score"; public static const strCreatorName:String = "Creator - "; public static const strLastYourTower:String = "Your last tower"; public static const strOn:String = "On"; public static const strWelcome:String = "Welcome"; public static const strPlayersOnline:String = "Players Online"; public static const strMultiPlayerConfirm:String = "This option is available as "quick play""; public static const miHall:int = 18; public static var iBGImage:BitmapData; public static var OWChoosePlayer:Array = [[Cubiz2S.BigFrame, 500, 500, "aqua1", "white", 0, 0, null, 0, true], [Cubiz2S.Header, 500, 50, "aqua1", Cubiz2L.strChoosePlayer, 0, 20, null, 0, true], [Cubiz2S.ListBoxText, 360, 40, "yellow", "yellow", 5, null, 30, 90, "iListBox", 0, true], [Cubiz2S.MakeTextButton, 170, 60, "yellow", "yellow", 30, Cubiz2L.strNew, 30, 340, "iNew", 0, true], [Cubiz2S.MakeTextButton, 170, 60, "magenta", "magenta", 30, Cubiz2L.strDelete, 300, 340, "iDelete", 0, true], [Cubiz2S.MakeTextButton, 170, 60, "yellow1", "yellow1", 30, Cubiz2L.strAccept, 70, 420, "iAccept", 0, true], [Cubiz2S.MakeTextButton, 170, 60, "red", "red", 30, Cubiz2L.strCancel, 260, 420, "iCancel", 0, true]]; public static var OIUp:Class = Cubiz2L_OIUp; private static var OWGameTowerCounterF:Array = [OInterface.OCounterMake, [[ODisplay.IDisplayObjectMake, OWPlayersCounterElement, 0, 0, "iDigits", 0, true], [ODisplay.IDisplayObjectMake, OWPlayersCounterElement, 17, 0, "iDigits", 1, true], [ODisplay.IDisplayObjectMake, OWPlayersCounterElement, 34, 0, "iDigits", 2, true]], 51, 30]; public static var OWInfoPBanner:Array = [[Cubiz2S.Header, 200, 18, "magenta1", Cubiz2L.strBanner, 600, 250, null, 0, true]]; public static var iPRecord:String = null; public static var OWInstructionsP:Array = [[Cubiz2S.Header, 700, 50, "red1", Cubiz2L.strInstructions, 0, 20, null, 0, true], [Cubiz2S.MakeSprite, 250, 250, "aqua1", Cubiz2L.OInfoC, 225, 60, null, 0, true], [Cubiz2S.Header, 700, 18, "magenta1", Cubiz2L.strInstructionsText, 0, 355, null, 0, true]]; public static var OInfoC:Class = Cubiz2L_OInfoC; public static var OIRight:Class = Cubiz2L_OIRight; public static var OWEnterName:Array = [[Cubiz2S.BigFrame, 460, 290, "aqua1", "white", 0, 0, null, 0, true], [Cubiz2S.Header, 460, 50, "aqua1", Cubiz2L.strNewPlayer, 0, 20, null, 0, true], [Cubiz2S.Header, 460, 30, "yellow", Cubiz2L.strEnterName, 0, 90, null, 0, true], [Cubiz2S.InputText, 400, 60, "yellow", "well", [45, 0.9, 0.6], 11, 30, 130, "iName", 0, true], [Cubiz2S.MakeTextButton, 170, 60, "yellow1", "yellow1", 30, Cubiz2L.strAccept, 50, 210, "iAccept", 0, true], [Cubiz2S.MakeTextButton, 170, 60, "red", "red", 30, Cubiz2L.strCancel, 240, 210, "iCancel", 0, true]]; public static var OWGameConnection:Array = [Cubiz2S.ColorHeader, 800, 40, Cubiz2L.OWColors, Cubiz2L.strConnectionToServer, OInterface.iDefSlowAnimators, 0, 280, null, 0, true]; private static var OWPlayersCounterF:Array = [OInterface.OCounterMake, [[ODisplay.IDisplayObjectMake, OWPlayersCounterElement, 0, 0, "iDigits", 0, true], [ODisplay.IDisplayObjectMake, OWPlayersCounterElement, 17, 0, "iDigits", 1, true], [ODisplay.IDisplayObjectMake, OWPlayersCounterElement, 34, 0, "iDigits", 2, true], [ODisplay.IDisplayObjectMake, OWPlayersCounterElement, 51, 0, "iDigits", 3, true], [ODisplay.IDisplayObjectMake, OWPlayersCounterElement, 67, 0, "iDigits", 4, true]], 85, 30]; public static var OSSmile01:Class = Cubiz2L_OSSmile01; public static var iCache:OCache = new OCache(); private static var OWPlayersCounterElement:Array = [OInterface.OTabMake, [[Cubiz2S.Header, 17, 30, "0", " ", 0, 0, null, 0, false], [Cubiz2S.Header, 17, 30, "0", "0", 0, 0, null, 0, false], [Cubiz2S.Header, 17, 30, "30", "1", 0, 0, null, 0, false], [Cubiz2S.Header, 17, 30, "60", "2", 0, 0, null, 0, false], [Cubiz2S.Header, 17, 30, "90", "3", 0, 0, null, 0, false], [Cubiz2S.Header, 17, 30, "120", "4", 0, 0, null, 0, false], [Cubiz2S.Header, 17, 30, "150", "5", 0, 0, null, 0, false], [Cubiz2S.Header, 17, 30, "180", "6", 0, 0, null, 0, false], [Cubiz2S.Header, 17, 30, "210", "7", 0, 0, null, 0, false], [Cubiz2S.Header, 17, 30, "240", "8", 0, 0, null, 0, false], [Cubiz2S.Header, 17, 30, "270", "9", 0, 0, null, 0, false]], 17, 30, Cubiz2L.OTimerAnimator, null]; public static var OWGameNameColor:Array = ["red", "yellow1", "aqua1", "magenta1", "yellow", "blue", "red1", "green1"]; public static var OWCommingSoon:Array = [[Cubiz2S.BigFrame, 530, 290, "yellow1", "yellow", 0, 0, null, 0, true], [Cubiz2S.Header, 530, 50, "red", Cubiz2L.strCommingSoon, 0, 20, null, 0, true], [Cubiz2S.Header, 530, 30, "magenta", Cubiz2L.strCommingSoonI, 0, 125, null, 0, true], [Cubiz2S.MakeTextButton, 170, 60, "aqua1", "aqua1", 30, Cubiz2L.strClose, 180, 210, null, 0, true]]; public static var OWInfoPTower:Array = [[Cubiz2S.Header, 200, 18, "magenta1", Cubiz2L.strBestWorldTower, 600, 57, null, 0, true], [Cubiz2S.Header, 200, 16, "red", Cubiz2L.strCreator, 600, 80, null, 0, true], [Cubiz2S.Header, 200, 16, "yellow1", Cubiz2L.strDateCreation, 600, 100, null, 0, true], [Cubiz2S.TextAlign, 190, 16, 16, "magenta1", Cubiz2L.strHeight, 2, 1, 600, 129, null, 0, true]]; public static var OWPlayersColor:Array = ["180", "210", "240", "270", "300", "330", "0", "30", "60", "90", "120", "150", "180", "210", "240", "270", "300", "330", "0", "30", "60", "90", "120", "150"]; public static var OILeft:Class = Cubiz2L_OILeft; public static var iLLoader:OLLoader = new OLLoader(); public static var OWResults:Array = [[Cubiz2S.ColorHeader, 800, 55, OWColors, Cubiz2L.strGameOver, null, 0, 0, null, 0, true], [Cubiz2S.Header, 200, 18, "red1", Cubiz2L.strPlayerTower, (150 + 150), 75, null, 0, true], [Cubiz2S.Header, 200, 18, "magenta1", Cubiz2L.strBestWorldTower, 450, 75, null, 0, false], [Cubiz2S.Header, 200, 18, "red1", Cubiz2L.strPlayerTower, (150 + 150), 95, null, 0, true], [Cubiz2S.Header, 200, 18, "magenta1", Cubiz2L.strBestWorldTower, 450, 95, null, 0, false], [Cubiz2S.MakeTextButton, 180, 50, "yellow1", "yellow1", 25, Cubiz2L.strTryAgain, 310, 540, null, 0, true]]; public static var OWMenuReiting:Array = [[Cubiz2S.Header, 800, 30, "yellow", "W", 0, 380, null, 0, true]]; public static var OBox2D_logo:Class = Cubiz2L_OBox2D_logo; public static var OSEEE:Class = Cubiz2L_OSEEE; public static var OFont:Class = Cubiz2L_OFont; private static var iSoundRegistered:Boolean = OSound.RegisterEmbedSounds(OSoundParams); private static var OTimerAnimator:Object = {F:OA_AlphaFade.Make, iSAlpha:-1, iEAlpha:0, iSInd:[0], iEInd:[1], iPIter:15}; public static var OWMenu:Array = [[Cubiz2S.Header, 800, 40, "magenta1", Cubiz2L.strWelcome, 0, 10, null, 0, true], [Cubiz2S.Header, 800, 30, "white", Cubiz2L.strChangePlayer, 0, 55, null, 0, true], [Cubiz2S.ColorHeader, 800, 120, Cubiz2L.OWGameNameColor, Cubiz2L.strGameName, null, 0, 75, "iGameName", 0, true], [Cubiz2S.InvisibleButton, 400, 75, 200, 10, "iBName", 0, true], [ODisplay.IDisplayObjectMake, OWPlayersCounterF, 20, 226, "iCPlayers", 0, true], [Cubiz2S.ColorText, 30, Cubiz2L.OWPlayersColor, Cubiz2L.strPlayersOnline, null, 20, 220, "iPlayers", 0, true], [Cubiz2S.MakeTextButton, 460, 90, "aqua1", "aqua1", 50, Cubiz2L.strPlayOnline, 170, 275, "iPlayOnline", 0, true], [Cubiz2S.MakeTextButton, 320, 60, "yellow", "yellow", 30, Cubiz2L.strOptions, 50, 425, "iOptions", 0, true], [Cubiz2S.MakeTextButton, 320, 60, "yellow1", "yellow1", 30, Cubiz2L.strInstructions, 420, 425, "iInstructions", 0, true], [Cubiz2S.MakeTextButton, 320, 60, "blue", "blue", 30, Cubiz2L.strHall, (30 + 200), 505, "iHall", 0, true], [Cubiz2S.MakeTextButton, 320, 60, "magenta", "magenta", 30, Cubiz2L.strMoreGames, 440, 505, "iMoreGames", 0, false]]; public static var OWColors:Array = ["0", "30", "60", "90", "120", "150", "180", "210", "240", "270", "300", "330", "0", "30", "60", "90", "120", "150", "180", "210", "240", "270", "300", "330"]; public static var OWIntroParam:Array = [[OSprite.Make, [[ODisplay.SpriteRect, (800 * OGlobal.Scale), (600 * OGlobal.Scale)]], 0, 0, "iHit", 0, false], [Cubiz2S.Header, 800, 50, "aqua1", Cubiz2L.strSite, 0, 160, "iHeader", 0, true], [Cubiz2S.Header, 800, 40, "aqua1", Cubiz2L.strPresents, 0, 400, "iFooter", 0, true], [Cubiz2S.ColorHeader, 800, 120, Cubiz2L.OWGameNameColor, Cubiz2L.strGameName, null, 0, 210, "iGameName", 0, true], [Cubiz2S.ColorHeader, 800, 40, Cubiz2L.OWColors, Cubiz2L.strGameName1, null, 0, 330, "iGameName1", 0, true]]; public static var OWLevels:Array = [[Cubiz2S.ColorHeader, 800, 50, Cubiz2L.OWColors, Cubiz2L.strHall, null, 0, -4, null, 0, true], [Cubiz2S.MakeTextButton, 180, 50, "aqua1", "aqua1", 30, Cubiz2L.strClose, 310, 530, "iClose", 0, true], [Cubiz2S.MakeTextButton, 100, 50, "yellow", "yellow", 30, Cubiz2L.strPrev, 20, 530, "iPrev", 0, true], [Cubiz2S.MakeTextButton, 100, 50, "yellow", "yellow", 30, Cubiz2L.strNext, 680, 530, "iNext", 0, true]]; public static var OWGameAlert:Array = [[Cubiz2S.MakeTextButton, 250, 60, "yellow", "yellow", 30, Cubiz2L.strContinueGame, 0, 0, "iButtons", 0, true], [Cubiz2S.MakeTextButton, 250, 60, "yellow1", "yellow1", 30, Cubiz2L.strNewGame, 0, 70, "iButtons", 1, true]]; public static var OIDown:Class = Cubiz2L_OIDown; public static var OWOptions:Array = [[Cubiz2S.BigFrame, 540, 390, "aqua1", "white", 0, 0, null, 0, true], [Cubiz2S.Header, 540, 50, "aqua1", Cubiz2L.strOptions, 0, 20, null, 0, true], [Cubiz2S.ListBoxTextHSlider, 520, 50, "magenta", false, 90, 40, "magenta", Cubiz2L.strSound, Cubiz2L.iWOptionsVolume, 10, 90, "iSound", 0, true], [Cubiz2S.ListBoxTextHSlider, 520, 50, "yellow", false, 90, 40, "yellow", Cubiz2L.strMusic, Cubiz2L.iWOptionsVolume, 10, 140, "iMusic", 0, true], [Cubiz2S.ListBoxTextHSlider, 520, 50, "green1", false, 200, 40, "green1", Cubiz2L.strWindow, null, 10, 190, "iResolution", 0, true], [Cubiz2S.ListBoxTextHSlider, 520, 50, "red1", false, 90, 40, "red1", Cubiz2L.strFullScreen, Cubiz2L.iWOptionsOnOff, 10, 240, "iFullScreen", 0, false], [Cubiz2S.MakeTextButton, 170, 60, "yellow1", "yellow1", 30, Cubiz2L.strAccept, 90, 310, "iAccept", 0, true], [Cubiz2S.MakeTextButton, 170, 60, "red", "red", 30, Cubiz2L.strCancel, 280, 310, "iCancel", 0, true]]; public static var OWInstructions:Array = [[Cubiz2S.BigFrame, 700, 520, "red1", "white", 0, 0, null, 0, true], [Cubiz2S.Header, 700, 50, "red1", Cubiz2L.strInstructions, 0, 20, null, 0, true], [Cubiz2S.MakeSprite, 250, 250, "aqua1", Cubiz2L.OInfoC, 225, 60, null, 0, true], [Cubiz2S.Header, 700, 18, "magenta1", Cubiz2L.strInstructionsText, 0, 330, null, 0, true], [Cubiz2S.MakeTextButton, 190, 50, "aqua1", "aqua1", 30, Cubiz2L.strClose, 0xFF, 450, null, 0, true], [Cubiz2S.Header, 520, 18, "blue", Cubiz2L.strBox2D, 0, 400, null, 0, true], [Cubiz2S.MakeUniversalLink, 164, 44, [ODisplay.SpriteLib, Cubiz2L.OBox2D_logo, 0.7, 0, 0, null, 0, true], strBox2DLink, 513, 382, null, 0, true]]; public static var OWDeletePlayerConfirm:Array = [[Cubiz2S.BigFrame, 420, 270, "red", "yellow", 0, 0, null, 0, true], [Cubiz2S.Header, 420, 30, "aqua1", Cubiz2L.strDeletePlayerConfirm, 0, 85, null, 0, true], [Cubiz2S.MakeTextButton, 150, 60, "yellow1", "yellow1", 30, Cubiz2L.strYes, 50, 190, "iButtons", 0, true], [Cubiz2S.MakeTextButton, 150, 60, "red", "red", 30, Cubiz2L.strNo, 220, 190, "iButtons", 1, true]]; public static var iMP:OMultiplayer = new OMultiplayer(sDebug); public static var OBG01:Class = Cubiz2L_OBG01; public static var iFirst:Boolean = true; public static var iGAME:OGame = new OCGame(); public static var OSBubbleBang01:Class = Cubiz2L_OSBubbleBang01; public static var iPPRecord:String = null; public static var OWGame:Array = [[Cubiz2S.ColorHeader, 200, 43, Cubiz2L.OWGameNameColor, Cubiz2L.strGameName, null, 600, -7, null, 0, true], [Cubiz2S.Header, 200, 18, "aqua1", Cubiz2L.strSite, 600, 533, null, 0, true], [Cubiz2S.InvisibleButton, 200, 22, 600, 528, "iSite", 0, false], [Cubiz2S.MakeTextButton, 120, 35, "aqua1", "aqua1", 22, Cubiz2L.strMenu, 640, 560, "iMenu", 0, true], [Cubiz2S.ColorText, 30, Cubiz2L.OWPlayersColor, Cubiz2L.strTowerHeight, null, 3, -7, null, 0, true], [ODisplay.IDisplayObjectMake, OWGameTowerCounterF, 200, 1, "iTHeightC", 0, true]]; } }//package
Section 149
//Cubiz2L_OBG01 (Cubiz2L_OBG01) package { import mx.core.*; public class Cubiz2L_OBG01 extends SpriteAsset { } }//package
Section 150
//Cubiz2L_OBox2D_logo (Cubiz2L_OBox2D_logo) package { import mx.core.*; public class Cubiz2L_OBox2D_logo extends SpriteAsset { } }//package
Section 151
//Cubiz2L_OFont (Cubiz2L_OFont) package { import mx.core.*; public class Cubiz2L_OFont extends SpriteAsset { } }//package
Section 152
//Cubiz2L_OIDown (Cubiz2L_OIDown) package { import mx.core.*; public class Cubiz2L_OIDown extends SpriteAsset { } }//package
Section 153
//Cubiz2L_OILeft (Cubiz2L_OILeft) package { import mx.core.*; public class Cubiz2L_OILeft extends SpriteAsset { } }//package
Section 154
//Cubiz2L_OInfoC (Cubiz2L_OInfoC) package { import mx.core.*; public class Cubiz2L_OInfoC extends SpriteAsset { } }//package
Section 155
//Cubiz2L_OIRight (Cubiz2L_OIRight) package { import mx.core.*; public class Cubiz2L_OIRight extends SpriteAsset { } }//package
Section 156
//Cubiz2L_OIUp (Cubiz2L_OIUp) package { import mx.core.*; public class Cubiz2L_OIUp extends SpriteAsset { } }//package
Section 157
//Cubiz2L_OSBubbleBang01 (Cubiz2L_OSBubbleBang01) package { import mx.core.*; public class Cubiz2L_OSBubbleBang01 extends SoundAsset { } }//package
Section 158
//Cubiz2L_OSEEE (Cubiz2L_OSEEE) package { import mx.core.*; public class Cubiz2L_OSEEE extends SoundAsset { } }//package
Section 159
//Cubiz2L_OSSmile01 (Cubiz2L_OSSmile01) package { import mx.core.*; public class Cubiz2L_OSSmile01 extends SoundAsset { } }//package
Section 160
//Cubiz2S (Cubiz2S) package { import ENGINE.DISPLAY.*; import flash.display.*; import flash.geom.*; import ENGINE.INTERFACE.*; import ENGINE.INTERFACE.ELEMENTS.*; import RES.WINDOWS.*; import ENGINE.INTERFACE.ANIMATORS.*; import ENGINE.DISPLAY.EFFECTS.*; import ENGINE.CORE.*; import flash.text.*; import ENGINE.SKIN.*; public class Cubiz2S { public static var iRegistered:Boolean = Cubiz2S.Register(); public static function DrawPicture(_arg1:Array):OBitmap{ return (OBitmap.MakeTmp(_arg1[1], _arg1[2], _arg1[3], _arg1[4], 0)); } public static function MakeSprite(_arg1:Array):OBitmap{ return (ODisplay.OBitmapSpriteFillRect([null, _arg1[1], _arg1[2], [ODisplay.SpriteLib, _arg1[4]], "INC", _arg1[3], "border", 1, OGlobal.ScaleFloor(_arg1[5]), OGlobal.ScaleFloor(_arg1[6])])); } private static function Register():Boolean{ OEffects.RegisterEffect("INC", new OEffectInk()); OEffects.RegisterColor("INC", "red", {iCH:0, iCS:0.75, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "red1", {iCH:30, iCS:0.75, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "yellow", {iCH:60, iCS:0.9, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "yellow1", {iCH:90, iCS:0.9, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "green", {iCH:120, iCS:0.75, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "green1", {iCH:150, iCS:0.75, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "aqua", {iCH:180, iCS:0.6, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "aqua1", {iCH:210, iCS:0.6, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "blue", {iCH:240, iCS:0.45, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "blue1", {iCH:270, iCS:0.45, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "magenta", {iCH:300, iCS:0.6, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "magenta1", {iCH:330, iCS:0.6, iCB:0.9, iCA:0.9}); OEffects.RegisterColor("INC", "white", {iCH:0, iCS:0, iCB:0.75, iCA:0.9}); OEffects.RegisterFilter("INC", "bpanel", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); OEffects.RegisterFilter("INC", "text 30", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); OEffects.RegisterFilter("INC", "text 40", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); OEffects.RegisterFilter("INC", "text 50", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); OEffects.RegisterFilter("INC", "text 60", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); OEffects.RegisterFilter("INC", "text 90", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); OEffects.RegisterFilter("INC", "spanel", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); OEffects.RegisterFilter("INC", "border", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); OEffects.RegisterFilter("INC", "border1", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); OEffects.RegisterFilter("INC", "bpanel ns", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); OEffects.RegisterFilter("INC", "spanel ns", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); OEffects.RegisterFilter("INC", "border ns", {iBorder:1, iAngle:45, iFSD:0, iFSB:0, iFB:0}); return (true); } public static function MakeSpriteButton(_arg1:Array):OButton{ var _local2:Array; var _local3:OButton; _local2 = [[ODisplay.OBitmapSpriteFillRect, _arg1[1], _arg1[2], [ODisplay.SpriteLib, _arg1[5]], "INC", _arg1[3], _arg1[6], _arg1[7], 0, 0, null, 0, true], [OSprite.Make, [[ODisplay.SpriteRect, (_arg1[1] * OGlobal.Scale), (_arg1[2] * OGlobal.Scale)]], 0, 0, "iHit", 0, false]]; _local3 = new OButton(_local2); _local3.Pos(OGlobal.ScaleFloor(_arg1[8]), OGlobal.ScaleFloor(_arg1[9])); return (_local3); } public static function SmallFrame(_arg1:Array):OBitmap{ return (ODisplay.OBitmapXBorder([null, _arg1[1], _arg1[2], 24, 5, "INC", _arg1[3], "border", 1, OGlobal.ScaleFloor(_arg1[5]), OGlobal.ScaleFloor(_arg1[6])])); } public static function Text(_arg1:Array):OBitmap{ var _local2:Number; var _local3:String; _local2 = Math.round((1 + (_arg1[1] / 70))); _local3 = ("text " + String(Math.max(30, Math.min((Math.round((_arg1[1] / 10)) * 10), 90)))); return (ODisplay.OBitmapText([null, Cubiz2L.OFont, _arg1[1], _local2, _arg1[3], "INC", _arg1[2], _local3, 1, OGlobal.ScaleFloor(_arg1[4]), OGlobal.ScaleFloor(_arg1[5])])); } public static function ListBoxTextHSlider(_arg1:Array):OListBox{ var _local2:Number; var _local3:Number; var _local4:String; var _local5:Rectangle; var _local6:Number; var _local7:Array; var _local8:Array; var _local9:Array; var _local10:Array; var _local11:OListBox; _local2 = _arg1[6]; _local3 = Math.round((1 + (_local2 / 70))); _local4 = ("text " + String(Math.max(30, Math.min((Math.round((_local2 / 10)) * 10), 90)))); _local5 = ODisplay.TextRect(Cubiz2L.OFont, _local2, _local3, _arg1[8]); _local6 = (_arg1[6] - 10); _local7 = (_arg1[4]) ? [[Cubiz2S.SmallBorder, _arg1[1], _arg1[2], _arg1[3], 0, 0, null, 0, true]] : new Array(); _local8 = [[ODisplay.OBitmapText, Cubiz2L.OFont, _local2, _local3, _arg1[8], "INC", _arg1[3], _local4, 1, 15, ((_arg1[2] - _local5.height) * 0.5), null, 0, true], [Cubiz2S.MakeSpriteButton, _local6, _local6, _arg1[3], _arg1[4], Cubiz2L.OILeft, "text 60", 1, ((_arg1[1] - _arg1[5]) - 75), ((_arg1[2] - _local6) * 0.5), "iUp", 0, false], [Cubiz2S.MakeSpriteButton, _local6, _local6, _arg1[3], _arg1[4], Cubiz2L.OIRight, "text 60", 1, (_arg1[1] - 45), ((_arg1[2] - _local6) * 0.5), "iDown", 0, false]]; _local7 = _local7.concat(_local8); _local9 = [Cubiz2S.ListBoxTextElement, _arg1[5], _arg1[6], _arg1[7], "w", _arg1[7], 0, 0]; _local10 = [[((_arg1[1] - 45) - _arg1[5]), ((_arg1[2] - _arg1[6]) * 0.5)]]; _local11 = new OListBox(_local7, _local9, Cubiz2S.ListBoxTextElementP, _local10, null); _local11.iUp.prAnimatorParams = OInterface.iDefLBButtonAnimators; _local11.iDown.prAnimatorParams = OInterface.iDefLBButtonAnimators; _local11.prSelection = false; _local11.prCycling = true; _local11.prLBParams = _arg1[9]; _local11.Pos(OGlobal.ScaleFloor(_arg1[10]), OGlobal.ScaleFloor(_arg1[11])); return (_local11); } public static function ColorText(_arg1:Array):OIObject{ var _local2:Number; var _local3:String; var _local4:Sprite; var _local5:TextField; var _local6:TextFormat; var _local7:Array; var _local8:int; var _local9:int; var _local10:OIObject; var _local11:String; var _local12:Rectangle; _local2 = Math.round((1 + (_arg1[1] / 70))); _local3 = ("text " + String(Math.max(30, Math.min((Math.round((_arg1[1] / 10)) * 10), 90)))); _local4 = ((Cubiz2L.OFont is Sprite)) ? (Cubiz2L.OFont as Sprite) : new ((Cubiz2L.OFont as Class)); if (!(_local4.getChildAt(0) is TextField)){ return (null); }; _local5 = (_local4.getChildAt(0) as TextField); _local5.autoSize = TextFieldAutoSize.LEFT; _local5.text = _arg1[3]; _local6 = _local5.defaultTextFormat; _local6.size = _arg1[1]; _local6.letterSpacing = _local2; _local5.setTextFormat(_local6); _local7 = new Array(); _local8 = 0; _local9 = 0; while (_local9 < _local5.length) { _local11 = _arg1[3].substr(_local9, 1); if (_local11 == " "){ } else { _local12 = _local5.getCharBoundaries(_local9); if (_local12 == null){ throw (new Error((((("Неопределён символ '" + _local11) + "' (строка '") + _arg1[3]) + "') в шрифте \n смортри library.fla"))); }; var _temp1 = _local8; _local8 = (_local8 + 1); _local7.push([ODisplay.OBitmapMake, [ODisplay.SpriteText, Cubiz2L.OFont, _arg1[1], _local2, _local11], 1, "INC", _arg1[2][_temp1], _local3, 1, _local12.x, _local12.y, null, 0, true]); }; _local9++; }; _local10 = new OIObject(_local7, _arg1[4]); _local10.Pos(OGlobal.ScaleFloor(_arg1[5]), OGlobal.ScaleFloor(_arg1[6])); return (_local10); } public static function TextSmallFrame(_arg1:Array):OBitmap{ var _local2:Number; var _local3:String; _local2 = Math.round((1 + (_arg1[4] / 70))); _local3 = ("text " + String(Math.max(30, Math.min((Math.round((_arg1[4] / 10)) * 10), 90)))); return (ODisplay.OBitmapXBorderText([null, _arg1[1], _arg1[2], 24, 5, "INC", _arg1[3], "border", 1, Cubiz2L.OFont, _arg1[4], _local2, _arg1[5], "INC", _arg1[6], _local3, 1, OGlobal.ScaleFloor(_arg1[7]), OGlobal.ScaleFloor(_arg1[8])])); } public static function ListBoxTextVSlider(_arg1:Array):OListBox{ var _local2:Number; var _local3:Number; var _local4:String; var _local5:Rectangle; var _local6:Array; var _local7:Number; var _local8:Number; var _local9:Array; var _local10:Array; var _local11:Array; var _local12:OListBox; _local2 = _arg1[6]; _local3 = Math.round((1 + (_local2 / 70))); _local4 = ("text " + String(Math.max(30, Math.min((Math.round((_local2 / 10)) * 10), 90)))); _local5 = ODisplay.TextRect(Cubiz2L.OFont, _local2, _local3, _arg1[9]); _local6 = [[((_arg1[1] - _arg1[5]) * 0.5), _arg1[7]]]; _local7 = (_arg1[6] - 10); _local8 = (_local6[0][1] + ((_arg1[6] - _local7) * 0.5)); _local9 = (_arg1[4]) ? [[Cubiz2S.SmallBorder, _arg1[1], _arg1[2], _arg1[3], 0, 0, null, 0, true]] : new Array(); _local10 = [[ODisplay.OBitmapText, Cubiz2L.OFont, _local2, _local3, _arg1[9], "INC", _arg1[3], _local4, 1, ((_arg1[1] - _local5.width) * 0.5), _arg1[10], null, 0, true], [Cubiz2S.MakeSpriteButton, _local7, _local7, _arg1[3], _arg1[4], Cubiz2L.OILeft, "text 60", 1, (_local6[0][0] - _local7), _local8, "iUp", 0, false], [Cubiz2S.MakeSpriteButton, _local7, _local7, _arg1[3], _arg1[4], Cubiz2L.OIRight, "text 60", 1, (_local6[0][0] + _arg1[5]), _local8, "iDown", 0, false]]; _local9 = _local9.concat(_local10); _local11 = [Cubiz2S.ListBoxTextElement, _arg1[5], _arg1[6], _arg1[8], "w", _arg1[8], 0, 0]; _local12 = new OListBox(_local9, _local11, Cubiz2S.ListBoxTextElementP, _local6, null); _local12.iUp.prAnimatorParams = OInterface.iDefLBButtonAnimators; _local12.iDown.prAnimatorParams = OInterface.iDefLBButtonAnimators; _local12.prSelection = false; _local12.prCycling = true; _local12.prLBParams = _arg1[11]; _local12.Pos(OGlobal.ScaleFloor(_arg1[12]), OGlobal.ScaleFloor(_arg1[13])); return (_local12); } public static function MakeBackgroundImage():BitmapData{ var _local1:Sprite; var _local2:int; var _local3:int; var _local4:Number; var _local5:Number; var _local6:int; var _local7:BitmapData; _local1 = new Sprite(); _local2 = ((OGlobal.StageRect.width / 10) - 1); _local3 = ((OGlobal.StageRect.height / 10) - 1); _local4 = (Math.floor(((OGlobal.StageRect.width - (_local2 * 10)) / 2)) + 0.2); _local5 = (Math.floor(((OGlobal.StageRect.height - (_local3 * 10)) / 2)) + 0.2); _local1.graphics.beginFill(16710391); _local1.graphics.drawRect(0, 0, OGlobal.StageRect.width, OGlobal.StageRect.height); _local1.graphics.endFill(); _local1.graphics.lineStyle(0, 14474989); _local6 = 0; while (_local6 <= _local3) { _local1.graphics.moveTo(_local4, (_local5 + (_local6 * 10))); _local1.graphics.lineTo((_local4 + (_local2 * 10)), (_local5 + (_local6 * 10))); _local6++; }; _local6 = 0; while (_local6 <= _local2) { _local1.graphics.moveTo((_local4 + (_local6 * 10)), _local5); _local1.graphics.lineTo((_local4 + (_local6 * 10)), (_local5 + (_local3 * 10))); _local6++; }; _local7 = new BitmapData(OGlobal.StageRect.width, OGlobal.StageRect.height, false, 0); _local7.draw(_local1); return (_local7); } public static function MakeNFTextButton(_arg1:Array):OButton{ var _local2:Number; var _local3:String; var _local4:Array; var _local5:OButton; _local2 = Math.round((1 + (_arg1[5] / 70))); _local3 = ("text " + String(Math.max(30, Math.min((Math.round((_arg1[5] / 10)) * 10), 90)))); _local4 = [[ODisplay.OBitmapTextInRect, Cubiz2L.OFont, _arg1[5], _local2, _arg1[6], "INC", _arg1[3], _local3, 1, _arg1[1], _arg1[2], 0, 0, null, 0, true], [OSprite.Make, [[ODisplay.SpriteRoundRect, (_arg1[1] * OGlobal.Scale), (_arg1[2] * OGlobal.Scale), (24 * OGlobal.Scale)]], 0, 0, "iHit", 0, false]]; _local5 = new OButton(_local4); _local5.Pos(OGlobal.ScaleFloor(_arg1[7]), OGlobal.ScaleFloor(_arg1[8])); return (_local5); } public static function InvisibleButton(_arg1:Array):OButton{ var _local2:Array; var _local3:OButton; _local2 = [[OSprite.Make, [[ODisplay.SpriteRect, (_arg1[1] * OGlobal.Scale), (_arg1[2] * OGlobal.Scale)]], 0, 0, "iHit", 0, false]]; _local3 = new OButton(_local2, null); _local3.Pos(OGlobal.ScaleFloor(_arg1[3]), OGlobal.ScaleFloor(_arg1[4])); _local3.prVisible = true; _local3.prActive = true; return (_local3); } public static function ListBoxTextElement(_arg1:Array):OListBoxElement{ var _local2:Number; var _local3:Number; var _local4:String; var _local5:Array; var _local6:OListBoxElement; _local2 = (_arg1[2] - 10); if (_local2 < 30){ _local2 = 30; }; _local3 = Math.round((1 + (_local2 / 70))); _local4 = ("text " + String(Math.max(30, Math.min((Math.round((_local2 / 10)) * 10), 90)))); _local5 = [[ODisplay.OBitmapMake, [ODisplay.SpriteXBorder, _arg1[1], _arg1[2], 4, 6], 1, "INC", _arg1[3], "border", 1, 0, 0, null, 0, false], [ODisplay.OBitmapMake, [ODisplay.SpriteTextInRect, Cubiz2L.OFont, _local2, _local3, _arg1[4], _arg1[1], _arg1[2]], 1, "INC", _arg1[5], _local4, 1, 0, 0, null, 0, true], [OSprite.Make, [[ODisplay.SpriteRoundRect, (_arg1[1] * OGlobal.Scale), (_arg1[2] * OGlobal.Scale), (12 * OGlobal.Scale)]], 0, 0, "iHit", 0, false]]; _local6 = new OListBoxElement(_local5); _local6.Pos(OGlobal.ScaleFloor(_arg1[6]), OGlobal.ScaleFloor(_arg1[7])); return (_local6); } public static function MakeTextButton(_arg1:Array):OButton{ var _local2:Number; var _local3:String; var _local4:Number; var _local5:Array; var _local6:OButton; _local2 = Math.round((1 + (_arg1[5] / 70))); _local3 = ("text " + String(Math.max(30, Math.min((Math.round((_arg1[5] / 10)) * 10), 90)))); _local4 = ((_arg1[2] <= 60)) ? 1 : 1.2; _local5 = [[ODisplay.OBitmapXBorderText, _arg1[1], _arg1[2], 3, 5, "INC", _arg1[3], "border", 1, Cubiz2L.OFont, _arg1[5], _local2, _arg1[6], "INC", _arg1[3], _local3, 1, 0, 0, null, 0, true], [OSprite.Make, [[ODisplay.SpriteRoundRect, (_arg1[1] * OGlobal.Scale), (_arg1[2] * OGlobal.Scale), (24 * OGlobal.Scale)]], 0, 0, "iHit", 0, false]]; _local6 = new OButton(_local5); _local6.Pos(OGlobal.ScaleFloor(_arg1[7]), OGlobal.ScaleFloor(_arg1[8])); return (_local6); } public static function ListBoxTextElementP(_arg1:Array, _arg2:String):void{ _arg1[4] = _arg2; } public static function MakeUniversalButton(_arg1:Array):OButton{ var _local2:Array; var _local3:OButton; var _local4:DisplayObject; _local2 = [_arg1[3], [OSprite.Make, [[ODisplay.SpriteRoundRect, (_arg1[1] * OGlobal.Scale), (_arg1[2] * OGlobal.Scale), (24 * OGlobal.Scale)]], 0, 0, "iHit", 0, false]]; _local3 = new OButton(_local2); _local4 = _local3.getChildAt(0); _local4.width = (_arg1[1] * OGlobal.Scale); _local4.height = (_arg1[2] * OGlobal.Scale); _local3.Pos(OGlobal.ScaleFloor(_arg1[4]), OGlobal.ScaleFloor(_arg1[5])); return (_local3); } public static function ColorHeader(_arg1:Array):OIObject{ var _local2:Number; var _local3:String; var _local4:Sprite; var _local5:TextField; var _local6:TextFormat; var _local7:Rectangle; var _local8:Number; var _local9:Array; var _local10:int; var _local11:int; var _local12:OIObject; var _local13:String; var _local14:Rectangle; _local2 = Math.round((1 + (_arg1[2] / 70))); _local3 = ("text " + String(Math.max(30, Math.min((Math.round((_arg1[2] / 10)) * 10), 90)))); _local4 = ((Cubiz2L.OFont is Sprite)) ? (Cubiz2L.OFont as Sprite) : new ((Cubiz2L.OFont as Class)); if (!(_local4.getChildAt(0) is TextField)){ return (null); }; _local5 = (_local4.getChildAt(0) as TextField); _local5.autoSize = TextFieldAutoSize.LEFT; _local5.text = _arg1[4]; _local6 = _local5.defaultTextFormat; _local6.size = _arg1[2]; _local6.letterSpacing = _local2; _local5.setTextFormat(_local6); _local7 = _local5.getBounds(_local4); _local8 = ((_arg1[1] - _local7.width) / 2); _local9 = new Array(); _local10 = 0; _local11 = 0; while (_local11 < _local5.length) { _local13 = _arg1[4].substr(_local11, 1); if (_local13 == " "){ } else { _local14 = _local5.getCharBoundaries(_local11); if (_local14 == null){ throw (new Error((("Неопределён символ '" + _local13) + "' в шрифте \n смортри library.fla"))); }; var _temp1 = _local10; _local10 = (_local10 + 1); _local9.push([ODisplay.OBitmapMake, [ODisplay.SpriteText, Cubiz2L.OFont, _arg1[2], _local2, _local13], 1, "INC", _arg1[3][(_temp1 % _arg1[3].length)], _local3, 1, (_local14.x + _local8), _local14.y, null, 0, true]); }; _local11++; }; _local12 = new OIObject(_local9, _arg1[5]); _local12.Pos(OGlobal.ScaleFloor(_arg1[6]), OGlobal.ScaleFloor(_arg1[7])); return (_local12); } public static function SmallBorder(_arg1:Array):OBitmap{ return (ODisplay.OBitmapXBorder([null, _arg1[1], _arg1[2], 4, 6, "INC", _arg1[3], "border", 1, OGlobal.ScaleFloor(_arg1[4]), OGlobal.ScaleFloor(_arg1[5])])); } public static function Header(_arg1:Array):OBitmap{ var _local2:Number; var _local3:String; _local2 = Math.round((1 + (_arg1[2] / 70))); _local3 = ("text " + String(Math.max(30, Math.min((Math.round((_arg1[2] / 10)) * 10), 90)))); return (ODisplay.OBitmapTextInRect([null, Cubiz2L.OFont, _arg1[2], _local2, _arg1[4], "INC", _arg1[3], _local3, 1, _arg1[1], _arg1[2], OGlobal.ScaleFloor(_arg1[5]), OGlobal.ScaleFloor(_arg1[6])])); } public static function MakeTextLink(_arg1:Array):OWLink{ var _local2:Array; var _local3:OWLink; _local2 = [[Cubiz2S.MakeNFTextButton, _arg1[1], _arg1[2], _arg1[3], _arg1[3], _arg1[4], _arg1[5], 0, 0, "iHit", 0, true]]; _local3 = new OWLink(_local2); _local3.iLink = _arg1[6]; _local3.Pos(_arg1[7], _arg1[8]); return (_local3); } public static function InputText(_arg1:Array):OInput{ var _local2:Array; var _local3:OInput; _local2 = [[Cubiz2S.SmallBorder, _arg1[1], _arg1[2], _arg1[3], 0, 0, null, 0, true], [OInterface.OInputTextFieldMake, (_arg1[1] - 10), (_arg1[2] - 10), Cubiz2L.OFont, (_arg1[2] - 30), 1, false, _arg1[5], _arg1[4], _arg1[6], 5, 8, "iText", 0, true]]; _local3 = new OInput(_local2); _local3.Pos(OGlobal.ScaleFloor(_arg1[7]), OGlobal.ScaleFloor(_arg1[8])); return (_local3); } public static function TextAlign(_arg1:Array):OBitmap{ var _local2:Number; var _local3:String; _local2 = Math.round((1 + (_arg1[2] / 70))); _local3 = ("text " + String(Math.max(30, Math.min((Math.round((_arg1[2] / 10)) * 10), 90)))); return (ODisplay.OBitmapTextAlign([null, Cubiz2L.OFont, _arg1[3], _local2, _arg1[5], _arg1[6], _arg1[7], "INC", _arg1[4], _local3, 1, _arg1[1], _arg1[2], OGlobal.ScaleFloor(_arg1[8]), OGlobal.ScaleFloor(_arg1[9])])); } public static function ListBoxText(_arg1:Array):OListBox{ var _local2:Number; var _local3:Number; var _local4:Array; var _local5:Array; var _local6:Array; var _local7:int; var _local8:OListBox; _local2 = (_arg1[1] + 80); _local3 = ((_arg1[2] * _arg1[5]) + 30); _local4 = [[Cubiz2S.SmallBorder, _local2, _local3, _arg1[3], 0, 0, null, 0, true], [Cubiz2S.MakeSpriteButton, 30, 30, _arg1[3], _arg1[4], Cubiz2L.OIUp, "text 60", 1, (_local2 - 50), 20, "iUp", 0, false], [Cubiz2S.MakeSpriteButton, 30, 30, _arg1[3], _arg1[4], Cubiz2L.OIDown, "text 60", 1, (_local2 - 50), (_local3 - 50), "iDown", 0, false]]; _local5 = [Cubiz2S.ListBoxTextElement, _arg1[1], _arg1[2], _arg1[3], "w", _arg1[4], 0, 0]; _local6 = new Array(_arg1[5]); _local7 = 0; while (_local7 < _arg1[5]) { _local6[_local7] = [15, ((_local7 * _arg1[2]) + 15)]; _local7++; }; _local8 = new OListBox(_local4, _local5, Cubiz2S.ListBoxTextElementP, _local6, null); _local8.iUp.prAnimatorParams = OInterface.iDefLBButtonAnimators; _local8.iDown.prAnimatorParams = OInterface.iDefLBButtonAnimators; _local8.prLBParams = _arg1[6]; _local8.Pos(OGlobal.ScaleFloor(_arg1[7]), OGlobal.ScaleFloor(_arg1[8])); return (_local8); } public static function BigFrame(_arg1:Array):OBitmap{ return (ODisplay.OBitmapXBorder([null, _arg1[1], _arg1[2], 6, 8, "INC", _arg1[3], "border", 1, OGlobal.ScaleFloor(_arg1[5]), OGlobal.ScaleFloor(_arg1[6])])); } public static function MakeUniversalLink(_arg1:Array):OWLink{ var _local2:Array; var _local3:OWLink; _local2 = [[Cubiz2S.MakeUniversalButton, _arg1[1], _arg1[2], _arg1[3], 0, 0, "iHit", 0, true]]; _local3 = new OWLink(_local2); _local3.iLink = _arg1[4]; _local3.Pos(_arg1[5], _arg1[6]); return (_local3); } } }//package
Section 161
//OCGame (OCGame) package { import ENGINE.GAME.*; public class OCGame extends OGame { public function OCGame(){ super(2, 5); } override public function DefaultInitLocalScores():void{ } } }//package
Section 162
//OWLogo (OWLogo) package { import flash.events.*; import flash.display.*; import flash.geom.*; import ENGINE.INTERFACE.*; import ENGINE.CORE.*; import flash.net.*; public class OWLogo extends OIObject { public var iLogo:Bitmap; public static var OLogoBig:Class = OWLogo_OLogoBig; public function OWLogo(){ var _local1:Rectangle; var _local2:MovieClip; this.graphics.beginFill(0xFFFFFF); _local1 = OGlobal.StageRect; this.graphics.drawRect((-((_local1.width - (800 * OGlobal.Scale))) / 2), (-((_local1.height - (600 * OGlobal.Scale))) / 2), _local1.width, _local1.height); this.graphics.endFill(); super([], OInterface.iDefSlowAnimators); _local2 = (new OLogoBig() as MovieClip); _local2.x = 0; _local2.y = 0; this.addChild(_local2); } public function OnClick(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://www.shockwave.com"), "_blank"); this.removeEventListener(MouseEvent.CLICK, OnClick); this.buttonMode = false; } } }//package
Section 163
//OWLogo_OLogoBig (OWLogo_OLogoBig) package { import mx.core.*; public class OWLogo_OLogoBig extends MovieClipAsset { } }//package

Library Items

Symbol 1 Sound {Cubiz2L_OSSmile01} [Cubiz2L_OSSmile01]
Symbol 2 GraphicUsed by:3
Symbol 3 MovieClip {Cubiz2L_OIUp} [OIUp]Uses:2
Symbol 4 FontUsed by:5
Symbol 5 EditableTextUses:4Used by:6
Symbol 6 MovieClip {Cubiz2L_OFont} [OFont]Uses:5
Symbol 7 GraphicUsed by:8
Symbol 8 MovieClip {Cubiz2L_OIDown} [OIDown]Uses:7
Symbol 9 GraphicUsed by:10
Symbol 10 MovieClip {Cubiz2L_OILeft} [OILeft]Uses:9
Symbol 11 Sound {Cubiz2L_OSEEE} [Cubiz2L_OSEEE]
Symbol 12 GraphicUsed by:15
Symbol 13 FontUsed by:14
Symbol 14 TextUses:13Used by:15
Symbol 15 MovieClipUses:12 14Used by:16
Symbol 16 MovieClip {Cubiz2L_OBox2D_logo} [Box2D_logo]Uses:15
Symbol 17 GraphicUsed by:18
Symbol 18 MovieClip {Cubiz2L_OInfoC} [OInfo]Uses:17
Symbol 19 Sound {Cubiz2L_OSBubbleBang01} [Cubiz2L_OSBubbleBang01]
Symbol 20 GraphicUsed by:21
Symbol 21 MovieClip {Cubiz2L_OBG01} [OBG01]Uses:20
Symbol 22 GraphicUsed by:23
Symbol 23 MovieClip {Cubiz2L_OIRight} [OIRight]Uses:22
Symbol 24 GraphicUsed by:47
Symbol 25 GraphicUsed by:26
Symbol 26 MovieClipUses:25Used by:47
Symbol 27 GraphicUsed by:28
Symbol 28 MovieClipUses:27Used by:47
Symbol 29 GraphicUsed by:30
Symbol 30 MovieClipUses:29Used by:47
Symbol 31 GraphicUsed by:32
Symbol 32 MovieClipUses:31Used by:47
Symbol 33 GraphicUsed by:34
Symbol 34 MovieClipUses:33Used by:47
Symbol 35 GraphicUsed by:36
Symbol 36 MovieClipUses:35Used by:47
Symbol 37 GraphicUsed by:38
Symbol 38 MovieClipUses:37Used by:47
Symbol 39 GraphicUsed by:40
Symbol 40 MovieClipUses:39Used by:47
Symbol 41 GraphicUsed by:42
Symbol 42 MovieClipUses:41Used by:47
Symbol 43 GraphicUsed by:44
Symbol 44 MovieClipUses:43Used by:47
Symbol 45 GraphicUsed by:47
Symbol 46 GraphicUsed by:47
Symbol 47 MovieClip {OWLogo_OLogoBig} [Logo]Uses:24 26 28 30 32 34 36 38 40 42 44 45 46

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 1 as "Cubiz2L_OSSmile01"
ExportAssets (56)Timeline Frame 1Symbol 3 as "OIUp"
ExportAssets (56)Timeline Frame 1Symbol 6 as "OFont"
ExportAssets (56)Timeline Frame 1Symbol 8 as "OIDown"
ExportAssets (56)Timeline Frame 1Symbol 10 as "OILeft"
ExportAssets (56)Timeline Frame 1Symbol 11 as "Cubiz2L_OSEEE"
ExportAssets (56)Timeline Frame 1Symbol 16 as "Box2D_logo"
ExportAssets (56)Timeline Frame 1Symbol 18 as "OInfo"
ExportAssets (56)Timeline Frame 1Symbol 19 as "Cubiz2L_OSBubbleBang01"
ExportAssets (56)Timeline Frame 1Symbol 21 as "OBG01"
ExportAssets (56)Timeline Frame 1Symbol 23 as "OIRight"
ExportAssets (56)Timeline Frame 1Symbol 47 as "Logo"
SerialNumber (41)Timeline Frame 1

Labels

"Cubiz2"Frame 1




http://swfchan.com/7/31843/info.shtml
Created: 18/5 -2019 10:28:24 Last modified: 18/5 -2019 10:28:24 Server time: 22/12 -2024 05:31:46