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

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

Gem Rush - operate magic cannon and collect gems in this game.swf

This is the info page for
Flash #90771

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


Text
LOADING...

LOADING

LOADING.

LOADING..

PLAY

PLAY

PLAY

PLAY

Help

Help

Highscores

Highscores

Download this game

Download this game

Play more games

Play more games

Select level

Preview

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

Are You Sure?

Yes

Yes

No

No

Reset Progress

Best level score: 0123456789

Submit score

Submit score

<p align="center"><font face="_sans" size="15" color="#002c3f" letterSpacing="0.800000" kerning="0">Enter your name</font></p>

<p align="center"><font face="_sans" size="16" color="#ffffff" letterSpacing="0.800000" kerning="0">Final score: 0123456789</font></p>

Congratulation!
You WIN!

Use the mouse to aim and fire.
Click and hold to increase shot's power.
Try to bring down as much gems as you can
using maximum 5 shots per level.
Each collected gem gives you +1 point.
Earn level's minimum score (or more) to
complete level. Less spended shots gives
you more score per level.
Avoid bad gems with skull mark (-1 point).
Complete all 20 levels to submit total score.

Good Luck!

Good Luck!

Sponsored by:

Thanks to:

Box2d.org,
soundsnap.com,
mochibot.com,
flashgamelicense.com

DOWNLOAD

Click on link below to download
game's archive. It contains game (swf),
description and thumbnails.

Back

Back

Credits

Controls

Download

Collected:

00

/

00

Shoots:

00

00

Walkthrough

Walkthrough

Menu

Replay

Defeat

Menu

Replay

Victory!

Next Level

Menu

ActionScript [AS3]

Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2CircleDef extends b2ShapeDef { public var radius:Number; public var localPosition:b2Vec2; public function b2CircleDef(){ localPosition = new b2Vec2(0, 0); super(); type = b2Shape.e_circleShape; radius = 1; } } }//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2CircleShape extends b2Shape { public var m_localPosition:b2Vec2; public var m_radius:Number; public function b2CircleShape(_arg1:b2ShapeDef){ m_localPosition = new b2Vec2(); super(_arg1); var _local2:b2CircleDef = (_arg1 as b2CircleDef); m_type = e_circleShape; m_localPosition.SetV(_local2.localPosition); m_radius = _local2.radius; } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{ var _local10:Number; var _local6:b2Mat22 = _arg1.R; var _local7:Number = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y))); var _local8:Number = (_arg1.position.x + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y))); var _local9:Number = (_arg4.p1.x - _local7); _local10 = (_arg4.p1.y - _local8); var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius)); if (_local11 < 0){ return (false); }; var _local12:Number = (_arg4.p2.x - _arg4.p1.x); var _local13:Number = (_arg4.p2.y - _arg4.p1.y); var _local14:Number = ((_local9 * _local12) + (_local10 * _local13)); var _local15:Number = ((_local12 * _local12) + (_local13 * _local13)); var _local16:Number = ((_local14 * _local14) - (_local15 * _local11)); if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){ return (false); }; var _local17:Number = -((_local14 + Math.sqrt(_local16))); if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){ _local17 = (_local17 / _local15); _arg2[0] = _local17; _arg3.x = (_local9 + (_local17 * _local12)); _arg3.y = (_local10 + (_local17 * _local13)); _arg3.Normalize(); return (true); }; return (false); } override public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2XForm, _arg4:b2Vec2):Number{ var _local5:b2Vec2 = b2Math.b2MulX(_arg3, m_localPosition); var _local6:Number = -((b2Math.b2Dot(_arg1, _local5) - _arg2)); if (_local6 < (-(m_radius) + Number.MIN_VALUE)){ return (0); }; if (_local6 > m_radius){ _arg4.SetV(_local5); return (((b2Settings.b2_pi * m_radius) * m_radius)); }; var _local7:Number = (m_radius * m_radius); var _local8:Number = (_local6 * _local6); var _local9:Number = ((_local7 * (Math.asin((_local6 / m_radius)) + (b2Settings.b2_pi / 2))) + (_local6 * Math.sqrt((_local7 - _local8)))); var _local10:Number = (((-2 / 3) * Math.pow((_local7 - _local8), 1.5)) / _local9); _arg4.x = (_local5.x + (_arg1.x * _local10)); _arg4.y = (_local5.y + (_arg1.y * _local10)); return (_local9); } public function GetLocalPosition():b2Vec2{ return (m_localPosition); } public function GetRadius():Number{ return (m_radius); } override public function ComputeMass(_arg1:b2MassData):void{ _arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius); _arg1.center.SetV(m_localPosition); _arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y)))); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2Mat22; _local4 = _arg2.R; var _local5:Number = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); var _local6:Number = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _local4 = _arg3.R; var _local7:Number = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); var _local8:Number = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius)); _arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius)); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:Number = (m_localPosition.x - _arg1.x); var _local3:Number = (m_localPosition.y - _arg1.y); _local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3))); m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop); } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22 = _arg2.R; var _local4:Number = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); var _local5:Number = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius)); _arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius)); } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Mat22 = _arg1.R; var _local4:Number = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); var _local5:Number = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _local4 = (_arg2.x - _local4); _local5 = (_arg2.y - _local5); return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius))); } } }//package Box2D.Collision.Shapes
Section 3
//b2FilterData (Box2D.Collision.Shapes.b2FilterData) package Box2D.Collision.Shapes { public class b2FilterData { public var maskBits:uint;// = 0xFFFF public var groupIndex:int;// = 0 public var categoryBits:uint;// = 1 public function Copy():b2FilterData{ var _local1:b2FilterData = new b2FilterData(); _local1.categoryBits = categoryBits; _local1.maskBits = maskBits; _local1.groupIndex = groupIndex; return (_local1); } } }//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2MassData { public var mass:Number;// = 0 public var center:b2Vec2; public var I:Number;// = 0 public function b2MassData(){ center = new b2Vec2(0, 0); super(); } } }//package Box2D.Collision.Shapes
Section 5
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PolygonDef extends b2ShapeDef { public var vertices:Array; public var vertexCount:int; private static var s_mat:b2Mat22 = new b2Mat22(); public function b2PolygonDef(){ vertices = new Array(b2Settings.b2_maxPolygonVertices); super(); type = b2Shape.e_polygonShape; vertexCount = 0; var _local1:int; while (_local1 < b2Settings.b2_maxPolygonVertices) { vertices[_local1] = new b2Vec2(); _local1++; }; } public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{ var _local5:b2Vec2; var _local6:b2Mat22; var _local7:int; vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); if (_arg3){ _local5 = _arg3; _local6 = s_mat; _local6.Set(_arg4); _local7 = 0; while (_local7 < vertexCount) { _arg3 = vertices[_local7]; _arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y))); _arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y))); _arg3.x = _arg1; _local7++; }; }; } public function SetAsBox(_arg1:Number, _arg2:Number):void{ vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); } } }//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolygonShape extends b2Shape { public var m_coreVertices:Array; public var m_vertices:Array; private var s_supportVec:b2Vec2; public var m_centroid:b2Vec2; public var m_normals:Array; public var m_obb:b2OBB; public var m_vertexCount:int; private static var s_computeMat:b2Mat22 = new b2Mat22(); private static var s_sweptAABB1:b2AABB = new b2AABB(); private static var s_sweptAABB2:b2AABB = new b2AABB(); public function b2PolygonShape(_arg1:b2ShapeDef){ var _local3:int; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; s_supportVec = new b2Vec2(); m_obb = new b2OBB(); m_vertices = new Array(b2Settings.b2_maxPolygonVertices); m_normals = new Array(b2Settings.b2_maxPolygonVertices); m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices); super(_arg1); m_type = e_polygonShape; var _local2:b2PolygonDef = (_arg1 as b2PolygonDef); m_vertexCount = _local2.vertexCount; var _local4:int = _local3; var _local5:int = _local3; _local3 = 0; while (_local3 < m_vertexCount) { m_vertices[_local3] = _local2.vertices[_local3].Copy(); _local3++; }; _local3 = 0; while (_local3 < m_vertexCount) { _local4 = _local3; _local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0; _local6 = (m_vertices[_local5].x - m_vertices[_local4].x); _local7 = (m_vertices[_local5].y - m_vertices[_local4].y); _local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8)); _local3++; }; m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount); ComputeOBB(m_obb, m_vertices, m_vertexCount); _local3 = 0; while (_local3 < m_vertexCount) { _local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1); _local5 = _local3; _local9 = m_normals[_local4].x; _local10 = m_normals[_local4].y; _local11 = m_normals[_local5].x; _local12 = m_normals[_local5].y; _local13 = (m_vertices[_local3].x - m_centroid.x); _local14 = (m_vertices[_local3].y - m_centroid.y); _local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop); _local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop); _local17 = (1 / ((_local9 * _local12) - (_local10 * _local11))); m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y)); _local3++; }; } override public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2XForm, _arg4:b2Vec2):Number{ var _local13:int; var _local22:b2Vec2; var _local24:Boolean; var _local25:b2MassData; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local5:b2Vec2 = b2Math.b2MulTMV(_arg3.R, _arg1); var _local6:Number = (_arg2 - b2Math.b2Dot(_arg1, _arg3.position)); var _local7:Array = []; var _local8:int; var _local9 = -1; var _local10 = -1; var _local11:b2Vec2; var _local12:Boolean; _local13 = 0; while (_local13 < m_vertexCount) { _local11 = m_vertices[_local13]; _local7[_local13] = (((_local5.x * _local11.x) + (_local5.y * _local11.y)) - _local6); _local24 = (_local7[_local13] < -(Number.MIN_VALUE)); if (_local13 > 0){ if (_local24){ if (!_local12){ _local9 = (_local13 - 1); _local8++; }; } else { if (_local12){ _local10 = (_local13 - 1); _local8++; }; }; }; _local12 = _local24; _local13++; }; switch (_local8){ case 0: if (_local12){ _local25 = new b2MassData(); ComputeMass(_local25); _arg4.SetV(b2Math.b2MulX(_arg3, _local25.center)); return ((_local25.mass / m_density)); }; return (0); case 1: if (_local9 == -1){ _local9 = (m_vertexCount - 1); } else { _local10 = (m_vertexCount - 1); }; break; }; var _local14:int = ((_local9 + 1) % m_vertexCount); var _local15:int = ((_local10 + 1) % m_vertexCount); var _local16:Number = ((0 - _local7[_local9]) / (_local7[_local14] - _local7[_local9])); var _local17:Number = ((0 - _local7[_local10]) / (_local7[_local15] - _local7[_local10])); var _local18:b2Vec2 = new b2Vec2(((m_vertices[_local9].x * (1 - _local16)) + (m_vertices[_local14].x * _local16)), ((m_vertices[_local9].y * (1 - _local16)) + (m_vertices[_local14].y * _local16))); var _local19:b2Vec2 = new b2Vec2(((m_vertices[_local10].x * (1 - _local17)) + (m_vertices[_local15].x * _local17)), ((m_vertices[_local10].y * (1 - _local17)) + (m_vertices[_local15].y * _local17))); var _local20:Number = 0; _arg4.Set(0, 0); var _local21:b2Vec2 = m_vertices[_local14]; var _local23:Number = (1 / 3); _local13 = _local14; while (_local13 != _local15) { _local13 = ((_local13 + 1) % m_vertexCount); if (_local13 == _local15){ _local22 = _local19; } else { _local22 = m_vertices[_local13]; }; _local26 = (_local21.x - _local18.x); _local27 = (_local21.y - _local18.y); _local28 = (_local22.x - _local18.x); _local29 = (_local22.y - _local18.y); _local30 = ((_local26 * _local29) - (_local27 * _local28)); _local31 = (0.5 * _local30); _local20 = (_local20 + _local31); _arg4.x = (_arg4.x + ((_local31 * _local23) * ((_local18.x + _local21.x) + _local22.x))); _arg4.y = (_arg4.y + ((_local31 * _local23) * ((_local18.y + _local21.y) + _local22.y))); _local21 = _local22; }; _arg4.x = (_arg4.x / _local20); _arg4.y = (_arg4.y / _local20); _arg4.SetV(b2Math.b2MulX(_arg3, _arg4)); return (_local20); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2AABB = s_sweptAABB1; var _local5:b2AABB = s_sweptAABB2; ComputeAABB(_local4, _arg2); ComputeAABB(_local5, _arg3); _arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y); _arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y); } public function GetVertices():Array{ return (m_vertices); } public function GetCoreVertices():Array{ return (m_coreVertices); } public function GetCentroid():b2Vec2{ return (m_centroid); } public function GetOBB():b2OBB{ return (m_obb); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_coreVertices[0])); } public function Centroid(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_centroid)); } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{ var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:b2Vec2; var _local20:Number; var _local21:Number; var _local6:Number = 0; var _local7:Number = _arg5; _local8 = (_arg4.p1.x - _arg1.position.x); _local9 = (_arg4.p1.y - _arg1.position.y); _local10 = _arg1.R; var _local12:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); var _local13:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); _local8 = (_arg4.p2.x - _arg1.position.x); _local9 = (_arg4.p2.y - _arg1.position.y); _local10 = _arg1.R; var _local14:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); var _local15:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); var _local16:Number = (_local14 - _local12); var _local17:Number = (_local15 - _local13); var _local18 = -1; var _local19:int; while (_local19 < m_vertexCount) { _local11 = m_vertices[_local19]; _local8 = (_local11.x - _local12); _local9 = (_local11.y - _local13); _local11 = m_normals[_local19]; _local20 = ((_local11.x * _local8) + (_local11.y * _local9)); _local21 = ((_local11.x * _local16) + (_local11.y * _local17)); if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){ _local6 = (_local20 / _local21); _local18 = _local19; } else { if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){ _local7 = (_local20 / _local21); }; }; if (_local7 < _local6){ return (false); }; _local19++; }; if (_local18 >= 0){ _arg2[0] = _local6; _local10 = _arg1.R; _local11 = m_normals[_local18]; _arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); return (true); }; return (false); } override public function ComputeMass(_arg1:b2MassData):void{ var _local10:b2Vec2; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local2:Number = 0; var _local3:Number = 0; var _local4:Number = 0; var _local5:Number = 0; var _local6:Number = 0; var _local7:Number = 0; var _local8:Number = (1 / 3); var _local9:int; while (_local9 < m_vertexCount) { _local10 = m_vertices[_local9]; _local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0]; _local12 = (_local10.x - _local6); _local13 = (_local10.y - _local7); _local14 = (_local11.x - _local6); _local15 = (_local11.y - _local7); _local16 = ((_local12 * _local15) - (_local13 * _local14)); _local17 = (0.5 * _local16); _local4 = (_local4 + _local17); _local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x))); _local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y))); _local18 = _local6; _local19 = _local7; _local20 = _local12; _local21 = _local13; _local22 = _local14; _local23 = _local15; _local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18)); _local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19)); _local5 = (_local5 + (_local16 * (_local24 + _local25))); _local9++; }; _arg1.mass = (m_density * _local4); _local2 = (_local2 * (1 / _local4)); _local3 = (_local3 * (1 / _local4)); _arg1.center.Set(_local2, _local3); _arg1.I = (m_density * _local5); } public function GetNormals():Array{ return (m_normals); } public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:b2Vec2; var _local5:b2Mat22; var _local11:Number; _local5 = _arg1.R; var _local6:Number = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y)); var _local7:Number = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y)); var _local8:int; _local4 = m_coreVertices[0]; var _local9:Number = ((_local4.x * _local6) + (_local4.y * _local7)); var _local10 = 1; while (_local10 < m_vertexCount) { _local4 = m_coreVertices[_local10]; _local11 = ((_local4.x * _local6) + (_local4.y * _local7)); if (_local11 > _local9){ _local8 = _local10; _local9 = _local11; }; _local10++; }; _local5 = _arg1.R; _local4 = m_coreVertices[_local8]; s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y))); s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y))); return (s_supportVec); } public function GetVertexCount():int{ return (m_vertexCount); } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22; var _local4:b2Vec2; var _local5:b2Mat22 = s_computeMat; _local3 = _arg2.R; _local4 = m_obb.R.col1; _local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local4 = m_obb.R.col2; _local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local5.Abs(); var _local6:b2Mat22 = _local5; _local4 = m_obb.extents; var _local7:Number = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y)); var _local8:Number = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y)); _local3 = _arg2.R; _local4 = m_obb.center; var _local9:Number = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y))); var _local10:Number = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y))); _arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8)); _arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8)); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:b2Vec2; var _local4:Number; var _local5:Number; m_sweepRadius = 0; var _local3:int; while (_local3 < m_vertexCount) { _local2 = m_coreVertices[_local3]; _local4 = (_local2.x - _arg1.x); _local5 = (_local2.y - _arg1.y); _local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5))); if (_local4 > m_sweepRadius){ m_sweepRadius = _local4; }; _local3++; }; } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Vec2; var _local10:Number; var _local4:b2Mat22 = _arg1.R; var _local5:Number = (_arg2.x - _arg1.position.x); var _local6:Number = (_arg2.y - _arg1.position.y); var _local7:Number = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y)); var _local8:Number = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y)); var _local9:int; while (_local9 < m_vertexCount) { _local3 = m_vertices[_local9]; _local5 = (_local7 - _local3.x); _local6 = (_local8 - _local3.y); _local3 = m_normals[_local9]; _local10 = ((_local3.x * _local5) + (_local3.y * _local6)); if (_local10 > 0){ return (false); }; _local9++; }; return (true); } public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{ var _local3:b2Vec2; var _local7:Number; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; _local3 = new b2Vec2(); var _local4:Number = 0; var _local5:Number = 0; var _local6:Number = 0; _local7 = (1 / 3); var _local8:int; while (_local8 < _arg2) { _local9 = _arg1[_local8]; _local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0]; _local11 = (_local9.x - _local5); _local12 = (_local9.y - _local6); _local13 = (_local10.x - _local5); _local14 = (_local10.y - _local6); _local15 = ((_local11 * _local14) - (_local12 * _local13)); _local16 = (0.5 * _local15); _local4 = (_local4 + _local16); _local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x))); _local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y))); _local8++; }; _local3.x = (_local3.x * (1 / _local4)); _local3.y = (_local3.y * (1 / _local4)); return (_local3); } public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{ var _local4:int; var _local7:b2Vec2; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:int; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:b2Mat22; var _local5:Array = new Array((b2Settings.b2_maxPolygonVertices + 1)); _local4 = 0; while (_local4 < _arg3) { _local5[_local4] = _arg2[_local4]; _local4++; }; _local5[_arg3] = _local5[0]; var _local6:Number = Number.MAX_VALUE; _local4 = 1; while (_local4 <= _arg3) { _local7 = _local5[int((_local4 - 1))]; _local8 = (_local5[_local4].x - _local7.x); _local9 = (_local5[_local4].y - _local7.y); _local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); _local8 = (_local8 / _local10); _local9 = (_local9 / _local10); _local11 = -(_local9); _local12 = _local8; _local13 = Number.MAX_VALUE; _local14 = Number.MAX_VALUE; _local15 = -(Number.MAX_VALUE); _local16 = -(Number.MAX_VALUE); _local17 = 0; while (_local17 < _arg3) { _local19 = (_local5[_local17].x - _local7.x); _local20 = (_local5[_local17].y - _local7.y); _local21 = ((_local8 * _local19) + (_local9 * _local20)); _local22 = ((_local11 * _local19) + (_local12 * _local20)); if (_local21 < _local13){ _local13 = _local21; }; if (_local22 < _local14){ _local14 = _local22; }; if (_local21 > _local15){ _local15 = _local21; }; if (_local22 > _local16){ _local16 = _local22; }; _local17++; }; _local18 = ((_local15 - _local13) * (_local16 - _local14)); if (_local18 < (0.95 * _local6)){ _local6 = _local18; _arg1.R.col1.x = _local8; _arg1.R.col1.y = _local9; _arg1.R.col2.x = _local11; _arg1.R.col2.y = _local12; _local23 = (0.5 * (_local13 + _local15)); _local24 = (0.5 * (_local14 + _local16)); _local25 = _arg1.R; _arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24))); _arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24))); _arg1.extents.x = (0.5 * (_local15 - _local13)); _arg1.extents.y = (0.5 * (_local16 - _local14)); }; _local4++; }; } } }//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; public class b2Shape { public var m_next:b2Shape; public var m_type:int; public var m_sweepRadius:Number; public var m_density:Number; public var m_filter:b2FilterData; public var m_friction:Number; public var m_isSensor:Boolean; public var m_restitution:Number; public var m_userData; public var m_proxyId:uint; public var m_body:b2Body; public static const e_polygonShape:int = 1; public static const e_unknownShape:int = -1; public static const e_circleShape:int = 0; public static const e_shapeTypeCount:int = 2; private static var s_resetAABB:b2AABB = new b2AABB(); private static var s_syncAABB:b2AABB = new b2AABB(); private static var s_proxyAABB:b2AABB = new b2AABB(); public function b2Shape(_arg1:b2ShapeDef){ m_userData = _arg1.userData; m_friction = _arg1.friction; m_restitution = _arg1.restitution; m_density = _arg1.density; m_body = null; m_sweepRadius = 0; m_next = null; m_proxyId = b2Pair.b2_nullProxy; m_filter = _arg1.filter.Copy(); m_isSensor = _arg1.isSensor; } public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2XForm, _arg4:b2Vec2):Number{ return (0); } public function SetUserData(_arg1):void{ m_userData = _arg1; } public function GetSweepRadius():Number{ return (m_sweepRadius); } public function GetNext():b2Shape{ return (m_next); } public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ } public function GetType():int{ return (m_type); } public function GetRestitution():Number{ return (m_restitution); } public function GetFriction():Number{ return (m_friction); } public function GetFilterData():b2FilterData{ return (m_filter.Copy()); } public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{ return (false); } public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ if (m_proxyId == b2Pair.b2_nullProxy){ return; }; _arg1.DestroyProxy(m_proxyId); var _local3:b2AABB = s_resetAABB; ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function SetFilterData(_arg1:b2FilterData):void{ m_filter = _arg1.Copy(); } public function GetUserData(){ return (m_userData); } public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{ if (m_proxyId == b2Pair.b2_nullProxy){ return (false); }; var _local4:b2AABB = s_syncAABB; ComputeSweptAABB(_local4, _arg2, _arg3); if (_arg1.InRange(_local4)){ _arg1.MoveProxy(m_proxyId, _local4); return (true); }; return (false); } public function ComputeMass(_arg1:b2MassData):void{ } public function IsSensor():Boolean{ return (m_isSensor); } public function DestroyProxy(_arg1:b2BroadPhase):void{ if (m_proxyId != b2Pair.b2_nullProxy){ _arg1.DestroyProxy(m_proxyId); m_proxyId = b2Pair.b2_nullProxy; }; } public function UpdateSweepRadius(_arg1:b2Vec2):void{ } public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ } public function GetBody():b2Body{ return (m_body); } public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ var _local3:b2AABB = s_proxyAABB; ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ return (false); } public static function Destroy(_arg1:b2Shape, _arg2):void{ } public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{ switch (_arg1.type){ case e_circleShape: return (new b2CircleShape(_arg1)); case e_polygonShape: return (new b2PolygonShape(_arg1)); default: return (null); }; } } }//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef) package Box2D.Collision.Shapes { public class b2ShapeDef { public var friction:Number;// = 0.2 public var isSensor:Boolean;// = false public var density:Number;// = 0 public var restitution:Number;// = 0 public var userData;// = null public var filter:b2FilterData; public var type:int;// = -1 public function b2ShapeDef(){ filter = new b2FilterData(); super(); } } }//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2AABB { public var upperBound:b2Vec2; public var lowerBound:b2Vec2; public function b2AABB(){ lowerBound = new b2Vec2(); upperBound = new b2Vec2(); super(); } public function IsValid():Boolean{ var _local1:Number = (upperBound.x - lowerBound.x); var _local2:Number = (upperBound.y - lowerBound.y); var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0))); _local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid())); return (_local3); } } }//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound) package Box2D.Collision { public class b2Bound { public var value:uint; public var proxyId:uint; public var stabbingCount:uint; public function Swap(_arg1:b2Bound):void{ var _local2:uint = value; var _local3:uint = proxyId; var _local4:uint = stabbingCount; value = _arg1.value; proxyId = _arg1.proxyId; stabbingCount = _arg1.stabbingCount; _arg1.value = _local2; _arg1.proxyId = _local3; _arg1.stabbingCount = _local4; } public function IsLower():Boolean{ return (((value & 1) == 0)); } public function IsUpper():Boolean{ return (((value & 1) == 1)); } } }//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues) package Box2D.Collision { public class b2BoundValues { public var lowerValues:Array; public var upperValues:Array; public function b2BoundValues(){ lowerValues = [0, 0]; upperValues = [0, 0]; super(); } } }//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2BroadPhase { public var m_bounds:Array; public var m_quantizationFactor:b2Vec2; public var m_worldAABB:b2AABB; public var m_freeProxy:uint; public var m_proxyCount:int; public var m_proxyPool:Array; public var m_queryResultCount:int; public var m_pairManager:b2PairManager; public var m_timeStamp:uint; public var m_queryResults:Array; public static const b2_nullEdge:uint = b2Settings.USHRT_MAX; public static const b2_invalid:uint = b2Settings.USHRT_MAX; public static var s_validate:Boolean = false; public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){ var _local3:int; var _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++; }; var _local4:Number = (_arg1.upperBound.x - _arg1.lowerBound.x); _local5 = (_arg1.upperBound.y - _arg1.lowerBound.y); m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4); m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5); _local3 = 0; while (_local3 < (b2Settings.b2_maxProxies - 1)) { _local6 = new b2Proxy(); m_proxyPool[_local3] = _local6; _local6.SetNext((_local3 + 1)); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; _local3++; }; _local6 = new b2Proxy(); m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6; _local6.SetNext(b2Pair.b2_nullProxy); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; m_freeProxy = 0; m_timeStamp = 1; m_queryResultCount = 0; } public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{ var _local6:uint; var _local7:uint; var _local12:b2Proxy; var _local4:Array = new Array(); var _local5:Array = new Array(); ComputeBounds(_local4, _local5, _arg1); var _local8:Array = [_local6]; var _local9:Array = [_local7]; Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0); Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1); var _local10:int; var _local11:int; while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) { _local12 = m_proxyPool[m_queryResults[_local11]]; _arg2[_local11] = _local12.userData; _local11++; _local10++; }; m_queryResultCount = 0; IncrementTimeStamp(); return (_local10); } public function Commit():void{ m_pairManager.Commit(); } public function GetProxy(_arg1:int):b2Proxy{ var _local2:b2Proxy = m_proxyPool[_arg1]; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){ return (null); }; return (_local2); } private function IncrementTimeStamp():void{ var _local1:uint; if (m_timeStamp == b2Settings.USHRT_MAX){ _local1 = 0; while (_local1 < b2Settings.b2_maxProxies) { (m_proxyPool[_local1] as b2Proxy).timeStamp = 0; _local1++; }; m_timeStamp = 1; } else { m_timeStamp++; }; } private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{ var _local10:b2Bound; var _local12:int; var _local13:int; var _local14:b2Proxy; var _local8:uint = BinarySearch(_arg5, _arg6, _arg3); var _local9:uint = BinarySearch(_arg5, _arg6, _arg4); var _local11:uint = _local8; while (_local11 < _local9) { _local10 = _arg5[_local11]; if (_local10.IsLower()){ IncrementOverlapCount(_local10.proxyId); }; _local11++; }; if (_local8 > 0){ _local12 = (_local8 - 1); _local10 = _arg5[_local12]; _local13 = _local10.stabbingCount; while (_local13) { _local10 = _arg5[_local12]; if (_local10.IsLower()){ _local14 = m_proxyPool[_local10.proxyId]; if (_local8 <= _local14.upperBounds[_arg7]){ IncrementOverlapCount(_local10.proxyId); _local13--; }; }; _local12--; }; }; _arg1[0] = _local8; _arg2[0] = _local9; } private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local5:b2Bound; var _local6:b2Bound; var _local3:int; while (_local3 < 2) { _local4 = m_bounds[_local3]; _local5 = _local4[_arg1.lowerBounds[_local3]]; _local6 = _local4[_arg2.upperBounds[_local3]]; if (_local5.value > _local6.value){ return (false); }; _local5 = _local4[_arg1.upperBounds[_local3]]; _local6 = _local4[_arg2.lowerBounds[_local3]]; if (_local5.value < _local6.value){ return (false); }; _local3++; }; return (true); } private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{ var _local4:Number = _arg3.lowerBound.x; var _local5:Number = _arg3.lowerBound.y; _local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x); _local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y); _local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x); _local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y); var _local6:Number = _arg3.upperBound.x; var _local7:Number = _arg3.upperBound.y; _local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x); _local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y); _local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x); _local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y); _arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1)); _arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1); _arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1)); _arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1); } public function CreateProxy(_arg1:b2AABB, _arg2):uint{ var _local3:uint; var _local4:b2Proxy; var _local11:Array; var _local12:uint; var _local13:uint; var _local14:Array; var _local15:Array; var _local16:Array; var _local17:int; var _local18:int; var _local19:b2Bound; var _local20:b2Bound; var _local21:b2Bound; var _local22:int; var _local23:b2Proxy; var _local5:uint = m_freeProxy; _local4 = m_proxyPool[_local5]; m_freeProxy = _local4.GetNext(); _local4.overlapCount = 0; _local4.userData = _arg2; var _local6:uint = (2 * m_proxyCount); var _local7:Array = new Array(); var _local8:Array = new Array(); ComputeBounds(_local7, _local8, _arg1); var _local9:int; while (_local9 < 2) { _local11 = m_bounds[_local9]; _local14 = [_local12]; _local15 = [_local13]; Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9); _local12 = _local14[0]; _local13 = _local15[0]; _local16 = new Array(); _local18 = (_local6 - _local13); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[int((_local13 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local22 = (_local13 + 2); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[int((_local22 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local16 = new Array(); _local18 = (_local13 - _local12); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[int((_local12 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local22 = (_local12 + 1); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[int((_local22 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local13++; _local19 = _local11[_local12]; _local20 = _local11[_local13]; _local19.value = _local7[_local9]; _local19.proxyId = _local5; _local20.value = _local8[_local9]; _local20.proxyId = _local5; _local21 = _local11[int((_local12 - 1))]; _local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount; _local21 = _local11[int((_local13 - 1))]; _local20.stabbingCount = _local21.stabbingCount; _local3 = _local12; while (_local3 < _local13) { _local21 = _local11[_local3]; _local21.stabbingCount++; _local3++; }; _local3 = _local12; while (_local3 < (_local6 + 2)) { _local19 = _local11[_local3]; _local23 = m_proxyPool[_local19.proxyId]; if (_local19.IsLower()){ _local23.lowerBounds[_local9] = _local3; } else { _local23.upperBounds[_local9] = _local3; }; _local3++; }; _local9++; }; m_proxyCount++; var _local10:int; while (_local10 < m_queryResultCount) { m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]); _local10++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); return (_local5); } public function DestroyProxy(_arg1:uint):void{ var _local2:b2Bound; var _local3:b2Bound; var _local8:Array; var _local9:uint; var _local10:uint; var _local11:uint; var _local12:uint; var _local13:Array; var _local14:int; var _local15:int; var _local16:int; var _local17:uint; var _local18:int; var _local19:b2Proxy; var _local4:b2Proxy = m_proxyPool[_arg1]; var _local5:int = (2 * m_proxyCount); var _local6:int; while (_local6 < 2) { _local8 = m_bounds[_local6]; _local9 = _local4.lowerBounds[_local6]; _local10 = _local4.upperBounds[_local6]; _local2 = _local8[_local9]; _local11 = _local2.value; _local3 = _local8[_local10]; _local12 = _local3.value; _local13 = new Array(); _local15 = ((_local10 - _local9) - 1); _local14 = 0; while (_local14 < _local15) { _local13[_local14] = new b2Bound(); _local2 = _local13[_local14]; _local3 = _local8[int(((_local9 + 1) + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = _local13.length; _local16 = _local9; _local14 = 0; while (_local14 < _local15) { _local3 = _local13[_local14]; _local2 = _local8[int((_local16 + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local13 = new Array(); _local15 = ((_local5 - _local10) - 1); _local14 = 0; while (_local14 < _local15) { _local13[_local14] = new b2Bound(); _local2 = _local13[_local14]; _local3 = _local8[int(((_local10 + 1) + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = _local13.length; _local16 = (_local10 - 1); _local14 = 0; while (_local14 < _local15) { _local3 = _local13[_local14]; _local2 = _local8[int((_local16 + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = (_local5 - 2); _local17 = _local9; while (_local17 < _local15) { _local2 = _local8[_local17]; _local19 = m_proxyPool[_local2.proxyId]; if (_local2.IsLower()){ _local19.lowerBounds[_local6] = _local17; } else { _local19.upperBounds[_local6] = _local17; }; _local17++; }; _local15 = (_local10 - 1); _local18 = _local9; while (_local18 < _local15) { _local2 = _local8[_local18]; _local2.stabbingCount--; _local18++; }; Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6); _local6++; }; var _local7:int; while (_local7 < m_queryResultCount) { m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]); _local7++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); _local4.userData = null; _local4.overlapCount = b2_invalid; _local4.lowerBounds[0] = b2_invalid; _local4.lowerBounds[1] = b2_invalid; _local4.upperBounds[0] = b2_invalid; _local4.upperBounds[1] = b2_invalid; _local4.SetNext(m_freeProxy); m_freeProxy = _arg1; m_proxyCount--; } public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local5:b2Bound; var _local3:int; while (_local3 < 2) { _local4 = m_bounds[_local3]; _local5 = _local4[_arg2.upperBounds[_local3]]; if (_arg1.lowerValues[_local3] > _local5.value){ return (false); }; _local5 = _local4[_arg2.lowerBounds[_local3]]; if (_arg1.upperValues[_local3] < _local5.value){ return (false); }; _local3++; }; return (true); } public function Validate():void{ var _local1:b2Pair; var _local2:b2Proxy; var _local3:b2Proxy; var _local4:Boolean; var _local6:b2Bound; var _local7:uint; var _local8:uint; var _local9:uint; var _local10:b2Bound; var _local5:int; while (_local5 < 2) { _local6 = m_bounds[_local5]; _local7 = (2 * m_proxyCount); _local8 = 0; _local9 = 0; while (_local9 < _local7) { _local10 = _local6[_local9]; if (_local10.IsLower() == true){ _local8++; } else { _local8--; }; _local9++; }; _local5++; }; } private function IncrementOverlapCount(_arg1:uint):void{ var _local2:b2Proxy = m_proxyPool[_arg1]; if (_local2.timeStamp < m_timeStamp){ _local2.timeStamp = m_timeStamp; _local2.overlapCount = 1; } else { _local2.overlapCount = 2; m_queryResults[m_queryResultCount] = _arg1; m_queryResultCount++; }; } public function InRange(_arg1:b2AABB):Boolean{ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local2 = _arg1.lowerBound.x; _local3 = _arg1.lowerBound.y; _local2 = (_local2 - m_worldAABB.upperBound.x); _local3 = (_local3 - m_worldAABB.upperBound.y); _local4 = m_worldAABB.lowerBound.x; _local5 = m_worldAABB.lowerBound.y; _local4 = (_local4 - _arg1.upperBound.x); _local5 = (_local5 - _arg1.upperBound.y); _local2 = b2Math.b2Max(_local2, _local4); _local3 = b2Math.b2Max(_local3, _local5); return ((b2Math.b2Max(_local2, _local3) < 0)); } public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{ var _local3:Array; var _local4:int; var _local5:uint; var _local6:uint; var _local7:b2Bound; var _local8:b2Bound; var _local9:b2Bound; var _local10:uint; var _local11:b2Proxy; var _local16:Array; var _local17:uint; var _local18:uint; var _local19:uint; var _local20:uint; var _local21:int; var _local22:int; var _local23:uint; var _local24:b2Proxy; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){ return; }; if (_arg2.IsValid() == false){ return; }; var _local12:uint = (2 * m_proxyCount); var _local13:b2Proxy = m_proxyPool[_arg1]; var _local14:b2BoundValues = new b2BoundValues(); ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2); var _local15:b2BoundValues = new b2BoundValues(); _local5 = 0; while (_local5 < 2) { _local7 = m_bounds[_local5][_local13.lowerBounds[_local5]]; _local15.lowerValues[_local5] = _local7.value; _local7 = m_bounds[_local5][_local13.upperBounds[_local5]]; _local15.upperValues[_local5] = _local7.value; _local5++; }; _local5 = 0; while (_local5 < 2) { _local16 = m_bounds[_local5]; _local17 = _local13.lowerBounds[_local5]; _local18 = _local13.upperBounds[_local5]; _local19 = _local14.lowerValues[_local5]; _local20 = _local14.upperValues[_local5]; _local7 = _local16[_local17]; _local21 = (_local19 - _local7.value); _local7.value = _local19; _local7 = _local16[_local18]; _local22 = (_local20 - _local7.value); _local7.value = _local20; if (_local21 < 0){ _local6 = _local17; while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) { _local7 = _local16[_local6]; _local8 = _local16[int((_local6 - 1))]; _local23 = _local8.proxyId; _local24 = m_proxyPool[_local8.proxyId]; _local8.stabbingCount++; if (_local8.IsUpper() == true){ if (TestOverlap(_local14, _local24)){ m_pairManager.AddBufferedPair(_arg1, _local23); }; _local3 = _local24.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount++; } else { _local3 = _local24.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount--; }; _local3 = _local13.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.Swap(_local8); _local6--; }; }; if (_local22 > 0){ _local6 = _local18; while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) { _local7 = _local16[_local6]; _local9 = _local16[int((_local6 + 1))]; _local10 = _local9.proxyId; _local11 = m_proxyPool[_local10]; _local9.stabbingCount++; if (_local9.IsLower() == true){ if (TestOverlap(_local14, _local11)){ m_pairManager.AddBufferedPair(_arg1, _local10); }; _local3 = _local11.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount++; } else { _local3 = _local11.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount--; }; _local3 = _local13.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.Swap(_local9); _local6++; }; }; if (_local21 > 0){ _local6 = _local17; while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) { _local7 = _local16[_local6]; _local9 = _local16[int((_local6 + 1))]; _local10 = _local9.proxyId; _local11 = m_proxyPool[_local10]; _local9.stabbingCount--; if (_local9.IsUpper()){ if (TestOverlap(_local15, _local11)){ m_pairManager.RemoveBufferedPair(_arg1, _local10); }; _local3 = _local11.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount--; } else { _local3 = _local11.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount++; }; _local3 = _local13.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.Swap(_local9); _local6++; }; }; if (_local22 < 0){ _local6 = _local18; while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) { _local7 = _local16[_local6]; _local8 = _local16[int((_local6 - 1))]; _local23 = _local8.proxyId; _local24 = m_proxyPool[_local23]; _local8.stabbingCount--; if (_local8.IsLower() == true){ if (TestOverlap(_local15, _local24)){ m_pairManager.RemoveBufferedPair(_arg1, _local23); }; _local3 = _local24.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount--; } else { _local3 = _local24.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount++; }; _local3 = _local13.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.Swap(_local8); _local6--; }; }; _local5++; }; } public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{ var _local6:int; var _local7:b2Bound; var _local4:int; var _local5:int = (_arg2 - 1); while (_local4 <= _local5) { _local6 = ((_local4 + _local5) / 2); _local7 = _arg1[_local6]; if (_local7.value > _arg3){ _local5 = (_local6 - 1); } else { if (_local7.value < _arg3){ _local4 = (_local6 + 1); } else { return (uint(_local6)); }; }; }; return (uint(_local4)); } } }//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair) package Box2D.Collision { public class b2BufferedPair { public var proxyId1:uint; public var proxyId2:uint; } }//package Box2D.Collision
Section 14
//b2Collision (Box2D.Collision.b2Collision) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Collision { public static const b2_nullFeature:uint = 0xFF; private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2(); public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{ var _local11:b2Mat22; var _local12:b2Vec2; var _local25:Number; var _local6:int = _arg1.m_vertexCount; var _local7:Array = _arg1.m_vertices; var _local8:Array = _arg1.m_normals; var _local9:int = _arg4.m_vertexCount; var _local10:Array = _arg4.m_vertices; _local11 = _arg2.R; _local12 = _local8[_arg3]; var _local13:Number = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)); var _local14:Number = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)); _local11 = _arg5.R; var _local15:Number = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14)); var _local16:Number = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14)); var _local17:int; var _local18:Number = Number.MAX_VALUE; var _local19:int; while (_local19 < _local9) { _local12 = _local10[_local19]; _local25 = ((_local12.x * _local15) + (_local12.y * _local16)); if (_local25 < _local18){ _local18 = _local25; _local17 = _local19; }; _local19++; }; _local12 = _local7[_arg3]; _local11 = _arg2.R; var _local20:Number = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y))); var _local21:Number = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y))); _local12 = _local10[_local17]; _local11 = _arg5.R; var _local22:Number = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y))); var _local23:Number = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y))); _local22 = (_local22 - _local20); _local23 = (_local23 - _local21); var _local24:Number = ((_local22 * _local13) + (_local23 * _local14)); return (_local24); } public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{ var _local3:b2Vec2 = _arg2.lowerBound; var _local4:b2Vec2 = _arg1.upperBound; var _local5:Number = (_local3.x - _local4.x); var _local6:Number = (_local3.y - _local4.y); _local3 = _arg1.lowerBound; _local4 = _arg2.upperBound; var _local7:Number = (_local3.x - _local4.x); var _local8:Number = (_local3.y - _local4.y); if ((((_local5 > 0)) || ((_local6 > 0)))){ return (false); }; if ((((_local7 > 0)) || ((_local8 > 0)))){ return (false); }; return (true); } public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{ var _local12:b2Mat22; var _local13:b2Vec2; var _local20:ClipVertex; var _local23:Number; var _local7:int = _arg2.m_vertexCount; var _local8:Array = _arg2.m_normals; var _local9:int = _arg5.m_vertexCount; var _local10:Array = _arg5.m_vertices; var _local11:Array = _arg5.m_normals; _local12 = _arg3.R; _local13 = _local8[_arg4]; var _local14:Number = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)); var _local15:Number = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)); _local12 = _arg6.R; var _local16:Number = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15)); _local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15)); _local14 = _local16; var _local17:int; var _local18:Number = Number.MAX_VALUE; var _local19:int; while (_local19 < _local9) { _local13 = _local11[_local19]; _local23 = ((_local14 * _local13.x) + (_local15 * _local13.y)); if (_local23 < _local18){ _local18 = _local23; _local17 = _local19; }; _local19++; }; var _local21:int = _local17; var _local22:int = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0; _local20 = _arg1[0]; _local13 = _local10[_local21]; _local12 = _arg6.R; _local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y))); _local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y))); _local20.id.features.referenceEdge = _arg4; _local20.id.features.incidentEdge = _local21; _local20.id.features.incidentVertex = 0; _local20 = _arg1[1]; _local13 = _local10[_local22]; _local12 = _arg6.R; _local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y))); _local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y))); _local20.id.features.referenceEdge = _arg4; _local20.id.features.incidentEdge = _local22; _local20.id.features.incidentVertex = 1; } public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{ var _local6:ClipVertex; var _local13:b2PolygonShape; var _local14:b2PolygonShape; var _local17:int; var _local18:uint; var _local34:int; var _local37:b2Vec2; var _local38:Number; var _local39:b2ManifoldPoint; _arg1.pointCount = 0; var _local7:int; var _local8:Array = [_local7]; var _local9:Number = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5); _local7 = _local8[0]; if (_local9 > 0){ return; }; var _local10:int; var _local11:Array = [_local10]; var _local12:Number = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3); _local10 = _local11[0]; if (_local12 > 0){ return; }; var _local15:b2XForm = new b2XForm(); var _local16:b2XForm = new b2XForm(); var _local19:Number = 0.98; var _local20:Number = 0.001; if (_local12 > ((_local19 * _local9) + _local20)){ _local13 = _arg4; _local14 = _arg2; _local15.Set(_arg5); _local16.Set(_arg3); _local17 = _local10; _local18 = 1; } else { _local13 = _arg2; _local14 = _arg4; _local15.Set(_arg3); _local16.Set(_arg5); _local17 = _local7; _local18 = 0; }; var _local21:Array = [new ClipVertex(), new ClipVertex()]; FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16); var _local22:int = _local13.m_vertexCount; var _local23:Array = _local13.m_vertices; var _local24:b2Vec2 = _local23[_local17]; var _local25:b2Vec2 = _local24.Copy(); if ((_local17 + 1) < _local22){ _local24 = _local23[int((_local17 + 1))]; _local37 = _local24.Copy(); } else { _local24 = _local23[0]; _local37 = _local24.Copy(); }; var _local26:b2Vec2 = b2Math.SubtractVV(_local37, _local25); var _local27:b2Vec2 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25)); _local27.Normalize(); var _local28:b2Vec2 = b2Math.b2CrossVF(_local27, 1); _local25 = b2Math.b2MulX(_local15, _local25); _local37 = b2Math.b2MulX(_local15, _local37); var _local29:Number = b2Math.b2Dot(_local28, _local25); var _local30:Number = -(b2Math.b2Dot(_local27, _local25)); var _local31:Number = b2Math.b2Dot(_local27, _local37); var _local32:Array = [new ClipVertex(), new ClipVertex()]; var _local33:Array = [new ClipVertex(), new ClipVertex()]; _local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30); if (_local34 < 2){ return; }; _local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31); if (_local34 < 2){ return; }; _arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy(); var _local35:int; var _local36:int; while (_local36 < b2Settings.b2_maxManifoldPoints) { _local6 = _local33[_local36]; _local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29); if (_local38 <= 0){ _local39 = _arg1.points[_local35]; _local39.separation = _local38; _local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v); _local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v); _local39.id.key = _local6.id._key; _local39.id.features.flip = _local18; _local35++; }; _local36++; }; _arg1.pointCount = _local35; } public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{ var _local8:b2Vec2; var _local9:b2Mat22; var _local22:int; var _local23:Number; var _local24:int; var _local25:Number; var _local6:int = _arg2.m_vertexCount; var _local7:Array = _arg2.m_normals; _local9 = _arg5.R; _local8 = _arg4.m_centroid; var _local10:Number = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))); var _local11:Number = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))); _local9 = _arg3.R; _local8 = _arg2.m_centroid; _local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)))); _local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)))); var _local12:Number = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y)); var _local13:Number = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y)); var _local14:int; var _local15:Number = -(Number.MAX_VALUE); var _local16:int; while (_local16 < _local6) { _local8 = _local7[_local16]; _local25 = ((_local8.x * _local12) + (_local8.y * _local13)); if (_local25 > _local15){ _local15 = _local25; _local14 = _local16; }; _local16++; }; var _local17:Number = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5); if (_local17 > 0){ return (_local17); }; var _local18:int = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1); var _local19:Number = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5); if (_local19 > 0){ return (_local19); }; var _local20:int = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0; var _local21:Number = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5); if (_local21 > 0){ return (_local21); }; if ((((_local19 > _local17)) && ((_local19 > _local21)))){ _local24 = -1; _local22 = _local18; _local23 = _local19; } else { if (_local21 > _local17){ _local24 = 1; _local22 = _local20; _local23 = _local21; } else { _arg1[0] = _local14; return (_local17); }; }; while (true) { if (_local24 == -1){ _local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1); } else { _local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0; }; _local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5); if (_local17 > 0){ return (_local17); }; if (_local17 > _local23){ _local22 = _local14; _local23 = _local17; } else { break; }; }; _arg1[0] = _local22; return (_local23); } public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{ var _local5:ClipVertex; var _local6:int; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:Number; var _local11:Number; var _local12:b2Vec2; var _local13:ClipVertex; _local6 = 0; _local5 = _arg2[0]; _local7 = _local5.v; _local5 = _arg2[1]; _local8 = _local5.v; _local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4); var _local10:Number = (b2Math.b2Dot(_arg3, _local8) - _arg4); if (_local9 <= 0){ var _temp1 = _local6; _local6 = (_local6 + 1); var _local14 = _temp1; _arg1[_local14] = _arg2[0]; }; if (_local10 <= 0){ var _temp2 = _local6; _local6 = (_local6 + 1); _local14 = _temp2; _arg1[_local14] = _arg2[1]; }; if ((_local9 * _local10) < 0){ _local11 = (_local9 / (_local9 - _local10)); _local5 = _arg1[_local6]; _local12 = _local5.v; _local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x))); _local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y))); _local5 = _arg1[_local6]; if (_local9 > 0){ _local13 = _arg2[0]; _local5.id = _local13.id; } else { _local13 = _arg2[1]; _local5.id = _local13.id; }; _local6++; }; return (_local6); } public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{ var _local6:b2Mat22; var _local7:b2Vec2; var _local18:Number; var _local24:Number; var _local25:Number; _arg1.pointCount = 0; _local6 = _arg3.R; _local7 = _arg2.m_localPosition; var _local8:Number = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); var _local9:Number = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); _local6 = _arg5.R; _local7 = _arg4.m_localPosition; var _local10:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); var _local11:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); var _local12:Number = (_local10 - _local8); var _local13:Number = (_local11 - _local9); var _local14:Number = ((_local12 * _local12) + (_local13 * _local13)); var _local15:Number = _arg2.m_radius; var _local16:Number = _arg4.m_radius; var _local17:Number = (_local15 + _local16); if (_local14 > (_local17 * _local17)){ return; }; if (_local14 < Number.MIN_VALUE){ _local18 = -(_local17); _arg1.normal.Set(0, 1); } else { _local24 = Math.sqrt(_local14); _local18 = (_local24 - _local17); _local25 = (1 / _local24); _arg1.normal.x = (_local25 * _local12); _arg1.normal.y = (_local25 * _local13); }; _arg1.pointCount = 1; var _local19:b2ManifoldPoint = _arg1.points[0]; _local19.id.key = 0; _local19.separation = _local18; _local8 = (_local8 + (_local15 * _arg1.normal.x)); _local9 = (_local9 + (_local15 * _arg1.normal.y)); _local10 = (_local10 - (_local16 * _arg1.normal.x)); _local11 = (_local11 - (_local16 * _arg1.normal.y)); var _local20:Number = (0.5 * (_local8 + _local10)); var _local21:Number = (0.5 * (_local9 + _local11)); var _local22:Number = (_local20 - _arg3.position.x); var _local23:Number = (_local21 - _arg3.position.y); _local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y)); _local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y)); _local22 = (_local20 - _arg5.position.x); _local23 = (_local21 - _arg5.position.y); _local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y)); _local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y)); } public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{ var _local6:b2ManifoldPoint; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:b2Vec2; var _local12:b2Mat22; var _local17:Number; var _local32:Number; var _local33:Number; var _local34:Number; _arg1.pointCount = 0; _local12 = _arg5.R; _local11 = _arg4.m_localPosition; var _local13:Number = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y))); var _local14:Number = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y))); _local7 = (_local13 - _arg3.position.x); _local8 = (_local14 - _arg3.position.y); _local12 = _arg3.R; var _local15:Number = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); var _local16:Number = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); var _local18:int; var _local19:Number = -(Number.MAX_VALUE); var _local20:Number = _arg4.m_radius; var _local21:int = _arg2.m_vertexCount; var _local22:Array = _arg2.m_vertices; var _local23:Array = _arg2.m_normals; var _local24:int; while (_local24 < _local21) { _local11 = _local22[_local24]; _local7 = (_local15 - _local11.x); _local8 = (_local16 - _local11.y); _local11 = _local23[_local24]; _local34 = ((_local11.x * _local7) + (_local11.y * _local8)); if (_local34 > _local20){ return; }; if (_local34 > _local19){ _local19 = _local34; _local18 = _local24; }; _local24++; }; if (_local19 < Number.MIN_VALUE){ _arg1.pointCount = 1; _local11 = _local23[_local18]; _local12 = _arg3.R; _arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)); _arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)); _local6 = _arg1.points[0]; _local6.id.features.incidentEdge = _local18; _local6.id.features.incidentVertex = b2_nullFeature; _local6.id.features.referenceEdge = 0; _local6.id.features.flip = 0; _local9 = (_local13 - (_local20 * _arg1.normal.x)); _local10 = (_local14 - (_local20 * _arg1.normal.y)); _local7 = (_local9 - _arg3.position.x); _local8 = (_local10 - _arg3.position.y); _local12 = _arg3.R; _local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local7 = (_local9 - _arg5.position.x); _local8 = (_local10 - _arg5.position.y); _local12 = _arg5.R; _local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local6.separation = (_local19 - _local20); return; }; var _local25:int = _local18; var _local26:int = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0; _local11 = _local22[_local25]; var _local27:b2Vec2 = _local22[_local26]; var _local28:Number = (_local27.x - _local11.x); var _local29:Number = (_local27.y - _local11.y); var _local30:Number = Math.sqrt(((_local28 * _local28) + (_local29 * _local29))); _local28 = (_local28 / _local30); _local29 = (_local29 / _local30); _local7 = (_local15 - _local11.x); _local8 = (_local16 - _local11.y); var _local31:Number = ((_local7 * _local28) + (_local8 * _local29)); _local6 = _arg1.points[0]; if (_local31 <= 0){ _local32 = _local11.x; _local33 = _local11.y; _local6.id.features.incidentEdge = b2_nullFeature; _local6.id.features.incidentVertex = _local25; } else { if (_local31 >= _local30){ _local32 = _local27.x; _local33 = _local27.y; _local6.id.features.incidentEdge = b2_nullFeature; _local6.id.features.incidentVertex = _local26; } else { _local32 = ((_local28 * _local31) + _local11.x); _local33 = ((_local29 * _local31) + _local11.y); _local6.id.features.incidentEdge = _local18; _local6.id.features.incidentVertex = 0; }; }; _local7 = (_local15 - _local32); _local8 = (_local16 - _local33); _local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8))); _local7 = (_local7 / _local17); _local8 = (_local8 / _local17); if (_local17 > _local20){ return; }; _arg1.pointCount = 1; _local12 = _arg3.R; _arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8)); _arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8)); _local9 = (_local13 - (_local20 * _arg1.normal.x)); _local10 = (_local14 - (_local20 * _arg1.normal.y)); _local7 = (_local9 - _arg3.position.x); _local8 = (_local10 - _arg3.position.y); _local12 = _arg3.R; _local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local7 = (_local9 - _arg5.position.x); _local8 = (_local10 - _arg5.position.y); _local12 = _arg5.R; _local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local6.separation = (_local17 - _local20); _local6.id.features.referenceEdge = 0; _local6.id.features.flip = 0; } } }//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID) package Box2D.Collision { public class b2ContactID { public var _key:uint; public var features:Features; public function b2ContactID(){ features = new Features(); super(); features._m_id = this; } public function Set(_arg1:b2ContactID):void{ key = _arg1._key; } public function Copy():b2ContactID{ var _local1:b2ContactID = new b2ContactID(); _local1.key = key; return (_local1); } public function set key(_arg1:uint):void{ _key = _arg1; features._referenceEdge = (_key & 0xFF); features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF); features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF); features._flip = (((_key & 4278190080) >> 24) & 0xFF); } public function get key():uint{ return (_key); } } }//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2ContactPoint { public var friction:Number; public var separation:Number; public var normal:b2Vec2; public var position:b2Vec2; public var restitution:Number; public var shape1:b2Shape; public var shape2:b2Shape; public var id:b2ContactID; public var velocity:b2Vec2; public function b2ContactPoint(){ position = new b2Vec2(); velocity = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Distance { private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var gPoint:b2Point = new b2Point(); public static var g_GJK_Iterations:int = 0; public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{ var _local6:b2Vec2; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local4:Number = (100 * Number.MIN_VALUE); var _local5:int; while (_local5 < _arg3) { _local6 = _arg2[_local5]; _local7 = Math.abs((_arg1.x - _local6.x)); _local8 = Math.abs((_arg1.y - _local6.y)); _local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x)); _local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y)); if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){ return (true); }; _local5++; }; return (false); } public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{ var _local7:b2Vec2; var _local15:Number; var _local16:Number; var _local17:b2Vec2; var _local18:b2Vec2; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:int; var _local8:Array = s_p1s; var _local9:Array = s_p2s; var _local10:Array = s_points; var _local11:int; _arg1.SetV(_arg3.GetFirstVertex(_arg4)); _arg2.SetV(_arg5.GetFirstVertex(_arg6)); var _local12:Number = 0; var _local13 = 20; var _local14:int; while (_local14 < _local13) { _local15 = (_arg2.x - _arg1.x); _local16 = (_arg2.y - _arg1.y); _local17 = _arg3.Support(_arg4, _local15, _local16); _local18 = _arg5.Support(_arg6, -(_local15), -(_local16)); _local12 = ((_local15 * _local15) + (_local16 * _local16)); _local19 = (_local18.x - _local17.x); _local20 = (_local18.y - _local17.y); _local21 = ((_local15 * _local19) + (_local16 * _local20)); if ((_local12 - ((_local15 * _local19) + (_local16 * _local20))) <= (0.01 * _local12)){ if (_local11 == 0){ _arg1.SetV(_local17); _arg2.SetV(_local18); }; g_GJK_Iterations = _local14; return (Math.sqrt(_local12)); }; switch (_local11){ case 0: _local7 = _local8[0]; _local7.SetV(_local17); _local7 = _local9[0]; _local7.SetV(_local18); _local7 = _local10[0]; _local7.x = _local19; _local7.y = _local20; _arg1.SetV(_local8[0]); _arg2.SetV(_local9[0]); _local11++; break; case 1: _local7 = _local8[1]; _local7.SetV(_local17); _local7 = _local9[1]; _local7.SetV(_local18); _local7 = _local10[1]; _local7.x = _local19; _local7.y = _local20; _local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10); break; case 2: _local7 = _local8[2]; _local7.SetV(_local17); _local7 = _local9[2]; _local7.SetV(_local18); _local7 = _local10[2]; _local7.x = _local19; _local7.y = _local20; _local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10); break; }; if (_local11 == 3){ g_GJK_Iterations = _local14; return (0); }; _local22 = -(Number.MAX_VALUE); _local23 = 0; while (_local23 < _local11) { _local7 = _local10[_local23]; _local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y))); _local23++; }; if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){ g_GJK_Iterations = _local14; _local15 = (_arg2.x - _arg1.x); _local16 = (_arg2.y - _arg1.y); _local12 = ((_local15 * _local15) + (_local16 * _local16)); return (Math.sqrt(_local12)); }; _local14++; }; g_GJK_Iterations = _local13; return (Math.sqrt(_local12)); } public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{ var _local7:b2Mat22; var _local8:b2Vec2; var _local19:Number; var _local20:Number; _local7 = _arg4.R; _local8 = _arg3.m_localPosition; var _local9:Number = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); var _local10:Number = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); _local7 = _arg6.R; _local8 = _arg5.m_localPosition; var _local11:Number = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); var _local12:Number = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); var _local13:Number = (_local11 - _local9); var _local14:Number = (_local12 - _local10); var _local15:Number = ((_local13 * _local13) + (_local14 * _local14)); var _local16:Number = (_arg3.m_radius - b2Settings.b2_toiSlop); var _local17:Number = (_arg5.m_radius - b2Settings.b2_toiSlop); var _local18:Number = (_local16 + _local17); if (_local15 > (_local18 * _local18)){ _local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14))); _local13 = (_local13 / _local19); _local14 = (_local14 / _local19); _local20 = (_local19 - _local18); _arg1.x = (_local9 + (_local16 * _local13)); _arg1.y = (_local10 + (_local16 * _local14)); _arg2.x = (_local11 - (_local17 * _local13)); _arg2.y = (_local12 - (_local17 * _local14)); return (_local20); }; if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){ _local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14))); _local13 = (_local13 / _local19); _local14 = (_local14 / _local19); _arg1.x = (_local9 + (_local16 * _local13)); _arg1.y = (_local10 + (_local16 * _local14)); _arg2.x = _arg1.x; _arg2.y = _arg1.y; return (0); }; _arg1.x = _local9; _arg1.y = _local10; _arg2.x = _arg1.x; _arg2.y = _arg1.y; return (0); } public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{ var _local6:b2Vec2; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:b2Vec2; var _local12:b2Vec2; var _local13:b2Vec2; var _local35:Number; _local6 = _arg5[0]; _local7 = _arg5[1]; _local8 = _arg5[2]; _local9 = _arg3[0]; _local10 = _arg3[1]; _local11 = _arg3[2]; _local12 = _arg4[0]; _local13 = _arg4[1]; var _local14:b2Vec2 = _arg4[2]; var _local15:Number = _local6.x; var _local16:Number = _local6.y; var _local17:Number = _local7.x; var _local18:Number = _local7.y; var _local19:Number = _local8.x; var _local20:Number = _local8.y; var _local21:Number = (_local17 - _local15); var _local22:Number = (_local18 - _local16); var _local23:Number = (_local19 - _local15); var _local24:Number = (_local20 - _local16); var _local25:Number = (_local19 - _local17); var _local26:Number = (_local20 - _local18); var _local27:Number = -(((_local15 * _local21) + (_local16 * _local22))); var _local28:Number = ((_local17 * _local21) + (_local18 * _local22)); var _local29:Number = -(((_local15 * _local23) + (_local16 * _local24))); var _local30:Number = ((_local19 * _local23) + (_local20 * _local24)); var _local31:Number = -(((_local17 * _local25) + (_local18 * _local26))); var _local32:Number = ((_local19 * _local25) + (_local20 * _local26)); if ((((_local30 <= 0)) && ((_local32 <= 0)))){ _arg1.SetV(_local11); _arg2.SetV(_local14); _local9.SetV(_local11); _local12.SetV(_local14); _local6.SetV(_local8); return (1); }; var _local33:Number = ((_local21 * _local24) - (_local22 * _local23)); var _local34:Number = (_local33 * ((_local15 * _local18) - (_local16 * _local17))); var _local36:Number = (_local33 * ((_local17 * _local20) - (_local18 * _local19))); if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){ _local35 = (_local31 / (_local31 + _local32)); _arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x))); _arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y))); _arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x))); _arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y))); _local9.SetV(_local11); _local12.SetV(_local14); _local6.SetV(_local8); return (2); }; var _local37:Number = (_local33 * ((_local19 * _local16) - (_local20 * _local15))); if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){ _local35 = (_local29 / (_local29 + _local30)); _arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x))); _arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y))); _arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x))); _arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y))); _local10.SetV(_local11); _local13.SetV(_local14); _local7.SetV(_local8); return (2); }; var _local38:Number = ((_local36 + _local37) + _local34); _local38 = (1 / _local38); var _local39:Number = (_local36 * _local38); var _local40:Number = (_local37 * _local38); var _local41:Number = ((1 - _local39) - _local40); _arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x)); _arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y)); _arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x)); _arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y)); return (3); } public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{ var _local7:b2Mat22; var _local8:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local9:b2Point = gPoint; _local8 = _arg5.m_localPosition; _local7 = _arg6.R; _local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); _local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); var _local10:Number = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity); var _local11:Number = (_arg5.m_radius - b2Settings.b2_toiSlop); if (_local10 > _local11){ _local10 = (_local10 - _local11); _local12 = (_arg2.x - _arg1.x); _local13 = (_arg2.y - _arg1.y); _local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13))); _local12 = (_local12 / _local14); _local13 = (_local13 / _local14); _arg2.x = (_arg2.x - (_local11 * _local12)); _arg2.y = (_arg2.y - (_local11 * _local13)); } else { _local10 = 0; _arg2.x = _arg1.x; _arg2.y = _arg1.y; }; return (_local10); } public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{ var _local7:int = _arg3.m_type; var _local8:int = _arg5.m_type; if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){ return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6)); }; if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){ return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6)); }; if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){ return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4)); }; if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){ return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6)); }; return (0); } public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{ var _local9:b2Vec2; var _local10:b2Vec2; var _local11:b2Vec2; var _local17:Number; var _local6:b2Vec2 = _arg5[0]; var _local7:b2Vec2 = _arg5[1]; var _local8:b2Vec2 = _arg3[0]; _local9 = _arg3[1]; _local10 = _arg4[0]; _local11 = _arg4[1]; var _local12:Number = -(_local7.x); var _local13:Number = -(_local7.y); var _local14:Number = (_local6.x - _local7.x); var _local15:Number = (_local6.y - _local7.y); var _local16:Number = Math.sqrt(((_local14 * _local14) + (_local15 * _local15))); _local14 = (_local14 / _local16); _local15 = (_local15 / _local16); _local17 = ((_local12 * _local14) + (_local13 * _local15)); if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){ _arg1.SetV(_local9); _arg2.SetV(_local11); _local8.SetV(_local9); _local10.SetV(_local11); _local6.SetV(_local7); return (1); }; _local17 = (_local17 / _local16); _arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x))); _arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y))); _arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x))); _arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y))); return (2); } } }//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Manifold { public var pointCount:int;// = 0 public var normal:b2Vec2; public var points:Array; public function b2Manifold(){ points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ManifoldPoint(); _local1++; }; normal = new b2Vec2(); } public function Set(_arg1:b2Manifold):void{ pointCount = _arg1.pointCount; var _local2:int; while (_local2 < b2Settings.b2_maxManifoldPoints) { (points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]); _local2++; }; normal.SetV(_arg1.normal); } public function Reset():void{ var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { (points[_local1] as b2ManifoldPoint).Reset(); _local1++; }; normal.SetZero(); pointCount = 0; } } }//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint) package Box2D.Collision { import Box2D.Common.Math.*; public class b2ManifoldPoint { public var separation:Number; public var localPoint2:b2Vec2; public var normalImpulse:Number; public var tangentImpulse:Number; public var localPoint1:b2Vec2; public var id:b2ContactID; public function b2ManifoldPoint(){ localPoint1 = new b2Vec2(); localPoint2 = new b2Vec2(); id = new b2ContactID(); super(); } public function Set(_arg1:b2ManifoldPoint):void{ localPoint1.SetV(_arg1.localPoint1); localPoint2.SetV(_arg1.localPoint2); separation = _arg1.separation; normalImpulse = _arg1.normalImpulse; tangentImpulse = _arg1.tangentImpulse; id.key = _arg1.id.key; } public function Reset():void{ localPoint1.SetZero(); localPoint2.SetZero(); separation = 0; normalImpulse = 0; tangentImpulse = 0; id.key = 0; } } }//package Box2D.Collision
Section 20
//b2OBB (Box2D.Collision.b2OBB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2OBB { public var R:b2Mat22; public var center:b2Vec2; public var extents:b2Vec2; public function b2OBB(){ R = new b2Mat22(); center = new b2Vec2(); extents = new b2Vec2(); super(); } } }//package Box2D.Collision
Section 21
//b2Pair (Box2D.Collision.b2Pair) package Box2D.Collision { import Box2D.Common.*; public class b2Pair { public var proxyId1:uint; public var userData;// = null public var proxyId2:uint; public var status:uint; public var next:uint; public static var e_pairFinal:uint = 4; public static var b2_tableMask:int = (b2_tableCapacity - 1); public static var e_pairRemoved:uint = 2; public static var b2_nullPair:uint = b2Settings.USHRT_MAX; public static var e_pairBuffered:uint = 1; public static var b2_nullProxy:uint = b2Settings.USHRT_MAX; public static var b2_tableCapacity:int = b2Settings.b2_maxPairs; public function SetBuffered():void{ status = (status | e_pairBuffered); } public function IsBuffered():Boolean{ return (((status & e_pairBuffered) == e_pairBuffered)); } public function IsFinal():Boolean{ return (((status & e_pairFinal) == e_pairFinal)); } public function ClearRemoved():void{ status = (status & ~(e_pairRemoved)); } public function SetFinal():void{ status = (status | e_pairFinal); } public function IsRemoved():Boolean{ return (((status & e_pairRemoved) == e_pairRemoved)); } public function ClearBuffered():void{ status = (status & ~(e_pairBuffered)); } public function SetRemoved():void{ status = (status | e_pairRemoved); } } }//package Box2D.Collision
Section 22
//b2PairCallback (Box2D.Collision.b2PairCallback) package Box2D.Collision { public class b2PairCallback { public function PairRemoved(_arg1, _arg2, _arg3):void{ } public function PairAdded(_arg1, _arg2){ return (null); } } }//package Box2D.Collision
Section 23
//b2PairManager (Box2D.Collision.b2PairManager) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PairManager { public var m_pairCount:int; public var m_pairBuffer:Array; public var m_hashTable:Array; public var m_callback:b2PairCallback; public var m_pairs:Array; public var m_pairBufferCount:int; public var m_broadPhase:b2BroadPhase; public var m_freePair:uint; public function b2PairManager(){ var _local1:uint; super(); m_hashTable = new Array(b2Pair.b2_tableCapacity); _local1 = 0; while (_local1 < b2Pair.b2_tableCapacity) { m_hashTable[_local1] = b2Pair.b2_nullPair; _local1++; }; m_pairs = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1] = new b2Pair(); _local1++; }; m_pairBuffer = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairBuffer[_local1] = new b2BufferedPair(); _local1++; }; _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy; m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy; m_pairs[_local1].userData = null; m_pairs[_local1].status = 0; m_pairs[_local1].next = (_local1 + 1); _local1++; }; m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair; m_pairCount = 0; m_pairBufferCount = 0; } private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{ var _local4:b2Pair; var _local5:uint = m_hashTable[_arg3]; _local4 = m_pairs[_local5]; while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) { _local5 = _local4.next; _local4 = m_pairs[_local5]; }; if (_local5 == b2Pair.b2_nullPair){ return (null); }; return (_local4); } private function Find(_arg1:uint, _arg2:uint):b2Pair{ var _local4:uint; if (_arg1 > _arg2){ _local4 = _arg1; _arg1 = _arg2; _arg2 = _local4; }; var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); return (FindHash(_arg1, _arg2, _local3)); } private function ValidateBuffer():void{ } public function Commit():void{ var _local1:b2BufferedPair; var _local2:int; var _local5:b2Pair; var _local6:b2Proxy; var _local7:b2Proxy; var _local3:int; var _local4:Array = m_broadPhase.m_proxyPool; _local2 = 0; while (_local2 < m_pairBufferCount) { _local1 = m_pairBuffer[_local2]; _local5 = Find(_local1.proxyId1, _local1.proxyId2); _local5.ClearBuffered(); _local6 = _local4[_local5.proxyId1]; _local7 = _local4[_local5.proxyId2]; if (_local5.IsRemoved()){ if (_local5.IsFinal() == true){ m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData); }; _local1 = m_pairBuffer[_local3]; _local1.proxyId1 = _local5.proxyId1; _local1.proxyId2 = _local5.proxyId2; _local3++; } else { if (_local5.IsFinal() == false){ _local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData); _local5.SetFinal(); }; }; _local2++; }; _local2 = 0; while (_local2 < _local3) { _local1 = m_pairBuffer[_local2]; RemovePair(_local1.proxyId1, _local1.proxyId2); _local2++; }; m_pairBufferCount = 0; if (b2BroadPhase.s_validate){ ValidateTable(); }; } public function RemoveBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair = Find(_arg1, _arg2); if (_local4 == null){ return; }; if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = m_pairBuffer[m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; m_pairBufferCount++; }; _local4.SetRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function RemovePair(_arg1:uint, _arg2:uint){ var _local3:b2Pair; var _local7:uint; var _local8:uint; var _local9:*; if (_arg1 > _arg2){ _local7 = _arg1; _arg1 = _arg2; _arg2 = _local7; }; var _local4:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); var _local5:uint = m_hashTable[_local4]; var _local6:b2Pair; while (_local5 != b2Pair.b2_nullPair) { if (Equals(m_pairs[_local5], _arg1, _arg2)){ _local8 = _local5; _local3 = m_pairs[_local5]; if (_local6){ _local6.next = _local3.next; } else { m_hashTable[_local4] = _local3.next; }; _local3 = m_pairs[_local8]; _local9 = _local3.userData; _local3.next = m_freePair; _local3.proxyId1 = b2Pair.b2_nullProxy; _local3.proxyId2 = b2Pair.b2_nullProxy; _local3.userData = null; _local3.status = 0; m_freePair = _local8; m_pairCount--; return (_local9); } else { _local6 = m_pairs[_local5]; _local5 = _local6.next; }; }; return (null); } public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{ m_broadPhase = _arg1; m_callback = _arg2; } public function AddBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair = AddPair(_arg1, _arg2); if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = m_pairBuffer[m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; m_pairBufferCount++; }; _local4.ClearRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function AddPair(_arg1:uint, _arg2:uint):b2Pair{ var _local6:uint; if (_arg1 > _arg2){ _local6 = _arg1; _arg1 = _arg2; _arg2 = _local6; }; var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); var _local4 = FindHash(_arg1, _arg2, _local3); if (_local4 != null){ return (_local4); }; var _local5:uint = m_freePair; _local4 = m_pairs[_local5]; m_freePair = _local4.next; _local4.proxyId1 = _arg1; _local4.proxyId2 = _arg2; _local4.status = 0; _local4.userData = null; _local4.next = m_hashTable[_local3]; m_hashTable[_local3] = _local5; m_pairCount++; return (_local4); } private function ValidateTable():void{ } public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{ return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2)))); } public static function Hash(_arg1:uint, _arg2:uint):uint{ var _local3:uint = (((_arg2 << 16) & 4294901760) | _arg1); _local3 = (~(_local3) + ((_local3 << 15) & 4294934528)); _local3 = (_local3 ^ ((_local3 >> 12) & 1048575)); _local3 = (_local3 + ((_local3 << 2) & 4294967292)); _local3 = (_local3 ^ ((_local3 >> 4) & 268435455)); _local3 = (_local3 * 2057); _local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF)); return (_local3); } public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{ return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3)))); } } }//package Box2D.Collision
Section 24
//b2Point (Box2D.Collision.b2Point) package Box2D.Collision { import Box2D.Common.Math.*; public class b2Point { public var p:b2Vec2; public function b2Point(){ p = new b2Vec2(); super(); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (p); } public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{ return (p); } } }//package Box2D.Collision
Section 25
//b2Proxy (Box2D.Collision.b2Proxy) package Box2D.Collision { public class b2Proxy { public var overlapCount:uint; public var userData;// = null public var lowerBounds:Array; public var upperBounds:Array; public var timeStamp:uint; public function b2Proxy(){ lowerBounds = [uint(0), uint(0)]; upperBounds = [uint(0), uint(0)]; super(); } public function GetNext():uint{ return (lowerBounds[0]); } public function IsValid():Boolean{ return (!((overlapCount == b2BroadPhase.b2_invalid))); } public function SetNext(_arg1:uint):void{ lowerBounds[0] = (_arg1 & 0xFFFF); } } }//package Box2D.Collision
Section 26
//b2Segment (Box2D.Collision.b2Segment) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Segment { public var p1:b2Vec2; public var p2:b2Vec2; public function b2Segment(){ p1 = new b2Vec2(); p2 = new b2Vec2(); super(); } public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{ var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local5:b2Vec2 = _arg3.p1; var _local6:Number = (_arg3.p2.x - _local5.x); var _local7:Number = (_arg3.p2.y - _local5.y); var _local8:Number = (p2.x - p1.x); var _local9:Number = (p2.y - p1.y); var _local10:Number = _local9; var _local11:Number = -(_local8); var _local12:Number = (100 * Number.MIN_VALUE); var _local13:Number = -(((_local6 * _local10) + (_local7 * _local11))); if (_local13 > _local12){ _local14 = (_local5.x - p1.x); _local15 = (_local5.y - p1.y); _local16 = ((_local14 * _local10) + (_local15 * _local11)); if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){ _local17 = ((-(_local7) * _local15) + (_local7 * _local14)); if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){ _local16 = (_local16 / _local13); _local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); _local10 = (_local10 / _local18); _local11 = (_local11 / _local18); _arg1[0] = _local16; _arg2.Set(_local10, _local11); return (true); }; }; }; return (false); } } }//package Box2D.Collision
Section 27
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2TimeOfImpact { public static var s_xf1:b2XForm = new b2XForm(); public static var s_xf2:b2XForm = new b2XForm(); public static var s_p1:b2Vec2 = new b2Vec2(); public static var s_p2:b2Vec2 = new b2Vec2(); public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{ var _local5:Number; var _local6:Number; var _local25:Number; var _local26:b2XForm; var _local27:b2XForm; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local7:Number = _arg1.m_sweepRadius; var _local8:Number = _arg3.m_sweepRadius; var _local9:Number = _arg2.t0; var _local10:Number = (_arg2.c.x - _arg2.c0.x); var _local11:Number = (_arg2.c.y - _arg2.c0.y); var _local12:Number = (_arg4.c.x - _arg4.c0.x); var _local13:Number = (_arg4.c.y - _arg4.c0.y); var _local14:Number = (_arg2.a - _arg2.a0); var _local15:Number = (_arg4.a - _arg4.a0); var _local16:Number = 0; var _local17:b2Vec2 = s_p1; var _local18:b2Vec2 = s_p2; var _local19 = 20; var _local20:int; var _local21:Number = 0; var _local22:Number = 0; var _local23:Number = 0; var _local24:Number = 0; while (true) { _local25 = (((1 - _local16) * _local9) + _local16); _local26 = s_xf1; _local27 = s_xf2; _arg2.GetXForm(_local26, _local25); _arg4.GetXForm(_local27, _local25); _local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27); if (_local20 == 0){ if (_local23 > (2 * b2Settings.b2_toiSlop)){ _local24 = (1.5 * b2Settings.b2_toiSlop); } else { _local5 = (0.05 * b2Settings.b2_toiSlop); _local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop)); _local24 = ((_local5 > _local6)) ? _local5 : _local6; }; }; if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){ break; }; _local21 = (_local18.x - _local17.x); _local22 = (_local18.y - _local17.y); _local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22))); _local21 = (_local21 / _local28); _local22 = (_local22 / _local28); _local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8)); if (_local29 == 0){ _local16 = 1; break; }; _local30 = ((_local23 - _local24) / _local29); _local31 = (_local16 + _local30); if ((((_local31 < 0)) || ((1 < _local31)))){ _local16 = 1; break; }; if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){ break; }; _local16 = _local31; _local20++; }; return (_local16); } } }//package Box2D.Collision
Section 28
//ClipVertex (Box2D.Collision.ClipVertex) package Box2D.Collision { import Box2D.Common.Math.*; public class ClipVertex { public var id:b2ContactID; public var v:b2Vec2; public function ClipVertex(){ v = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features) package Box2D.Collision { public class Features { public var _referenceEdge:int; public var _incidentEdge:int; public var _flip:int; public var _incidentVertex:int; public var _m_id:b2ContactID; public function get referenceEdge():int{ return (_referenceEdge); } public function set incidentVertex(_arg1:int):void{ _incidentVertex = _arg1; _m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000)); } public function get flip():int{ return (_flip); } public function get incidentEdge():int{ return (_incidentEdge); } public function set referenceEdge(_arg1:int):void{ _referenceEdge = _arg1; _m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF)); } public function get incidentVertex():int{ return (_incidentVertex); } public function set flip(_arg1:int):void{ _flip = _arg1; _m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080)); } public function set incidentEdge(_arg1:int):void{ _incidentEdge = _arg1; _m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00)); } } }//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22) package Box2D.Common.Math { public class b2Mat22 { public var col1:b2Vec2; public var col2:b2Vec2; public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){ var _local4:Number; var _local5:Number; col1 = new b2Vec2(); col2 = new b2Vec2(); super(); if (((!((_arg2 == null))) && (!((_arg3 == null))))){ col1.SetV(_arg2); col2.SetV(_arg3); } else { _local4 = Math.cos(_arg1); _local5 = Math.sin(_arg1); col1.x = _local4; col2.x = -(_local5); col1.y = _local5; col2.y = _local4; }; } public function SetIdentity():void{ col1.x = 1; col2.x = 0; col1.y = 0; col2.y = 1; } public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{ col1.SetV(_arg1); col2.SetV(_arg2); } public function Set(_arg1:Number):void{ var _local2:Number; _local2 = Math.cos(_arg1); var _local3:Number = Math.sin(_arg1); col1.x = _local2; col2.x = -(_local3); col1.y = _local3; col2.y = _local2; } public function SetZero():void{ col1.x = 0; col2.x = 0; col1.y = 0; col2.y = 0; } public function SetM(_arg1:b2Mat22):void{ col1.SetV(_arg1.col1); col2.SetV(_arg1.col2); } public function AddM(_arg1:b2Mat22):void{ col1.x = (col1.x + _arg1.col1.x); col1.y = (col1.y + _arg1.col1.y); col2.x = (col2.x + _arg1.col2.x); col2.y = (col2.y + _arg1.col2.y); } public function Abs():void{ col1.Abs(); col2.Abs(); } public function Copy():b2Mat22{ return (new b2Mat22(0, col1, col2)); } public function Invert(_arg1:b2Mat22):b2Mat22{ var _local2:Number; var _local4:Number; var _local6:Number; _local2 = col1.x; var _local3:Number = col2.x; _local4 = col1.y; var _local5:Number = col2.y; _local6 = ((_local2 * _local5) - (_local3 * _local4)); _local6 = (1 / _local6); _arg1.col1.x = (_local6 * _local5); _arg1.col2.x = (-(_local6) * _local3); _arg1.col1.y = (-(_local6) * _local4); _arg1.col2.y = (_local6 * _local2); return (_arg1); } public function GetAngle():Number{ return (Math.atan2(col1.y, col1.x)); } public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:Number = col1.x; var _local5:Number = col2.x; var _local6:Number = col1.y; var _local7:Number = col2.y; var _local8:Number = ((_local4 * _local7) - (_local5 * _local6)); _local8 = (1 / _local8); _arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3))); _arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2))); return (_arg1); } } }//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math) package Box2D.Common.Math { public class b2Math { public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1)); public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity); public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0); public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x)); return (_local3); } public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y)); return (_local3); } public static function b2IsValid(_arg1:Number):Boolean{ return (isFinite(_arg1)); } public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y)); return (_local3); } public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = b2MulMV(_arg1.R, _arg2); _local3.x = (_local3.x + _arg1.position.x); _local3.y = (_local3.y + _arg1.position.y); return (_local3); } public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{ var _local3:Number = (_arg1.x - _arg2.x); var _local4:Number = (_arg1.y - _arg2.y); return (((_local3 * _local3) + (_local4 * _local4))); } public static function b2Swap(_arg1:Array, _arg2:Array):void{ var _local3:* = _arg1[0]; _arg1[0] = _arg2[0]; _arg2[0] = _local3; } public static function b2AbsM(_arg1:b2Mat22):b2Mat22{ var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2)); return (_local2); } public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y)); return (_local3); } public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; var _local4:Number; _local3 = SubtractVV(_arg2, _arg1.position); _local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y)); _local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y)); _local3.x = _local4; return (_local3); } public static function b2Abs(_arg1:Number):Number{ return (((_arg1 > 0)) ? _arg1 : -(_arg1)); } public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{ return (b2Max(_arg2, b2Min(_arg1, _arg3))); } public static function b2AbsV(_arg1:b2Vec2):b2Vec2{ var _local2:b2Vec2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y)); return (_local2); } public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y)); return (_local3); } public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x))); } public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y))); } public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x)); return (_local3); } public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2)); return (_local3); } public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{ var _local3:Number = (_arg1.x - _arg2.x); var _local4:Number = (_arg1.y - _arg2.y); return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4)))); } public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1)); var _local4:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2)); var _local5:b2Mat22 = new b2Mat22(0, _local3, _local4); return (_local5); } public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y)); return (_local3); } public static function b2IsPowerOfTwo(_arg1:uint):Boolean{ var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0))); return (_local2); } public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{ return (b2MaxV(_arg2, b2MinV(_arg1, _arg3))); } public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{ var _local3:Number = Math.random(); _local3 = (((_arg2 - _arg1) * _local3) + _arg1); return (_local3); } public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2)); return (_local3); } public static function b2Min(_arg1:Number, _arg2:Number):Number{ return (((_arg1 < _arg2)) ? _arg1 : _arg2); } public static function b2Random():Number{ return (((Math.random() * 2) - 1)); } public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2)); return (_local3); } public static function b2NextPowerOfTwo(_arg1:uint):uint{ _arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647)); _arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823)); _arg1 = (_arg1 | ((_arg1 >> 4) & 268435455)); _arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF)); _arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF)); return ((_arg1 + 1)); } public static function b2Max(_arg1:Number, _arg2:Number):Number{ return (((_arg1 > _arg2)) ? _arg1 : _arg2); } public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y))); return (_local3); } } }//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep) package Box2D.Common.Math { public class b2Sweep { public var localCenter:b2Vec2; public var a:Number; public var c:b2Vec2; public var a0:Number; public var c0:b2Vec2; public var t0:Number; public function b2Sweep(){ localCenter = new b2Vec2(); c0 = new b2Vec2(); c = new b2Vec2(); super(); } public function Advance(_arg1:Number):void{ var _local2:Number; if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){ _local2 = ((_arg1 - t0) / (1 - t0)); c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x)); c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y)); a0 = (((1 - _local2) * a0) + (_local2 * a)); t0 = _arg1; }; } public function GetXForm(_arg1:b2XForm, _arg2:Number):void{ var _local4:Number; var _local5:Number; if ((1 - t0) > Number.MIN_VALUE){ _local4 = ((_arg2 - t0) / (1 - t0)); _arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x)); _arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y)); _local5 = (((1 - _local4) * a0) + (_local4 * a)); _arg1.R.Set(_local5); } else { _arg1.position.SetV(c); _arg1.R.Set(a); }; var _local3:b2Mat22 = _arg1.R; _arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y))); _arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y))); } } }//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2) package Box2D.Common.Math { public class b2Vec2 { public var y:Number; public var x:Number; public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Add(_arg1:b2Vec2):void{ x = (x + _arg1.x); y = (y + _arg1.y); } public function Set(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Multiply(_arg1:Number):void{ x = (x * _arg1); y = (y * _arg1); } public function Length():Number{ return (Math.sqrt(((x * x) + (y * y)))); } public function LengthSquared():Number{ return (((x * x) + (y * y))); } public function MulM(_arg1:b2Mat22):void{ var _local2:Number = x; x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y)); y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y)); } public function SetZero():void{ x = 0; y = 0; } public function MinV(_arg1:b2Vec2):void{ x = ((x < _arg1.x)) ? x : _arg1.x; y = ((y < _arg1.y)) ? y : _arg1.y; } public function Normalize():Number{ var _local1:Number = Math.sqrt(((x * x) + (y * y))); if (_local1 < Number.MIN_VALUE){ return (0); }; var _local2:Number = (1 / _local1); x = (x * _local2); y = (y * _local2); return (_local1); } public function CrossVF(_arg1:Number):void{ var _local2:Number = x; x = (_arg1 * y); y = (-(_arg1) * _local2); } public function MaxV(_arg1:b2Vec2):void{ x = ((x > _arg1.x)) ? x : _arg1.x; y = ((y > _arg1.y)) ? y : _arg1.y; } public function SetV(_arg1:b2Vec2):void{ x = _arg1.x; y = _arg1.y; } public function Negative():b2Vec2{ return (new b2Vec2(-(x), -(y))); } public function CrossFV(_arg1:Number):void{ var _local2:Number = x; x = (-(_arg1) * y); y = (_arg1 * _local2); } public function Abs():void{ if (x < 0){ x = -(x); }; if (y < 0){ y = -(y); }; } public function Subtract(_arg1:b2Vec2):void{ x = (x - _arg1.x); y = (y - _arg1.y); } public function Copy():b2Vec2{ return (new b2Vec2(x, y)); } public function MulTM(_arg1:b2Mat22):void{ var _local2:Number = b2Math.b2Dot(this, _arg1.col1); y = b2Math.b2Dot(this, _arg1.col2); x = _local2; } public function IsValid():Boolean{ return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y)))); } public static function Make(_arg1:Number, _arg2:Number):b2Vec2{ return (new b2Vec2(_arg1, _arg2)); } } }//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm) package Box2D.Common.Math { public class b2XForm { public var position:b2Vec2; public var R:b2Mat22; public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{ position = new b2Vec2(); R = new b2Mat22(); super(); if (_arg1){ position.SetV(_arg1); R.SetM(_arg2); }; } public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{ position.SetV(_arg1); R.SetM(_arg2); } public function Set(_arg1:b2XForm):void{ position.SetV(_arg1.position); R.SetM(_arg1.R); } public function SetIdentity():void{ position.SetZero(); R.SetIdentity(); } } }//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color) package Box2D.Common { import Box2D.Common.Math.*; public class b2Color { private var _r:uint;// = 0 private var _g:uint;// = 0 private var _b:uint;// = 0 public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function set b(_arg1:Number):void{ _b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function get color():uint{ return (((_r | (_g << 8)) | (_b << 16))); } public function set r(_arg1:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function set g(_arg1:Number):void{ _g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } } }//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings) package Box2D.Common { import Box2D.Common.Math.*; public class b2Settings { public static const b2_angularSleepTolerance:Number = 0.0111111111111111; public static const b2_linearSleepTolerance:Number = 0.01; public static const b2_angularSlop:Number = ((2 / 180) * b2_pi); public static const b2_linearSlop:Number = 0.005; public static const b2_pi:Number = Math.PI; public static const b2_maxProxies:int = 0x0200; public static const b2_maxAngularVelocitySquared:Number = 62500; public static const b2_maxPolygonVertices:int = 8; public static const b2_velocityThreshold:Number = 1; public static const b2_contactBaumgarte:Number = 0.2; public static const b2_maxPairs:int = 4096; public static const b2_maxTOIContactsPerIsland:int = 32; public static const b2_timeToSleep:Number = 0.5; public static const b2_maxManifoldPoints:int = 2; public static const b2_maxAngularVelocity:Number = 250; public static const b2_maxAngularCorrection:Number = ((8 / 180) * b2_pi); public static const USHRT_MAX:int = 0xFFFF; public static const b2_maxLinearVelocity:Number = 200; public static const b2_maxLinearCorrection:Number = 0.2; public static const b2_toiSlop:Number = 0.04; public static const b2_maxLinearVelocitySquared:Number = 40000; public static function b2Assert(_arg1:Boolean):void{ var _local2:b2Vec2; if (!_arg1){ _local2.x++; }; } } }//package Box2D.Common
Section 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2CircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; var _local3:b2ManifoldPoint = m_manifold.points[0]; _local3.normalImpulse = 0; _local3.tangentImpulse = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2ManifoldPoint; var _local8:b2ManifoldPoint; var _local5:b2Body = m_shape1.m_body; var _local6:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf); var _local7:b2ContactPoint = s_evalCP; _local7.shape1 = m_shape1; _local7.shape2 = m_shape2; _local7.friction = m_friction; _local7.restitution = m_restitution; if (m_manifold.pointCount > 0){ m_manifoldCount = 1; _local8 = m_manifold.points[0]; if (m0.pointCount == 0){ _local8.normalImpulse = 0; _local8.tangentImpulse = 0; if (_arg1){ _local7.position = _local5.GetWorldPoint(_local8.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Add(_local7); }; } else { _local4 = m0.points[0]; _local8.normalImpulse = _local4.normalImpulse; _local8.tangentImpulse = _local4.tangentImpulse; if (_arg1){ _local7.position = _local5.GetWorldPoint(_local8.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Persist(_local7); }; }; } else { m_manifoldCount = 0; if ((((m0.pointCount > 0)) && (_arg1))){ _local4 = m0.points[0]; _local7.position = _local5.GetWorldPoint(_local4.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2CircleContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Contact { public var m_shape1:b2Shape; public var m_shape2:b2Shape; public var m_prev:b2Contact; public var m_toi:Number; public var m_next:b2Contact; public var m_friction:Number; public var m_manifoldCount:int; public var m_node1:b2ContactEdge; public var m_node2:b2ContactEdge; public var m_restitution:Number; public var m_flags:uint; public static var e_toiFlag:uint = 8; public static var e_nonSolidFlag:uint = 1; public static var e_slowFlag:uint = 2; public static var e_islandFlag:uint = 4; public static var s_registers:Array; public static var s_initialized:Boolean = false; public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){ m_node1 = new b2ContactEdge(); m_node2 = new b2ContactEdge(); super(); m_flags = 0; if (((!(_arg1)) || (!(_arg2)))){ m_shape1 = null; m_shape2 = null; return; }; if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){ m_flags = (m_flags | e_nonSolidFlag); }; m_shape1 = _arg1; m_shape2 = _arg2; m_manifoldCount = 0; m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction)); m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution); m_prev = null; m_next = null; m_node1.contact = null; m_node1.prev = null; m_node1.next = null; m_node1.other = null; m_node2.contact = null; m_node2.prev = null; m_node2.next = null; m_node2.other = null; } public function IsSolid():Boolean{ return (((m_flags & e_nonSolidFlag) == 0)); } public function GetShape1():b2Shape{ return (m_shape1); } public function GetShape2():b2Shape{ return (m_shape2); } public function GetNext():b2Contact{ return (m_next); } public function GetManifoldCount():int{ return (m_manifoldCount); } public function GetManifolds():Array{ return (null); } public function Update(_arg1:b2ContactListener):void{ var _local2:int = m_manifoldCount; Evaluate(_arg1); var _local3:int = m_manifoldCount; var _local4:b2Body = m_shape1.m_body; var _local5:b2Body = m_shape2.m_body; if ((((_local3 == 0)) && ((_local2 > 0)))){ _local4.WakeUp(); _local5.WakeUp(); }; if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){ m_flags = (m_flags & ~(e_slowFlag)); } else { m_flags = (m_flags | e_slowFlag); }; } public function Evaluate(_arg1:b2ContactListener):void{ } public static function InitializeRegisters():void{ var _local2:int; s_registers = new Array(b2Shape.e_shapeTypeCount); var _local1:int; while (_local1 < b2Shape.e_shapeTypeCount) { s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount); _local2 = 0; while (_local2 < b2Shape.e_shapeTypeCount) { s_registers[_local1][_local2] = new b2ContactRegister(); _local2++; }; _local1++; }; AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape); AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape); AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape); } public static function Destroy(_arg1:b2Contact, _arg2):void{ if (_arg1.m_manifoldCount > 0){ _arg1.m_shape1.m_body.WakeUp(); _arg1.m_shape2.m_body.WakeUp(); }; var _local3:int = _arg1.m_shape1.m_type; var _local4:int = _arg1.m_shape2.m_type; var _local5:b2ContactRegister = s_registers[_local3][_local4]; var _local6:Function = _local5.destroyFcn; _local6(_arg1, _arg2); } public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{ s_registers[_arg3][_arg4].createFcn = _arg1; s_registers[_arg3][_arg4].destroyFcn = _arg2; s_registers[_arg3][_arg4].primary = true; if (_arg3 != _arg4){ s_registers[_arg4][_arg3].createFcn = _arg1; s_registers[_arg4][_arg3].destroyFcn = _arg2; s_registers[_arg4][_arg3].primary = false; }; } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ var _local8:b2Contact; var _local9:int; var _local10:b2Manifold; if (s_initialized == false){ InitializeRegisters(); s_initialized = true; }; var _local4:int = _arg1.m_type; var _local5:int = _arg2.m_type; var _local6:b2ContactRegister = s_registers[_local4][_local5]; var _local7:Function = _local6.createFcn; if (_local7 != null){ if (_local6.primary){ return (_local7(_arg1, _arg2, _arg3)); }; _local8 = _local7(_arg2, _arg1, _arg3); _local9 = 0; while (_local9 < _local8.m_manifoldCount) { _local10 = _local8.GetManifolds()[_local9]; _local8.GetManifolds()[_local9].normal = _local10.normal.Negative(); _local9++; }; return (_local8); //unresolved jump }; return (null); } } }//package Box2D.Dynamics.Contacts
Section 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactConstraint { public var points:Array; public var normal:b2Vec2; public var restitution:Number; public var body1:b2Body; public var manifold:b2Manifold; public var body2:b2Body; public var friction:Number; public var pointCount:int; public function b2ContactConstraint(){ normal = new b2Vec2(); super(); points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ContactConstraintPoint(); _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; public class b2ContactConstraintPoint { public var r2:b2Vec2; public var separation:Number; public var positionImpulse:Number; public var normalImpulse:Number; public var tangentMass:Number; public var equalizedMass:Number; public var tangentImpulse:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var normalMass:Number; public var velocityBias:Number; public var r1:b2Vec2; public function b2ContactConstraintPoint(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); r1 = new b2Vec2(); r2 = new b2Vec2(); super(); } } }//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2ContactEdge { public var other:b2Body; public var prev:b2ContactEdge; public var contact:b2Contact; public var next:b2ContactEdge; } }//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister) package Box2D.Dynamics.Contacts { public class b2ContactRegister { public var primary:Boolean; public var createFcn:Function; public var destroyFcn:Function; } }//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; public class b2ContactResult { public var position:b2Vec2; public var shape1:b2Shape; public var shape2:b2Shape; public var normalImpulse:Number; public var normal:b2Vec2; public var tangentImpulse:Number; public var id:b2ContactID; public function b2ContactResult(){ position = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactSolver { public var m_constraintCount:int; public var m_constraints:Array; public var m_allocator; public var m_step:b2TimeStep; public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){ var _local5:b2Contact; var _local6:int; var _local7:b2Vec2; var _local8:b2Mat22; var _local10:b2Body; var _local11:b2Body; var _local12:int; var _local13:Array; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:int; var _local23:b2Manifold; var _local24:Number; var _local25:Number; var _local26:b2ContactConstraint; var _local27:uint; var _local28:b2ManifoldPoint; var _local29:b2ContactConstraintPoint; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local39:Number; var _local40:Number; var _local41:Number; var _local42:Number; var _local43:Number; var _local44:Number; var _local45:Number; var _local46:Number; var _local47:Number; m_step = new b2TimeStep(); m_constraints = new Array(); super(); m_step.dt = _arg1.dt; m_step.inv_dt = _arg1.inv_dt; m_step.maxIterations = _arg1.maxIterations; m_allocator = _arg4; m_constraintCount = 0; _local6 = 0; while (_local6 < _arg3) { _local5 = _arg2[_local6]; m_constraintCount = (m_constraintCount + _local5.m_manifoldCount); _local6++; }; _local6 = 0; while (_local6 < m_constraintCount) { m_constraints[_local6] = new b2ContactConstraint(); _local6++; }; var _local9:int; _local6 = 0; while (_local6 < _arg3) { _local5 = _arg2[_local6]; _local10 = _local5.m_shape1.m_body; _local11 = _local5.m_shape2.m_body; _local12 = _local5.m_manifoldCount; _local13 = _local5.GetManifolds(); _local14 = _local5.m_friction; _local15 = _local5.m_restitution; _local16 = _local10.m_linearVelocity.x; _local17 = _local10.m_linearVelocity.y; _local18 = _local11.m_linearVelocity.x; _local19 = _local11.m_linearVelocity.y; _local20 = _local10.m_angularVelocity; _local21 = _local11.m_angularVelocity; _local22 = 0; while (_local22 < _local12) { _local23 = _local13[_local22]; _local24 = _local23.normal.x; _local25 = _local23.normal.y; _local26 = m_constraints[_local9]; _local26.body1 = _local10; _local26.body2 = _local11; _local26.manifold = _local23; _local26.normal.x = _local24; _local26.normal.y = _local25; _local26.pointCount = _local23.pointCount; _local26.friction = _local14; _local26.restitution = _local15; _local27 = 0; while (_local27 < _local26.pointCount) { _local28 = _local23.points[_local27]; _local29 = _local26.points[_local27]; _local29.normalImpulse = _local28.normalImpulse; _local29.tangentImpulse = _local28.tangentImpulse; _local29.separation = _local28.separation; _local29.positionImpulse = 0; _local29.localAnchor1.SetV(_local28.localPoint1); _local29.localAnchor2.SetV(_local28.localPoint2); _local8 = _local10.m_xf.R; _local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x); _local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y); _local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33)); _local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33)); _local32 = _local30; _local29.r1.Set(_local32, _local33); _local8 = _local11.m_xf.R; _local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x); _local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y); _local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35)); _local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35)); _local34 = _local30; _local29.r2.Set(_local34, _local35); _local36 = ((_local32 * _local32) + (_local33 * _local33)); _local37 = ((_local34 * _local34) + (_local35 * _local35)); _local38 = ((_local32 * _local24) + (_local33 * _local25)); _local39 = ((_local34 * _local24) + (_local35 * _local25)); _local40 = (_local10.m_invMass + _local11.m_invMass); _local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39))))); _local29.normalMass = (1 / _local40); _local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass)); _local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39))))); _local29.equalizedMass = (1 / _local41); _local42 = _local25; _local43 = -(_local24); _local44 = ((_local32 * _local42) + (_local33 * _local43)); _local45 = ((_local34 * _local42) + (_local35 * _local43)); _local46 = (_local10.m_invMass + _local11.m_invMass); _local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45))))); _local29.tangentMass = (1 / _local46); _local29.velocityBias = 0; if (_local29.separation > 0){ _local29.velocityBias = (-60 * _local29.separation); }; _local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33)); _local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32)); _local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31)); if (_local47 < -(b2Settings.b2_velocityThreshold)){ _local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47)); }; _local27++; }; _local9++; _local22++; }; _local6++; }; } public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2Mat22; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:int; var _local19:int; var _local20:b2ContactConstraintPoint; var _local21:Number; var _local22:Number; var _local23:b2ContactConstraintPoint; var _local5:int; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_invMass; _local10 = _local7.m_invI; _local11 = _local8.m_invMass; _local12 = _local8.m_invI; _local13 = _local6.normal.x; _local14 = _local6.normal.y; _local15 = _local14; _local16 = -(_local13); if (_arg1.warmStarting){ _local19 = _local6.pointCount; _local18 = 0; while (_local18 < _local19) { _local20 = _local6.points[_local18]; _local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio); _local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio); _local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15)); _local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16)); _local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21)))); _local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21)); _local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22)); _local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21)))); _local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21)); _local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22)); _local18++; }; } else { _local19 = _local6.pointCount; _local18 = 0; while (_local18 < _local19) { _local23 = _local6.points[_local18]; _local23.normalImpulse = 0; _local23.tangentImpulse = 0; _local18++; }; }; _local5++; }; } public function SolvePositionConstraints(_arg1:Number):Boolean{ var _local3:b2Mat22; var _local4:b2Vec2; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:b2Vec2; var _local10:Number; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:int; var _local20:int; var _local21:b2ContactConstraintPoint; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local2:Number = 0; var _local5:int; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_sweep.c; _local10 = _local7.m_sweep.a; _local11 = _local8.m_sweep.c; _local12 = _local8.m_sweep.a; _local13 = (_local7.m_mass * _local7.m_invMass); _local14 = (_local7.m_mass * _local7.m_invI); _local15 = (_local8.m_mass * _local8.m_invMass); _local16 = (_local8.m_mass * _local8.m_invI); _local17 = _local6.normal.x; _local18 = _local6.normal.y; _local19 = _local6.pointCount; _local20 = 0; while (_local20 < _local19) { _local21 = _local6.points[_local20]; _local3 = _local7.m_xf.R; _local4 = _local7.m_sweep.localCenter; _local22 = (_local21.localAnchor1.x - _local4.x); _local23 = (_local21.localAnchor1.y - _local4.y); _local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23)); _local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23)); _local22 = _local26; _local3 = _local8.m_xf.R; _local4 = _local8.m_sweep.localCenter; _local24 = (_local21.localAnchor2.x - _local4.x); _local25 = (_local21.localAnchor2.y - _local4.y); _local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25)); _local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25)); _local24 = _local26; _local27 = (_local9.x + _local22); _local28 = (_local9.y + _local23); _local29 = (_local11.x + _local24); _local30 = (_local11.y + _local25); _local31 = (_local29 - _local27); _local32 = (_local30 - _local28); _local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation); _local2 = b2Math.b2Min(_local2, _local33); _local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0)); _local35 = (-(_local21.equalizedMass) * _local34); _local36 = _local21.positionImpulse; _local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0); _local35 = (_local21.positionImpulse - _local36); _local37 = (_local35 * _local17); _local38 = (_local35 * _local18); _local9.x = (_local9.x - (_local13 * _local37)); _local9.y = (_local9.y - (_local13 * _local38)); _local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37)))); _local7.m_sweep.a = _local10; _local7.SynchronizeTransform(); _local11.x = (_local11.x + (_local15 * _local37)); _local11.y = (_local11.y + (_local15 * _local38)); _local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37)))); _local8.m_sweep.a = _local12; _local8.SynchronizeTransform(); _local20++; }; _local5++; }; return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop))); } public function SolveVelocityConstraints():void{ var _local1:int; var _local2:b2ContactConstraintPoint; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:b2Mat22; var _local18:b2Vec2; var _local20:b2ContactConstraint; var _local21:b2Body; var _local22:b2Body; var _local23:Number; var _local24:Number; var _local25:b2Vec2; var _local26:b2Vec2; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:int; var _local38:Number; var _local19:int; while (_local19 < m_constraintCount) { _local20 = m_constraints[_local19]; _local21 = _local20.body1; _local22 = _local20.body2; _local23 = _local21.m_angularVelocity; _local24 = _local22.m_angularVelocity; _local25 = _local21.m_linearVelocity; _local26 = _local22.m_linearVelocity; _local27 = _local21.m_invMass; _local28 = _local21.m_invI; _local29 = _local22.m_invMass; _local30 = _local22.m_invI; _local31 = _local20.normal.x; _local32 = _local20.normal.y; _local33 = _local32; _local34 = -(_local31); _local35 = _local20.friction; _local37 = _local20.pointCount; _local1 = 0; while (_local1 < _local37) { _local2 = _local20.points[_local1]; _local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y)); _local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x)); _local9 = ((_local7 * _local31) + (_local8 * _local32)); _local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias)); _local10 = ((_local7 * _local33) + (_local8 * _local34)); _local12 = (_local2.tangentMass * -(_local10)); _local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0); _local11 = (_local13 - _local2.normalImpulse); _local38 = (_local35 * _local2.normalImpulse); _local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38); _local12 = (_local14 - _local2.tangentImpulse); _local15 = ((_local11 * _local31) + (_local12 * _local33)); _local16 = ((_local11 * _local32) + (_local12 * _local34)); _local25.x = (_local25.x - (_local27 * _local15)); _local25.y = (_local25.y - (_local27 * _local16)); _local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15)))); _local26.x = (_local26.x + (_local29 * _local15)); _local26.y = (_local26.y + (_local29 * _local16)); _local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15)))); _local2.normalImpulse = _local13; _local2.tangentImpulse = _local14; _local1++; }; _local21.m_angularVelocity = _local23; _local22.m_angularVelocity = _local24; _local19++; }; } public function FinalizeVelocityConstraints():void{ var _local2:b2ContactConstraint; var _local3:b2Manifold; var _local4:int; var _local5:b2ManifoldPoint; var _local6:b2ContactConstraintPoint; var _local1:int; while (_local1 < m_constraintCount) { _local2 = m_constraints[_local1]; _local3 = _local2.manifold; _local4 = 0; while (_local4 < _local2.pointCount) { _local5 = _local3.points[_local4]; _local6 = _local2.points[_local4]; _local5.normalImpulse = _local6.normalImpulse; _local5.tangentImpulse = _local6.tangentImpulse; _local4++; }; _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2NullContact extends b2Contact { override public function Evaluate(_arg1:b2ContactListener):void{ } override public function GetManifolds():Array{ return (null); } } }//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2PolyAndCircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape)); b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape)); m_manifold.pointCount = 0; var _local3:b2ManifoldPoint = m_manifold.points[0]; _local3.normalImpulse = 0; _local3.tangentImpulse = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:int; var _local3:b2Vec2; var _local4:b2Vec2; var _local5:b2ManifoldPoint; var _local10:b2ManifoldPoint; var _local11:Boolean; var _local12:uint; var _local13:int; var _local6:b2Body = m_shape1.m_body; var _local7:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf); var _local8:Array = [false, false]; var _local9:b2ContactPoint = s_evalCP; _local9.shape1 = m_shape1; _local9.shape2 = m_shape2; _local9.friction = m_friction; _local9.restitution = m_restitution; if (m_manifold.pointCount > 0){ _local2 = 0; while (_local2 < m_manifold.pointCount) { _local10 = m_manifold.points[_local2]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < m0.pointCount) { if (_local8[_local13] == true){ } else { _local5 = m0.points[_local13]; if (_local5.id._key == _local12){ _local8[_local13] = true; _local10.normalImpulse = _local5.normalImpulse; _local10.tangentImpulse = _local5.tangentImpulse; _local11 = true; if (_arg1 != null){ _local9.position = _local6.GetWorldPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m_manifold.normal); _local9.separation = _local10.separation; _local9.id.key = _local12; _arg1.Persist(_local9); }; break; }; }; _local13++; }; if ((((_local11 == false)) && (!((_arg1 == null))))){ _local9.position = _local6.GetWorldPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m_manifold.normal); _local9.separation = _local10.separation; _local9.id.key = _local12; _arg1.Add(_local9); }; _local2++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (_arg1 == null){ return; }; _local2 = 0; while (_local2 < m0.pointCount) { if (_local8[_local2]){ } else { _local5 = m0.points[_local2]; _local9.position = _local6.GetWorldPoint(_local5.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m0.normal); _local9.separation = _local5.separation; _local9.id.key = _local5.id._key; _arg1.Remove(_local9); }; _local2++; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolyAndCircleContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2PolygonContact extends b2Contact { private var m_manifolds:Array; private var m0:b2Manifold; public var m_manifold:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{ m0 = new b2Manifold(); m_manifolds = [new b2Manifold()]; super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2ManifoldPoint; var _local7:b2ContactPoint; var _local8:int; var _local10:b2ManifoldPoint; var _local11:Boolean; var _local12:uint; var _local13:int; var _local5:b2Body = m_shape1.m_body; var _local6:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf); var _local9:Array = [false, false]; _local7 = s_evalCP; _local7.shape1 = m_shape1; _local7.shape2 = m_shape2; _local7.friction = m_friction; _local7.restitution = m_restitution; if (m_manifold.pointCount > 0){ _local8 = 0; while (_local8 < m_manifold.pointCount) { _local10 = m_manifold.points[_local8]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < m0.pointCount) { if (_local9[_local13] == true){ } else { _local4 = m0.points[_local13]; if (_local4.id._key == _local12){ _local9[_local13] = true; _local10.normalImpulse = _local4.normalImpulse; _local10.tangentImpulse = _local4.tangentImpulse; _local11 = true; if (_arg1 != null){ _local7.position = _local5.GetWorldPoint(_local10.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local10.separation; _local7.id.key = _local12; _arg1.Persist(_local7); }; break; }; }; _local13++; }; if ((((_local11 == false)) && (!((_arg1 == null))))){ _local7.position = _local5.GetWorldPoint(_local10.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local10.separation; _local7.id.key = _local12; _arg1.Add(_local7); }; _local8++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (_arg1 == null){ return; }; _local8 = 0; while (_local8 < m0.pointCount) { if (_local9[_local8]){ } else { _local4 = m0.points[_local8]; _local7.position = _local5.GetWorldPoint(_local4.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; _local8++; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolygonContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2DistanceJoint extends b2Joint { public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_bias:Number; public var m_gamma:Number; public var m_u:b2Vec2; public var m_mass:Number; public var m_impulse:Number; public var m_dampingRatio:Number; public var m_frequencyHz:Number; public var m_length:Number; public function b2DistanceJoint(_arg1:b2DistanceJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u = new b2Vec2(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_length = _arg1.length; m_frequencyHz = _arg1.frequencyHz; m_dampingRatio = _arg1.dampingRatio; m_impulse = 0; m_gamma = 0; m_bias = 0; m_inv_dt = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; var _local3:Number; var _local4:b2Body; var _local5:b2Body; var _local6:Number; var _local8:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; m_inv_dt = _arg1.inv_dt; _local4 = m_body1; _local5 = m_body2; _local2 = _local4.m_xf.R; _local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local4.m_sweep.localCenter.y); _local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7)); _local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7)); _local6 = _local3; _local2 = _local5.m_xf.R; _local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local5.m_sweep.localCenter.y); _local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local3; m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6); m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7); var _local10:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y))); if (_local10 > b2Settings.b2_linearSlop){ m_u.Multiply((1 / _local10)); } else { m_u.SetZero(); }; var _local11:Number = ((_local6 * m_u.y) - (_local7 * m_u.x)); var _local12:Number = ((_local8 * m_u.y) - (_local9 * m_u.x)); var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12)); m_mass = (1 / _local13); if (m_frequencyHz > 0){ _local14 = (_local10 - m_length); _local15 = ((2 * Math.PI) * m_frequencyHz); _local16 = (((2 * m_mass) * m_dampingRatio) * _local15); _local17 = ((m_mass * _local15) * _local15); m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17)))); m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma); m_mass = (1 / (_local13 + m_gamma)); }; if (_arg1.warmStarting){ m_impulse = (m_impulse * _arg1.dtRatio); _local18 = (m_impulse * m_u.x); _local19 = (m_impulse * m_u.y); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19)); _local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18)))); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19)); _local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18)))); } else { m_impulse = 0; }; } override public function GetReactionTorque():Number{ return (0); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2(); _local1.SetV(m_u); _local1.Multiply((m_inv_dt * m_impulse)); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local1:b2Mat22; if (m_frequencyHz > 0){ return (true); }; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local1 = _local2.m_xf.R; var _local4:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local5:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local6:Number = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5)); _local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5)); _local4 = _local6; _local1 = _local3.m_xf.R; var _local7:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8)); _local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8)); _local7 = _local6; var _local9:Number = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4); var _local10:Number = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5); var _local11:Number = Math.sqrt(((_local9 * _local9) + (_local10 * _local10))); _local9 = (_local9 / _local11); _local10 = (_local10 / _local11); var _local12:Number = (_local11 - m_length); _local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local13:Number = (-(m_mass) * _local12); m_u.Set(_local9, _local10); var _local14:Number = (_local13 * m_u.x); var _local15:Number = (_local13 * m_u.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14)))); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15)); _local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14)))); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop)); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; _local2 = _local3.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6)); _local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6)); _local5 = _local7; _local2 = _local4.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local7; var _local10:Number = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6)); var _local11:Number = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5)); var _local12:Number = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9)); var _local13:Number = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8)); var _local14:Number = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11))); var _local15:Number = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse))); m_impulse = (m_impulse + _local15); var _local16:Number = (_local15 * m_u.x); var _local17:Number = (_local15 * m_u.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16)))); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17)); _local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); } } }//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2DistanceJointDef extends b2JointDef { public var localAnchor1:b2Vec2; public var length:Number; public var dampingRatio:Number; public var localAnchor2:b2Vec2; public var frequencyHz:Number; public function b2DistanceJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_distanceJoint; length = 1; frequencyHz = 0; dampingRatio = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1.SetV(body1.GetLocalPoint(_arg3)); localAnchor2.SetV(body2.GetLocalPoint(_arg4)); var _local5:Number = (_arg4.x - _arg3.x); var _local6:Number = (_arg4.y - _arg3.y); length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6))); frequencyHz = 0; dampingRatio = 0; } } }//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2GearJoint extends b2Joint { public var m_ground2:b2Body; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_ratio:Number; public var m_revolute2:b2RevoluteJoint; public var m_force:Number; public var m_mass:Number; public var m_prismatic2:b2PrismaticJoint; public var m_ground1:b2Body; public var m_revolute1:b2RevoluteJoint; public var m_prismatic1:b2PrismaticJoint; public var m_constant:Number; public var m_J:b2Jacobian; public function b2GearJoint(_arg1:b2GearJointDef){ var _local4:Number; var _local5:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_J = new b2Jacobian(); super(_arg1); var _local2:int = _arg1.joint1.m_type; var _local3:int = _arg1.joint2.m_type; m_revolute1 = null; m_prismatic1 = null; m_revolute2 = null; m_prismatic2 = null; m_ground1 = _arg1.joint1.m_body1; m_body1 = _arg1.joint1.m_body2; if (_local2 == b2Joint.e_revoluteJoint){ m_revolute1 = (_arg1.joint1 as b2RevoluteJoint); m_groundAnchor1.SetV(m_revolute1.m_localAnchor1); m_localAnchor1.SetV(m_revolute1.m_localAnchor2); _local4 = m_revolute1.GetJointAngle(); } else { m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint); m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1); m_localAnchor1.SetV(m_prismatic1.m_localAnchor2); _local4 = m_prismatic1.GetJointTranslation(); }; m_ground2 = _arg1.joint2.m_body1; m_body2 = _arg1.joint2.m_body2; if (_local3 == b2Joint.e_revoluteJoint){ m_revolute2 = (_arg1.joint2 as b2RevoluteJoint); m_groundAnchor2.SetV(m_revolute2.m_localAnchor1); m_localAnchor2.SetV(m_revolute2.m_localAnchor2); _local5 = m_revolute2.GetJointAngle(); } else { m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint); m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1); m_localAnchor2.SetV(m_prismatic2.m_localAnchor2); _local5 = m_prismatic2.GetJointTranslation(); }; m_ratio = _arg1.ratio; m_constant = (_local4 + (m_ratio * _local5)); m_force = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local15:Number; var _local2:b2Body = m_ground1; var _local3:b2Body = m_ground2; var _local4:b2Body = m_body1; var _local5:b2Body = m_body2; var _local14:Number = 0; m_J.SetZero(); if (m_revolute1){ m_J.angular1 = -1; _local14 = (_local14 + _local4.m_invI); } else { _local10 = _local2.m_xf.R; _local11 = m_prismatic1.m_localXAxis1; _local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); _local10 = _local4.m_xf.R; _local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y); _local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9)); _local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9)); _local8 = _local13; _local12 = ((_local8 * _local7) - (_local9 * _local6)); m_J.linear1.Set(-(_local6), -(_local7)); m_J.angular1 = -(_local12); _local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12))); }; if (m_revolute2){ m_J.angular2 = -(m_ratio); _local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI)); } else { _local10 = _local3.m_xf.R; _local11 = m_prismatic2.m_localXAxis1; _local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); _local10 = _local5.m_xf.R; _local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y); _local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9)); _local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9)); _local8 = _local13; _local12 = ((_local8 * _local7) - (_local9 * _local6)); m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7)); m_J.angular2 = (-(m_ratio) * _local12); _local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12)))); }; m_mass = (1 / _local14); if (_arg1.warmStarting){ _local15 = (_arg1.dt * m_force); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y)); _local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1)); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y)); _local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2)); } else { m_force = 0; }; } override public function GetReactionTorque():Number{ var _local1:b2Mat22 = m_body2.m_xf.R; var _local2:Number = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x); var _local3:Number = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y); var _local4:Number = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3)); _local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3)); _local2 = _local4; _local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x)))); return (_local4); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y)); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local4:Number; var _local5:Number; var _local1:Number = 0; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; if (m_revolute1){ _local4 = m_revolute1.GetJointAngle(); } else { _local4 = m_prismatic1.GetJointTranslation(); }; if (m_revolute2){ _local5 = m_revolute2.GetJointAngle(); } else { _local5 = m_prismatic2.GetJointTranslation(); }; var _local6:Number = (m_constant - (_local4 + (m_ratio * _local5))); var _local7:Number = (-(m_mass) * _local6); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y)); _local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1)); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2)); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((_local1 < b2Settings.b2_linearSlop)); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local5:Number = ((-(_arg1.inv_dt) * m_mass) * _local4); m_force = (m_force + _local5); var _local6:Number = (_arg1.dt * _local5); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2)); } } }//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef) package Box2D.Dynamics.Joints { public class b2GearJointDef extends b2JointDef { public var joint1:b2Joint; public var joint2:b2Joint; public var ratio:Number; public function b2GearJointDef(){ type = b2Joint.e_gearJoint; joint1 = null; joint2 = null; ratio = 1; } } }//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2Jacobian { public var linear1:b2Vec2; public var linear2:b2Vec2; public var angular1:Number; public var angular2:Number; public function b2Jacobian(){ linear1 = new b2Vec2(); linear2 = new b2Vec2(); super(); } public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{ linear1.SetV(_arg1); angular1 = _arg2; linear2.SetV(_arg3); angular2 = _arg4; } public function SetZero():void{ linear1.SetZero(); angular1 = 0; linear2.SetZero(); angular2 = 0; } public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{ return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4))); } } }//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2Joint { public var m_islandFlag:Boolean; public var m_body1:b2Body; public var m_prev:b2Joint; public var m_next:b2Joint; public var m_type:int; public var m_collideConnected:Boolean; public var m_node1:b2JointEdge; public var m_node2:b2JointEdge; public var m_inv_dt:Number; public var m_userData; public var m_body2:b2Body; public static const e_unknownJoint:int = 0; public static const e_inactiveLimit:int = 0; public static const e_atUpperLimit:int = 2; public static const e_atLowerLimit:int = 1; public static const e_gearJoint:int = 6; public static const e_revoluteJoint:int = 1; public static const e_equalLimits:int = 3; public static const e_distanceJoint:int = 3; public static const e_pulleyJoint:int = 4; public static const e_prismaticJoint:int = 2; public static const e_mouseJoint:int = 5; public function b2Joint(_arg1:b2JointDef){ m_node1 = new b2JointEdge(); m_node2 = new b2JointEdge(); super(); m_type = _arg1.type; m_prev = null; m_next = null; m_body1 = _arg1.body1; m_body2 = _arg1.body2; m_collideConnected = _arg1.collideConnected; m_islandFlag = false; m_userData = _arg1.userData; } public function GetBody2():b2Body{ return (m_body2); } public function GetAnchor1():b2Vec2{ return (null); } public function GetAnchor2():b2Vec2{ return (null); } public function GetNext():b2Joint{ return (m_next); } public function GetType():int{ return (m_type); } public function InitVelocityConstraints(_arg1:b2TimeStep):void{ } public function GetReactionTorque():Number{ return (0); } public function GetUserData(){ return (m_userData); } public function GetReactionForce():b2Vec2{ return (null); } public function SolvePositionConstraints():Boolean{ return (false); } public function SetUserData(_arg1):void{ m_userData = _arg1; } public function GetBody1():b2Body{ return (m_body1); } public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ } public function InitPositionConstraints():void{ } public static function Destroy(_arg1:b2Joint, _arg2):void{ } public static function Create(_arg1:b2JointDef, _arg2):b2Joint{ var _local3:b2Joint; switch (_arg1.type){ case e_distanceJoint: _local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef)); break; case e_mouseJoint: _local3 = new b2MouseJoint((_arg1 as b2MouseJointDef)); break; case e_prismaticJoint: _local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef)); break; case e_revoluteJoint: _local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef)); break; case e_pulleyJoint: _local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef)); break; case e_gearJoint: _local3 = new b2GearJoint((_arg1 as b2GearJointDef)); break; default: break; }; return (_local3); } } }//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointDef { public var body2:b2Body; public var type:int; public var userData; public var collideConnected:Boolean; public var body1:b2Body; public function b2JointDef(){ type = b2Joint.e_unknownJoint; userData = null; body1 = null; body2 = null; collideConnected = false; } } }//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointEdge { public var other:b2Body; public var next:b2JointEdge; public var prev:b2JointEdge; public var joint:b2Joint; } }//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2MouseJoint extends b2Joint { private var K1:b2Mat22; private var K:b2Mat22; public var m_beta:Number; public var m_mass:b2Mat22; private var K2:b2Mat22; public var m_target:b2Vec2; public var m_gamma:Number; public var m_impulse:b2Vec2; public var m_C:b2Vec2; public var m_localAnchor:b2Vec2; public var m_maxForce:Number; public function b2MouseJoint(_arg1:b2MouseJointDef){ var _local3:Number; K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); m_localAnchor = new b2Vec2(); m_target = new b2Vec2(); m_impulse = new b2Vec2(); m_mass = new b2Mat22(); m_C = new b2Vec2(); super(_arg1); m_target.SetV(_arg1.target); var _local2:Number = (m_target.x - m_body2.m_xf.position.x); _local3 = (m_target.y - m_body2.m_xf.position.y); var _local4:b2Mat22 = m_body2.m_xf.R; m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y)); m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y)); m_maxForce = _arg1.maxForce; m_impulse.SetZero(); var _local5:Number = m_body2.m_mass; var _local6:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz); var _local7:Number = (((2 * _local5) * _arg1.dampingRatio) * _local6); var _local8:Number = ((_arg1.timeStep * _local5) * (_local6 * _local6)); m_gamma = (1 / (_local7 + _local8)); m_beta = (_local8 / (_local7 + _local8)); } public function SetTarget(_arg1:b2Vec2):void{ if (m_body2.IsSleeping()){ m_body2.WakeUp(); }; m_target = _arg1; } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local7:Number; var _local8:Number; _local2 = m_body2; _local3 = _local2.m_xf.R; _local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x); _local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y); var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local7 = _local2.m_invMass; _local8 = _local2.m_invI; K1.col1.x = _local7; K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = _local7; K2.col1.x = ((_local8 * _local5) * _local5); K2.col2.x = ((-(_local8) * _local4) * _local5); K2.col1.y = ((-(_local8) * _local4) * _local5); K2.col2.y = ((_local8 * _local4) * _local4); K.SetM(K1); K.AddM(K2); K.col1.x = (K.col1.x + m_gamma); K.col2.y = (K.col2.y + m_gamma); K.Invert(m_mass); m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x); m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y); _local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98); var _local9:Number = (_arg1.dt * m_impulse.x); var _local10:Number = (_arg1.dt * m_impulse.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9)))); } override public function GetAnchor1():b2Vec2{ return (m_target); } override public function GetReactionTorque():Number{ return (0); } override public function GetReactionForce():b2Vec2{ return (m_impulse); } override public function SolvePositionConstraints():Boolean{ return (true); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local2:b2Body = m_body2; _local3 = _local2.m_xf.R; var _local6:Number = (m_localAnchor.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor.y - _local2.m_sweep.localCenter.y); _local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7)); _local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7)); _local6 = _local4; var _local8:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7)); var _local9:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6)); _local3 = m_mass; _local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x)); _local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y)); var _local10:Number = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5))); var _local11:Number = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5))); var _local12:Number = m_impulse.x; var _local13:Number = m_impulse.y; m_impulse.x = (m_impulse.x + _local10); m_impulse.y = (m_impulse.y + _local11); var _local14:Number = m_impulse.Length(); if (_local14 > m_maxForce){ m_impulse.Multiply((m_maxForce / _local14)); }; _local10 = (m_impulse.x - _local12); _local11 = (m_impulse.y - _local13); var _local15:Number = (_arg1.dt * _local10); var _local16:Number = (_arg1.dt * _local11); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); } } }//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2MouseJointDef extends b2JointDef { public var timeStep:Number; public var target:b2Vec2; public var maxForce:Number; public var dampingRatio:Number; public var frequencyHz:Number; public function b2MouseJointDef(){ target = new b2Vec2(); super(); type = b2Joint.e_mouseJoint; maxForce = 0; frequencyHz = 5; dampingRatio = 0.7; timeStep = (1 / 60); } } }//package Box2D.Dynamics.Joints
Section 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PrismaticJoint extends b2Joint { public var m_limitForce:Number; public var m_lowerTranslation:Number; public var m_localXAxis1:b2Vec2; public var m_refAngle:Number; public var m_torque:Number; public var m_motorForce:Number; public var m_enableLimit:Boolean; public var m_angularMass:Number; public var m_maxMotorForce:Number; public var m_localYAxis1:b2Vec2; public var m_force:Number; public var m_motorMass:Number; public var m_upperTranslation:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_limitState:int; public var m_linearMass:Number; public var m_motorJacobian:b2Jacobian; public var m_limitPositionImpulse:Number; public var m_motorSpeed:Number; public var m_enableMotor:Boolean; public var m_linearJacobian:b2Jacobian; public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_localXAxis1 = new b2Vec2(); m_localYAxis1 = new b2Vec2(); m_linearJacobian = new b2Jacobian(); m_motorJacobian = new b2Jacobian(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_localXAxis1.SetV(_arg1.localAxis1); m_localYAxis1.x = -(m_localXAxis1.y); m_localYAxis1.y = m_localXAxis1.x; m_refAngle = _arg1.referenceAngle; m_linearJacobian.SetZero(); m_linearMass = 0; m_force = 0; m_angularMass = 0; m_torque = 0; m_motorJacobian.SetZero(); m_motorMass = 0; m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerTranslation = _arg1.lowerTranslation; m_upperTranslation = _arg1.upperTranslation; m_maxMotorForce = _arg1.maxMotorForce; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local8:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; var _local4:Number = _local2.m_invMass; var _local5:Number = _local3.m_invMass; var _local6:Number = _local2.m_invI; var _local7:Number = _local3.m_invI; var _local9:Number = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local10:Number = ((-(_arg1.inv_dt) * m_linearMass) * _local9); m_force = (m_force + _local10); var _local11:Number = (_arg1.dt * _local10); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2)); var _local12:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity); var _local13:Number = ((-(_arg1.inv_dt) * m_angularMass) * _local12); m_torque = (m_torque + _local13); var _local14:Number = (_arg1.dt * _local13); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14)); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed); _local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15); _local17 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce); _local16 = (m_motorForce - _local17); _local11 = (_arg1.dt * _local16); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local19); } else { if (m_limitState == e_atLowerLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); } else { if (m_limitState == e_atUpperLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); }; }; }; _local11 = (_arg1.dt * _local19); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function GetUpperLimit():Number{ return (m_upperTranslation); } public function GetLowerLimit():Number{ return (m_lowerTranslation); } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function GetJointTranslation():Number{ var _local3:b2Mat22; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; var _local4:b2Vec2 = _local1.GetWorldPoint(m_localAnchor1); var _local5:b2Vec2 = _local2.GetWorldPoint(m_localAnchor2); var _local6:Number = (_local5.x - _local4.x); var _local7:Number = (_local5.y - _local4.y); var _local8:b2Vec2 = _local1.GetWorldVector(m_localXAxis1); var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7)); return (_local9); } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ var _local1:b2Mat22 = m_body1.m_xf.R; var _local2:Number = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y))); var _local3:Number = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y))); var _local4:Number = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y))); var _local5:Number = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y))); return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5)))); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local9:b2Mat22; var _local10:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; var _local5:Number = _local3.m_invMass; var _local6:Number = _local4.m_invMass; var _local7:Number = _local3.m_invI; var _local8:Number = _local4.m_invI; _local9 = _local3.m_xf.R; var _local11:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local12:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12)); _local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12)); _local11 = _local10; _local9 = _local4.m_xf.R; var _local13:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local14:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; var _local15:Number = (_local3.m_sweep.c.x + _local11); var _local16:Number = (_local3.m_sweep.c.y + _local12); var _local17:Number = (_local4.m_sweep.c.x + _local13); var _local18:Number = (_local4.m_sweep.c.y + _local14); var _local19:Number = (_local17 - _local15); var _local20:Number = (_local18 - _local16); _local9 = _local3.m_xf.R; var _local21:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y)); var _local22:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y)); var _local23:Number = ((_local21 * _local19) + (_local22 * _local20)); _local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local24:Number = (-(m_linearMass) * _local23); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2)); var _local25:Number = b2Math.b2Abs(_local23); var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle); _local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); var _local27:Number = (-(m_angularMass) * _local26); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); var _local28:Number = b2Math.b2Abs(_local26); if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local9 = _local3.m_xf.R; _local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); _local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12)); _local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12)); _local11 = _local10; _local9 = _local4.m_xf.R; _local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); _local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; _local15 = (_local3.m_sweep.c.x + _local11); _local16 = (_local3.m_sweep.c.y + _local12); _local17 = (_local4.m_sweep.c.x + _local13); _local18 = (_local4.m_sweep.c.y + _local14); _local19 = (_local17 - _local15); _local20 = (_local18 - _local16); _local9 = _local3.m_xf.R; _local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y)); _local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y)); _local31 = ((_local29 * _local19) + (_local30 * _local20)); _local32 = 0; if (m_limitState == e_equalLimits){ _local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26)); } else { if (m_limitState == e_atLowerLimit){ _local1 = (_local31 - m_lowerTranslation); _local25 = b2Math.b2Max(_local25, -(_local1)); _local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); } else { if (m_limitState == e_atUpperLimit){ _local1 = (_local31 - m_upperTranslation); _local25 = b2Math.b2Max(_local25, _local1); _local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); }; }; }; _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop)))); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function GetJointSpeed():Number{ var _local3:b2Mat22; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; _local3 = _local1.m_xf.R; var _local4:Number = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); var _local5:Number = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local3 = _local2.m_xf.R; var _local7:Number = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8)); _local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8)); _local7 = _local6; var _local9:Number = (_local1.m_sweep.c.x + _local4); var _local10:Number = (_local1.m_sweep.c.y + _local5); var _local11:Number = (_local2.m_sweep.c.x + _local7); var _local12:Number = (_local2.m_sweep.c.y + _local8); var _local13:Number = (_local11 - _local9); var _local14:Number = (_local12 - _local10); var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1); var _local16:b2Vec2 = _local1.m_linearVelocity; var _local17:b2Vec2 = _local2.m_linearVelocity; var _local18:Number = _local1.m_angularVelocity; var _local19:Number = _local2.m_angularVelocity; var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4))))); return (_local20); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local5:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local10:Number = _local2.m_invMass; var _local11:Number = _local3.m_invMass; var _local12:Number = _local2.m_invI; var _local13:Number = _local3.m_invI; _local4 = _local2.m_xf.R; var _local14:Number = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y)); var _local15:Number = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y)); var _local16:Number = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x); var _local17:Number = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y); m_linearJacobian.linear1.x = -(_local14); m_linearJacobian.linear1.y = -(_local15); m_linearJacobian.linear2.x = _local14; m_linearJacobian.linear2.y = _local15; m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14))); m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14)); m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2)); m_linearMass = (1 / m_linearMass); m_angularMass = (_local12 + _local13); if (m_angularMass > Number.MIN_VALUE){ m_angularMass = (1 / m_angularMass); }; if (((m_enableLimit) || (m_enableMotor))){ _local4 = _local2.m_xf.R; _local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y)); _local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y)); m_motorJacobian.linear1.x = -(_local18); m_motorJacobian.linear1.y = -(_local19); m_motorJacobian.linear2.x = _local18; m_motorJacobian.linear2.y = _local19; m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18))); m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18)); m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2)); m_motorMass = (1 / m_motorMass); if (m_enableLimit){ _local20 = (_local16 - _local6); _local21 = (_local17 - _local7); _local22 = ((_local18 * _local20) + (_local19 * _local21)); if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){ m_limitState = e_equalLimits; } else { if (_local22 <= m_lowerTranslation){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local22 >= m_upperTranslation){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; }; }; if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit == false){ m_limitForce = 0; }; if (_arg1.warmStarting){ _local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x))); _local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y))); _local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x))); _local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y))); _local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1))); _local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2))); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28)); } else { m_force = 0; m_torque = 0; m_limitForce = 0; m_motorForce = 0; }; m_limitPositionImpulse = 0; } public function GetMotorForce():Number{ return (m_motorForce); } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } public function SetMaxMotorForce(_arg1:Number):void{ m_maxMotorForce = _arg1; } override public function GetReactionTorque():Number{ return (m_torque); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerTranslation = _arg1; m_upperTranslation = _arg2; } } }//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2PrismaticJointDef extends b2JointDef { public var motorSpeed:Number; public var localAxis1:b2Vec2; public var referenceAngle:Number; public var upperTranslation:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var enableMotor:Boolean; public var maxMotorForce:Number; public var lowerTranslation:Number; public function b2PrismaticJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); localAxis1 = new b2Vec2(); super(); type = b2Joint.e_prismaticJoint; localAxis1.Set(1, 0); referenceAngle = 0; enableLimit = false; lowerTranslation = 0; upperTranslation = 0; enableMotor = false; maxMotorForce = 0; motorSpeed = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); localAxis1 = body1.GetLocalVector(_arg4); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PulleyJoint extends b2Joint { public var m_limitState1:int; public var m_limitState2:int; public var m_ground:b2Body; public var m_maxLength2:Number; public var m_maxLength1:Number; public var m_limitPositionImpulse1:Number; public var m_limitPositionImpulse2:Number; public var m_force:Number; public var m_constant:Number; public var m_positionImpulse:Number; public var m_state:int; public var m_ratio:Number; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_limitMass1:Number; public var m_limitMass2:Number; public var m_pulleyMass:Number; public var m_u1:b2Vec2; public var m_limitForce1:Number; public var m_limitForce2:Number; public var m_u2:b2Vec2; public static const b2_minPulleyLength:Number = 2; public function b2PulleyJoint(_arg1:b2PulleyJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u1 = new b2Vec2(); m_u2 = new b2Vec2(); super(_arg1); m_ground = m_body1.m_world.m_groundBody; m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x); m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y); m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x); m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_ratio = _arg1.ratio; m_constant = (_arg1.length1 + (m_ratio * _arg1.length2)); m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength))); m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio)); m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; } public function GetGroundAnchor2():b2Vec2{ var _local1:b2Vec2 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor2); return (_local1); } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = m_u2.Copy(); _local1.Multiply(m_force); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local3:b2Mat22; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; var _local4:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local5:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local6:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local7:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); var _local23:Number = 0; if (m_state == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9)); _local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9)); _local8 = _local22; _local3 = _local2.m_xf.R; _local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11)); _local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11)); _local10 = _local22; _local12 = (_local1.m_sweep.c.x + _local8); _local13 = (_local1.m_sweep.c.y + _local9); _local14 = (_local2.m_sweep.c.x + _local10); _local15 = (_local2.m_sweep.c.y + _local11); m_u1.Set((_local12 - _local4), (_local13 - _local5)); m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local16 = m_u1.Length(); _local17 = m_u2.Length(); if (_local16 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / _local16)); } else { m_u1.SetZero(); }; if (_local17 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / _local17)); } else { m_u2.SetZero(); }; _local18 = ((m_constant - _local16) - (m_ratio * _local17)); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_pulleyMass) * _local18); _local20 = m_positionImpulse; m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19)); _local19 = (m_positionImpulse - _local20); _local12 = (-(_local19) * m_u1.x); _local13 = (-(_local19) * m_u1.y); _local14 = ((-(m_ratio) * _local19) * m_u2.x); _local15 = ((-(m_ratio) * _local19) * m_u2.y); _local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12)); _local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13)); _local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local1.SynchronizeTransform(); _local2.SynchronizeTransform(); }; if (m_limitState1 == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9)); _local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9)); _local8 = _local22; _local12 = (_local1.m_sweep.c.x + _local8); _local13 = (_local1.m_sweep.c.y + _local9); m_u1.Set((_local12 - _local4), (_local13 - _local5)); _local16 = m_u1.Length(); if (_local16 > b2Settings.b2_linearSlop){ m_u1.x = (m_u1.x * (1 / _local16)); m_u1.y = (m_u1.y * (1 / _local16)); } else { m_u1.SetZero(); }; _local18 = (m_maxLength1 - _local16); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass1) * _local18); _local21 = m_limitPositionImpulse1; m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19)); _local19 = (m_limitPositionImpulse1 - _local21); _local12 = (-(_local19) * m_u1.x); _local13 = (-(_local19) * m_u1.y); _local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12)); _local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13)); _local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local1.SynchronizeTransform(); }; if (m_limitState2 == e_atUpperLimit){ _local3 = _local2.m_xf.R; _local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11)); _local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11)); _local10 = _local22; _local14 = (_local2.m_sweep.c.x + _local10); _local15 = (_local2.m_sweep.c.y + _local11); m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local17 = m_u2.Length(); if (_local17 > b2Settings.b2_linearSlop){ m_u2.x = (m_u2.x * (1 / _local17)); m_u2.y = (m_u2.y * (1 / _local17)); } else { m_u2.SetZero(); }; _local18 = (m_maxLength2 - _local17); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass2) * _local18); _local21 = m_limitPositionImpulse2; m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19)); _local19 = (m_limitPositionImpulse2 - _local21); _local14 = (-(_local19) * m_u2.x); _local15 = (-(_local19) * m_u2.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local2.SynchronizeTransform(); }; return ((_local23 < b2Settings.b2_linearSlop)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; var _local10:Number = (_local2.m_sweep.c.x + _local5); var _local11:Number = (_local2.m_sweep.c.y + _local6); var _local12:Number = (_local3.m_sweep.c.x + _local8); var _local13:Number = (_local3.m_sweep.c.y + _local9); var _local14:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local15:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local16:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local17:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); m_u1.Set((_local10 - _local14), (_local11 - _local15)); m_u2.Set((_local12 - _local16), (_local13 - _local17)); var _local18:Number = m_u1.Length(); var _local19:Number = m_u2.Length(); if (_local18 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / _local18)); } else { m_u1.SetZero(); }; if (_local19 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / _local19)); } else { m_u2.SetZero(); }; var _local20:Number = ((m_constant - _local18) - (m_ratio * _local19)); if (_local20 > 0){ m_state = e_inactiveLimit; m_force = 0; } else { m_state = e_atUpperLimit; m_positionImpulse = 0; }; if (_local18 < m_maxLength1){ m_limitState1 = e_inactiveLimit; m_limitForce1 = 0; } else { m_limitState1 = e_atUpperLimit; m_limitPositionImpulse1 = 0; }; if (_local19 < m_maxLength2){ m_limitState2 = e_inactiveLimit; m_limitForce2 = 0; } else { m_limitState2 = e_atUpperLimit; m_limitPositionImpulse2 = 0; }; var _local21:Number = ((_local5 * m_u1.y) - (_local6 * m_u1.x)); var _local22:Number = ((_local8 * m_u2.y) - (_local9 * m_u2.x)); m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21)); m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22)); m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2)); m_limitMass1 = (1 / m_limitMass1); m_limitMass2 = (1 / m_limitMass2); m_pulleyMass = (1 / m_pulleyMass); if (_arg1.warmStarting){ _local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x); _local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y); _local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x); _local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25)))); } else { m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; }; } override public function GetReactionTorque():Number{ return (0); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; if (m_state == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13)))); _local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18); _local20 = m_force; m_force = b2Math.b2Max(0, (m_force + _local19)); _local19 = (m_force - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x); _local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; if (m_limitState1 == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11))); _local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18); _local20 = m_limitForce1; m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19)); _local19 = (m_limitForce1 - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); }; if (m_limitState2 == e_atUpperLimit){ _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13))); _local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18); _local20 = m_limitForce2; m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19)); _local19 = (m_limitForce2 - _local20); _local16 = ((-(_arg1.dt) * _local19) * m_u2.x); _local17 = ((-(_arg1.dt) * _local19) * m_u2.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; } public function GetLength1():Number{ var _local1:b2Vec2 = m_body1.GetWorldPoint(m_localAnchor1); var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local4:Number = (_local1.x - _local2); var _local5:Number = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetLength2():Number{ var _local1:b2Vec2 = m_body2.GetWorldPoint(m_localAnchor2); var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); var _local4:Number = (_local1.x - _local2); var _local5:Number = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetGroundAnchor1():b2Vec2{ var _local1:b2Vec2 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor1); return (_local1); } } }//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2PulleyJointDef extends b2JointDef { public var maxLength1:Number; public var maxLength2:Number; public var length1:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var groundAnchor1:b2Vec2; public var groundAnchor2:b2Vec2; public var ratio:Number; public var length2:Number; public function b2PulleyJointDef(){ groundAnchor1 = new b2Vec2(); groundAnchor2 = new b2Vec2(); localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_pulleyJoint; groundAnchor1.Set(-1, 1); groundAnchor2.Set(1, 1); localAnchor1.Set(-1, 0); localAnchor2.Set(1, 0); length1 = 0; maxLength1 = 0; length2 = 0; maxLength2 = 0; ratio = 1; collideConnected = true; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{ body1 = _arg1; body2 = _arg2; groundAnchor1.SetV(_arg3); groundAnchor2.SetV(_arg4); localAnchor1 = body1.GetLocalPoint(_arg5); localAnchor2 = body2.GetLocalPoint(_arg6); var _local8:Number = (_arg5.x - _arg3.x); var _local9:Number = (_arg5.y - _arg3.y); length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); var _local10:Number = (_arg6.x - _arg4.x); var _local11:Number = (_arg6.y - _arg4.y); length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); ratio = _arg7; var _local12:Number = (length1 + (ratio * length2)); maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength)); maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio); } } }//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2RevoluteJoint extends b2Joint { public var m_limitForce:Number; public var m_pivotMass:b2Mat22; public var m_motorForce:Number; public var m_enableLimit:Boolean; public var m_limitState:int; public var m_motorMass:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; private var K1:b2Mat22; private var K2:b2Mat22; private var K3:b2Mat22; private var K:b2Mat22; public var m_pivotForce:b2Vec2; public var m_enableMotor:Boolean; public var m_referenceAngle:Number; public var m_limitPositionImpulse:Number; public var m_motorSpeed:Number; public var m_upperAngle:Number; public var m_lowerAngle:Number; public var m_maxMotorTorque:Number; public static var tImpulse:b2Vec2 = new b2Vec2(); public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){ K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); K3 = new b2Mat22(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_pivotForce = new b2Vec2(); m_pivotMass = new b2Mat22(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_referenceAngle = _arg1.referenceAngle; m_pivotForce.Set(0, 0); m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerAngle = _arg1.lowerAngle; m_upperAngle = _arg1.upperAngle; m_maxMotorTorque = _arg1.maxMotorTorque; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local5:Number; var _local10:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local11:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7)); var _local12:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6)); var _local13:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12))); var _local14:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12))); m_pivotForce.x = (m_pivotForce.x + _local13); m_pivotForce.y = (m_pivotForce.y + _local14); var _local15:Number = (_arg1.dt * _local13); _local16 = (_arg1.dt * _local14); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15)))); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed); _local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17); _local19 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque); _local18 = (m_motorForce - _local19); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity); _local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local21); } else { if (m_limitState == e_atLowerLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); } else { if (m_limitState == e_atUpperLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); }; }; }; _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21)); }; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function GetUpperLimit():Number{ return (m_upperAngle); } public function GetLowerLimit():Number{ return (m_lowerAngle); } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ return (m_pivotForce); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local6:b2Mat22; var _local25:Number; var _local26:Number; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; var _local5:Number = 0; _local6 = _local3.m_xf.R; var _local7:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); var _local9:Number = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8)); _local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8)); _local7 = _local9; _local6 = _local4.m_xf.R; var _local10:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local11:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11)); _local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11)); _local10 = _local9; var _local12:Number = (_local3.m_sweep.c.x + _local7); var _local13:Number = (_local3.m_sweep.c.y + _local8); var _local14:Number = (_local4.m_sweep.c.x + _local10); var _local15:Number = (_local4.m_sweep.c.y + _local11); var _local16:Number = (_local14 - _local12); var _local17:Number = (_local15 - _local13); _local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17))); var _local18:Number = _local3.m_invMass; var _local19:Number = _local4.m_invMass; var _local20:Number = _local3.m_invI; var _local21:Number = _local4.m_invI; K1.col1.x = (_local18 + _local19); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local18 + _local19); K2.col1.x = ((_local20 * _local8) * _local8); K2.col2.x = ((-(_local20) * _local7) * _local8); K2.col1.y = ((-(_local20) * _local7) * _local8); K2.col2.y = ((_local20 * _local7) * _local7); K3.col1.x = ((_local21 * _local11) * _local11); K3.col2.x = ((-(_local21) * _local10) * _local11); K3.col1.y = ((-(_local21) * _local10) * _local11); K3.col2.y = ((_local21 * _local10) * _local10); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Solve(tImpulse, -(_local16), -(_local17)); var _local22:Number = tImpulse.x; var _local23:Number = tImpulse.y; _local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23)); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22)))); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22)))); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); var _local24:Number = 0; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle); _local26 = 0; if (m_limitState == e_equalLimits){ _local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local24 = b2Math.b2Abs(_local2); } else { if (m_limitState == e_atLowerLimit){ _local2 = (_local25 - m_lowerAngle); _local24 = b2Math.b2Max(0, -(_local2)); _local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); } else { if (m_limitState == e_atUpperLimit){ _local2 = (_local25 - m_upperAngle); _local24 = b2Math.b2Max(0, _local2); _local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); }; }; }; _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop)))); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function GetJointSpeed():Number{ return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity)); } public function SetMaxMotorTorque(_arg1:Number):void{ m_maxMotorTorque = _arg1; } public function GetJointAngle():Number{ return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle)); } public function GetMotorTorque():Number{ return (m_motorForce); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local7:Number; var _local14:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); _local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local10:Number = _local2.m_invMass; var _local11:Number = _local3.m_invMass; var _local12:Number = _local2.m_invI; var _local13:Number = _local3.m_invI; K1.col1.x = (_local10 + _local11); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local10 + _local11); K2.col1.x = ((_local12 * _local7) * _local7); K2.col2.x = ((-(_local12) * _local6) * _local7); K2.col1.y = ((-(_local12) * _local6) * _local7); K2.col2.y = ((_local12 * _local6) * _local6); K3.col1.x = ((_local13 * _local9) * _local9); K3.col2.x = ((-(_local13) * _local8) * _local9); K3.col1.y = ((-(_local13) * _local8) * _local9); K3.col2.y = ((_local13 * _local8) * _local8); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Invert(m_pivotMass); m_motorMass = (1 / (_local12 + _local13)); if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit){ _local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle); if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){ m_limitState = e_equalLimits; } else { if (_local14 <= m_lowerAngle){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local14 >= m_upperAngle){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; } else { m_limitForce = 0; }; if (_arg1.warmStarting){ _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); } else { m_pivotForce.SetZero(); m_motorForce = 0; m_limitForce = 0; }; m_limitPositionImpulse = 0; } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } override public function GetReactionTorque():Number{ return (m_limitForce); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerAngle = _arg1; m_upperAngle = _arg2; } } }//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2RevoluteJointDef extends b2JointDef { public var upperAngle:Number; public var enableMotor:Boolean; public var referenceAngle:Number; public var motorSpeed:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var lowerAngle:Number; public var maxMotorTorque:Number; public function b2RevoluteJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_revoluteJoint; localAnchor1.Set(0, 0); localAnchor2.Set(0, 0); referenceAngle = 0; lowerAngle = 0; upperAngle = 0; maxMotorTorque = 0; motorSpeed = 0; enableLimit = false; enableMotor = false; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Contacts.*; public class b2Body { public var m_next:b2Body; public var m_xf:b2XForm; public var m_contactList:b2ContactEdge; public var m_angularVelocity:Number; public var m_shapeList:b2Shape; public var m_force:b2Vec2; public var m_mass:Number; public var m_sweep:b2Sweep; public var m_torque:Number; public var m_userData; public var m_flags:uint; public var m_world:b2World; public var m_prev:b2Body; public var m_invMass:Number; public var m_type:int; public var m_linearDamping:Number; public var m_shapeCount:int; public var m_angularDamping:Number; public var m_invI:Number; public var m_linearVelocity:b2Vec2; public var m_sleepTime:Number; public var m_jointList:b2JointEdge; public var m_I:Number; public static var e_fixedRotationFlag:uint = 64; public static var e_frozenFlag:uint = 2; public static var e_maxTypes:uint = 3; public static var e_sleepFlag:uint = 8; private static var s_massData:b2MassData = new b2MassData(); public static var e_bulletFlag:uint = 32; public static var e_staticType:uint = 1; public static var e_islandFlag:uint = 4; public static var e_allowSleepFlag:uint = 16; private static var s_xf1:b2XForm = new b2XForm(); public static var e_dynamicType:uint = 2; public function b2Body(_arg1:b2BodyDef, _arg2:b2World){ m_xf = new b2XForm(); m_sweep = new b2Sweep(); m_linearVelocity = new b2Vec2(); m_force = new b2Vec2(); super(); m_flags = 0; if (_arg1.isBullet){ m_flags = (m_flags | e_bulletFlag); }; if (_arg1.fixedRotation){ m_flags = (m_flags | e_fixedRotationFlag); }; if (_arg1.allowSleep){ m_flags = (m_flags | e_allowSleepFlag); }; if (_arg1.isSleeping){ m_flags = (m_flags | e_sleepFlag); }; m_world = _arg2; m_xf.position.SetV(_arg1.position); m_xf.R.Set(_arg1.angle); m_sweep.localCenter.SetV(_arg1.massData.center); m_sweep.t0 = 1; m_sweep.a0 = (m_sweep.a = _arg1.angle); var _local3:b2Mat22 = m_xf.R; var _local4:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_jointList = null; m_contactList = null; m_prev = null; m_next = null; m_linearDamping = _arg1.linearDamping; m_angularDamping = _arg1.angularDamping; m_force.Set(0, 0); m_torque = 0; m_linearVelocity.SetZero(); m_angularVelocity = 0; m_sleepTime = 0; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = _arg1.massData.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = _arg1.massData.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; m_userData = _arg1.userData; m_shapeList = null; m_shapeCount = 0; } public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{ return (new b2Vec2((m_linearVelocity.x - (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.y + (m_angularVelocity * (_arg1.x - m_sweep.c.x))))); } public function SetLinearVelocity(_arg1:b2Vec2):void{ m_linearVelocity.SetV(_arg1); } public function WakeUp():void{ m_flags = (m_flags & ~(e_sleepFlag)); m_sleepTime = 0; } public function GetLocalCenter():b2Vec2{ return (m_sweep.localCenter); } public function ApplyTorque(_arg1:Number):void{ if (IsSleeping()){ WakeUp(); }; m_torque = (m_torque + _arg1); } public function IsFrozen():Boolean{ return (((m_flags & e_frozenFlag) == e_frozenFlag)); } public function IsDynamic():Boolean{ return ((m_type == e_dynamicType)); } public function GetLinearVelocity():b2Vec2{ return (m_linearVelocity); } public function SynchronizeTransform():void{ m_xf.R.Set(m_sweep.a); var _local1:b2Mat22 = m_xf.R; var _local2:b2Vec2 = m_sweep.localCenter; m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y))); m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y))); } public function GetInertia():Number{ return (m_I); } public function IsSleeping():Boolean{ return (((m_flags & e_sleepFlag) == e_sleepFlag)); } public function SetMassFromShapes():void{ var _local1:b2Shape; if (m_world.m_lock == true){ return; }; m_mass = 0; m_invMass = 0; m_I = 0; m_invI = 0; var _local2:Number = 0; var _local3:Number = 0; var _local4:b2MassData = s_massData; _local1 = m_shapeList; while (_local1) { _local1.ComputeMass(_local4); m_mass = (m_mass + _local4.mass); _local2 = (_local2 + (_local4.mass * _local4.center.x)); _local3 = (_local3 + (_local4.mass * _local4.center.y)); m_I = (m_I + _local4.I); _local1 = _local1.m_next; }; if (m_mass > 0){ m_invMass = (1 / m_mass); _local2 = (_local2 * m_invMass); _local3 = (_local3 * m_invMass); }; if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){ m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3)))); m_invI = (1 / m_I); } else { m_I = 0; m_invI = 0; }; m_sweep.localCenter.Set(_local2, _local3); var _local5:b2Mat22 = m_xf.R; var _local6:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)); m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); _local1 = m_shapeList; while (_local1) { _local1.UpdateSweepRadius(m_sweep.localCenter); _local1 = _local1.m_next; }; var _local7:int = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (_local7 != m_type){ _local1 = m_shapeList; while (_local1) { _local1.RefilterProxy(m_world.m_broadPhase, m_xf); _local1 = _local1.m_next; }; }; } public function PutToSleep():void{ m_flags = (m_flags | e_sleepFlag); m_sleepTime = 0; m_linearVelocity.SetZero(); m_angularVelocity = 0; m_force.SetZero(); m_torque = 0; } public function GetJointList():b2JointEdge{ return (m_jointList); } public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{ var _local3:b2Shape; var _local7:Boolean; if (m_world.m_lock == true){ return (true); }; if (IsFrozen()){ return (false); }; m_xf.R.Set(_arg2); m_xf.position.SetV(_arg1); var _local4:b2Mat22 = m_xf.R; var _local5:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y)); m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_sweep.a0 = (m_sweep.a = _arg2); var _local6:Boolean; _local3 = m_shapeList; while (_local3) { _local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf); if (_local7 == false){ _local6 = true; break; }; _local3 = _local3.m_next; }; if (_local6 == true){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local3 = m_shapeList; while (_local3) { _local3.DestroyProxy(m_world.m_broadPhase); _local3 = _local3.m_next; }; return (false); }; m_world.m_broadPhase.Commit(); return (true); } public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulXT(m_xf, _arg1)); } public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_force.x = (m_force.x + _arg1.x); m_force.y = (m_force.y + _arg1.y); m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))); } public function SynchronizeShapes():Boolean{ var _local4:b2Shape; var _local1:b2XForm = s_xf1; _local1.R.Set(m_sweep.a0); var _local2:b2Mat22 = _local1.R; var _local3:b2Vec2 = m_sweep.localCenter; _local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y))); _local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y))); var _local5:Boolean; _local4 = m_shapeList; while (_local4) { _local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf); if (_local5 == false){ break; }; _local4 = _local4.m_next; }; if (_local5 == false){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local4 = m_shapeList; while (_local4) { _local4.DestroyProxy(m_world.m_broadPhase); _local4 = _local4.m_next; }; return (false); }; return (true); } public function GetAngle():Number{ return (m_sweep.a); } public function GetXForm():b2XForm{ return (m_xf); } public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22 = m_xf.R; var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y))); _local3.x = (_local3.x + m_xf.position.x); _local3.y = (_local3.y + m_xf.position.y); return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x))))); } public function GetNext():b2Body{ return (m_next); } public function GetMass():Number{ return (m_mass); } public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x)); m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y)); m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)))); } public function GetAngularVelocity():Number{ return (m_angularVelocity); } public function SetAngularVelocity(_arg1:Number):void{ m_angularVelocity = _arg1; } public function SetMass(_arg1:b2MassData):void{ var _local2:b2Shape; if (m_world.m_lock == true){ return; }; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = _arg1.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = _arg1.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; m_sweep.localCenter.SetV(_arg1.center); var _local3:b2Mat22 = m_xf.R; var _local4:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); _local2 = m_shapeList; while (_local2) { _local2.UpdateSweepRadius(m_sweep.localCenter); _local2 = _local2.m_next; }; var _local5:int = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (_local5 != m_type){ _local2 = m_shapeList; while (_local2) { _local2.RefilterProxy(m_world.m_broadPhase, m_xf); _local2 = _local2.m_next; }; }; } public function IsStatic():Boolean{ return ((m_type == e_staticType)); } public function GetWorldVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulMV(m_xf.R, _arg1)); } public function GetShapeList():b2Shape{ return (m_shapeList); } public function Advance(_arg1:Number):void{ m_sweep.Advance(_arg1); m_sweep.c.SetV(m_sweep.c0); m_sweep.a = m_sweep.a0; SynchronizeTransform(); } public function SetBullet(_arg1:Boolean):void{ if (_arg1){ m_flags = (m_flags | e_bulletFlag); } else { m_flags = (m_flags & ~(e_bulletFlag)); }; } public function CreateShape(_arg1:b2ShapeDef):b2Shape{ var _local2:b2Shape; if (m_world.m_lock == true){ return (null); }; _local2 = b2Shape.Create(_arg1, m_world.m_blockAllocator); _local2.m_next = m_shapeList; m_shapeList = _local2; m_shapeCount++; _local2.m_body = this; _local2.CreateProxy(m_world.m_broadPhase, m_xf); _local2.UpdateSweepRadius(m_sweep.localCenter); return (_local2); } public function IsConnected(_arg1:b2Body):Boolean{ var _local2:b2JointEdge = m_jointList; while (_local2) { if (_local2.other == _arg1){ return ((_local2.joint.m_collideConnected == false)); }; _local2 = _local2.next; }; return (false); } public function DestroyShape(_arg1:b2Shape):void{ if (m_world.m_lock == true){ return; }; _arg1.DestroyProxy(m_world.m_broadPhase); var _local2:b2Shape = m_shapeList; var _local3:b2Shape; var _local4:Boolean; while (_local2 != null) { if (_local2 == _arg1){ if (_local3){ _local3.m_next = _arg1.m_next; } else { m_shapeList = _arg1.m_next; }; _local4 = true; break; }; _local3 = _local2; _local2 = _local2.m_next; }; _arg1.m_body = null; _arg1.m_next = null; m_shapeCount--; b2Shape.Destroy(_arg1, m_world.m_blockAllocator); } public function GetUserData(){ return (m_userData); } public function IsBullet():Boolean{ return (((m_flags & e_bulletFlag) == e_bulletFlag)); } public function GetWorldCenter():b2Vec2{ return (m_sweep.c); } public function AllowSleeping(_arg1:Boolean):void{ if (_arg1){ m_flags = (m_flags | e_allowSleepFlag); } else { m_flags = (m_flags & ~(e_allowSleepFlag)); WakeUp(); }; } public function SetUserData(_arg1):void{ m_userData = _arg1; } public function GetLocalVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulTMV(m_xf.R, _arg1)); } public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22 = m_xf.R; var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y))); _local3.x = (_local3.x + m_xf.position.x); _local3.y = (_local3.y + m_xf.position.y); return (_local3); } public function GetWorld():b2World{ return (m_world); } public function GetPosition():b2Vec2{ return (m_xf.position); } } }//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2BodyDef { public var angularDamping:Number; public var angle:Number; public var isSleeping:Boolean; public var position:b2Vec2; public var isBullet:Boolean; public var allowSleep:Boolean; public var userData; public var fixedRotation:Boolean; public var linearDamping:Number; public var massData:b2MassData; public function b2BodyDef(){ massData = new b2MassData(); position = new b2Vec2(); super(); massData.center.SetZero(); massData.mass = 0; massData.I = 0; userData = null; position.Set(0, 0); angle = 0; linearDamping = 0; angularDamping = 0; allowSleep = true; isSleeping = false; fixedRotation = false; isBullet = false; } } }//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener) package Box2D.Dynamics { public class b2BoundaryListener { public function Violation(_arg1:b2Body):void{ } } }//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; public class b2ContactFilter { public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter); ; public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{ var _local3:b2FilterData = _arg1.GetFilterData(); var _local4:b2FilterData = _arg2.GetFilterData(); if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){ return ((_local3.groupIndex > 0)); }; var _local5:Boolean = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0)))); return (_local5); } } }//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener) package Box2D.Dynamics { import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class b2ContactListener { public function Add(_arg1:b2ContactPoint):void{ } public function Remove(_arg1:b2ContactPoint):void{ } public function Persist(_arg1:b2ContactPoint):void{ } public function Result(_arg1:b2ContactResult):void{ } } }//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2ContactManager extends b2PairCallback { public var m_world:b2World; public var m_destroyImmediate:Boolean; public var m_nullContact:b2NullContact; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2ContactManager(){ m_nullContact = new b2NullContact(); super(); m_world = null; m_destroyImmediate = false; } override public function PairRemoved(_arg1, _arg2, _arg3):void{ if (_arg3 == null){ return; }; var _local4:b2Contact = (_arg3 as b2Contact); if (_local4 == m_nullContact){ return; }; Destroy(_local4); } public function Destroy(_arg1:b2Contact):void{ var _local7:b2Body; var _local8:b2Body; var _local9:Array; var _local10:b2ContactPoint; var _local11:int; var _local12:b2Manifold; var _local13:int; var _local14:b2ManifoldPoint; var _local15:b2Vec2; var _local16:b2Vec2; var _local2:b2Shape = _arg1.m_shape1; var _local3:b2Shape = _arg1.m_shape2; var _local4:int = _arg1.m_manifoldCount; if ((((_local4 > 0)) && (m_world.m_contactListener))){ _local7 = _local2.m_body; _local8 = _local3.m_body; _local9 = _arg1.GetManifolds(); _local10 = s_evalCP; _local10.shape1 = _arg1.m_shape1; _local10.shape2 = _arg1.m_shape1; _local10.friction = _arg1.m_friction; _local10.restitution = _arg1.m_restitution; _local11 = 0; while (_local11 < _local4) { _local12 = _local9[_local11]; _local10.normal.SetV(_local12.normal); _local13 = 0; while (_local13 < _local12.pointCount) { _local14 = _local12.points[_local13]; _local10.position = _local7.GetWorldPoint(_local14.localPoint1); _local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1); _local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2); _local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y)); _local10.separation = _local14.separation; _local10.id.key = _local14.id._key; m_world.m_contactListener.Remove(_local10); _local13++; }; _local11++; }; }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_world.m_contactList){ m_world.m_contactList = _arg1.m_next; }; var _local5:b2Body = _local2.m_body; var _local6:b2Body = _local3.m_body; if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local5.m_contactList){ _local5.m_contactList = _arg1.m_node1.next; }; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local6.m_contactList){ _local6.m_contactList = _arg1.m_node2.next; }; b2Contact.Destroy(_arg1, m_world.m_blockAllocator); m_world.m_contactCount--; } override public function PairAdded(_arg1, _arg2){ var _local3:b2Shape = (_arg1 as b2Shape); var _local4:b2Shape = (_arg2 as b2Shape); var _local5:b2Body = _local3.m_body; var _local6:b2Body = _local4.m_body; if (((_local5.IsStatic()) && (_local6.IsStatic()))){ return (m_nullContact); }; if (_local3.m_body == _local4.m_body){ return (m_nullContact); }; if (_local6.IsConnected(_local5)){ return (m_nullContact); }; if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){ return (m_nullContact); }; var _local7:b2Contact = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator); if (_local7 == null){ return (m_nullContact); }; _local3 = _local7.m_shape1; _local4 = _local7.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; _local7.m_prev = null; _local7.m_next = m_world.m_contactList; if (m_world.m_contactList != null){ m_world.m_contactList.m_prev = _local7; }; m_world.m_contactList = _local7; _local7.m_node1.contact = _local7; _local7.m_node1.other = _local6; _local7.m_node1.prev = null; _local7.m_node1.next = _local5.m_contactList; if (_local5.m_contactList != null){ _local5.m_contactList.prev = _local7.m_node1; }; _local5.m_contactList = _local7.m_node1; _local7.m_node2.contact = _local7; _local7.m_node2.other = _local5; _local7.m_node2.prev = null; _local7.m_node2.next = _local6.m_contactList; if (_local6.m_contactList != null){ _local6.m_contactList.prev = _local7.m_node2; }; _local6.m_contactList = _local7.m_node2; m_world.m_contactCount++; return (_local7); } public function Collide():void{ var _local2:b2Body; var _local3:b2Body; var _local1:b2Contact = m_world.m_contactList; while (_local1) { _local2 = _local1.m_shape1.m_body; _local3 = _local1.m_shape2.m_body; if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){ } else { _local1.Update(m_world.m_contactListener); }; _local1 = _local1.m_next; }; } } }//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw) package Box2D.Dynamics { import flash.display.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2DebugDraw { public var m_xformScale:Number;// = 1 public var m_fillAlpha:Number;// = 1 public var m_alpha:Number;// = 1 public var m_drawFlags:uint; public var m_lineThickness:Number;// = 1 public var m_drawScale:Number;// = 1 public var m_sprite:Sprite; public static var e_coreShapeBit:uint = 4; public static var e_shapeBit:uint = 1; public static var e_centerOfMassBit:uint = 64; public static var e_aabbBit:uint = 8; public static var e_obbBit:uint = 16; public static var e_pairBit:uint = 32; public static var e_jointBit:uint = 2; public function b2DebugDraw(){ m_drawFlags = 0; } public function ClearFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags & ~(_arg1)); } public function SetFlags(_arg1:uint):void{ m_drawFlags = _arg1; } public function AppendFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags | _arg1); } public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale)); m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale)); } public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha); var _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.endFill(); } public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); } public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); var _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); } public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha); m_sprite.graphics.moveTo(0, 0); m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); m_sprite.graphics.endFill(); m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale)); } public function GetFlags():uint{ return (m_drawFlags); } public function DrawXForm(_arg1:b2XForm):void{ m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale)); m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale)); } } }//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener) package Box2D.Dynamics { import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; public class b2DestructionListener { public function SayGoodbyeShape(_arg1:b2Shape):void{ } public function SayGoodbyeJoint(_arg1:b2Joint):void{ } } }//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.Joints.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2Island { public var m_listener:b2ContactListener; public var m_positionIterationCount:int; public var m_bodyCapacity:int; public var m_bodies:Array; public var m_joints:Array; public var m_jointCapacity:int; public var m_contactCount:int; public var m_contacts:Array; public var m_contactCapacity:int; public var m_jointCount:int; public var m_allocator; public var m_bodyCount:int; private static var s_reportCR:b2ContactResult = new b2ContactResult(); public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){ var _local6:int; super(); m_bodyCapacity = _arg1; m_contactCapacity = _arg2; m_jointCapacity = _arg3; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_allocator = _arg4; m_listener = _arg5; m_bodies = new Array(_arg1); _local6 = 0; while (_local6 < _arg1) { m_bodies[_local6] = null; _local6++; }; m_contacts = new Array(_arg2); _local6 = 0; while (_local6 < _arg2) { m_contacts[_local6] = null; _local6++; }; m_joints = new Array(_arg3); _local6 = 0; while (_local6 < _arg3) { m_joints[_local6] = null; _local6++; }; m_positionIterationCount = 0; } public function AddBody(_arg1:b2Body):void{ var _local2 = m_bodyCount++; m_bodies[_local2] = _arg1; } public function AddJoint(_arg1:b2Joint):void{ var _local2 = m_jointCount++; m_joints[_local2] = _arg1; } public function Report(_arg1:Array):void{ var _local2:b2Mat22; var _local3:b2Vec2; var _local5:b2Contact; var _local6:b2ContactConstraint; var _local7:b2ContactResult; var _local8:b2Body; var _local9:int; var _local10:Array; var _local11:int; var _local12:b2Manifold; var _local13:int; var _local14:b2ManifoldPoint; var _local15:b2ContactConstraintPoint; if (m_listener == null){ return; }; var _local4:int; while (_local4 < m_contactCount) { _local5 = m_contacts[_local4]; _local6 = _arg1[_local4]; _local7 = s_reportCR; _local7.shape1 = _local5.m_shape1; _local7.shape2 = _local5.m_shape2; _local8 = _local7.shape1.m_body; _local9 = _local5.m_manifoldCount; _local10 = _local5.GetManifolds(); _local11 = 0; while (_local11 < _local9) { _local12 = _local10[_local11]; _local7.normal.SetV(_local12.normal); _local13 = 0; while (_local13 < _local12.pointCount) { _local14 = _local12.points[_local13]; _local15 = _local6.points[_local13]; _local7.position = _local8.GetWorldPoint(_local14.localPoint1); _local7.normalImpulse = _local15.normalImpulse; _local7.tangentImpulse = _local15.tangentImpulse; _local7.id.key = _local14.id.key; m_listener.Result(_local7); _local13++; }; _local11++; }; _local4++; }; } public function AddContact(_arg1:b2Contact):void{ var _local2 = m_contactCount++; m_contacts[_local2] = _arg1; } public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{ var _local5:int; var _local6:b2Body; var _local7:b2Joint; var _local9:int; var _local10:Boolean; var _local11:Boolean; var _local12:Boolean; var _local13:Number; var _local14:Number; var _local15:Number; _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.IsStatic()){ } else { _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x)))); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y)))); _local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque)); _local6.m_force.SetZero(); _local6.m_torque = 0; _local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1)); _local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1)); if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){ _local6.m_linearVelocity.Normalize(); _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity); }; if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){ if (_local6.m_angularVelocity < 0){ _local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity); } else { _local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity; }; }; }; _local5++; }; var _local8:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local8.InitVelocityConstraints(_arg1); _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local7.InitVelocityConstraints(_arg1); _local5++; }; _local5 = 0; while (_local5 < _arg1.maxIterations) { _local8.SolveVelocityConstraints(); _local9 = 0; while (_local9 < m_jointCount) { _local7 = m_joints[_local9]; _local7.SolveVelocityConstraints(_arg1); _local9++; }; _local5++; }; _local8.FinalizeVelocityConstraints(); _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.IsStatic()){ } else { _local6.m_sweep.c0.SetV(_local6.m_sweep.c); _local6.m_sweep.a0 = _local6.m_sweep.a; _local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x)); _local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y)); _local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity)); _local6.SynchronizeTransform(); }; _local5++; }; if (_arg3){ _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local7.InitPositionConstraints(); _local5++; }; m_positionIterationCount = 0; while (m_positionIterationCount < _arg1.maxIterations) { _local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte); _local11 = true; _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local12 = _local7.SolvePositionConstraints(); _local11 = ((_local11) && (_local12)); _local5++; }; if (((_local10) && (_local11))){ break; }; m_positionIterationCount++; }; }; Report(_local8.m_constraints); if (_arg4){ _local13 = Number.MAX_VALUE; _local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance); _local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance); _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.m_invMass == 0){ } else { if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){ _local6.m_sleepTime = 0; _local13 = 0; }; if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){ _local6.m_sleepTime = 0; _local13 = 0; } else { _local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt); _local13 = b2Math.b2Min(_local13, _local6.m_sleepTime); }; }; _local5++; }; if (_local13 >= b2Settings.b2_timeToSleep){ _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag); _local6.m_linearVelocity.SetZero(); _local6.m_angularVelocity = 0; _local5++; }; }; }; } public function Clear():void{ m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:int; var _local5:b2Body; var _local6:Boolean; var _local3:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local2 = 0; while (_local2 < _arg1.maxIterations) { _local3.SolveVelocityConstraints(); _local2++; }; _local2 = 0; while (_local2 < m_bodyCount) { _local5 = m_bodies[_local2]; if (_local5.IsStatic()){ } else { _local5.m_sweep.c0.SetV(_local5.m_sweep.c); _local5.m_sweep.a0 = _local5.m_sweep.a; _local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x)); _local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y)); _local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity)); _local5.SynchronizeTransform(); }; _local2++; }; var _local4:Number = 0.75; _local2 = 0; while (_local2 < _arg1.maxIterations) { _local6 = _local3.SolvePositionConstraints(_local4); if (_local6){ break; }; _local2++; }; Report(_local3.m_constraints); } } }//package Box2D.Dynamics
Section 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep) package Box2D.Dynamics { public class b2TimeStep { public var warmStarting:Boolean; public var positionCorrection:Boolean; public var dt:Number; public var maxIterations:int; public var dtRatio:Number; public var inv_dt:Number; } }//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2World { public var m_inv_dt0:Number; public var m_boundaryListener:b2BoundaryListener; public var m_contactList:b2Contact; public var m_blockAllocator; public var m_contactListener:b2ContactListener; public var m_allowSleep:Boolean; public var m_broadPhase:b2BroadPhase; public var m_destructionListener:b2DestructionListener; public var m_jointCount:int; public var m_bodyCount:int; public var m_lock:Boolean; public var m_positionIterationCount:int; public var m_groundBody:b2Body; public var m_contactCount:int; public var m_debugDraw:b2DebugDraw; public var m_contactFilter:b2ContactFilter; public var m_bodyList:b2Body; public var m_stackAllocator; public var m_jointList:b2Joint; public var m_gravity:b2Vec2; public var m_contactManager:b2ContactManager; private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8); public static var m_continuousPhysics:Boolean; public static var m_warmStarting:Boolean; private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6); public static var m_positionCorrection:Boolean; private static var s_xf:b2XForm = new b2XForm(); public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){ m_contactManager = new b2ContactManager(); super(); m_destructionListener = null; m_boundaryListener = null; m_contactFilter = b2ContactFilter.b2_defaultFilter; m_contactListener = null; m_debugDraw = null; m_bodyList = null; m_contactList = null; m_jointList = null; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_positionCorrection = true; m_warmStarting = true; m_continuousPhysics = true; m_allowSleep = _arg3; m_gravity = _arg2; m_lock = false; m_inv_dt0 = 0; m_contactManager.m_world = this; m_broadPhase = new b2BroadPhase(_arg1, m_contactManager); var _local4:b2BodyDef = new b2BodyDef(); m_groundBody = CreateBody(_local4); } public function DrawJoint(_arg1:b2Joint):void{ var _local11:b2PulleyJoint; var _local12:b2Vec2; var _local13:b2Vec2; var _local2:b2Body = _arg1.m_body1; var _local3:b2Body = _arg1.m_body2; var _local4:b2XForm = _local2.m_xf; var _local5:b2XForm = _local3.m_xf; var _local6:b2Vec2 = _local4.position; var _local7:b2Vec2 = _local5.position; var _local8:b2Vec2 = _arg1.GetAnchor1(); var _local9:b2Vec2 = _arg1.GetAnchor2(); var _local10:b2Color = s_jointColor; switch (_arg1.m_type){ case b2Joint.e_distanceJoint: m_debugDraw.DrawSegment(_local8, _local9, _local10); break; case b2Joint.e_pulleyJoint: _local11 = (_arg1 as b2PulleyJoint); _local12 = _local11.GetGroundAnchor1(); _local13 = _local11.GetGroundAnchor2(); m_debugDraw.DrawSegment(_local12, _local8, _local10); m_debugDraw.DrawSegment(_local13, _local9, _local10); m_debugDraw.DrawSegment(_local12, _local13, _local10); break; case b2Joint.e_mouseJoint: m_debugDraw.DrawSegment(_local8, _local9, _local10); break; default: if (_local2 != m_groundBody){ m_debugDraw.DrawSegment(_local6, _local8, _local10); }; m_debugDraw.DrawSegment(_local8, _local9, _local10); if (_local3 != m_groundBody){ m_debugDraw.DrawSegment(_local7, _local9, _local10); }; }; } public function Refilter(_arg1:b2Shape):void{ _arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf); } public function SetDebugDraw(_arg1:b2DebugDraw):void{ m_debugDraw = _arg1; } public function SetContinuousPhysics(_arg1:Boolean):void{ m_continuousPhysics = _arg1; } public function GetProxyCount():int{ return (m_broadPhase.m_proxyCount); } public function DrawDebugData():void{ var _local2:int; var _local3:b2Body; var _local4:b2Shape; var _local5:b2Joint; var _local6:b2BroadPhase; var _local11:b2XForm; var _local15:Boolean; var _local16:uint; var _local17:b2Pair; var _local18:b2Proxy; var _local19:b2Proxy; var _local20:b2Vec2; var _local21:b2Vec2; var _local22:b2Proxy; var _local23:b2PolygonShape; var _local24:b2OBB; var _local25:b2Vec2; var _local26:b2Mat22; var _local27:b2Vec2; var _local28:Number; if (m_debugDraw == null){ return; }; m_debugDraw.m_sprite.graphics.clear(); var _local1:uint = m_debugDraw.GetFlags(); var _local7:b2Vec2 = new b2Vec2(); var _local8:b2Vec2 = new b2Vec2(); var _local9:b2Vec2 = new b2Vec2(); var _local10:b2Color = new b2Color(0, 0, 0); var _local12:b2AABB = new b2AABB(); var _local13:b2AABB = new b2AABB(); var _local14:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()]; if ((_local1 & b2DebugDraw.e_shapeBit)){ _local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit); _local3 = m_bodyList; while (_local3) { _local11 = _local3.m_xf; _local4 = _local3.GetShapeList(); while (_local4) { if (_local3.IsStatic()){ DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15); } else { if (_local3.IsSleeping()){ DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15); } else { DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15); }; }; _local4 = _local4.m_next; }; _local3 = _local3.m_next; }; }; if ((_local1 & b2DebugDraw.e_jointBit)){ _local5 = m_jointList; while (_local5) { DrawJoint(_local5); _local5 = _local5.m_next; }; }; if ((_local1 & b2DebugDraw.e_pairBit)){ _local6 = m_broadPhase; _local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y)); _local10.Set(0.9, 0.9, 0.3); _local2 = 0; while (_local2 < b2Pair.b2_tableCapacity) { _local16 = _local6.m_pairManager.m_hashTable[_local2]; while (_local16 != b2Pair.b2_nullPair) { _local17 = _local6.m_pairManager.m_pairs[_local16]; _local18 = _local6.m_proxyPool[_local17.proxyId1]; _local19 = _local6.m_proxyPool[_local17.proxyId2]; _local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value)); _local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value)); _local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value)); _local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value)); _local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value)); _local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value)); _local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value)); _local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value)); _local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x)); _local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y)); _local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x)); _local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y)); m_debugDraw.DrawSegment(_local8, _local9, _local10); _local16 = _local17.next; }; _local2++; }; }; if ((_local1 & b2DebugDraw.e_aabbBit)){ _local6 = m_broadPhase; _local20 = _local6.m_worldAABB.lowerBound; _local21 = _local6.m_worldAABB.upperBound; _local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y)); _local10.Set(0.9, 0.3, 0.9); _local2 = 0; while (_local2 < b2Settings.b2_maxProxies) { _local22 = _local6.m_proxyPool[_local2]; if (_local22.IsValid() == false){ } else { _local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value)); _local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value)); _local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value)); _local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value)); _local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y); _local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y); _local14[2].Set(_local12.upperBound.x, _local12.upperBound.y); _local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y); m_debugDraw.DrawPolygon(_local14, 4, _local10); }; _local2++; }; _local14[0].Set(_local20.x, _local20.y); _local14[1].Set(_local21.x, _local20.y); _local14[2].Set(_local21.x, _local21.y); _local14[3].Set(_local20.x, _local21.y); m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9)); }; if ((_local1 & b2DebugDraw.e_obbBit)){ _local10.Set(0.5, 0.3, 0.5); _local3 = m_bodyList; while (_local3) { _local11 = _local3.m_xf; _local4 = _local3.GetShapeList(); while (_local4) { if (_local4.m_type != b2Shape.e_polygonShape){ } else { _local23 = (_local4 as b2PolygonShape); _local24 = _local23.GetOBB(); _local25 = _local24.extents; _local14[0].Set(-(_local25.x), -(_local25.y)); _local14[1].Set(_local25.x, -(_local25.y)); _local14[2].Set(_local25.x, _local25.y); _local14[3].Set(-(_local25.x), _local25.y); _local2 = 0; while (_local2 < 4) { _local26 = _local24.R; _local27 = _local14[_local2]; _local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y))); _local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y))); _local14[_local2].x = _local28; _local26 = _local11.R; _local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y))); _local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y))); _local14[_local2].x = _local28; _local2++; }; m_debugDraw.DrawPolygon(_local14, 4, _local10); }; _local4 = _local4.m_next; }; _local3 = _local3.m_next; }; }; if ((_local1 & b2DebugDraw.e_centerOfMassBit)){ _local3 = m_bodyList; while (_local3) { _local11 = s_xf; _local11.R = _local3.m_xf.R; _local11.position = _local3.GetWorldCenter(); m_debugDraw.DrawXForm(_local11); _local3 = _local3.m_next; }; }; } public function DestroyBody(_arg1:b2Body):void{ var _local4:b2JointEdge; var _local5:b2Shape; if (m_lock == true){ return; }; var _local2:b2JointEdge = _arg1.m_jointList; while (_local2) { _local4 = _local2; _local2 = _local2.next; if (m_destructionListener){ m_destructionListener.SayGoodbyeJoint(_local4.joint); }; DestroyJoint(_local4.joint); }; var _local3:b2Shape = _arg1.m_shapeList; while (_local3) { _local5 = _local3; _local3 = _local3.m_next; if (m_destructionListener){ m_destructionListener.SayGoodbyeShape(_local5); }; _local5.DestroyProxy(m_broadPhase); b2Shape.Destroy(_local5, m_blockAllocator); }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_bodyList){ m_bodyList = _arg1.m_next; }; m_bodyCount--; } public function SetContactFilter(_arg1:b2ContactFilter):void{ m_contactFilter = _arg1; } public function GetGroundBody():b2Body{ return (m_groundBody); } public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{ var _local6:b2CircleShape; var _local7:b2Vec2; var _local8:Number; var _local9:b2Vec2; var _local10:int; var _local11:b2PolygonShape; var _local12:int; var _local13:Array; var _local14:Array; var _local15:Array; var _local5:b2Color = s_coreColor; switch (_arg1.m_type){ case b2Shape.e_circleShape: _local6 = (_arg1 as b2CircleShape); _local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition); _local8 = _local6.m_radius; _local9 = _arg2.R.col1; m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3); if (_arg4){ m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5); }; break; case b2Shape.e_polygonShape: _local11 = (_arg1 as b2PolygonShape); _local12 = _local11.GetVertexCount(); _local13 = _local11.GetVertices(); _local14 = new Array(b2Settings.b2_maxPolygonVertices); _local10 = 0; while (_local10 < _local12) { _local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]); _local10++; }; m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3); if (_arg4){ _local15 = _local11.GetCoreVertices(); _local10 = 0; while (_local10 < _local12) { _local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]); _local10++; }; m_debugDraw.DrawPolygon(_local14, _local12, _local5); }; break; }; } public function GetContactCount():int{ return (m_contactCount); } public function Solve(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local9:int; var _local10:int; var _local11:b2Body; var _local12:b2ContactEdge; var _local13:b2JointEdge; var _local14:Boolean; m_positionIterationCount = 0; var _local3:b2Island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2 = _local2.m_next; }; var _local4:b2Contact = m_contactList; while (_local4) { _local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag)); _local4 = _local4.m_next; }; var _local5:b2Joint = m_jointList; while (_local5) { _local5.m_islandFlag = false; _local5 = _local5.m_next; }; var _local6:int = m_bodyCount; var _local7:Array = new Array(_local6); var _local8:b2Body = m_bodyList; while (_local8) { if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){ } else { if (_local8.IsStatic()){ } else { _local3.Clear(); _local9 = 0; var _temp1 = _local9; _local9 = (_local9 + 1); var _local15 = _temp1; _local7[_local15] = _local8; _local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag); while (_local9 > 0) { --_local9; _local2 = _local7[_local9]; _local3.AddBody(_local2); _local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag)); if (_local2.IsStatic()){ } else { _local12 = _local2.m_contactList; while (_local12) { if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){ } else { if (_local12.contact.m_manifoldCount == 0){ } else { _local3.AddContact(_local12.contact); _local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag); _local11 = _local12.other; if ((_local11.m_flags & b2Body.e_islandFlag)){ } else { var _temp2 = _local9; _local9 = (_local9 + 1); var _local16 = _temp2; _local7[_local16] = _local11; _local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag); }; }; }; _local12 = _local12.next; }; _local13 = _local2.m_jointList; while (_local13) { if (_local13.joint.m_islandFlag == true){ } else { _local3.AddJoint(_local13.joint); _local13.joint.m_islandFlag = true; _local11 = _local13.other; if ((_local11.m_flags & b2Body.e_islandFlag)){ } else { var _temp3 = _local9; _local9 = (_local9 + 1); _local16 = _temp3; _local7[_local16] = _local11; _local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag); }; }; _local13 = _local13.next; }; }; }; _local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep); if (_local3.m_positionIterationCount > m_positionIterationCount){ m_positionIterationCount = _local3.m_positionIterationCount; }; _local10 = 0; while (_local10 < _local3.m_bodyCount) { _local2 = _local3.m_bodies[_local10]; if (_local2.IsStatic()){ _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); }; _local10++; }; }; }; _local8 = _local8.m_next; }; _local2 = m_bodyList; while (_local2) { if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (_local2.IsStatic()){ } else { _local14 = _local2.SynchronizeShapes(); if ((((_local14 == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(_local2); }; }; }; _local2 = _local2.m_next; }; m_broadPhase.Commit(); } public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{ var _local4:Array = new Array(_arg3); var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3); var _local6:int; while (_local6 < _local5) { _arg2[_local6] = _local4[_local6]; _local6++; }; return (_local5); } public function SetGravity(_arg1:b2Vec2):void{ m_gravity = _arg1; } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Shape; var _local4:b2Shape; var _local5:b2Body; var _local6:b2Body; var _local7:b2ContactEdge; var _local11:b2Contact; var _local12:b2Contact; var _local13:Number; var _local14:b2Body; var _local15:int; var _local16:b2TimeStep; var _local17:int; var _local18:Number; var _local19:Number; var _local20:b2Body; var _local21:Boolean; var _local8:b2Island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener); var _local9:int = m_bodyCount; var _local10:Array = new Array(_local9); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2.m_sweep.t0 = 0; _local2 = _local2.m_next; }; _local11 = m_contactList; while (_local11) { _local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local11 = _local11.m_next; }; while (true) { _local12 = null; _local13 = 1; _local11 = m_contactList; for (;_local11;(_local11 = _local11.m_next)) { if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){ } else { _local18 = 1; if ((_local11.m_flags & b2Contact.e_toiFlag)){ _local18 = _local11.m_toi; } else { _local3 = _local11.m_shape1; _local4 = _local11.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){ continue; }; _local19 = _local5.m_sweep.t0; if (_local5.m_sweep.t0 < _local6.m_sweep.t0){ _local19 = _local6.m_sweep.t0; _local5.m_sweep.Advance(_local19); } else { if (_local6.m_sweep.t0 < _local5.m_sweep.t0){ _local19 = _local5.m_sweep.t0; _local6.m_sweep.Advance(_local19); }; }; _local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep); if ((((_local18 > 0)) && ((_local18 < 1)))){ _local18 = (((1 - _local18) * _local19) + _local18); if (_local18 > 1){ _local18 = 1; }; }; _local11.m_toi = _local18; _local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag); }; if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){ _local12 = _local11; _local13 = _local18; }; }; }; if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){ break; }; _local3 = _local12.m_shape1; _local4 = _local12.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; _local5.Advance(_local13); _local6.Advance(_local13); _local12.Update(m_contactListener); _local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag)); if (_local12.m_manifoldCount == 0){ } else { _local14 = _local5; if (_local14.IsStatic()){ _local14 = _local6; }; _local8.Clear(); _local15 = 0; var _temp1 = _local15; _local15 = (_local15 + 1); var _local22 = _temp1; _local10[_local22] = _local14; _local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag); while (_local15 > 0) { --_local15; _local2 = _local10[_local15]; _local8.AddBody(_local2); _local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag)); if (_local2.IsStatic()){ } else { _local7 = _local2.m_contactList; while (_local7) { if (_local8.m_contactCount == _local8.m_contactCapacity){ } else { if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){ } else { if (_local7.contact.m_manifoldCount == 0){ } else { _local8.AddContact(_local7.contact); _local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag); _local20 = _local7.other; if ((_local20.m_flags & b2Body.e_islandFlag)){ } else { if (_local20.IsStatic() == false){ _local20.Advance(_local13); _local20.WakeUp(); }; var _temp2 = _local15; _local15 = (_local15 + 1); var _local23 = _temp2; _local10[_local23] = _local20; _local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag); }; }; }; }; _local7 = _local7.next; }; }; }; _local16 = new b2TimeStep(); _local16.dt = ((1 - _local13) * _arg1.dt); _local16.inv_dt = (1 / _local16.dt); _local16.maxIterations = _arg1.maxIterations; _local8.SolveTOI(_local16); _local17 = 0; while (_local17 < _local8.m_bodyCount) { _local2 = _local8.m_bodies[_local17]; _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (_local2.IsStatic()){ } else { _local21 = _local2.SynchronizeShapes(); if ((((_local21 == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(_local2); }; _local7 = _local2.m_contactList; while (_local7) { _local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag)); _local7 = _local7.next; }; }; }; _local17++; }; _local17 = 0; while (_local17 < _local8.m_contactCount) { _local11 = _local8.m_contacts[_local17]; _local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local17++; }; m_broadPhase.Commit(); }; }; } public function GetJointList():b2Joint{ return (m_jointList); } public function Validate():void{ m_broadPhase.Validate(); } public function GetGravity():b2Vec2{ return (m_gravity); } public function GetPairCount():int{ return (m_broadPhase.m_pairManager.m_pairCount); } public function GetBodyList():b2Body{ return (m_bodyList); } public function SetWarmStarting(_arg1:Boolean):void{ m_warmStarting = _arg1; } public function SetPositionCorrection(_arg1:Boolean):void{ m_positionCorrection = _arg1; } public function CreateJoint(_arg1:b2JointDef):b2Joint{ var _local3:b2Body; var _local4:b2Shape; var _local2:b2Joint = b2Joint.Create(_arg1, m_blockAllocator); _local2.m_prev = null; _local2.m_next = m_jointList; if (m_jointList){ m_jointList.m_prev = _local2; }; m_jointList = _local2; m_jointCount++; _local2.m_node1.joint = _local2; _local2.m_node1.other = _local2.m_body2; _local2.m_node1.prev = null; _local2.m_node1.next = _local2.m_body1.m_jointList; if (_local2.m_body1.m_jointList){ _local2.m_body1.m_jointList.prev = _local2.m_node1; }; _local2.m_body1.m_jointList = _local2.m_node1; _local2.m_node2.joint = _local2; _local2.m_node2.other = _local2.m_body1; _local2.m_node2.prev = null; _local2.m_node2.next = _local2.m_body2.m_jointList; if (_local2.m_body2.m_jointList){ _local2.m_body2.m_jointList.prev = _local2.m_node2; }; _local2.m_body2.m_jointList = _local2.m_node2; if (_arg1.collideConnected == false){ _local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2; _local4 = _local3.m_shapeList; while (_local4) { _local4.RefilterProxy(m_broadPhase, _local3.m_xf); _local4 = _local4.m_next; }; }; return (_local2); } public function DestroyJoint(_arg1:b2Joint):void{ var _local5:b2Body; var _local6:b2Shape; var _local2:Boolean = _arg1.m_collideConnected; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_jointList){ m_jointList = _arg1.m_next; }; var _local3:b2Body = _arg1.m_body1; var _local4:b2Body = _arg1.m_body2; _local3.WakeUp(); _local4.WakeUp(); if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local3.m_jointList){ _local3.m_jointList = _arg1.m_node1.next; }; _arg1.m_node1.prev = null; _arg1.m_node1.next = null; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local4.m_jointList){ _local4.m_jointList = _arg1.m_node2.next; }; _arg1.m_node2.prev = null; _arg1.m_node2.next = null; b2Joint.Destroy(_arg1, m_blockAllocator); m_jointCount--; if (_local2 == false){ _local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4; _local6 = _local5.m_shapeList; while (_local6) { _local6.RefilterProxy(m_broadPhase, _local5.m_xf); _local6 = _local6.m_next; }; }; } public function SetContactListener(_arg1:b2ContactListener):void{ m_contactListener = _arg1; } public function CreateBody(_arg1:b2BodyDef):b2Body{ if (m_lock == true){ return (null); }; var _local2:b2Body = new b2Body(_arg1, this); _local2.m_prev = null; _local2.m_next = m_bodyList; if (m_bodyList){ m_bodyList.m_prev = _local2; }; m_bodyList = _local2; m_bodyCount++; return (_local2); } public function SetBoundaryListener(_arg1:b2BoundaryListener):void{ m_boundaryListener = _arg1; } public function SetDestructionListener(_arg1:b2DestructionListener):void{ m_destructionListener = _arg1; } public function Step(_arg1:Number, _arg2:int):void{ m_lock = true; var _local3:b2TimeStep = new b2TimeStep(); _local3.dt = _arg1; _local3.maxIterations = _arg2; if (_arg1 > 0){ _local3.inv_dt = (1 / _arg1); } else { _local3.inv_dt = 0; }; _local3.dtRatio = (m_inv_dt0 * _arg1); _local3.positionCorrection = m_positionCorrection; _local3.warmStarting = m_warmStarting; m_contactManager.Collide(); if (_local3.dt > 0){ Solve(_local3); }; if (((m_continuousPhysics) && ((_local3.dt > 0)))){ SolveTOI(_local3); }; DrawDebugData(); m_inv_dt0 = _local3.inv_dt; m_lock = false; } public function GetBodyCount():int{ return (m_bodyCount); } public function GetJointCount():int{ return (m_jointCount); } } }//package Box2D.Dynamics
Section 75
//b2BuoyancyController (com.boristhebrave.Box2D.Controllers.b2BuoyancyController) package com.boristhebrave.Box2D.Controllers { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2BuoyancyController extends b2MultiController { public var useDensity:Boolean;// = false public var useWorldGravity:Boolean;// = true public var normal:b2Vec2; public var density:Number;// = 0 public var offset:Number;// = 0 public var gravity:b2Vec2;// = null public var angularDrag:Number;// = 1 public var linearDrag:Number;// = 2 public var velocity:b2Vec2; public function b2BuoyancyController(){ normal = new b2Vec2(0, -1); velocity = new b2Vec2(0, 0); super(); } override public function Draw(_arg1:b2DebugDraw):void{ var _local2:Number = 1000; var _local3:b2Vec2 = new b2Vec2(); var _local4:b2Vec2 = new b2Vec2(); _local3.x = ((normal.x * offset) + (normal.y * _local2)); _local3.y = ((normal.y * offset) - (normal.x * _local2)); _local4.x = ((normal.x * offset) - (normal.y * _local2)); _local4.y = ((normal.y * offset) + (normal.x * _local2)); var _local5:b2Color = new b2Color(0, 0, 1); _arg1.DrawSegment(_local3, _local4, _local5); } override public function Step(_arg1:Number):void{ var _local3:b2Body; var _local4:b2Vec2; var _local5:b2Vec2; var _local6:Number; var _local7:Number; var _local8:b2Shape; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:b2Vec2; var _local12:Number; var _local13:Number; if (m_bodies.length == 0){ return; }; if (useWorldGravity){ gravity = m_bodies[0].GetWorld().GetGravity().Copy(); }; var _local2:int; while (_local2 < m_bodies.length) { _local3 = m_bodies[_local2]; if (_local3.IsSleeping()){ } else { _local4 = new b2Vec2(); _local5 = new b2Vec2(); _local6 = 0; _local7 = 0; _local8 = _local3.GetShapeList(); while (_local8) { _local11 = new b2Vec2(); _local12 = _local8.ComputeSubmergedArea(normal, offset, _local3.GetXForm(), _local11); _local6 = (_local6 + _local12); _local4.x = (_local4.x + (_local12 * _local11.x)); _local4.y = (_local4.y + (_local12 * _local11.y)); if (useDensity){ _local13 = _local8.m_density; } else { _local13 = 1; }; _local7 = (_local7 + (_local12 * _local13)); _local5.x = (_local5.x + ((_local12 * _local11.x) * _local13)); _local5.y = (_local5.y + ((_local12 * _local11.y) * _local13)); _local8 = _local8.GetNext(); }; _local4.x = (_local4.x / _local6); _local4.y = (_local4.y / _local6); _local5.x = (_local5.x / _local7); _local5.y = (_local5.y / _local7); if (_local6 < Number.MIN_VALUE){ } else { _local9 = gravity.Negative(); _local9.Multiply((density * _local6)); _local3.ApplyForce(_local9, _local5); _local10 = _local3.GetLinearVelocityFromWorldPoint(_local4); _local10.Subtract(velocity); _local10.Multiply((-(linearDrag) * _local6)); _local3.ApplyForce(_local10, _local4); _local3.ApplyTorque(((((-(_local3.GetInertia()) / _local3.GetMass()) * _local6) * _local3.GetAngularVelocity()) * angularDrag)); }; }; _local2++; }; } public static function FromBodies(_arg1:Array, _arg2:b2Vec2=null, _arg3:Number=0, _arg4:Number=0):b2BuoyancyController{ var _local5:b2BuoyancyController = new (b2BuoyancyController); var _local6:* = 0; while (_local6 < _arg1.length) { _local5.AddBody(_arg1[_local6]); _local6++; }; if (_arg2 != null){ _local5.normal.SetV(_arg2); _local5.offset = _arg3; }; if (_arg4 > 0){ _local5.density = _arg4; }; return (_local5); } } }//package com.boristhebrave.Box2D.Controllers
Section 76
//b2Controller (com.boristhebrave.Box2D.Controllers.b2Controller) package com.boristhebrave.Box2D.Controllers { import Box2D.Dynamics.*; public class b2Controller { public var m_prev:b2Controller; public var m_next:b2Controller; public function GetPrev():b2Controller{ return (m_prev); } public function Step(_arg1:Number):void{ } public function Draw(_arg1:b2DebugDraw):void{ } public function GetNext():b2Controller{ return (m_next); } } }//package com.boristhebrave.Box2D.Controllers
Section 77
//b2GravityController (com.boristhebrave.Box2D.Controllers.b2GravityController) package com.boristhebrave.Box2D.Controllers { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import core.shape.shapeProps.*; public class b2GravityController extends b2MultiController { public var G:Number;// = 25 public var invSqr:Boolean;// = true override public function Step(_arg1:Number):void{ var _local2:int; var _local3:b2Body; var _local4:b2Vec2; var _local5:Number = 0; var _local6:int; var _local7:b2Body; var _local8:b2Vec2; var _local9:Number = 0; var _local10:Number = 0; var _local11:Number = 0; var _local12:b2Vec2; _local2 = 0; while (_local2 < m_bodies.length) { _local3 = m_bodies[_local2]; _local4 = _local3.GetWorldCenter(); _local5 = _local3.GetMass(); _local6 = 0; for (;_local6 < _local2;_local6++) { _local7 = m_bodies[_local6]; if ((((UserData(_local3.m_userData).type == "hero")) && ((UserData(_local7.m_userData).type == "magnet")))){ _local8 = _local7.GetWorldCenter(); _local9 = (_local8.x - _local4.x); _local10 = (_local8.y - _local4.y); _local11 = ((_local9 * _local9) + (_local10 * _local10)); if (_local11 < Number.MIN_VALUE){ continue; }; _local12 = new b2Vec2(_local9, _local10); _local12.Multiply(Number(UserData(_local7.m_userData).subtype)); _local12.Multiply(((((G / _local11) / Math.sqrt(_local11)) * _local5) * _local7.GetMass())); _local3.ApplyForce(_local12, _local4); } else { if ((((UserData(_local3.m_userData).type == "magnet")) && ((UserData(_local7.m_userData).type == "hero")))){ _local8 = _local7.GetWorldCenter(); _local9 = (_local8.x - _local4.x); _local10 = (_local8.y - _local4.y); _local11 = ((_local9 * _local9) + (_local10 * _local10)); if (_local11 < Number.MIN_VALUE){ } else { _local12 = new b2Vec2(_local9, _local10); _local12.Multiply(((((G / _local11) / Math.sqrt(_local11)) * _local5) * _local7.GetMass())); _local12.Multiply(-1); _local12.Multiply(Number(UserData(_local3.m_userData).subtype)); if (!_local7.IsSleeping()){ _local7.ApplyForce(_local12, _local8); }; }; }; }; }; _local2++; }; } public static function FromBodies(_arg1:Array):b2GravityController{ var _local2:b2GravityController = new (b2GravityController); var _local3:* = 0; while (_local3 < _arg1.length) { _local2.AddBody(_arg1[_local3]); _local3++; }; return (_local2); } } }//package com.boristhebrave.Box2D.Controllers
Section 78
//b2MultiController (com.boristhebrave.Box2D.Controllers.b2MultiController) package com.boristhebrave.Box2D.Controllers { import Box2D.Dynamics.*; public class b2MultiController extends b2Controller { var m_bodies:Array; public function b2MultiController(){ m_bodies = []; super(); } public function AddBodies(_arg1:Array):void{ var _local2:* = 0; while (_local2 < _arg1.length) { AddBody(_arg1[_local2]); _local2++; }; } public function AddBody(_arg1:b2Body):void{ m_bodies.push(_arg1); } public function WakeBodies():void{ var _local1:int; while (_local1 < m_bodies.length) { m_bodies[_local1].WakeUp(); _local1++; }; } public function RemoveBody(_arg1:b2Body):void{ var body = _arg1; m_bodies = m_bodies.filter(function (_arg1){ return (!((_arg1 == body))); }); } public function removeAllBodies():void{ m_bodies = new Array(); } public function GetBodies():Array{ return (m_bodies); } public static function FromBodies(_arg1:Array):b2MultiController{ var _local2:b2MultiController = new (b2MultiController); var _local3:* = 0; while (_local3 < _arg1.length) { _local2.AddBody(_arg1[_local3]); _local3++; }; return (_local2); } } }//package com.boristhebrave.Box2D.Controllers
Section 79
//MuteControl_7 (Controls_fla.MuteControl_7) package Controls_fla { import flash.events.*; import flash.display.*; public dynamic class MuteControl_7 extends MovieClip { public var btnMute:SimpleButton; public var mcWaves:MovieClip; public function MuteControl_7(){ addFrameScript(0, frame1); } function frame1(){ btnMute.addEventListener(MouseEvent.CLICK, onClick); } public function onClick(_arg1:MouseEvent):void{ mcWaves.visible = !(mcWaves.visible); dispatchEvent(new Event("Mute", true)); } } }//package Controls_fla
Section 80
//SponsorLogo_58 (Controls_fla.SponsorLogo_58) package Controls_fla { import flash.events.*; import flash.display.*; import flash.net.*; public dynamic class SponsorLogo_58 extends MovieClip { public var btn:SimpleButton; public function SponsorLogo_58(){ addFrameScript(0, frame1); } function frame1(){ btn.addEventListener(MouseEvent.CLICK, onClick); } public function onClick(_arg1:MouseEvent):void{ var _local2:URLRequest; _local2 = new URLRequest("http://www.gamesbutler.com"); navigateToURL(_local2, "_blank"); } } }//package Controls_fla
Section 81
//Symbol44_2 (Controls_fla.Symbol44_2) package Controls_fla { import flash.events.*; import flash.display.*; import flash.net.*; public dynamic class Symbol44_2 extends MovieClip { public var btn:SimpleButton; public function Symbol44_2(){ addFrameScript(0, frame1); } function frame1(){ btn.addEventListener(MouseEvent.CLICK, onClick); } public function onClick(_arg1:MouseEvent):void{ var _local2:URLRequest; _local2 = new URLRequest("http://www.gamesbutler.com/game/3460/Gem_Rush_Walkthrough/"); navigateToURL(_local2, "_blank"); } } }//package Controls_fla
Section 82
//BContactListener (core.engine.BContactListener) package core.engine { import flash.events.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class BContactListener extends b2ContactListener { public var dispatcher:EventDispatcher; public static const COLLIDE_ADD:String = "CollideAdd"; public static const COLLIDE_PERSIST:String = "CollidePersist"; public static const COLLIDE_REMOVE:String = "CollideRemove"; public static const COLLIDE_RESULT:String = "CollideResult"; public function BContactListener():void{ dispatcher = new EventDispatcher(); } override public function Add(_arg1:b2ContactPoint):void{ dispatcher.dispatchEvent(new CoreEvent(COLLIDE_ADD, _arg1)); } override public function Persist(_arg1:b2ContactPoint):void{ dispatcher.dispatchEvent(new CoreEvent(COLLIDE_PERSIST, _arg1)); } public function collideExist(_arg1:b2Body, _arg2:b2Body):Boolean{ var _local3:b2ContactEdge = _arg1.m_contactList; while (_local3) { if (_local3.other == _arg2){ return (true); }; _local3 = _local3.next; }; return (false); } override public function Remove(_arg1:b2ContactPoint):void{ dispatcher.dispatchEvent(new CoreEvent(COLLIDE_REMOVE, _arg1)); } override public function Result(_arg1:b2ContactResult):void{ dispatcher.dispatchEvent(new CoreEvent(COLLIDE_RESULT, _arg1)); } } }//package core.engine
Section 83
//CoreEngine (core.engine.CoreEngine) package core.engine { import flash.events.*; import flash.display.*; import core.renderer.*; import Box2D.Common.Math.*; import com.boristhebrave.Box2D.Controllers.*; import Box2D.Dynamics.*; import Box2D.Collision.*; public class CoreEngine extends Sprite { public var debugDrawContainer:Sprite; public var gravity:b2Vec2; private var _renderers:Array; public var world:b2World; public var contactListener:BContactListener; public var controller:b2MultiController; private static var _instance:CoreEngine; public function CoreEngine(_arg1:SingletonEnforcer){ gravity = new b2Vec2(0, 10); _renderers = new Array(); contactListener = new BContactListener(); super(); createWorld(); } public function explode(_arg1:b2Vec2, _arg2:Number=3, _arg3:Number=65):void{ var aabb:*; var vMin:*; var vMax:*; var shapes:*; var i:*; var b:*; var fv:*; var position = _arg1; var radius = _arg2; var power = _arg3; var _local5 = world; with (_local5) { aabb = new b2AABB(); vMin = position.Copy(); vMin.Subtract(new b2Vec2(radius, radius)); vMax = position.Copy(); vMax.Add(new b2Vec2(radius, radius)); aabb.lowerBound = vMin; aabb.upperBound = vMax; shapes = new Array(); Query(aabb, shapes, 100); i = 0; while (i < shapes.length) { b = shapes[i].GetBody(); fv = b.GetPosition().Copy(); fv.Subtract(position); fv.Normalize(); fv.Multiply(power); b.WakeUp(); b.ApplyForce(fv, b.GetPosition()); i++; }; }; } public function removeRenderer(_arg1:BaseRenderer):void{ var _local2:BaseRenderer; for each (_local2 in _renderers) { if (_local2 == _arg1){ _arg1.destroy(); _renderers = _renderers.filter(filterValidRenderers); }; }; } public function addRenderer(_arg1:BaseRenderer):void{ _renderers.push(_arg1); } private function onEnterFrame(_arg1:Event):void{ var _local2:BaseRenderer; world.Step(0.0333, 5); if (controller){ controller.Step(0.0333); }; for each (_local2 in _renderers) { _local2.render(); }; } public function createWorld():void{ var _local2:b2DebugDraw; var _local3:Sprite; if (controller){ controller.removeAllBodies(); }; _renderers = new Array(); var _local1:b2AABB = new b2AABB(); _local1.lowerBound.Set(-10000, -10000); _local1.upperBound.Set(10000, 10000); world = new b2World(_local1, gravity, true); if (debugDrawContainer){ _local2 = new b2DebugDraw(); _local3 = debugDrawContainer; _local3.mouseEnabled = false; _local3.mouseChildren = false; _local2.m_sprite = _local3; _local2.m_drawScale = 30; _local2.m_fillAlpha = 0.7; _local2.m_lineThickness = 1; _local2.m_drawFlags = (b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit); world.SetDebugDraw(_local2); }; world.SetContactListener(contactListener); removeEventListener(Event.ENTER_FRAME, onEnterFrame); addEventListener(Event.ENTER_FRAME, onEnterFrame); } private function filterValidRenderers(_arg1:BaseRenderer, _arg2:int, _arg3:Array):Boolean{ return (_arg1.isValid()); } public static function getInstance():CoreEngine{ if (_instance == null){ _instance = new CoreEngine(new SingletonEnforcer()); }; return (_instance); } } }//package core.engine class SingletonEnforcer { private function SingletonEnforcer(){ } }
Section 84
//CoreEvent (core.engine.CoreEvent) package core.engine { import flash.events.*; public class CoreEvent extends Event { public var data:Object; public static const COMPLETE_LEVEL:String = "COMPLETE_LEVEL"; public static const RESET:String = "RESET"; public static const SHOCKER:String = "SHOCKER"; public function CoreEvent(_arg1:String, _arg2:Object=null, _arg3:Boolean=false, _arg4:Boolean=false){ this.data = _arg2; super(_arg1, _arg3, _arg4); } } }//package core.engine
Section 85
//BaseRenderer (core.renderer.BaseRenderer) package core.renderer { import flash.display.*; import core.engine.*; import Box2D.Dynamics.*; public class BaseRenderer { protected var _skins:Array; protected var _bodies:Array; public function BaseRenderer(_arg1:Array, _arg2:Array, _arg3:Boolean=true):void{ if (_arg1.length != _arg2.length){ throw (new Error("BaseRenderer was not initialized properly. shapes count should be = skins count")); }; _bodies = _arg1; _skins = _arg2; addSkins(); } protected function removeSkins():void{ var _local2:Sprite; var _local1:Sprite = Scene2DReference.getInstance().scene; for each (_local2 in _skins) { _local1.removeChild(_local2); }; } protected function removeBodies():void{ var _local2:b2Body; var _local1:b2World = CoreEngine.getInstance().world; for each (_local2 in _bodies) { _local1.DestroyBody(_local2); _local2 = null; }; _bodies = null; } public function addSkins():void{ var _local2:Sprite; var _local1:Sprite = Scene2DReference.getInstance().scene; for each (_local2 in _skins) { _local1.addChild(_local2); }; } public function render():void{ var i:uint; var body:b2Body; var skin:Sprite; if (!_bodies){ return; }; i = 0; while (i < _bodies.length) { body = _bodies[i]; skin = _skins[i]; var _local2 = skin; with (_local2) { x = (body.GetPosition().x * 30); y = (body.GetPosition().y * 30); rotation = ((body.GetAngle() * 180) / Math.PI); }; i = (i + 1); }; } public function isValid():Boolean{ return ((_bodies) ? true : false); } public function destroy():void{ removeSkins(); removeBodies(); } } }//package core.renderer
Section 86
//Scene2DReference (core.renderer.Scene2DReference) package core.renderer { import flash.display.*; public class Scene2DReference { public var scene:Sprite; private static var _instance:Scene2DReference; public function Scene2DReference(_arg1:SingletonEnforcer){ } public static function getInstance():Scene2DReference{ if (_instance == null){ _instance = new Scene2DReference(new SingletonEnforcer()); }; return (_instance); } } }//package core.renderer class SingletonEnforcer { private function SingletonEnforcer(){ } }
Section 87
//DefaultDynamicShapeProps (core.shape.shapeProps.DefaultDynamicShapeProps) package core.shape.shapeProps { public class DefaultDynamicShapeProps extends DefaultShapeProps { public function DefaultDynamicShapeProps(){ friction = 0.3; restitution = 0.3; density = 0.4; angularDamping = 0; linearDamping = 0; } } }//package core.shape.shapeProps
Section 88
//DefaultShapeProps (core.shape.shapeProps.DefaultShapeProps) package core.shape.shapeProps { public class DefaultShapeProps { public var angularDamping:uint; public var categoryBits:uint; public var density:Number; public var restitution:Number; public var isBullet:Boolean;// = false public var maskBits:uint; public var groupIndex:int; public var friction:Number; public var linearDamping:uint; } }//package core.shape.shapeProps
Section 89
//DefaultStaticShapeProps (core.shape.shapeProps.DefaultStaticShapeProps) package core.shape.shapeProps { public class DefaultStaticShapeProps extends DefaultShapeProps { public function DefaultStaticShapeProps(){ friction = 0.3; restitution = 0; density = 0; } } }//package core.shape.shapeProps
Section 90
//UserData (core.shape.shapeProps.UserData) package core.shape.shapeProps { public class UserData { public var subtype:String;// = "" public var renderer; public var h:Number;// = 0 public var w:Number;// = 0 public var type:String;// = "none" public var health:uint; } }//package core.shape.shapeProps
Section 91
//BaseShape (core.shape.BaseShape) package core.shape { import Box2D.Dynamics.*; public class BaseShape { private var _body:b2Body; protected var _physScale:uint;// = 30 public function BaseShape(){ _body = createBody(); } public function get body():b2Body{ return (_body); } protected function createBody():b2Body{ return (null); } } }//package core.shape
Section 92
//BoxShape (core.shape.BoxShape) package core.shape { import core.engine.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import core.shape.shapeProps.*; public class BoxShape extends BaseShape { private var _height:Number; private var _width:Number; private var _isStatic:Boolean; private var _x:Number; private var _y:Number; private var _customShapeProps:DefaultShapeProps; public function BoxShape(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean, _arg6:DefaultShapeProps=null){ _x = _arg1; _y = _arg2; _width = _arg3; _height = _arg4; _isStatic = _arg5; _customShapeProps = _arg6; super(); } override protected function createBody():b2Body{ var _local1:b2BodyDef; var _local3:DefaultShapeProps; _local1 = new b2BodyDef(); _local1.position.x = (_x / _physScale); _local1.position.y = (_y / _physScale); var _local2:b2PolygonDef = new b2PolygonDef(); _local2.SetAsBox((_width / 60), (_height / 60)); if (_customShapeProps){ _local3 = _customShapeProps; } else { _local3 = (_isStatic) ? new DefaultStaticShapeProps() : new DefaultDynamicShapeProps(); }; _local2.friction = _local3.friction; _local2.restitution = _local3.restitution; _local2.density = _local3.density; _local1.angularDamping = _local3.angularDamping; _local1.linearDamping = _local3.linearDamping; if (_local3.categoryBits){ _local2.filter.categoryBits = _local3.categoryBits; }; if (_local3.maskBits){ _local2.filter.maskBits = _local3.maskBits; }; if (_local3.groupIndex){ _local2.filter.groupIndex = _local3.groupIndex; }; var _local4:b2Body = CoreEngine.getInstance().world.CreateBody(_local1); _local4.CreateShape(_local2); _local4.SetMassFromShapes(); var _local5:UserData = new UserData(); _local5.w = _width; _local5.h = _height; _local4.m_userData = _local5; return (_local4); } } }//package core.shape
Section 93
//CircleShape (core.shape.CircleShape) package core.shape { import core.engine.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import core.shape.shapeProps.*; public class CircleShape extends BaseShape { private var _radius:Number; private var _customShapeProps:DefaultShapeProps; private var _isStatic:Boolean; private var _x:Number; private var _y:Number; public function CircleShape(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:DefaultShapeProps=null){ _x = _arg1; _y = _arg2; _radius = _arg3; _isStatic = _arg4; _customShapeProps = _arg5; super(); } override protected function createBody():b2Body{ var _local3:DefaultShapeProps; var _local1:b2BodyDef = new b2BodyDef(); _local1.position.x = (_x / _physScale); _local1.position.y = (_y / _physScale); var _local2:b2CircleDef = new b2CircleDef(); _local2.radius = (_radius / _physScale); if (_customShapeProps){ _local3 = _customShapeProps; } else { _local3 = (_isStatic) ? new DefaultStaticShapeProps() : new DefaultDynamicShapeProps(); }; _local2.friction = _local3.friction; _local2.restitution = _local3.restitution; _local2.density = _local3.density; if (_local3.categoryBits){ _local2.filter.categoryBits = _local3.categoryBits; }; if (_local3.maskBits){ _local2.filter.maskBits = _local3.maskBits; }; if (_local3.groupIndex){ _local2.filter.groupIndex = _local3.groupIndex; }; var _local4:b2Body = CoreEngine.getInstance().world.CreateBody(_local1); _local4.CreateShape(_local2); _local4.SetMassFromShapes(); if (_local3.isBullet == true){ _local4.SetBullet(true); }; _local4.m_userData = new UserData(); return (_local4); } } }//package core.shape
Section 94
//KeyboardListener (core.KeyboardListener) package core { import flash.events.*; import flash.display.*; public class KeyboardListener { public var left:Boolean;// = false public var up:Boolean;// = false public var right:Boolean;// = false private static var _instance:KeyboardListener; public function KeyboardListener(_arg1:SingletonEnforcer){ } public function onKeyDown(_arg1:KeyboardEvent):void{ switch (_arg1.keyCode){ case 37: left = true; break; case 38: up = true; break; case 39: right = true; break; case 65: left = true; break; case 87: up = true; break; case 68: right = true; break; case 32: up = true; break; }; } public function onKeyUp(_arg1:KeyboardEvent):void{ switch (_arg1.keyCode){ case 37: left = false; break; case 38: up = false; break; case 39: right = false; break; case 65: left = false; break; case 87: up = false; break; case 68: right = false; break; case 32: up = false; break; }; } public function listen(_arg1:Stage):void{ _arg1.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); _arg1.addEventListener(KeyboardEvent.KEY_UP, onKeyUp); } public static function getInstance():KeyboardListener{ if (_instance == null){ _instance = new KeyboardListener(new SingletonEnforcer()); }; return (_instance); } } }//package core class SingletonEnforcer { private function SingletonEnforcer(){ } }
Section 95
//DustEffect (effects.DustEffect) package effects { import flash.events.*; import flash.display.*; import idv.cjcat.stardust.common.clocks.*; import idv.cjcat.stardust.twoD.zones.*; import idv.cjcat.stardust.twoD.initializers.*; import idv.cjcat.stardust.twoD.renderers.*; public class DustEffect extends Sprite { private var _target:Sprite; private var _emitter:DustEmitter; public function DustEffect(){ _emitter = new DustEmitter(new SteadyClock(1)); var _local1:Sprite = new Sprite(); addChild(_local1); var _local2:DisplayObjectRenderer = new DisplayObjectRenderer(_local1); _local2.addEmitter(_emitter); var _local3:Velocity = new Velocity(new SinglePoint(0, 5)); } public function start(_arg1:Sprite):void{ _target = _arg1; addEventListener(Event.ENTER_FRAME, onEnterFrame); } private function onEnterFrame(_arg1:Event):void{ if (_target){ _emitter.point.x = _target.x; _emitter.point.y = _target.y; _emitter.step(); } else { stop(); }; } public function stop():void{ removeEventListener(Event.ENTER_FRAME, onEnterFrame); } } }//package effects
Section 96
//DustEmitter (effects.DustEmitter) package effects { import idv.cjcat.stardust.common.actions.*; import idv.cjcat.stardust.common.initializers.*; import idv.cjcat.stardust.common.clocks.*; import idv.cjcat.stardust.twoD.zones.*; import idv.cjcat.stardust.common.math.*; import idv.cjcat.stardust.twoD.initializers.*; import idv.cjcat.stardust.twoD.actions.*; import idv.cjcat.stardust.twoD.emitters.*; public class DustEmitter extends Emitter2D { public var point:SinglePoint; public function DustEmitter(_arg1:Clock=null){ super(_arg1); point = new SinglePoint(); addInitializer(new DisplayObjectClass(Dust)); addInitializer(new Position(point)); addInitializer(new Velocity(new LazySectorZone(1E-5, 0))); addInitializer(new Life(new UniformRandom(50, 5))); addAction(new Age()); addAction(new DeathLife()); addAction(new Accelerate(0.025)); addAction(new Move()); addAction(new ScaleCurve(15, 15)); } } }//package effects
Section 97
//GameEvent (events.GameEvent) package events { import flash.events.*; public class GameEvent extends Event { public var data:Object; public static var COLLECT_ANTI_TRASH:String = "COLLECT_ANTI_TRASH"; public static var COLLECT_TRASH:String = "COLLECT_TRASH"; public static var FINISH_SHOOT:String = "FINISH_SHOOT"; public static var SHOOT:String = "SHOOT"; public function GameEvent(_arg1:String, _arg2:Object=null, _arg3:Boolean=false, _arg4:Boolean=false){ this.data = _arg2; super(_arg1, _arg3, _arg4); } } }//package events
Section 98
//HelpContent_4 (HelpMenu_fla.HelpContent_4) package HelpMenu_fla { import flash.events.*; import flash.display.*; import flash.net.*; public dynamic class HelpContent_4 extends MovieClip { public var btnDownload:SimpleButton; public var btnGoodLuck:SimpleButton; public function HelpContent_4(){ addFrameScript(0, frame1, 9, frame10, 19, frame20); } function frame10(){ btnGoodLuck.visible = false; } function frame1(){ stop(); btnGoodLuck.visible = true; } function frame20(){ btnGoodLuck.visible = false; btnDownload.addEventListener(MouseEvent.CLICK, onDownload); } public function onDownload(_arg1:MouseEvent):void{ var _local2:URLRequest; _local2 = new URLRequest("http://www.gamesbutler.com/gem-rush.zip"); navigateToURL(_local2, "_blank"); } } }//package HelpMenu_fla
Section 99
//SponsorLogo_8 (HelpMenu_fla.SponsorLogo_8) package HelpMenu_fla { import flash.events.*; import flash.display.*; import flash.net.*; public dynamic class SponsorLogo_8 extends MovieClip { public var btn:SimpleButton; public function SponsorLogo_8(){ addFrameScript(0, frame1); } function frame1(){ btn.addEventListener(MouseEvent.CLICK, onClick); } public function onClick(_arg1:MouseEvent):void{ var _local2:URLRequest; _local2 = new URLRequest("http://www.gamesbutler.com"); navigateToURL(_local2, "_blank"); } } }//package HelpMenu_fla
Section 100
//ActionTrigger (idv.cjcat.stardust.common.actions.triggers.ActionTrigger) package idv.cjcat.stardust.common.actions.triggers { import idv.cjcat.stardust.common.actions.*; import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; public class ActionTrigger extends CompositeAction { public var inverted:Boolean; public function ActionTrigger(_arg1:Boolean=false){ this.inverted = _arg1; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); if (_local1.@inverted.length()){ _local1.@inverted = inverted; }; return (_local1); } override public function getXMLTagName():String{ return ("ActionTrigger"); } override public function getElementTypeXMLTag():XML{ return (<triggers/> ); } public function testTrigger(_arg1:Emitter, _arg2:Particle, _arg3:Number):Boolean{ return (false); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Array; var _local5:Boolean; var _local6:Action; _local4 = actionCollection.actions; _local5 = testTrigger(_arg1, _arg2, _arg3); if (inverted){ _local5 = !(_local5); }; if (_local5){ for each (_local6 in _local4) { _local6.update(_arg1, _arg2, _arg3); }; }; } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); inverted = (_arg1.@inverted == "true"); } } }//package idv.cjcat.stardust.common.actions.triggers
Section 101
//DeathTrigger (idv.cjcat.stardust.common.actions.triggers.DeathTrigger) package idv.cjcat.stardust.common.actions.triggers { import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; public class DeathTrigger extends ActionTrigger { override public function getXMLTagName():String{ return ("DeathTrigger"); } override public function testTrigger(_arg1:Emitter, _arg2:Particle, _arg3:Number):Boolean{ return (_arg2.isDead); } } }//package idv.cjcat.stardust.common.actions.triggers
Section 102
//LifeTrigger (idv.cjcat.stardust.common.actions.triggers.LifeTrigger) package idv.cjcat.stardust.common.actions.triggers { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; public class LifeTrigger extends ActionTrigger { private var _upperBound:Number; public var triggerEvery:Number; private var _lowerBound:Number; public var triggerWithinBounds:Boolean; public function LifeTrigger(_arg1:Number=0, _arg2:Number=1.79769313486232E308, _arg3:Boolean=true, _arg4:Number=1){ this.lowerBound = _arg1; this.upperBound = _arg2; this.triggerWithinBounds = _arg3; this.triggerEvery = _arg4; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); if (_local1.@triggerWithinBounds.length()){ _local1.@triggerWithinBounds = triggerWithinBounds; }; if (_local1.@triggerEvery.length()){ _local1.@triggerEvery = triggerEvery; }; if (_local1.@lowerBound.length()){ _local1.@lowerBound = lowerBound; }; if (_local1.@upperBound.length()){ _local1.@upperBound = upperBound; }; return (_local1); } override public function getXMLTagName():String{ return ("LifeTrigger"); } public function get upperBound():Number{ return (_upperBound); } override public function testTrigger(_arg1:Emitter, _arg2:Particle, _arg3:Number):Boolean{ if (triggerWithinBounds){ if ((((_arg2.life >= lowerBound)) && ((_arg2.life <= upperBound)))){ return (((_arg2.life % triggerEvery) < _arg3)); }; } else { if ((((_arg2.life < lowerBound)) || ((_arg2.life > upperBound)))){ return (((_arg2.life % triggerEvery) < _arg3)); }; }; return (false); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); triggerWithinBounds = (_arg1.@triggerWithinBounds == "true"); triggerEvery = parseFloat(_arg1.@triggerEvery); lowerBound = parseFloat(_arg1.@lowerBound); upperBound = parseFloat(_arg1.@upperBound); } public function set upperBound(_arg1:Number):void{ if (_arg1 < _lowerBound){ _lowerBound = _arg1; }; _upperBound = _arg1; } public function set lowerBound(_arg1:Number):void{ if (_arg1 > _upperBound){ _upperBound = _arg1; }; _lowerBound = _arg1; } public function get lowerBound():Number{ return (_lowerBound); } } }//package idv.cjcat.stardust.common.actions.triggers
Section 103
//Action (idv.cjcat.stardust.common.actions.Action) package idv.cjcat.stardust.common.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.events.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.*; public class Action extends StardustElement { private var _mask:int; public var skipThisAction:Boolean; public var active:Boolean; private var _priority:int; protected var _supports2D:Boolean; protected var _supports3D:Boolean; public function Action(){ _supports2D = (_supports3D = true); priority = CommonActionPriority.getInstance().getPriority((Object(this).constructor as Class)); active = true; _mask = 1; } override public function getElementTypeXMLTag():XML{ return (<actions/> ); } public function get mask():int{ return (_mask); } public function set priority(_arg1:int):void{ _priority = _arg1; dispatchEvent(new ActionEvent(ActionEvent.PRIORITY_CHANGE, this)); } public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ } public function postUpdate(_arg1:Emitter, _arg2:Number):void{ } public function set mask(_arg1:int):void{ _mask = _arg1; } public function get needsSortedParticles():Boolean{ return (false); } final public function doUpdate(_arg1:Emitter, _arg2:ParticleCollection, _arg3:Number):void{ var _local4:Particle; var _local5:ParticleIterator; skipThisAction = false; if (active){ _local5 = _arg2.getIterator(); while ((_local4 = _local5.particle)) { if ((mask & _local4.mask)){ update(_arg1, _local4, _arg3); }; if (skipThisAction){ return; }; _local5.next(); }; }; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@active = active; _local1.@mask = mask; return (_local1); } override public function getXMLTagName():String{ return ("Action"); } public function get supports2D():Boolean{ return (_supports2D); } public function preUpdate(_arg1:Emitter, _arg2:Number):void{ } public function doStraightUpdate(_arg1:Emitter, _arg2:ParticleCollection, _arg3:Number):void{ var _local4:Particle; var _local5:ParticleIterator; skipThisAction = false; if (active){ _local5 = _arg2.getIterator(); while ((_local4 = _local5.particle)) { update(_arg1, _local4, _arg3); if (skipThisAction){ return; }; _local5.next(); }; }; } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@active.length()){ active = (_arg1.@active == "true"); }; if (_arg1.@mask.length()){ mask = parseInt(_arg1.@mask); }; } public function get priority():int{ return (_priority); } public function get supports3D():Boolean{ return (_supports3D); } } }//package idv.cjcat.stardust.common.actions
Section 104
//ActionCollection (idv.cjcat.stardust.common.actions.ActionCollection) package idv.cjcat.stardust.common.actions { import flash.events.*; import idv.cjcat.stardust.common.events.*; import idv.cjcat.stardust.*; public class ActionCollection implements ActionCollector { sd var actions:Array; public function ActionCollection(){ actions = []; } final public function sortActions(_arg1:Event=null):void{ actions.sortOn("priority", (Array.NUMERIC | Array.DESCENDING)); } final public function removeAction(_arg1:Action):void{ var _local2:int; while ((_local2 = actions.indexOf(_arg1)) >= 0) { _arg1 = (actions.splice(_local2, 1)[0] as Action); _arg1.removeEventListener(ActionEvent.PRIORITY_CHANGE, sortActions); }; } final public function clearActions():void{ var _local1:Action; for each (_local1 in actions) { removeAction(_local1); }; } final public function addAction(_arg1:Action):void{ actions.push(_arg1); _arg1.addEventListener(ActionEvent.PRIORITY_CHANGE, sortActions); sortActions(); } } }//package idv.cjcat.stardust.common.actions
Section 105
//ActionCollector (idv.cjcat.stardust.common.actions.ActionCollector) package idv.cjcat.stardust.common.actions { public interface ActionCollector { function clearActions():void; function addAction(_arg1:Action):void; function removeAction(_arg1:Action):void; } }//package idv.cjcat.stardust.common.actions
Section 106
//ActionPriority (idv.cjcat.stardust.common.actions.ActionPriority) package idv.cjcat.stardust.common.actions { import flash.utils.*; public class ActionPriority { protected var priorities:Dictionary; private static var _instance:ActionPriority; public function ActionPriority(){ priorities = new Dictionary(); populatePriorities(); } final public function getPriority(_arg1:Class):int{ if (priorities[_arg1] == undefined){ return (0); }; return (priorities[_arg1]); } protected function populatePriorities():void{ } public static function getInstance():ActionPriority{ if (!_instance){ _instance = new (ActionPriority); }; return (_instance); } } }//package idv.cjcat.stardust.common.actions
Section 107
//Age (idv.cjcat.stardust.common.actions.Age) package idv.cjcat.stardust.common.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; public class Age extends Action { public var multiplier:Number; public function Age(_arg1:Number=1){ this.multiplier = _arg1; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ _arg2.life = (_arg2.life - (_arg3 * multiplier)); if (_arg2.life < 0){ _arg2.life = 0; }; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@multiplier = multiplier; return (_local1); } override public function getXMLTagName():String{ return ("Age"); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@multiplier.length()){ multiplier = parseFloat(_arg1.@multiplier); }; } } }//package idv.cjcat.stardust.common.actions
Section 108
//CommonActionPriority (idv.cjcat.stardust.common.actions.CommonActionPriority) package idv.cjcat.stardust.common.actions { import idv.cjcat.stardust.common.actions.triggers.*; public class CommonActionPriority extends ActionPriority { private static var _instance:CommonActionPriority; final override protected function populatePriorities():void{ priorities[DeathLife] = -1; priorities[DeathTrigger] = -5; priorities[LifeTrigger] = -5; } public static function getInstance():CommonActionPriority{ if (!_instance){ _instance = new (CommonActionPriority); }; return (_instance); } } }//package idv.cjcat.stardust.common.actions
Section 109
//CompositeAction (idv.cjcat.stardust.common.actions.CompositeAction) package idv.cjcat.stardust.common.actions { import flash.events.*; import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.events.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.*; public class CompositeAction extends Action implements ActionCollector { public var checkComponentMasks:Boolean; sd var actionCollection:ActionCollection; public function CompositeAction(){ checkComponentMasks = false; actionCollection = new ActionCollection(); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ var _local3:XML; super.parseXML(_arg1, _arg2); checkComponentMasks = (_arg1.@checkComponentMasks == "true"); clearActions(); for each (_local3 in _arg1.actions.*) { addAction((_arg2.getElementByName(_local3.@name) as Action)); }; } final override public function get needsSortedParticles():Boolean{ var _local1:Action; for each (_local1 in actionCollection.actions) { if (_local1.needsSortedParticles){ return (true); }; }; return (false); } override public function toXML():XML{ var _local1:XML; var _local2:Action; _local1 = super.toXML(); if (_local1.@checkComponentMasks.length()){ _local1.@checkComponentMasks = checkComponentMasks; }; if (actionCollection.actions.length > 0){ _local1.appendChild(<actions/> ); for each (_local2 in actionCollection.actions) { _local1.actions.appendChild(_local2.getXMLTag()); }; }; return (_local1); } override public function getXMLTagName():String{ return ("CompositeAction"); } public function addAction(_arg1:Action):void{ actionCollection.actions.push(_arg1); _arg1.addEventListener(ActionEvent.PRIORITY_CHANGE, sortActions); sortActions(); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Action; if (checkComponentMasks){ for each (_local4 in actionCollection.actions) { if (_local4.active){ if ((_local4.mask & _arg2.mask)){ _local4.update(_arg1, _arg2, _arg3); }; }; }; } else { for each (_local4 in actionCollection.actions) { if (_local4.active){ _local4.update(_arg1, _arg2, _arg3); }; }; }; } override public function preUpdate(_arg1:Emitter, _arg2:Number):void{ var _local3:Action; for each (_local3 in actionCollection.actions) { _local3.preUpdate(_arg1, _arg2); }; } public function removeAction(_arg1:Action):void{ var _local2:int; var _local3:Action; while ((_local2 = actionCollection.actions.indexOf(_arg1)) >= 0) { _local3 = actionCollection.actions.splice(_local2, 1)[0]; _local3.removeEventListener(ActionEvent.PRIORITY_CHANGE, sortActions); }; } override public function getRelatedObjects():Array{ return (actionCollection.actions.concat()); } public function clearActions():void{ var _local1:Action; for each (_local1 in actionCollection.actions) { removeAction(_local1); }; } final public function sortActions(_arg1:Event=null):void{ actionCollection.actions.sortOn("priority", (Array.NUMERIC | Array.DESCENDING)); } } }//package idv.cjcat.stardust.common.actions
Section 110
//DeathLife (idv.cjcat.stardust.common.actions.DeathLife) package idv.cjcat.stardust.common.actions { import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; public class DeathLife extends Action { public var threshold:Number; override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ if (_arg2.life <= 0){ _arg2.isDead = true; }; } override public function getXMLTagName():String{ return ("DeathLife"); } } }//package idv.cjcat.stardust.common.actions
Section 111
//ScaleCurve (idv.cjcat.stardust.common.actions.ScaleCurve) package idv.cjcat.stardust.common.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.easing.*; public class ScaleCurve extends Action { private var _outFunction:Function; public var inLifespan:Number; public var inScale:Number; private var _outFunctionExtraParams:Array; public var outLifespan:Number; private var _inFunction:Function; public var outScale:Number; private var _inFunctionExtraParams:Array; public function ScaleCurve(_arg1:Number=0, _arg2:Number=0, _arg3:Function=null, _arg4:Function=null){ this.inScale = 0; this.outScale = 0; this.inLifespan = _arg1; this.outLifespan = _arg2; this.inFunction = _arg3; this.outFunction = _arg4; this.inFunctionExtraParams = []; this.outFunctionExtraParams = []; } public function get outFunctionExtraParams():Array{ return (_outFunctionExtraParams); } public function set outFunction(_arg1:Function):void{ if (_arg1 == null){ _arg1 = Linear.easeOut; }; _outFunction = _arg1; } public function set outFunctionExtraParams(_arg1:Array):void{ if (!_arg1){ _arg1 = []; }; _outFunctionExtraParams = _arg1; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@inScale = inScale; _local1.@outScale = outScale; _local1.@inLifespan = inLifespan; _local1.@outLifespan = outLifespan; _local1.@inFunction = EasingFunctionType.functions[inFunction]; _local1.@outFunction = EasingFunctionType.functions[outFunction]; return (_local1); } override public function getXMLTagName():String{ return ("ScaleCurve"); } public function get inFunction():Function{ return (_inFunction); } public function set inFunctionExtraParams(_arg1:Array):void{ if (!_arg1){ _arg1 = []; }; _inFunctionExtraParams = _arg1; } public function set inFunction(_arg1:Function):void{ if (_arg1 == null){ _arg1 = Linear.easeIn; }; _inFunction = _arg1; } public function get outFunction():Function{ return (_outFunction); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ if ((_arg2.initLife - _arg2.life) < inLifespan){ _arg2.scale = _inFunction.apply(null, [(_arg2.initLife - _arg2.life), inScale, (_arg2.initScale - inScale), inLifespan].concat(_inFunctionExtraParams)); } else { if (_arg2.life < outLifespan){ _arg2.scale = _outFunction.apply(null, [(outLifespan - _arg2.life), _arg2.initScale, (outScale - _arg2.initScale), outLifespan].concat(_outFunctionExtraParams)); } else { _arg2.scale = _arg2.initScale; }; }; } public function get inFunctionExtraParams():Array{ return (_inFunctionExtraParams); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@inScale.length()){ inScale = parseFloat(_arg1.@inScale); }; if (_arg1.@outScale.length()){ outScale = parseFloat(_arg1.@outScale); }; if (_arg1.@inLifespan.length()){ inLifespan = parseFloat(_arg1.@inLifespan); }; if (_arg1.@outLifespan.length()){ outLifespan = parseFloat(_arg1.@outLifespan); }; if (_arg1.@inFunction.length()){ inFunction = EasingFunctionType.functions[_arg1.@inFunction.toString()]; }; if (_arg1.@outFunction.length()){ outFunction = EasingFunctionType.functions[_arg1.@outFunction.toString()]; }; } } }//package idv.cjcat.stardust.common.actions
Section 112
//Clock (idv.cjcat.stardust.common.clocks.Clock) package idv.cjcat.stardust.common.clocks { import idv.cjcat.stardust.common.*; public class Clock extends StardustElement { override public function getElementTypeXMLTag():XML{ return (<clocks/> ); } public function getTicks(_arg1:Number):int{ return (0); } } }//package idv.cjcat.stardust.common.clocks
Section 113
//SteadyClock (idv.cjcat.stardust.common.clocks.SteadyClock) package idv.cjcat.stardust.common.clocks { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.math.*; public class SteadyClock extends Clock { public var ticksPerCall:Number; public function SteadyClock(_arg1:Number=0){ this.ticksPerCall = _arg1; } override public function getTicks(_arg1:Number):int{ return (StardustMath.randomFloor((ticksPerCall * _arg1))); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@ticksPerCall = ticksPerCall; return (_local1); } override public function getXMLTagName():String{ return ("SteadyClock"); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@ticksPerCall.length()){ ticksPerCall = parseFloat(_arg1.@ticksPerCall); }; } } }//package idv.cjcat.stardust.common.clocks
Section 114
//Back (idv.cjcat.stardust.common.easing.Back) package idv.cjcat.stardust.common.easing { public class Back { public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=1.70158):Number{ _arg1 = ((_arg1 / _arg4) - 1); return (((_arg3 * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 1)) + _arg2)); } public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=1.70158):Number{ _arg1 = (_arg1 / _arg4); return (((((_arg3 * _arg1) * _arg1) * (((_arg5 + 1) * _arg1) - _arg5)) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=1.70158):Number{ _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ _arg5 = (_arg5 * 1.525); return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) - _arg5))) + _arg2)); }; _arg1 = (_arg1 - 2); _arg5 = (_arg5 * 1.525); return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 2)) + _arg2)); } } }//package idv.cjcat.stardust.common.easing
Section 115
//Circ (idv.cjcat.stardust.common.easing.Circ) package idv.cjcat.stardust.common.easing { public class Circ { public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = ((_arg1 / _arg4) - 1); return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2)); } public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / _arg4); return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2)); }; _arg1 = (_arg1 - 2); return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2)); } } }//package idv.cjcat.stardust.common.easing
Section 116
//Cubic (idv.cjcat.stardust.common.easing.Cubic) package idv.cjcat.stardust.common.easing { public class Cubic { public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = ((_arg1 / _arg4) - 1); return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2)); } public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / _arg4); return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2)); }; _arg1 = (_arg1 - 2); return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2)); } } }//package idv.cjcat.stardust.common.easing
Section 117
//EasingFunctionType (idv.cjcat.stardust.common.easing.EasingFunctionType) package idv.cjcat.stardust.common.easing { import flash.utils.*; public class EasingFunctionType { private static var _functions:Dictionary; public static function get functions():Dictionary{ if (!_functions){ _functions = new Dictionary(); _functions["Back.easeIn"] = Back.easeIn; _functions["Back.easeInOut"] = Back.easeInOut; _functions["Back.easeOut"] = Back.easeOut; _functions["Circ.easeIn"] = Circ.easeIn; _functions["Circ.easeInOut"] = Circ.easeInOut; _functions["Circ.easeOut"] = Circ.easeOut; _functions["Cubic.easeIn"] = Cubic.easeIn; _functions["Cubic.easeInOut"] = Cubic.easeInOut; _functions["Cubic.easeOut"] = Cubic.easeOut; _functions["Elastic.easeIn"] = Elastic.easeIn; _functions["Elastic.easeInOut"] = Elastic.easeInOut; _functions["Elastic.easeOut"] = Elastic.easeOut; _functions["Expo.easeIn"] = Expo.easeIn; _functions["Expo.easeInOut"] = Expo.easeInOut; _functions["Expo.easeOut"] = Expo.easeOut; _functions["Linear.easeIn"] = Linear.easeIn; _functions["Linear.easeInOut"] = Linear.easeInOut; _functions["Linear.easeNone"] = Linear.easeNone; _functions["Linear.easeOut"] = Linear.easeOut; _functions["Quad.easeIn"] = Quad.easeIn; _functions["Quad.easeInOut"] = Quad.easeInOut; _functions["Quad.easeOut"] = Quad.easeOut; _functions["Quart.easeIn"] = Quart.easeIn; _functions["Quart.easeInOut"] = Quart.easeInOut; _functions["Quart.easeOut"] = Quart.easeOut; _functions["Quint.easeIn"] = Quint.easeIn; _functions["Quint.easeInOut"] = Quint.easeInOut; _functions["Quint.easeOut"] = Quint.easeOut; _functions["Sine.easeIn"] = Sine.easeIn; _functions["Sine.easeInOut"] = Sine.easeInOut; _functions["Sine.easeOut"] = Sine.easeOut; _functions[Back.easeIn] = "Back.easeIn"; _functions[Back.easeInOut] = "Back.easeInOut"; _functions[Back.easeOut] = "Back.easeOut"; _functions[Circ.easeIn] = "Circ.easeIn"; _functions[Circ.easeInOut] = "Circ.easeInOut"; _functions[Circ.easeOut] = "Circ.easeOut"; _functions[Cubic.easeIn] = "Cubic.easeIn"; _functions[Cubic.easeInOut] = "Cubic.easeInOut"; _functions[Cubic.easeOut] = "Cubic.easeOut"; _functions[Elastic.easeIn] = "Elastic.easeIn"; _functions[Elastic.easeInOut] = "Elastic.easeInOut"; _functions[Elastic.easeOut] = "Elastic.easeOut"; _functions[Expo.easeIn] = "Expo.easeIn"; _functions[Expo.easeInOut] = "Expo.easeInOut"; _functions[Expo.easeOut] = "Expo.easeOut"; _functions[Linear.easeIn] = "Linear.easeIn"; _functions[Linear.easeInOut] = "Linear.easeInOut"; _functions[Linear.easeNone] = "Linear.easeNone"; _functions[Linear.easeOut] = "Linear.easeOut"; _functions[Quad.easeIn] = "Quad.easeIn"; _functions[Quad.easeInOut] = "Quad.easeInOut"; _functions[Quad.easeOut] = "Quad.easeOut"; _functions[Quart.easeIn] = "Quart.easeIn"; _functions[Quart.easeInOut] = "Quart.easeInOut"; _functions[Quart.easeOut] = "Quart.easeOut"; _functions[Quint.easeIn] = "Quint.easeIn"; _functions[Quint.easeInOut] = "Quint.easeInOut"; _functions[Quint.easeOut] = "Quint.easeOut"; _functions[Sine.easeIn] = "Sine.easeIn"; _functions[Sine.easeInOut] = "Sine.easeInOut"; _functions[Sine.easeOut] = "Sine.easeOut"; }; return (_functions); } } }//package idv.cjcat.stardust.common.easing
Section 118
//Elastic (idv.cjcat.stardust.common.easing.Elastic) package idv.cjcat.stardust.common.easing { public class Elastic { private static const _2PI:Number = 6.28318530717959; public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{ var _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / _arg4); if (_arg1 == 1){ return ((_arg2 + _arg3)); }; if (!_arg6){ _arg6 = (_arg4 * 0.3); }; if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){ _arg5 = _arg3; _local7 = (_arg6 / 4); } else { _local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5))); }; --_arg1; return ((-(((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6)))) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{ var _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 == 2){ return ((_arg2 + _arg3)); }; if (!_arg6){ _arg6 = (_arg4 * (0.3 * 1.5)); }; if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){ _arg5 = _arg3; _local7 = (_arg6 / 4); } else { _local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5))); }; if (_arg1 < 1){ --_arg1; return (((-0.5 * ((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6)))) + _arg2)); }; --_arg1; return ((((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6))) * 0.5) + _arg3) + _arg2)); } public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{ var _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / _arg4); if (_arg1 == 1){ return ((_arg2 + _arg3)); }; if (!_arg6){ _arg6 = (_arg4 * 0.3); }; if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){ _arg5 = _arg3; _local7 = (_arg6 / 4); } else { _local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5))); }; return (((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6))) + _arg3) + _arg2)); } } }//package idv.cjcat.stardust.common.easing
Section 119
//Expo (idv.cjcat.stardust.common.easing.Expo) package idv.cjcat.stardust.common.easing { public class Expo { public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return (((_arg1)==_arg4) ? (_arg2 + _arg3) : ((_arg3 * (-(Math.pow(2, ((-10 * _arg1) / _arg4))) + 1)) + _arg2)); } public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return (((_arg1)==0) ? _arg2 : ((_arg3 * Math.pow(2, (10 * ((_arg1 / _arg4) - 1)))) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ if (_arg1 == 0){ return (_arg2); }; if (_arg1 == _arg4){ return ((_arg2 + _arg3)); }; _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return ((((_arg3 / 2) * Math.pow(2, (10 * (_arg1 - 1)))) + _arg2)); }; --_arg1; return ((((_arg3 / 2) * (-(Math.pow(2, (-10 * _arg1))) + 2)) + _arg2)); } } }//package idv.cjcat.stardust.common.easing
Section 120
//Linear (idv.cjcat.stardust.common.easing.Linear) package idv.cjcat.stardust.common.easing { public class Linear { public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return ((((_arg3 * _arg1) / _arg4) + _arg2)); } public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return ((((_arg3 * _arg1) / _arg4) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return ((((_arg3 * _arg1) / _arg4) + _arg2)); } public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return ((((_arg3 * _arg1) / _arg4) + _arg2)); } } }//package idv.cjcat.stardust.common.easing
Section 121
//Quad (idv.cjcat.stardust.common.easing.Quad) package idv.cjcat.stardust.common.easing { public class Quad { public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / _arg4); return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2)); } public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / _arg4); return ((((_arg3 * _arg1) * _arg1) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2)); }; --_arg1; return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2)); } } }//package idv.cjcat.stardust.common.easing
Section 122
//Quart (idv.cjcat.stardust.common.easing.Quart) package idv.cjcat.stardust.common.easing { public class Quart { public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = ((_arg1 / _arg4) - 1); return (((-(_arg3) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2)); } public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / _arg4); return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return (((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); }; _arg1 = (_arg1 - 2); return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 2)) + _arg2)); } } }//package idv.cjcat.stardust.common.easing
Section 123
//Quint (idv.cjcat.stardust.common.easing.Quint) package idv.cjcat.stardust.common.easing { public class Quint { public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = ((_arg1 / _arg4) - 1); return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2)); } public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / _arg4); return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 < 1){ return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2)); }; _arg1 = (_arg1 - 2); return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2)); } } }//package idv.cjcat.stardust.common.easing
Section 124
//Sine (idv.cjcat.stardust.common.easing.Sine) package idv.cjcat.stardust.common.easing { public class Sine { private static const _HALF_PI:Number = 1.5707963267949; public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return (((_arg3 * Math.sin(((_arg1 / _arg4) * _HALF_PI))) + _arg2)); } public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * _HALF_PI))) + _arg3) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2)); } } }//package idv.cjcat.stardust.common.easing
Section 125
//Emitter (idv.cjcat.stardust.common.emitters.Emitter) package idv.cjcat.stardust.common.emitters { import flash.events.*; import idv.cjcat.stardust.common.actions.*; import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.initializers.*; import idv.cjcat.stardust.common.clocks.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.events.*; import idv.cjcat.stardust.common.*; import idv.cjcat.stardust.*; public class Emitter extends StardustElement implements ActionCollector, InitializerCollector { protected var factory:PooledParticleFactory; private var _clock:Clock; public var active:Boolean; public var stepTimeInterval:Number;// = 1 sd var particles:ParticleList; private var _actionCollection:ActionCollection; public var needsSort:Boolean; public function Emitter(_arg1:Clock=null){ stepTimeInterval = 1; super(); needsSort = false; this.clock = _arg1; this.active = true; _actionCollection = new ActionCollection(); particles = new PooledParticleList(); } final public function removeDeadParticles():void{ var _local1:Particle; var _local2:ParticleCollection; var _local3:ParticleIterator; var _local4:*; var _local5:InfoRecycler; _local2 = new ParticleList(); _local3 = particles.getIterator(); while ((_local1 = _local3.particle)) { if (_local1.isDead){ _local2.add(_local1); _local3.remove(); } else { _local3.next(); }; }; if (_local2.size){ dispatchEvent(new EmitterEvent(EmitterEvent.PARTICLES_REMOVED, _local2)); }; _local3 = _local2.getIterator(); while ((_local1 = _local3.particle)) { for (_local4 in _local1.recyclers) { _local5 = (_local4 as InfoRecycler); if (_local5){ _local5.recycleInfo(_local1); }; }; _local1.destroy(); factory.recycle(_local1); _local3.next(); }; } public function addInitializer(_arg1:Initializer):void{ factory.addInitializer(_arg1); } public function get clock():Clock{ return (_clock); } final public function addParticles(_arg1:ParticleCollection):void{ var _local2:Particle; var _local3:ParticleIterator; _local3 = _arg1.getIterator(); while ((_local2 = _local3.particle)) { this.particles.add(_local2); _local3.next(); }; if (_arg1.size){ dispatchEvent(new EmitterEvent(EmitterEvent.PARTICLES_ADDED, _arg1)); }; } override public function toXML():XML{ var _local1:XML; var _local2:Action; var _local3:Initializer; _local1 = super.toXML(); _local1.@active = active.toString(); _local1.@clock = _clock.name; if (actions.length){ _local1.appendChild(<actions/> ); for each (_local2 in actions) { _local1.actions.appendChild(_local2.getXMLTag()); }; }; if (initializers.length){ _local1.appendChild(<initializers/> ); for each (_local3 in initializers) { _local1.initializers.appendChild(_local3.getXMLTag()); }; }; return (_local1); } override public function getXMLTagName():String{ return ("Emitter"); } public function set clock(_arg1:Clock):void{ if (!_arg1){ _arg1 = new SteadyClock(0); }; _clock = _arg1; } public function addAction(_arg1:Action):void{ _actionCollection.addAction(_arg1); } override public function getElementTypeXMLTag():XML{ return (<emitters/> ); } final public function removeInitializer(_arg1:Initializer):void{ factory.removeInitializer(_arg1); } final public function step(_arg1:Event=null):void{ var _local2:Boolean; var _local3:Particle; var _local4:ParticleIterator; var _local5:Action; var _local6:int; var _local7:ParticleCollection; _local2 = false; if (active){ _local6 = clock.getTicks(stepTimeInterval); _local7 = factory.createParticles(_local6); addParticles(_local7); }; for each (_local5 in actions) { _local5.preUpdate(this, stepTimeInterval); if (!_local2){ if (_local5.needsSortedParticles){ particles.sort(); _local4 = particles.getIterator(); while ((_local3 = _local4.particle)) { _local3.sortedIndexIterator = _local4.dump(ParticleListIteratorPool.get(particles)); _local4.next(); }; _local2 = true; }; }; _local5.doUpdate(this, particles, stepTimeInterval); _local5.postUpdate(this, stepTimeInterval); }; if (_local2){ _local4 = particles.getIterator(); while ((_local3 = _local4.particle)) { ParticleListIteratorPool.recycle((_local3.sortedIndexIterator as ParticleListIterator)); _local4.next(); }; }; removeDeadParticles(); dispatchEvent(new EmitterEvent(EmitterEvent.STEPPED, particles)); if (!numParticles){ dispatchEvent(new EmitterEvent(EmitterEvent.EMITTER_EMPTY, null)); }; } final public function get numParticles():int{ return (particles.size); } final sd function get initializers():Array{ return (factory.initializerCollection.initializers); } override public function getRelatedObjects():Array{ return ([_clock].concat(initializers).concat(actions)); } final public function clearInitializers():void{ factory.clearInitializers(); } final public function removeAction(_arg1:Action):void{ _actionCollection.removeAction(_arg1); } final public function clearParticles():void{ var _local1:ParticleCollection; var _local2:Particle; var _local3:ParticleIterator; _local1 = particles; particles = new ParticleList(); if (_local1.size){ dispatchEvent(new EmitterEvent(EmitterEvent.PARTICLES_REMOVED, _local1)); }; _local3 = particles.getIterator(); while ((_local2 = _local3.particle)) { _local2.destroy(); factory.recycle(_local2); _local3.remove(); }; } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ var _local3:XML; super.parseXML(_arg1, _arg2); _actionCollection.clearActions(); factory.clearInitializers(); if (_arg1.@active.length()){ active = (_arg1.@active == "true"); }; if (_arg1.@clock.length()){ clock = (_arg2.getElementByName(_arg1.@clock) as Clock); }; for each (_local3 in _arg1.actions.*) { addAction((_arg2.getElementByName(_local3.@name) as Action)); }; for each (_local3 in _arg1.initializers.*) { addInitializer((_arg2.getElementByName(_local3.@name) as Initializer)); }; } final public function clearActions():void{ _actionCollection.clearActions(); } final sd function get actions():Array{ return (_actionCollection.actions); } public function getParticles():ParticleCollection{ return (particles); } } }//package idv.cjcat.stardust.common.emitters
Section 126
//DuplicateElementNameError (idv.cjcat.stardust.common.errors.DuplicateElementNameError) package idv.cjcat.stardust.common.errors { import idv.cjcat.stardust.common.*; public class DuplicateElementNameError extends Error { private var _name:String; private var _element1:StardustElement; private var _element2:StardustElement; public function DuplicateElementNameError(_arg1, _arg2:String, _arg3:StardustElement, _arg4:StardustElement){ super(_arg1); _element1 = _arg3; _element2 = _arg4; _name = _arg2; } public function get elementName():String{ return (_name); } public function get element1():StardustElement{ return (_element1); } public function get element2():StardustElement{ return (_element2); } } }//package idv.cjcat.stardust.common.errors
Section 127
//ActionEvent (idv.cjcat.stardust.common.events.ActionEvent) package idv.cjcat.stardust.common.events { import flash.events.*; import idv.cjcat.stardust.common.actions.*; public class ActionEvent extends Event { private var _action:Action; public static const PRIORITY_CHANGE:String = "stardustActoinPriorityChange"; public function ActionEvent(_arg1:String, _arg2:Action){ super(_arg1); _action = _arg2; } public function get action():Action{ return (_action); } } }//package idv.cjcat.stardust.common.events
Section 128
//EmitterEvent (idv.cjcat.stardust.common.events.EmitterEvent) package idv.cjcat.stardust.common.events { import flash.events.*; import idv.cjcat.stardust.common.particles.*; public class EmitterEvent extends Event { private var _particles:ParticleCollection; public static const EMITTER_EMPTY:String = "stardustEmitterEmpty"; public static const PARTICLES_ADDED:String = "stardustEmitterParticleAdded"; public static const STEPPED:String = "stardustEmitterStepped"; public static const PARTICLES_REMOVED:String = "stardustEmitterParticleRemoved"; public function EmitterEvent(_arg1:String, _arg2:ParticleCollection){ super(_arg1); _particles = _arg2; } public function get particles():ParticleCollection{ return (_particles); } } }//package idv.cjcat.stardust.common.events
Section 129
//InitializerEvent (idv.cjcat.stardust.common.events.InitializerEvent) package idv.cjcat.stardust.common.events { import flash.events.*; import idv.cjcat.stardust.common.initializers.*; public class InitializerEvent extends Event { private var _initializer:Initializer; public static const PRIORITY_CHANGE:String = "stardustInitializerPriorityChange"; public function InitializerEvent(_arg1:String, _arg2:Initializer){ super(_arg1); _initializer = _arg2; } public function get initializer():Initializer{ return (_initializer); } } }//package idv.cjcat.stardust.common.events
Section 130
//CommonInitializerPriority (idv.cjcat.stardust.common.initializers.CommonInitializerPriority) package idv.cjcat.stardust.common.initializers { public class CommonInitializerPriority extends InitializerPriority { private static var _instance:CommonInitializerPriority; final override protected function populatePriorities():void{ priorities[Mask] = 1; } public static function getInstance():CommonInitializerPriority{ if (!_instance){ _instance = new (CommonInitializerPriority); }; return (_instance); } } }//package idv.cjcat.stardust.common.initializers
Section 131
//Initializer (idv.cjcat.stardust.common.initializers.Initializer) package idv.cjcat.stardust.common.initializers { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.events.*; import idv.cjcat.stardust.common.*; public class Initializer extends StardustElement implements InfoRecycler { private var _priority:int; public var active:Boolean; protected var _supports3D:Boolean; protected var _supports2D:Boolean; public function Initializer(){ _supports2D = (_supports3D = true); priority = CommonInitializerPriority.getInstance().getPriority((Object(this).constructor as Class)); active = true; } final public function doInitialize(_arg1:ParticleCollection):void{ var _local2:Particle; var _local3:ParticleIterator; if (active){ _local3 = _arg1.getIterator(); while ((_local2 = _local3.particle)) { initialize(_local2); if (needsRecycle()){ _local2.recyclers[this] = this; }; _local3.next(); }; }; } override public function getElementTypeXMLTag():XML{ return (<initializers/> ); } public function set priority(_arg1:int):void{ _priority = _arg1; dispatchEvent(new InitializerEvent(InitializerEvent.PRIORITY_CHANGE, this)); } public function initialize(_arg1:Particle):void{ } public function get supports2D():Boolean{ return (_supports2D); } public function recycleInfo(_arg1:Particle):void{ } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@active = active; return (_local1); } override public function getXMLTagName():String{ return ("Initializer"); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@active.length()){ active = (_arg1.@active == "true"); }; } public function needsRecycle():Boolean{ return (false); } public function get priority():int{ return (_priority); } public function get supports3D():Boolean{ return (_supports3D); } } }//package idv.cjcat.stardust.common.initializers
Section 132
//InitializerCollection (idv.cjcat.stardust.common.initializers.InitializerCollection) package idv.cjcat.stardust.common.initializers { import flash.events.*; import idv.cjcat.stardust.common.events.*; import idv.cjcat.stardust.*; public class InitializerCollection implements InitializerCollector { sd var initializers:Array; public function InitializerCollection(){ initializers = []; } final public function addInitializer(_arg1:Initializer):void{ if (initializers.indexOf(_arg1) < 0){ initializers.push(_arg1); }; _arg1.addEventListener(InitializerEvent.PRIORITY_CHANGE, sortInitializers); sortInitializers(); } final public function clearInitializers():void{ var _local1:Initializer; for each (_local1 in initializers) { removeInitializer(_local1); }; } final public function removeInitializer(_arg1:Initializer):void{ var _local2:int; _local2 = initializers.indexOf(_arg1); if (_local2 >= 0){ _arg1 = (initializers.splice(_local2, 1)[0] as Initializer); _arg1.removeEventListener(InitializerEvent.PRIORITY_CHANGE, sortInitializers); }; } final public function sortInitializers(_arg1:Event=null):void{ initializers.sortOn("priority", (Array.NUMERIC | Array.DESCENDING)); } } }//package idv.cjcat.stardust.common.initializers
Section 133
//InitializerCollector (idv.cjcat.stardust.common.initializers.InitializerCollector) package idv.cjcat.stardust.common.initializers { public interface InitializerCollector { function addInitializer(_arg1:Initializer):void; function removeInitializer(_arg1:Initializer):void; function clearInitializers():void; } }//package idv.cjcat.stardust.common.initializers
Section 134
//InitializerPriority (idv.cjcat.stardust.common.initializers.InitializerPriority) package idv.cjcat.stardust.common.initializers { import flash.utils.*; public class InitializerPriority { protected var priorities:Dictionary; private static var _instance:InitializerPriority; public function InitializerPriority(){ priorities = new Dictionary(); populatePriorities(); } public function getPriority(_arg1:Class):int{ if (priorities[_arg1] == undefined){ return (0); }; return (priorities[_arg1]); } protected function populatePriorities():void{ } public static function getInstance():InitializerPriority{ if (!_instance){ _instance = new (InitializerPriority); }; return (_instance); } } }//package idv.cjcat.stardust.common.initializers
Section 135
//Life (idv.cjcat.stardust.common.initializers.Life) package idv.cjcat.stardust.common.initializers { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.math.*; public class Life extends Initializer { private var _random:Random; public function Life(_arg1:Random=null){ this.random = _arg1; } override public function initialize(_arg1:Particle):void{ _arg1.initLife = (_arg1.life = random.random()); } public function get random():Random{ return (_random); } override public function getRelatedObjects():Array{ return ([_random]); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@random = _random.name; return (_local1); } override public function getXMLTagName():String{ return ("Life"); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@random.length()){ random = (_arg2.getElementByName(_arg1.@random) as Random); }; } public function set random(_arg1:Random):void{ if (!_arg1){ _arg1 = new UniformRandom(0, 0); }; _random = _arg1; } } }//package idv.cjcat.stardust.common.initializers
Section 136
//Mask (idv.cjcat.stardust.common.initializers.Mask) package idv.cjcat.stardust.common.initializers { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; public class Mask extends Initializer { private var _mask:int; public function Mask(_arg1:int=1){ _mask = _arg1; } override public function initialize(_arg1:Particle):void{ _arg1.mask = _mask; } public function set mask(_arg1:int):void{ if (_arg1 < 0){ _arg1 = 0; }; _mask = _arg1; } public function get mask():int{ return (_mask); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@mask = mask; return (_local1); } override public function getXMLTagName():String{ return ("Mask"); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@mask.length()){ mask = parseInt(_arg1.@mask); }; } } }//package idv.cjcat.stardust.common.initializers
Section 137
//Random (idv.cjcat.stardust.common.math.Random) package idv.cjcat.stardust.common.math { import idv.cjcat.stardust.common.*; public class Random extends StardustElement { public function setRange(_arg1:Number, _arg2:Number):void{ } override public function getElementTypeXMLTag():XML{ return (<randoms/> ); } public function random():Number{ return (0.5); } override public function getXMLTagName():String{ return ("Random"); } public function getRange():Array{ return ([0.5, 0.5]); } } }//package idv.cjcat.stardust.common.math
Section 138
//StardustMath (idv.cjcat.stardust.common.math.StardustMath) package idv.cjcat.stardust.common.math { public class StardustMath { public static const HALF_PI:Number = 1.5707963267949; public static const TWO_PI:Number = 6.28318530717959; public static const RADIAN_TO_DEGREE:Number = 57.2957795130823; public static const DEGREE_TO_RADIAN:Number = 0.0174532925199433; public static function interpolate(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Number{ return ((_arg2 - (((_arg2 - _arg4) * (_arg1 - _arg5)) / (_arg1 - _arg3)))); } public static function mod(_arg1:Number, _arg2:Number):Number{ var _local3:Number; _local3 = (_arg1 % _arg2); return (((_local3)<0) ? (_local3 + _arg2) : _local3); } public static function randomFloor(_arg1:Number):int{ var _local2:int; _local2 = (_arg1 | 0); return ((_local2 + int((((_arg1 - _local2))>Math.random()) ? 1 : 0))); } public static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{ if (_arg1 < _arg2){ return (_arg2); }; if (_arg1 > _arg3){ return (_arg3); }; return (_arg1); } } }//package idv.cjcat.stardust.common.math
Section 139
//UniformRandom (idv.cjcat.stardust.common.math.UniformRandom) package idv.cjcat.stardust.common.math { import idv.cjcat.stardust.common.xml.*; public class UniformRandom extends Random { public var radius:Number; public var center:Number; public function UniformRandom(_arg1:Number=0.5, _arg2:Number=0){ this.center = _arg1; this.radius = _arg2; } override public function getRange():Array{ return ([(center - radius), (center + radius)]); } override public function random():Number{ if (radius){ return ((((radius * 2) * (Math.random() - 0.5)) + center)); }; return (center); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@center = center; _local1.@radius = radius; return (_local1); } override public function getXMLTagName():String{ return ("UniformRandom"); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@center.length()){ center = parseFloat(_arg1.@center); }; if (_arg1.@radius.length()){ radius = parseFloat(_arg1.@radius); }; } override public function setRange(_arg1:Number, _arg2:Number):void{ var _local3:Number; _local3 = (_arg2 - _arg1); radius = (0.5 * _local3); center = (_arg1 + radius); } } }//package idv.cjcat.stardust.common.math
Section 140
//InfoRecycler (idv.cjcat.stardust.common.particles.InfoRecycler) package idv.cjcat.stardust.common.particles { public interface InfoRecycler { function recycleInfo(_arg1:Particle):void; function needsRecycle():Boolean; } }//package idv.cjcat.stardust.common.particles
Section 141
//Particle (idv.cjcat.stardust.common.particles.Particle) package idv.cjcat.stardust.common.particles { import flash.utils.*; public class Particle { public var scale:Number; public var target; public var dictionary:Dictionary; public var initScale:Number; public var recyclers:Dictionary; public var alpha:Number; public var collisionRadius:Number; public var color:uint; public var initLife:Number; public var initAlpha:Number; public var sortedIndexIterator:ParticleIterator; public var mask:int; public var isDead:Boolean; public var mass:Number; public var life:Number; public function Particle(){ dictionary = new Dictionary(); recyclers = new Dictionary(); } public function destroy():void{ var _local1:*; target = null; for (_local1 in dictionary) { delete dictionary[_local1]; }; for (_local1 in recyclers) { delete recyclers[_local1]; }; } public function init():void{ initLife = (life = 0); initScale = (scale = 1); initAlpha = (alpha = 1); mass = 1; mask = 1; isDead = false; collisionRadius = 0; color = 0; sortedIndexIterator = null; } } }//package idv.cjcat.stardust.common.particles
Section 142
//Particle2DListSorter (idv.cjcat.stardust.common.particles.Particle2DListSorter) package idv.cjcat.stardust.common.particles { import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.twoD.particles.*; class Particle2DListSorter extends ParticleListSorter { private static var _instance:Particle2DListSorter; private function mergeSort(_arg1:ParticleNode):ParticleNode{ var _local2:ParticleNode; var _local3:ParticleNode; var _local4:ParticleNode; var _local5:ParticleNode; var _local6:ParticleNode; var _local7:int; var _local8:int; var _local9:int; var _local10:int; var _local11:int; if (!_arg1){ return (null); }; _local2 = _arg1; _local7 = 1; while (true) { _local3 = _local2; _local6 = null; _local2 = _local6; _local8 = 0; while (_local3) { _local8++; _local11 = 0; _local9 = 0; _local4 = _local3; while (_local11 < _local7) { _local9++; _local4 = _local4.next; if (!_local4){ break; }; _local11++; }; _local10 = _local7; while ((((_local9 > 0)) || ((((_local10 > 0)) && (_local4))))) { if (_local9 == 0){ _local5 = _local4; _local4 = _local4.next; _local10--; } else { if ((((_local10 == 0)) || (!(_local4)))){ _local5 = _local3; _local3 = _local3.next; _local9--; } else { if ((Particle2D(_local3.particle).x - Particle2D(_local4.particle).x) <= 0){ _local5 = _local3; _local3 = _local3.next; _local9--; } else { _local5 = _local4; _local4 = _local4.next; _local10--; }; }; }; if (_local6){ _local6.next = _local5; } else { _local2 = _local5; }; _local5.prev = _local6; _local6 = _local5; }; _local3 = _local4; }; _arg1.prev = _local6; _local6.next = null; if (_local8 <= 1){ _local2.prev = null; return (_local2); }; _local7 = (_local7 << 1); }; return (null); } override public function sort(_arg1:ParticleList):void{ _arg1.head = mergeSort(_arg1.head); } public static function getInstance():Particle2DListSorter{ if (!_instance){ _instance = new (Particle2DListSorter); }; return (_instance); } } }//package idv.cjcat.stardust.common.particles
Section 143
//Particle3DListSorter (idv.cjcat.stardust.common.particles.Particle3DListSorter) package idv.cjcat.stardust.common.particles { import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.threeD.particles.*; class Particle3DListSorter extends ParticleListSorter { private static var _instance:Particle3DListSorter; private function mergeSort(_arg1:ParticleNode):ParticleNode{ var _local2:ParticleNode; var _local3:ParticleNode; var _local4:ParticleNode; var _local5:ParticleNode; var _local6:ParticleNode; var _local7:int; var _local8:int; var _local9:int; var _local10:int; var _local11:int; if (!_arg1){ return (null); }; _local2 = _arg1; _local7 = 1; while (true) { _local3 = _local2; _local6 = null; _local2 = _local6; _local8 = 0; while (_local3) { _local8++; _local11 = 0; _local9 = 0; _local4 = _local3; while (_local11 < _local7) { _local9++; _local4 = _local4.next; if (!_local4){ break; }; _local11++; }; _local10 = _local7; while ((((_local9 > 0)) || ((((_local10 > 0)) && (_local4))))) { if (_local9 == 0){ _local5 = _local4; _local4 = _local4.next; _local10--; } else { if ((((_local10 == 0)) || (!(_local4)))){ _local5 = _local3; _local3 = _local3.next; _local9--; } else { if ((Particle3D(_local3.particle).x - Particle3D(_local4.particle).x) <= 0){ _local5 = _local3; _local3 = _local3.next; _local9--; } else { _local5 = _local4; _local4 = _local4.next; _local10--; }; }; }; if (_local6){ _local6.next = _local5; } else { _local2 = _local5; }; _local5.prev = _local6; _local6 = _local5; }; _local3 = _local4; }; _arg1.prev = _local6; _local6.next = null; if (_local8 <= 1){ _local2.prev = null; return (_local2); }; _local7 = (_local7 << 1); }; return (null); } override public function sort(_arg1:ParticleList):void{ _arg1.head = mergeSort(_arg1.head); } public static function getInstance():Particle3DListSorter{ if (!_instance){ _instance = new (Particle3DListSorter); }; return (_instance); } } }//package idv.cjcat.stardust.common.particles
Section 144
//ParticleCollection (idv.cjcat.stardust.common.particles.ParticleCollection) package idv.cjcat.stardust.common.particles { public interface ParticleCollection { function get size():int; function add(_arg1:Particle):void; function getIterator():ParticleIterator; function sort():void; } }//package idv.cjcat.stardust.common.particles
Section 145
//ParticleFactory (idv.cjcat.stardust.common.particles.ParticleFactory) package idv.cjcat.stardust.common.particles { import idv.cjcat.stardust.common.initializers.*; import idv.cjcat.stardust.*; public class ParticleFactory implements InitializerCollector { sd var initializerCollection:InitializerCollection; public function ParticleFactory(){ initializerCollection = new InitializerCollection(); } final public function removeInitializer(_arg1:Initializer):void{ initializerCollection.removeInitializer(_arg1); } protected function createNewParticle():Particle{ return (new Particle()); } final public function clearInitializers():void{ initializerCollection.clearInitializers(); } public function addInitializer(_arg1:Initializer):void{ initializerCollection.addInitializer(_arg1); } final public function createParticles(_arg1:int):ParticleList{ var _local2:ParticleList; var _local3:int; var _local4:Initializer; var _local5:Particle; _local2 = new ParticleList(); _local3 = 0; while (_local3 < _arg1) { _local5 = createNewParticle(); _local5.init(); _local2.add(_local5); _local3++; }; for each (_local4 in initializerCollection.initializers) { _local4.doInitialize(_local2); }; return (_local2); } } }//package idv.cjcat.stardust.common.particles
Section 146
//ParticleIterator (idv.cjcat.stardust.common.particles.ParticleIterator) package idv.cjcat.stardust.common.particles { public interface ParticleIterator { function next():void; function dump(_arg1:ParticleIterator):ParticleIterator; function get particle():Particle; function remove():void; function clone():ParticleIterator; function reset():void; } }//package idv.cjcat.stardust.common.particles
Section 147
//ParticleList (idv.cjcat.stardust.common.particles.ParticleList) package idv.cjcat.stardust.common.particles { import idv.cjcat.stardust.*; public class ParticleList implements ParticleCollection { var head:ParticleNode; private var node:ParticleNode; sd var sorter:ParticleListSorter; var tail:ParticleNode; var count:int; public static const TWO_D:Boolean = true; public static const THREE_D:Boolean = false; public function ParticleList(_arg1:Boolean=true){ head = (tail = null); count = 0; if (_arg1){ sorter = Particle2DListSorter.getInstance(); } else { sorter = Particle3DListSorter.getInstance(); }; } public function get size():int{ return (count); } protected function createNode(_arg1:Particle):ParticleNode{ return (new ParticleNode(_arg1)); } public function getIterator():ParticleIterator{ return (new ParticleListIterator(this)); } public function add(_arg1:Particle):void{ node = createNode(_arg1); if (head){ tail.next = node; node.prev = tail; tail = node; } else { head = (tail = node); }; count++; } public function isEmpty():Boolean{ return ((count == 0)); } public function clear():void{ var _local1:ParticleNode; var _local2:ParticleListIterator; _local2 = (getIterator() as ParticleListIterator); while ((_local1 = _local2.node)) { ParticleNodePool.recycle(_local1); _local2.next(); }; head = (tail = null); count = 0; } public function sort():void{ sorter.sort(this); } } }//package idv.cjcat.stardust.common.particles
Section 148
//ParticleListIterator (idv.cjcat.stardust.common.particles.ParticleListIterator) package idv.cjcat.stardust.common.particles { public class ParticleListIterator implements ParticleIterator { var node:ParticleNode; var list:ParticleList; public function ParticleListIterator(_arg1:ParticleList=null){ this.list = _arg1; reset(); } public function get particle():Particle{ if (node){ return (node.particle); }; return (null); } public function clone():ParticleIterator{ var _local1:ParticleListIterator; _local1 = new ParticleListIterator(list); _local1.node = node; return (_local1); } public function reset():void{ if (list){ node = list.head; }; } public function dump(_arg1:ParticleIterator):ParticleIterator{ var _local2:ParticleListIterator; _local2 = (_arg1 as ParticleListIterator); if (_local2){ _local2.list = list; _local2.node = node; }; return (_arg1); } public function next():void{ if (node){ node = node.next; }; } public function remove():void{ var _local1:ParticleNode; if (node){ if (node.prev){ node.prev.next = node.next; }; if (node.next){ node.next.prev = node.prev; }; if (node == list.head){ list.head = node.next; }; if (node == list.tail){ list.tail = node.prev; }; _local1 = node; node = node.next; ParticleNodePool.recycle(_local1); list.count--; }; } } }//package idv.cjcat.stardust.common.particles
Section 149
//ParticleListIteratorPool (idv.cjcat.stardust.common.particles.ParticleListIteratorPool) package idv.cjcat.stardust.common.particles { public class ParticleListIteratorPool { private static var _vec:Array = [new ParticleListIterator()]; private static var _position:int = 0; public static function recycle(_arg1:ParticleListIterator):void{ if (_position == 0){ return; }; _arg1.list = null; _arg1.node = null; _vec[(_position - 1)] = _arg1; if (_position){ _position--; }; } public static function get(_arg1:ParticleList):ParticleListIterator{ var _local2:ParticleListIterator; var _local3:int; if (_position == _vec.length){ _vec.length = (_vec.length << 1); _local3 = _position; while (_local3 < _vec.length) { _vec[_local3] = new ParticleListIterator(); _local3++; }; }; _position++; _local2 = (_vec[(_position - 1)] as ParticleListIterator); _local2.list = _arg1; return (_local2); } } }//package idv.cjcat.stardust.common.particles
Section 150
//ParticleListSorter (idv.cjcat.stardust.common.particles.ParticleListSorter) package idv.cjcat.stardust.common.particles { import idv.cjcat.stardust.common.particles.*; class ParticleListSorter { private static var _instance:ParticleListSorter; public function sort(_arg1:ParticleList):void{ } public static function getInstane():ParticleListSorter{ if (!_instance){ _instance = new (ParticleListSorter); }; return (_instance); } } }//package idv.cjcat.stardust.common.particles
Section 151
//ParticleNode (idv.cjcat.stardust.common.particles.ParticleNode) package idv.cjcat.stardust.common.particles { import idv.cjcat.stardust.common.particles.*; class ParticleNode { var prev:ParticleNode; var particle:Particle; var next:ParticleNode; function ParticleNode(_arg1:Particle=null){ this.particle = _arg1; } } }//package idv.cjcat.stardust.common.particles
Section 152
//ParticleNodePool (idv.cjcat.stardust.common.particles.ParticleNodePool) package idv.cjcat.stardust.common.particles { import idv.cjcat.stardust.common.particles.*; class ParticleNodePool { private static var _vec:Array = [new ParticleNode()]; private static var _position:int = 0; public static function recycle(_arg1:ParticleNode):void{ if (_position == 0){ return; }; _arg1.particle = null; _arg1.next = null; _vec[(_position - 1)] = _arg1; if (_position){ _position--; }; } public static function get(_arg1:Particle):ParticleNode{ var _local2:ParticleNode; var _local3:int; if (_position == _vec.length){ _vec.length = (_vec.length << 1); _local3 = _position; while (_local3 < _vec.length) { _vec[_local3] = new ParticleNode(); _local3++; }; }; _position++; _local2 = (_vec[(_position - 1)] as ParticleNode); _local2.particle = _arg1; return (_local2); } } }//package idv.cjcat.stardust.common.particles
Section 153
//ParticlePool (idv.cjcat.stardust.common.particles.ParticlePool) package idv.cjcat.stardust.common.particles { import idv.cjcat.stardust.*; public class ParticlePool { private var _position:int; sd var particleClass:Class; private var _array:Array; private static var _instance:ParticlePool; public function ParticlePool(){ _array = [createNewParticle()]; _position = 0; } final public function recycle(_arg1:Particle):void{ if (_position == 0){ return; }; _array[(_position - 1)] = _arg1; if (_position){ _position--; }; } protected function createNewParticle():Particle{ return (new Particle()); } final public function get():Particle{ var _local1:int; if (_position == _array.length){ _array.length = (_array.length << 1); _local1 = _position; while (_local1 < _array.length) { _array[_local1] = createNewParticle(); _local1++; }; }; _position++; return ((_array[(_position - 1)] as Particle)); } public static function getInstance():ParticlePool{ if (!_instance){ _instance = new (ParticlePool); }; return (_instance); } } }//package idv.cjcat.stardust.common.particles
Section 154
//PooledParticleFactory (idv.cjcat.stardust.common.particles.PooledParticleFactory) package idv.cjcat.stardust.common.particles { public class PooledParticleFactory extends ParticleFactory { protected var particlePool:ParticlePool; public function PooledParticleFactory(){ particlePool = ParticlePool.getInstance(); } override protected function createNewParticle():Particle{ return (particlePool.get()); } public function recycle(_arg1:Particle):void{ particlePool.recycle(_arg1); } } }//package idv.cjcat.stardust.common.particles
Section 155
//PooledParticleList (idv.cjcat.stardust.common.particles.PooledParticleList) package idv.cjcat.stardust.common.particles { public class PooledParticleList extends ParticleList { public function PooledParticleList(_arg1:Boolean=true){ super(_arg1); } override protected function createNode(_arg1:Particle):ParticleNode{ return (ParticleNodePool.get(_arg1)); } } }//package idv.cjcat.stardust.common.particles
Section 156
//Renderer (idv.cjcat.stardust.common.renderers.Renderer) package idv.cjcat.stardust.common.renderers { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.events.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.*; public class Renderer extends StardustElement { private var _emitters:Array; public function Renderer(){ _emitters = []; } protected function particlesRemoved(_arg1:EmitterEvent):void{ } override public function getElementTypeXMLTag():XML{ return (<renderers/> ); } protected function particlesAdded(_arg1:EmitterEvent):void{ } final public function removeEmitter(_arg1:Emitter):void{ var _local2:int; _local2 = _emitters.indexOf(_arg1); if (_local2 >= 0){ _emitters.splice(_local2, 1); _arg1.removeEventListener(EmitterEvent.PARTICLES_ADDED, particlesAdded); _arg1.removeEventListener(EmitterEvent.PARTICLES_REMOVED, particlesRemoved); _arg1.removeEventListener(EmitterEvent.STEPPED, render); }; } protected function render(_arg1:EmitterEvent):void{ } override public function getRelatedObjects():Array{ return (_emitters); } override public function toXML():XML{ var _local1:XML; var _local2:Emitter; _local1 = super.toXML(); if (_emitters.length > 0){ _local1.appendChild(<emitters/> ); for each (_local2 in _emitters) { _local1.emitters.appendChild(_local2.getXMLTag()); }; }; return (_local1); } override public function getXMLTagName():String{ return ("Renderer"); } final public function addEmitter(_arg1:Emitter):void{ if (_emitters.indexOf(_arg1) < 0){ _arg1.addEventListener(EmitterEvent.PARTICLES_ADDED, particlesAdded); _arg1.addEventListener(EmitterEvent.PARTICLES_REMOVED, particlesRemoved); _arg1.addEventListener(EmitterEvent.STEPPED, render); _emitters.push(_arg1); }; } final public function get numParticles():int{ var _local1:int; var _local2:Emitter; _local1 = 0; for each (_local2 in _emitters) { _local1 = (_local1 + _local2.numParticles); }; return (_local1); } final public function clearEmitters():void{ var _local1:Emitter; for each (_local1 in _emitters) { removeEmitter(_local1); }; } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ var _local3:XML; super.parseXML(_arg1, _arg2); clearEmitters(); for each (_local3 in _arg1.emitters.*) { addEmitter((_arg2.getElementByName(_local3.@name) as Emitter)); }; } } }//package idv.cjcat.stardust.common.renderers
Section 157
//construct (idv.cjcat.stardust.common.utils.construct) package idv.cjcat.stardust.common.utils { import flash.errors.*; public function construct(_arg1:Class, _arg2:Array=null){ if (!_arg2){ return (new (_arg1)); }; switch (_arg2.length){ case 0: return (new (_arg1)); case 1: return (new _arg1(_arg2[0])); case 2: return (new _arg1(_arg2[0], _arg2[1])); case 3: return (new _arg1(_arg2[0], _arg2[1], _arg2[2])); case 4: return (new _arg1(_arg2[0], _arg2[1], _arg2[2], _arg2[3])); case 5: return (new _arg1(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4])); case 6: return (new _arg1(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4], _arg2[5])); case 7: return (new _arg1(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4], _arg2[5], _arg2[6])); case 8: return (new _arg1(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4], _arg2[5], _arg2[6], _arg2[7])); case 9: return (new _arg1(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4], _arg2[5], _arg2[6], _arg2[7], _arg2[8])); case 10: return (new _arg1(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4], _arg2[5], _arg2[6], _arg2[7], _arg2[8], _arg2[9])); default: throw (new IllegalOperationError("The number of parameters given exceeds the maximum number this method can handle.")); }; } }//package idv.cjcat.stardust.common.utils
Section 158
//ClassPackage (idv.cjcat.stardust.common.xml.ClassPackage) package idv.cjcat.stardust.common.xml { public class ClassPackage { protected var classes:Array; private static var _instance:ClassPackage; public function ClassPackage(){ classes = []; populateClasses(); } final public function getClasses():Array{ return (classes.concat()); } protected function populateClasses():void{ } public static function getInstance():ClassPackage{ if (_instance){ _instance = new (ClassPackage); }; return (_instance); } } }//package idv.cjcat.stardust.common.xml
Section 159
//XMLBuilder (idv.cjcat.stardust.common.xml.XMLBuilder) package idv.cjcat.stardust.common.xml { import flash.utils.*; import idv.cjcat.stardust.common.*; import idv.cjcat.stardust.*; import idv.cjcat.stardust.common.errors.*; import flash.errors.*; public class XMLBuilder { private var elementClasses:Dictionary; private var elements:Dictionary; public function XMLBuilder(){ elementClasses = new Dictionary(); elements = new Dictionary(); } public function registerClasses(_arg1:Array):void{ var _local2:Class; for each (_local2 in _arg1) { registerClass(_local2); }; } public function getElementByName(_arg1:String):StardustElement{ if (elements[_arg1] == undefined){ throw (new IllegalOperationError(("Element not found: " + _arg1))); }; return (elements[_arg1]); } public function registerClass(_arg1:Class):void{ var _local2:StardustElement; _local2 = (new (_arg1) as StardustElement); if (!_local2){ throw (new IllegalOperationError("The class is not a subclass of the StardustElement class.")); }; if (elementClasses[_local2.getXMLTagName()] != undefined){ throw (new IllegalOperationError(("This element class name is already registered: " + _local2.getXMLTagName()))); }; elementClasses[_local2.getXMLTagName()] = _arg1; } public function registerClassesFromClassPackage(_arg1:ClassPackage):void{ registerClasses(_arg1.getClasses()); } public function unregisterClass(_arg1:String):void{ delete elementClasses[_arg1]; } public function buildFromXML(_arg1:XML):void{ var _local2:StardustElement; var _local3:XML; var _local4:*; if (elements){ for (_local4 in elements) { delete elements[_local4]; }; }; elements = new Dictionary(); for each (_local3 in _arg1.*.*) { _local2 = (new (elementClasses[_local3.name()]) as StardustElement); if (elements[_local3.@name] != undefined){ throw (new DuplicateElementNameError(("Duplicate element name: " + _local3.@name), _local3.@name, elements[_local3.@name], _local2)); }; elements[_local3.@name.toString()] = _local2; }; for each (_local3 in _arg1.*.*) { _local2 = (elements[_local3.@name.toString()] as StardustElement); _local2.parseXML(_local3, this); }; } private static function elementTypeSorter(_arg1:StardustElement, _arg2:StardustElement):Number{ if (_arg1.getElementTypeXMLTag().name() > _arg2.getElementTypeXMLTag().name()){ return (1); }; if (_arg1.getElementTypeXMLTag().name() < _arg2.getElementTypeXMLTag().name()){ return (-1); }; if (_arg1.getXMLTagName() > _arg2.getXMLTagName()){ return (1); }; if (_arg1.getXMLTagName() < _arg2.getXMLTagName()){ return (-1); }; if (_arg1.name > _arg2.name){ return (1); }; return (-1); } public static function buildXML(_arg1:StardustElement):XML{ var _local2:Dictionary; var _local3:XML; var _local4:Dictionary; var _local5:Array; var _local6:XML; var _local7:XML; _local2 = new Dictionary(); _local3 = <StardustParticleSystem/> ; _local3.@version = Stardust.VERSION; _local4 = new Dictionary(); traverseRelatedObjects(_arg1, _local4); _local5 = []; for each (_arg1 in _local4) { _local5.push(_arg1); }; _local5.sort(elementTypeSorter); for each (_arg1 in _local5) { _local6 = _arg1.toXML(); _local7 = _arg1.getElementTypeXMLTag(); if (_local3[_local7.name()].length() == 0){ _local3.appendChild(_local7); }; _local3[_local7.name()].appendChild(_local6); }; return (_local3); } private static function traverseRelatedObjects(_arg1:StardustElement, _arg2:Dictionary):void{ var _local3:StardustElement; if (!_arg1){ return; }; if (_arg2[_arg1.name] != undefined){ if (_arg2[_arg1.name] != _arg1){ throw (new DuplicateElementNameError(("Duplicate element name: " + _arg1.name), _arg1.name, _arg2[_arg1.name], _arg1)); }; } else { _arg2[_arg1.name] = _arg1; }; for each (_local3 in _arg1.getRelatedObjects()) { traverseRelatedObjects(_local3, _arg2); }; } } }//package idv.cjcat.stardust.common.xml
Section 160
//XMLConvertible (idv.cjcat.stardust.common.xml.XMLConvertible) package idv.cjcat.stardust.common.xml { public interface XMLConvertible { function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void; function toXML():XML; } }//package idv.cjcat.stardust.common.xml
Section 161
//StardustElement (idv.cjcat.stardust.common.StardustElement) package idv.cjcat.stardust.common { import flash.events.*; import flash.utils.*; import idv.cjcat.stardust.common.xml.*; public class StardustElement extends EventDispatcher implements XMLConvertible { public var name:String; private static var elementCounter:Dictionary = new Dictionary(); public function StardustElement(){ var _local1:String; super(); _local1 = getXMLTagName(); if (elementCounter[_local1] == undefined){ elementCounter[_local1] = 0; } else { var _local2 = elementCounter; var _local3 = _local1; var _local4 = (_local2[_local3] + 1); _local2[_local3] = _local4; }; this.name = ((_local1 + "_") + elementCounter[_local1]); } public function getElementTypeXMLTag():XML{ return (<elements/> ); } public function getXMLTagName():String{ return ("StardustElement"); } final public function getXMLTag():XML{ var _local1:XML; _local1 = XML((("<" + getXMLTagName()) + "/>")); _local1.@name = name; return (_local1); } public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ name = _arg1.@name; } public function toXML():XML{ var _local1:XML; _local1 = getXMLTag(); return (_local1); } public function getRelatedObjects():Array{ return ([]); } } }//package idv.cjcat.stardust.common
Section 162
//Particle3D (idv.cjcat.stardust.threeD.particles.Particle3D) package idv.cjcat.stardust.threeD.particles { import idv.cjcat.stardust.common.particles.*; public class Particle3D extends Particle { public var omegaX:Number; public var omegaY:Number; public var omegaZ:Number; public var rotationZ:Number; public var rotationX:Number; public var rotationY:Number; public var screenVY:Number; public var screenVX:Number; public var vx:Number; public var vy:Number; public var vz:Number; public var screenX:Number; public var screenY:Number; public var y:Number; public var z:Number; public var x:Number; override public function init():void{ super.init(); x = 0; y = 0; z = 0; screenX = 0; screenY = 0; vx = 0; vy = 0; vz = 0; screenVX = 0; screenVY = 0; rotationX = 0; rotationY = 0; rotationZ = 0; omegaX = 0; omegaY = 0; omegaZ = 0; } } }//package idv.cjcat.stardust.threeD.particles
Section 163
//ActionTrigger2D (idv.cjcat.stardust.twoD.actions.triggers.ActionTrigger2D) package idv.cjcat.stardust.twoD.actions.triggers { import idv.cjcat.stardust.twoD.actions.*; import idv.cjcat.stardust.common.actions.triggers.*; public class ActionTrigger2D extends ActionTrigger { public function ActionTrigger2D(){ _supports3D = false; priority = Action2DPriority.getInstance().getPriority((Object(this).constructor as Class)); } override public function getXMLTagName():String{ return ("ActionTrigger2D"); } } }//package idv.cjcat.stardust.twoD.actions.triggers
Section 164
//DeflectorTrigger (idv.cjcat.stardust.twoD.actions.triggers.DeflectorTrigger) package idv.cjcat.stardust.twoD.actions.triggers { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.deflectors.*; public class DeflectorTrigger extends ActionTrigger2D { public var deflector:Deflector; public function DeflectorTrigger(_arg1:Deflector=null){ this.deflector = _arg1; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); if (deflector){ _local1.@deflector = deflector.name; }; return (_local1); } override public function getXMLTagName():String{ return ("DeflectorTrigger"); } override public function testTrigger(_arg1:Emitter, _arg2:Particle, _arg3:Number):Boolean{ return (Boolean(_arg2.dictionary[deflector])); } override public function getRelatedObjects():Array{ return ([deflector]); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@deflector.length()){ deflector = (_arg2.getElementByName(_arg1.@deflector) as Deflector); }; } } }//package idv.cjcat.stardust.twoD.actions.triggers
Section 165
//ZoneTrigger (idv.cjcat.stardust.twoD.actions.triggers.ZoneTrigger) package idv.cjcat.stardust.twoD.actions.triggers { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.twoD.zones.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.particles.*; public class ZoneTrigger extends ActionTrigger2D { private var _zone:Zone; public function ZoneTrigger(_arg1:Zone=null){ this.zone = _arg1; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@zone = _zone.name; return (_local1); } override public function getXMLTagName():String{ return ("ZoneTrigger"); } public function get zone():Zone{ return (_zone); } override public function testTrigger(_arg1:Emitter, _arg2:Particle, _arg3:Number):Boolean{ var _local4:Particle2D; _local4 = (_arg2 as Particle2D); return (_zone.contains(_local4.x, _local4.y)); } override public function getRelatedObjects():Array{ return ([_zone]); } public function set zone(_arg1:Zone):void{ if (!_arg1){ _arg1 = new SinglePoint(0, 0); }; _zone = _arg1; } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@zone.length()){ zone = (_arg2.getElementByName(_arg1.@zone) as Zone); }; } } }//package idv.cjcat.stardust.twoD.actions.triggers
Section 166
//Accelerate (idv.cjcat.stardust.twoD.actions.Accelerate) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.twoD.particles.*; public class Accelerate extends Action2D { public var acceleration:Number; public function Accelerate(_arg1:Number=0.1){ this.acceleration = _arg1; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D; var _local5:Vec2D; _local4 = (_arg2 as Particle2D); _local5 = Vec2DPool.get(_local4.vx, _local4.vy); if (_local5.length > 0){ _local5.length = (_local5.length + (acceleration * _arg3)); _local4.vx = _local5.x; _local4.vy = _local5.y; }; Vec2DPool.recycle(_local5); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@acceleration.length()){ acceleration = parseFloat(_arg1.@acceleration); }; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@acceleration = acceleration; return (_local1); } override public function getXMLTagName():String{ return ("Accelerate"); } } }//package idv.cjcat.stardust.twoD.actions
Section 167
//Action2D (idv.cjcat.stardust.twoD.actions.Action2D) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.actions.*; public class Action2D extends Action { public function Action2D(){ _supports3D = false; priority = Action2DPriority.getInstance().getPriority((Object(this).constructor as Class)); } override public function getXMLTagName():String{ return ("Action2D"); } } }//package idv.cjcat.stardust.twoD.actions
Section 168
//Action2DPriority (idv.cjcat.stardust.twoD.actions.Action2DPriority) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.actions.*; import idv.cjcat.stardust.twoD.actions.triggers.*; public class Action2DPriority extends ActionPriority { private static var _instance:Action2DPriority; final override protected function populatePriorities():void{ priorities[Damping] = -1; priorities[DeathZone] = -1; priorities[VelocityField] = -2; priorities[Gravity] = -3; priorities[MutualGravity] = -3; priorities[Move] = -4; priorities[Spin] = -4; priorities[Deflect] = -5; priorities[Collide] = -6; priorities[DeathZone] = -6; priorities[Oriented] = -6; priorities[ZoneTrigger] = -6; priorities[DeflectorTrigger] = -6; priorities[SnapshotRestore] = -7; } public static function getInstance():Action2DPriority{ if (!_instance){ _instance = new (Action2DPriority); }; return (_instance); } } }//package idv.cjcat.stardust.twoD.actions
Section 169
//Collide (idv.cjcat.stardust.twoD.actions.Collide) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.twoD.particles.*; import idv.cjcat.stardust.*; public class Collide extends MutualAction { public function Collide(){ maxDistance = 0; } override public function preUpdate(_arg1:Emitter, _arg2:Number):void{ var _local3:ParticleCollection; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Particle; var _local8:ParticleIterator; _local3 = _arg1.sd::particles; if (_local3.size <= 1){ return; }; _local4 = 0; _local5 = 0; _local8 = _local3.getIterator(); while ((_local7 = _local8.particle)) { _local6 = (_local7.collisionRadius * _local7.scale); if (_local6 > _local4){ _local5 = _local4; _local4 = _local6; } else { if (_local6 > _local5){ _local5 = _local6; }; }; _local8.next(); }; maxDistance = (_local4 + _local5); } override public function getXMLTagName():String{ return ("Collide"); } override protected function doMutualAction(_arg1:Particle2D, _arg2:Particle2D, _arg3:Number):void{ var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Vec2D; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Vec2D; var _local17:Vec2D; var _local18:Vec2D; var _local19:Vec2D; var _local20:Vec2D; var _local21:Number; _local4 = (_arg1.x - _arg2.x); _local5 = (_arg1.y - _arg2.y); _local6 = (_arg1.collisionRadius * _arg1.scale); _local7 = (_arg2.collisionRadius * _arg2.scale); _local8 = (_local6 + _local7); if (((_local4 * _local4) + (_local5 * _local5)) > (_local8 * _local8)){ return; }; _local9 = Vec2DPool.get(_local4, _local5); _local10 = (1 / _local8); _local11 = (((_arg1.x * _local7) + (_arg2.x * _local6)) * _local10); _local12 = (((_arg1.y * _local7) + (_arg2.y * _local6)) * _local10); _local9.length = _local6; _arg1.x = (_local11 + _local9.x); _arg1.y = (_local12 + _local9.y); _local9.length = _local7; _arg2.x = (_local11 - _local9.x); _arg2.y = (_local12 - _local9.y); _local13 = (_arg1.mass * _arg1.scale); _local14 = (_arg2.mass * _arg2.scale); _local15 = (1 / (_local13 + _local14)); _local16 = Vec2DPool.get(_arg1.vx, _arg1.vy); _local17 = Vec2DPool.get(_arg2.vx, _arg2.vy); _local16.projectThis(_local9); _local17.projectThis(_local9); _local18 = Vec2DPool.get((_arg1.vx - _local16.x), (_arg1.vy - _local16.y)); _local19 = Vec2DPool.get((_arg2.vx - _local17.x), (_arg2.vy - _local17.y)); _local20 = Vec2DPool.get((_local16.x - _local17.x), (_local16.y - _local17.y)); _local21 = (_local13 - _local14); _local16.x = (((_local21 * _local16.x) + ((2 * _local14) * _local17.x)) * _local15); _local16.y = (((_local21 * _local16.y) + ((2 * _local14) * _local17.y)) * _local15); _local17.x = (_local20.x + _local16.x); _local17.y = (_local20.y + _local16.y); _arg1.vx = (_local16.x + _local18.x); _arg1.vy = (_local16.y + _local18.y); _arg2.vx = (_local17.x + _local19.x); _arg2.vy = (_local17.y + _local19.y); Vec2DPool.recycle(_local9); Vec2DPool.recycle(_local16); Vec2DPool.recycle(_local17); Vec2DPool.recycle(_local18); Vec2DPool.recycle(_local19); Vec2DPool.recycle(_local20); } } }//package idv.cjcat.stardust.twoD.actions
Section 170
//Damping (idv.cjcat.stardust.twoD.actions.Damping) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.particles.*; public class Damping extends Action2D { public var damping:Number; private var damp:Number; public function Damping(_arg1:Number=0){ this.damping = _arg1; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D; _local4 = (_arg2 as Particle2D); (_arg2 as Particle2D).vx = (_local4.vx * damp); _local4.vy = (_local4.vy * damp); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@damping.length()){ damping = parseFloat(_arg1.@damping); }; } override public function preUpdate(_arg1:Emitter, _arg2:Number):void{ damp = 1; if (damping){ damp = Math.pow((1 - damping), _arg2); }; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@damping = damping; return (_local1); } override public function getXMLTagName():String{ return ("Damping"); } } }//package idv.cjcat.stardust.twoD.actions
Section 171
//DeathZone (idv.cjcat.stardust.twoD.actions.DeathZone) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.twoD.zones.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.particles.*; public class DeathZone extends Action2D { public var zone:Zone; public var inverted:Boolean; public function DeathZone(_arg1:Zone=null, _arg2:Boolean=false){ this.zone = _arg1; this.inverted = _arg2; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D; var _local5:Boolean; if (!zone){ return; }; _local4 = (_arg2 as Particle2D); _local5 = zone.contains(_local4.x, _local4.y); if (inverted){ _local5 = !(_local5); }; if (_local5){ _arg2.isDead = true; }; } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@zone == "null"){ zone = null; } else { if (_arg1.@zone.length()){ zone = (_arg2.getElementByName(_arg1.@zone) as Zone); }; }; if (_arg1.@inverted.length()){ inverted = (_arg1.@inverted == "true"); }; } override public function getRelatedObjects():Array{ if (!zone){ return ([]); }; return ([zone]); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); if (!zone){ _local1.@zone = "null"; } else { _local1.@zone = zone.name; }; _local1.@inverted = inverted; return (_local1); } override public function getXMLTagName():String{ return ("DeathZone"); } } }//package idv.cjcat.stardust.twoD.actions
Section 172
//Deflect (idv.cjcat.stardust.twoD.actions.Deflect) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.twoD.particles.*; import idv.cjcat.stardust.twoD.deflectors.*; import idv.cjcat.stardust.*; public class Deflect extends Action2D { private var deflector:Deflector; private var p2D:Particle2D; sd var deflectors:Array; private var md4D:MotionData4D; public function Deflect(){ deflectors = []; } public function clearDeflectors():void{ deflectors = []; } override public function toXML():XML{ var _local1:XML; var _local2:Deflector; _local1 = super.toXML(); if (deflectors.length > 0){ _local1.appendChild(<deflectors/> ); for each (_local2 in deflectors) { _local1.deflectors.appendChild(_local2.getXMLTag()); }; }; return (_local1); } override public function getXMLTagName():String{ return ("Deflect"); } public function removeDeflector(_arg1:Deflector):void{ var _local2:int; _local2 = deflectors.indexOf(_arg1); if (_local2 >= 0){ deflectors.splice(_local2, 1); }; } public function addDeflector(_arg1:Deflector):void{ if (deflectors.indexOf(_arg1) < 0){ deflectors.push(_arg1); }; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ p2D = (_arg2 as Particle2D); for each (deflector in deflectors) { md4D = deflector.getMotionData4D(p2D); if (md4D){ p2D.dictionary[deflector] = true; p2D.x = md4D.x; p2D.y = md4D.y; p2D.vx = md4D.vx; p2D.vy = md4D.vy; md4D = null; } else { p2D.dictionary[deflector] = false; }; }; } override public function getRelatedObjects():Array{ return (deflectors); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ var _local3:XML; super.parseXML(_arg1, _arg2); clearDeflectors(); for each (_local3 in _arg1.deflectors.*) { addDeflector((_arg2.getElementByName(_local3.@name) as Deflector)); }; } } }//package idv.cjcat.stardust.twoD.actions
Section 173
//Gravity (idv.cjcat.stardust.twoD.actions.Gravity) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.twoD.particles.*; import idv.cjcat.stardust.twoD.fields.*; import idv.cjcat.stardust.*; public class Gravity extends Action2D { private var md2D:MotionData2D; sd var fields:Array; private var p2D:Particle2D; private var field:Field; public function Gravity(){ fields = []; } override public function toXML():XML{ var _local1:XML; var _local2:Field; _local1 = super.toXML(); if (fields.length > 0){ _local1.appendChild(<fields/> ); for each (_local2 in fields) { _local1.fields.appendChild(_local2.getXMLTag()); }; }; return (_local1); } override public function getXMLTagName():String{ return ("Gravity"); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ p2D = (_arg2 as Particle2D); for each (field in fields) { md2D = field.getMotionData2D(p2D); if (md2D){ p2D.vx = (p2D.vx + (md2D.x * _arg3)); p2D.vy = (p2D.vy + (md2D.y * _arg3)); MotionData2DPool.recycle(md2D); }; }; } public function addField(_arg1:Field):void{ if (fields.indexOf(_arg1) < 0){ fields.push(_arg1); }; } public function removeField(_arg1:Field):void{ var _local2:int; _local2 = fields.indexOf(_arg1); if (_local2 >= 0){ fields.splice(_local2, 1); }; } override public function getRelatedObjects():Array{ return (fields); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ var _local3:XML; super.parseXML(_arg1, _arg2); clearFields(); for each (_local3 in _arg1.fields.*) { addField((_arg2.getElementByName(_local3.@name) as Field)); }; } public function clearFields():void{ fields = []; } } }//package idv.cjcat.stardust.twoD.actions
Section 174
//Move (idv.cjcat.stardust.twoD.actions.Move) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.particles.*; public class Move extends Action2D { public var multiplier:Number; private var p2D:Particle2D; private var factor:Number; public function Move(_arg1:Number=1){ this.multiplier = _arg1; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@multiplier = multiplier; return (_local1); } override public function getXMLTagName():String{ return ("Move"); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ p2D = (_arg2 as Particle2D); p2D.x = (p2D.x + (p2D.vx * factor)); p2D.y = (p2D.y + (p2D.vy * factor)); } override public function preUpdate(_arg1:Emitter, _arg2:Number):void{ factor = (_arg2 * multiplier); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@multiplier.length()){ multiplier = parseFloat(_arg1.@multiplier); }; } } }//package idv.cjcat.stardust.twoD.actions
Section 175
//MutualAction (idv.cjcat.stardust.twoD.actions.MutualAction) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.particles.*; public class MutualAction extends Action2D { private var j:ParticleListIterator; public var maxDistance:Number; public function MutualAction(){ j = new ParticleListIterator(); super(); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D; var _local5:Particle2D; var _local6:ParticleIterator; _local4 = (_arg2 as Particle2D); _local6 = _arg2.sortedIndexIterator; while ((_local4 = (_local6.particle as Particle2D))) { _local4.sortedIndexIterator.dump(j); j.next(); while ((_local5 = (j.particle as Particle2D))) { if ((_local5.x - _local4.x) <= maxDistance){ if ((_local4.mask & _local5.mask)){ doMutualAction(_local4, _local5, _arg3); }; } else { break; }; j.next(); }; _local6.next(); }; } final override public function get needsSortedParticles():Boolean{ return (active); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@maxDistance.length()){ maxDistance = parseFloat(_arg1.@maxDistance); }; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@maxDistance = maxDistance; return (_local1); } override public function getXMLTagName():String{ return ("MutualAction"); } protected function doMutualAction(_arg1:Particle2D, _arg2:Particle2D, _arg3:Number):void{ } } }//package idv.cjcat.stardust.twoD.actions
Section 176
//MutualGravity (idv.cjcat.stardust.twoD.actions.MutualGravity) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.twoD.particles.*; public class MutualGravity extends MutualAction { public var attenuationPower:Number; public var massless:Boolean; public var strength:Number; public var epsilon:Number; public function MutualGravity(_arg1:Number=1, _arg2:Number=100, _arg3:Number=1){ this.strength = _arg1; this.maxDistance = _arg2; this.epsilon = 1; this.attenuationPower = _arg3; this.massless = true; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@strength = strength; _local1.@epsilon = epsilon; _local1.@attenuationPower = attenuationPower; _local1.@massless = massless; return (_local1); } override public function getXMLTagName():String{ return ("MutualGravity"); } override protected function doMutualAction(_arg1:Particle2D, _arg2:Particle2D, _arg3:Number):void{ var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Vec2D; var _local8:Number; _local4 = (_arg1.x - _arg2.x); _local5 = (_arg1.y - _arg2.y); _local6 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5))); if (_local6 < epsilon){ _local6 = epsilon; }; _local7 = Vec2DPool.get(_local4, _local5); if (massless){ _local7.length = (strength * Math.pow(_local6, -(attenuationPower))); _arg2.vx = (_arg2.vx + (_local7.x * _arg3)); _arg2.vy = (_arg2.vy + (_local7.y * _arg3)); _arg1.vx = (_arg1.vx - (_local7.x * _arg3)); _arg1.vy = (_arg1.vy - (_local7.y * _arg3)); } else { _local8 = (((strength * _arg1.mass) * _arg2.mass) * Math.pow(_local6, -(attenuationPower))); _local7.length = (_local8 / _arg2.mass); _arg2.vx = (_arg2.vx + (_local7.x * _arg3)); _arg2.vy = (_arg2.vy + (_local7.y * _arg3)); _local7.length = (_local8 / _arg1.mass); _arg1.vx = (_arg1.vx - (_local7.x * _arg3)); _arg1.vy = (_arg1.vy - (_local7.y * _arg3)); }; Vec2DPool.recycle(_local7); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@strength.length()){ strength = parseFloat(_arg1.@strength); }; if (_arg1.@epsilon.length()){ epsilon = parseFloat(_arg1.@epsilon); }; if (_arg1.@attenuationPower.length()){ attenuationPower = parseFloat(_arg1.@attenuationPower); }; if (_arg1.@massless.length()){ massless = (_arg1.@massless == "true"); }; } } }//package idv.cjcat.stardust.twoD.actions
Section 177
//Oriented (idv.cjcat.stardust.twoD.actions.Oriented) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.math.*; import idv.cjcat.stardust.twoD.particles.*; public class Oriented extends Action2D { private var os:Number; public var offset:Number; public var factor:Number; private var f:Number; public function Oriented(_arg1:Number=1, _arg2:Number=0){ this.factor = _arg1; this.offset = _arg2; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@factor = factor; _local1.@offset = offset; return (_local1); } override public function getXMLTagName():String{ return ("Oriented"); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D; var _local5:Number; _local4 = (_arg2 as Particle2D); _local5 = (((Math.atan2(_local4.vy, _local4.vx) * StardustMath.RADIAN_TO_DEGREE) + os) - _local4.rotation); _local4.rotation = (_local4.rotation + (f * _local5)); } override public function preUpdate(_arg1:Emitter, _arg2:Number):void{ f = Math.pow(factor, (1 / _arg2)); os = (offset + 90); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@factor.length()){ factor = parseFloat(_arg1.@factor); }; if (_arg1.@offset.length()){ offset = parseFloat(_arg1.@offset); }; } } }//package idv.cjcat.stardust.twoD.actions
Section 178
//Snapshot (idv.cjcat.stardust.twoD.actions.Snapshot) package idv.cjcat.stardust.twoD.actions { import flash.events.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.particles.*; public class Snapshot extends Action2D { private var _snapshotTaken:Boolean;// = true public function Snapshot(){ _snapshotTaken = true; super(); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D; _local4 = (_arg2 as Particle2D); if (_snapshotTaken){ skipThisAction = true; return; }; _local4.dictionary[Snapshot] = new SnapshotData(_local4); } override public function postUpdate(_arg1:Emitter, _arg2:Number):void{ if (!_snapshotTaken){ _snapshotTaken = true; }; } override public function getXMLTagName():String{ return ("Snapshot"); } public function takeSnapshot(_arg1:Event=null):void{ _snapshotTaken = false; } } }//package idv.cjcat.stardust.twoD.actions
Section 179
//SnapshotData (idv.cjcat.stardust.twoD.actions.SnapshotData) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.twoD.particles.*; class SnapshotData { public var scale:Number; public var x:Number; public var y:Number; public var rotation:Number; function SnapshotData(_arg1:Particle2D){ this.x = _arg1.x; this.y = _arg1.y; this.rotation = _arg1.rotation; this.scale = _arg1.scale; } } }//package idv.cjcat.stardust.twoD.actions
Section 180
//SnapshotRestore (idv.cjcat.stardust.twoD.actions.SnapshotRestore) package idv.cjcat.stardust.twoD.actions { import flash.events.*; import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.math.*; import idv.cjcat.stardust.twoD.particles.*; import idv.cjcat.stardust.twoD.events.*; import idv.cjcat.stardust.common.easing.*; public class SnapshotRestore extends Action2D { private var _durationKey:Object; public var flags:int; private var _started2:Boolean;// = false private var _counter:Number; private var _started:Boolean;// = false private var _maxDuration:Number; private var _curve:Function; private var _duration:Random; public function SnapshotRestore(_arg1:Random=null, _arg2:int=1, _arg3:Function=null){ _started = false; _started2 = false; _durationKey = {}; super(); this.duration = _arg1; this.flags = _arg2; this.curve = _arg3; } override public function postUpdate(_arg1:Emitter, _arg2:Number):void{ if (_started2){ _started2 = false; }; if (_started){ if (_counter >= _maxDuration){ _started = false; dispatchEvent(new SnapshotRestoreEvent(SnapshotRestoreEvent.COMPLETE)); }; }; } public function get duration():Random{ return (_duration); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@duration = duration.name; _local1.@flags = flags; _local1.@curve = EasingFunctionType.functions[curve]; return (_local1); } override public function getXMLTagName():String{ return ("SnapshotRestore"); } public function set duration(_arg1:Random):void{ if (!_arg1){ _arg1 = new UniformRandom(0, 0); }; _duration = _arg1; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D; var _local5:SnapshotData; var _local6:SnapshotData; var _local7:Number; var _local8:Number; if (!_started){ skipThisAction = true; return; }; _local4 = (_arg2 as Particle2D); if (!_local4.dictionary[Snapshot]){ return; }; if (_started2){ _local4.dictionary[SnapshotRestore] = new SnapshotData(_local4); _local4.dictionary[_durationKey] = _duration.random(); }; _local5 = (_local4.dictionary[SnapshotRestore] as SnapshotData); _local6 = (_local4.dictionary[Snapshot] as SnapshotData); _local7 = _local4.dictionary[_durationKey]; _local8 = StardustMath.clamp(_counter, 0, _local7); if ((flags & SnapshotRestoreFlag.POSITION)){ _local4.x = curve.apply(null, [_local8, _local5.x, (_local6.x - _local5.x), _local7]); _local4.y = curve.apply(null, [_local8, _local5.y, (_local6.y - _local5.y), _local7]); }; if ((flags & SnapshotRestoreFlag.ROTATION)){ _local4.rotation = curve.apply(null, [_local8, _local5.rotation, (_local6.rotation - _local5.rotation), _local7]); }; if ((flags & SnapshotRestoreFlag.SCALE)){ _local4.scale = curve.apply(null, [_local8, _local5.scale, (_local6.scale - _local5.scale), _local7]); }; _local4.vx = (_local4.vy = (_local4.omega = 0)); } override public function preUpdate(_arg1:Emitter, _arg2:Number):void{ _counter = (_counter + _arg2); _counter = StardustMath.clamp(_counter, 0, _maxDuration); } public function set curve(_arg1:Function):void{ if (_arg1 == null){ _arg1 = Linear.easeOut; }; _curve = _arg1; } override public function getRelatedObjects():Array{ return ([_duration]); } public function start(_arg1:Event=null):void{ _started = true; _started2 = true; _counter = 0; _maxDuration = _duration.getRange()[1]; } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@duration.length()){ duration = (_arg2.getElementByName(_arg1.@duration) as Random); }; if (_arg1.@flags.length()){ flags = parseInt(_arg1.@flags); }; if (_arg1.@curve.length()){ curve = EasingFunctionType.functions[_arg1.@curve.toString()]; }; } public function get curve():Function{ return (_curve); } } }//package idv.cjcat.stardust.twoD.actions
Section 181
//SnapshotRestoreFlag (idv.cjcat.stardust.twoD.actions.SnapshotRestoreFlag) package idv.cjcat.stardust.twoD.actions { public class SnapshotRestoreFlag { public static const ALL:int = ((POSITION | ROTATION) | SCALE); public static const POSITION:int = 1; public static const SCALE:int = (1 << 3); public static const ROTATION:int = (1 << 2); } }//package idv.cjcat.stardust.twoD.actions
Section 182
//Spin (idv.cjcat.stardust.twoD.actions.Spin) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.particles.*; public class Spin extends Action2D { public var multiplier:Number; private var p2D:Particle2D; private var factor:Number; public function Spin(_arg1:Number=1){ this.multiplier = _arg1; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@multiplier = multiplier; return (_local1); } override public function getXMLTagName():String{ return ("Spin"); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ p2D = (_arg2 as Particle2D); p2D.rotation = (p2D.rotation + (p2D.omega * factor)); } override public function preUpdate(_arg1:Emitter, _arg2:Number):void{ factor = (_arg2 * multiplier); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@multiplier.length()){ multiplier = parseFloat(_arg1.@multiplier); }; } } }//package idv.cjcat.stardust.twoD.actions
Section 183
//VelocityField (idv.cjcat.stardust.twoD.actions.VelocityField) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.twoD.particles.*; import idv.cjcat.stardust.twoD.fields.*; public class VelocityField extends Action2D { public var field:Field; public function VelocityField(_arg1:Field=null){ this.field = _arg1; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D; var _local5:MotionData2D; if (!field){ return; }; _local4 = (_arg2 as Particle2D); _local5 = field.getMotionData2D(_local4); _local4.vx = _local5.x; _local4.vy = _local5.y; MotionData2DPool.recycle(_local5); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@field == "null"){ field = null; } else { if (_arg1.@field.length()){ field = (_arg2.getElementByName(_arg1.@field) as Field); }; }; } override public function getRelatedObjects():Array{ if (field != null){ return ([field]); }; return ([]); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); if (!field){ _local1.@field = "null"; } else { _local1.@field = field.name; }; return (_local1); } override public function getXMLTagName():String{ return ("VelocityField"); } } }//package idv.cjcat.stardust.twoD.actions
Section 184
//Deflector (idv.cjcat.stardust.twoD.deflectors.Deflector) package idv.cjcat.stardust.twoD.deflectors { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.common.*; import idv.cjcat.stardust.twoD.particles.*; public class Deflector extends StardustElement { public var bounce:Number; public var active:Boolean; public function Deflector(){ active = true; bounce = 0.8; } override public function getElementTypeXMLTag():XML{ return (<deflectors/> ); } protected function calculateMotionData4D(_arg1:Particle2D):MotionData4D{ return (null); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@active = active; _local1.@bounce = bounce; return (_local1); } override public function getXMLTagName():String{ return ("Deflector"); } final public function getMotionData4D(_arg1:Particle2D):MotionData4D{ if (active){ return (calculateMotionData4D(_arg1)); }; return (null); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@active.length()){ active = (_arg1.@active == "true"); }; if (_arg1.@bounce.length()){ bounce = parseFloat(_arg1.@bounce); }; } } }//package idv.cjcat.stardust.twoD.deflectors
Section 185
//AddChildMode (idv.cjcat.stardust.twoD.display.AddChildMode) package idv.cjcat.stardust.twoD.display { public class AddChildMode { public static const RANDOM:int = 0; public static const TOP:int = 1; public static const BOTTOM:int = 2; } }//package idv.cjcat.stardust.twoD.display
Section 186
//IStardustSprite (idv.cjcat.stardust.twoD.display.IStardustSprite) package idv.cjcat.stardust.twoD.display { import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; public interface IStardustSprite { function init(_arg1:Particle):void; function disable():void; function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void; } }//package idv.cjcat.stardust.twoD.display
Section 187
//Emitter2D (idv.cjcat.stardust.twoD.emitters.Emitter2D) package idv.cjcat.stardust.twoD.emitters { import flash.utils.*; import idv.cjcat.stardust.common.actions.*; import idv.cjcat.stardust.common.initializers.*; import idv.cjcat.stardust.common.clocks.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.twoD.particles.*; import flash.errors.*; public class Emitter2D extends Emitter { public function Emitter2D(_arg1:Clock=null){ super(_arg1); factory = new PooledParticle2DFactory(); particles = new PooledParticleList(ParticleList.TWO_D); } final override public function addInitializer(_arg1:Initializer):void{ if (!_arg1.supports2D){ throw (new IllegalOperationError(("This initializer does not support 2D: " + getQualifiedClassName((Object(_arg1).constructor as Class))))); }; super.addInitializer(_arg1); } override public function getXMLTagName():String{ return ("Emitter2D"); } final override public function addAction(_arg1:Action):void{ if (!_arg1.supports2D){ throw (new IllegalOperationError(("This action does not support 2D: " + getQualifiedClassName((Object(_arg1).constructor as Class))))); }; super.addAction(_arg1); } } }//package idv.cjcat.stardust.twoD.emitters
Section 188
//SnapshotRestoreEvent (idv.cjcat.stardust.twoD.events.SnapshotRestoreEvent) package idv.cjcat.stardust.twoD.events { import flash.events.*; public class SnapshotRestoreEvent extends Event { public static const COMPLETE:String = "stardustSnapshotRestoreComplete"; public function SnapshotRestoreEvent(_arg1:String){ super(_arg1); } } }//package idv.cjcat.stardust.twoD.events
Section 189
//Vec2DEvent (idv.cjcat.stardust.twoD.events.Vec2DEvent) package idv.cjcat.stardust.twoD.events { import flash.events.*; import idv.cjcat.stardust.twoD.geom.*; public class Vec2DEvent extends Event { private var _vec:Vec2D; public static const CHANGE:String = "stardustVec2DChange"; public function Vec2DEvent(_arg1:String, _arg2:Vec2D){ super(_arg1); _vec = _arg2; } public function get vec():Vec2D{ return (_vec); } } }//package idv.cjcat.stardust.twoD.events
Section 190
//Field (idv.cjcat.stardust.twoD.fields.Field) package idv.cjcat.stardust.twoD.fields { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.common.*; import idv.cjcat.stardust.twoD.particles.*; public class Field extends StardustElement { public var active:Boolean; public var massless:Boolean; private var mass_inv:Number; private var md2D:MotionData2D; public function Field(){ active = true; massless = true; } override public function getElementTypeXMLTag():XML{ return (<fields/> ); } final public function getMotionData2D(_arg1:Particle2D):MotionData2D{ if (!active){ return (MotionData2DPool.get(0, 0)); }; md2D = calculateMotionData2D(_arg1); if (!massless){ mass_inv = (1 / _arg1.mass); md2D.x = (md2D.x * mass_inv); md2D.y = (md2D.y * mass_inv); }; return (md2D); } protected function calculateMotionData2D(_arg1:Particle2D):MotionData2D{ return (null); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@active = active; _local1.@massless = massless; return (_local1); } override public function getXMLTagName():String{ return ("Field"); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@active.length()){ active = (_arg1.@active == "action"); }; if (_arg1.@massless.length()){ massless = (_arg1.@active == "massless"); }; } } }//package idv.cjcat.stardust.twoD.fields
Section 191
//MotionData2D (idv.cjcat.stardust.twoD.geom.MotionData2D) package idv.cjcat.stardust.twoD.geom { public class MotionData2D { public var x:Number; public var y:Number; public function MotionData2D(_arg1:Number=0, _arg2:Number=0){ this.x = _arg1; this.y = _arg2; } } }//package idv.cjcat.stardust.twoD.geom
Section 192
//MotionData2DPool (idv.cjcat.stardust.twoD.geom.MotionData2DPool) package idv.cjcat.stardust.twoD.geom { public class MotionData2DPool { private static var _vec:Array = [new MotionData2D()]; private static var _position:int = 0; public static function recycle(_arg1:MotionData2D):void{ if (_position == 0){ return; }; if (!_arg1){ return; }; _vec[(_position - 1)] = _arg1; if (_position){ _position--; }; } public static function get(_arg1:Number=0, _arg2:Number=0):MotionData2D{ var _local3:MotionData2D; var _local4:int; if (_position == _vec.length){ _vec.length = (_vec.length << 1); _local4 = _position; while (_local4 < _vec.length) { _vec[_local4] = new MotionData2D(); _local4++; }; }; _position++; _local3 = (_vec[(_position - 1)] as MotionData2D); _local3.x = _arg1; _local3.y = _arg2; return (_local3); } } }//package idv.cjcat.stardust.twoD.geom
Section 193
//MotionData4D (idv.cjcat.stardust.twoD.geom.MotionData4D) package idv.cjcat.stardust.twoD.geom { public class MotionData4D { public var vx:Number; public var vy:Number; public var x:Number; public var y:Number; public function MotionData4D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){ this.x = _arg1; this.y = _arg2; this.vx = _arg3; this.vy = _arg4; } } }//package idv.cjcat.stardust.twoD.geom
Section 194
//Vec2D (idv.cjcat.stardust.twoD.geom.Vec2D) package idv.cjcat.stardust.twoD.geom { import flash.events.*; import idv.cjcat.stardust.common.math.*; import idv.cjcat.stardust.twoD.events.*; public class Vec2D extends EventDispatcher { private var _x:Number; private var _y:Number; public function Vec2D(_arg1:Number=0, _arg2:Number=0){ _x = _arg1; _y = _arg2; } public function dot(_arg1:Vec2D):Number{ return (((_x * _arg1._x) + (_y * _arg1._y))); } public function set length(_arg1:Number):void{ var _local2:Number; if ((((_x == 0)) && ((_y == 0)))){ return; }; _local2 = (_arg1 / length); _x = (_x * _local2); _y = (_y * _local2); dispatchEvent(new Vec2DEvent(Vec2DEvent.CHANGE, this)); } public function get angle():Number{ return ((Math.atan2(_y, _x) * StardustMath.RADIAN_TO_DEGREE)); } public function projectThis(_arg1:Vec2D):void{ var _local2:Vec2D; _local2 = Vec2DPool.get(_arg1._x, _arg1._y); _local2.length = 1; _local2.length = dot(_local2); _x = _local2._x; _y = _local2._y; Vec2DPool.recycle(_local2); } public function project(_arg1:Vec2D):Vec2D{ var _local2:Vec2D; _local2 = clone(); _local2.projectThis(_arg1); return (_local2); } public function rotate(_arg1:Number, _arg2:Boolean=false):Vec2D{ var _local3:Vec2D; _local3 = new Vec2D(_x, _y); _local3.rotateThis(_arg1, _arg2); return (_local3); } public function clone():Vec2D{ return (new Vec2D(_x, _y)); } public function set y(_arg1:Number):void{ _y = _arg1; dispatchEvent(new Vec2DEvent(Vec2DEvent.CHANGE, this)); } public function rotateThis(_arg1:Number, _arg2:Boolean=false):void{ var _local3:Number; if (!_arg2){ _arg1 = (_arg1 * StardustMath.DEGREE_TO_RADIAN); }; _local3 = _x; _x = ((_local3 * Math.cos(_arg1)) - (_y * Math.sin(_arg1))); _y = ((_local3 * Math.sin(_arg1)) + (_y * Math.cos(_arg1))); dispatchEvent(new Vec2DEvent(Vec2DEvent.CHANGE, this)); } public function set(_arg1:Number, _arg2:Number):void{ _x = _arg1; _y = _arg2; dispatchEvent(new Vec2DEvent(Vec2DEvent.CHANGE, this)); } public function get length():Number{ return (Math.sqrt(((_x * _x) + (_y * _y)))); } override public function toString():String{ return (((((("[Vec2D" + " x=") + _x) + " y=") + _y) + "]")); } public function set angle(_arg1:Number):void{ var _local2:Number; var _local3:Number; _local2 = length; _local3 = (_arg1 * StardustMath.DEGREE_TO_RADIAN); _x = (_local2 * Math.cos(_local3)); _y = (_local2 * Math.sin(_local3)); dispatchEvent(new Vec2DEvent(Vec2DEvent.CHANGE, this)); } public function set x(_arg1:Number):void{ _x = _arg1; dispatchEvent(new Vec2DEvent(Vec2DEvent.CHANGE, this)); } public function unitVec():Vec2D{ var _local1:Number; if (length == 0){ return (new Vec2D()); }; _local1 = (1 / length); return (new Vec2D((_x * _local1), (_y * _local1))); } public function get x():Number{ return (_x); } public function get y():Number{ return (_y); } } }//package idv.cjcat.stardust.twoD.geom
Section 195
//Vec2DPool (idv.cjcat.stardust.twoD.geom.Vec2DPool) package idv.cjcat.stardust.twoD.geom { public class Vec2DPool { private static var _vec:Array = [new Vec2D()]; private static var _position:int = 0; public static function recycle(_arg1:Vec2D):void{ if (_position == 0){ return; }; if (!_arg1){ return; }; _vec[(_position - 1)] = _arg1; if (_position){ _position--; }; } public static function get(_arg1:Number=0, _arg2:Number=0):Vec2D{ var _local3:Vec2D; var _local4:int; if (_position == _vec.length){ _vec.length = (_vec.length << 1); _local4 = _position; while (_local4 < _vec.length) { _vec[_local4] = new Vec2D(); _local4++; }; }; _position++; _local3 = (_vec[(_position - 1)] as Vec2D); _local3.x = _arg1; _local3.y = _arg2; return (_local3); } } }//package idv.cjcat.stardust.twoD.geom
Section 196
//DisplayObjectClass (idv.cjcat.stardust.twoD.initializers.DisplayObjectClass) package idv.cjcat.stardust.twoD.initializers { import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.utils.*; public class DisplayObjectClass extends Initializer2D { public var displayObjectClass:Class; public var constructorParams:Array; public function DisplayObjectClass(_arg1:Class=null, _arg2:Array=null){ this.displayObjectClass = _arg1; this.constructorParams = _arg2; } override public function initialize(_arg1:Particle):void{ if (!displayObjectClass){ return; }; _arg1.target = construct(displayObjectClass, constructorParams); } override public function getXMLTagName():String{ return ("DisplayObjectClass"); } } }//package idv.cjcat.stardust.twoD.initializers
Section 197
//DisplayObjectParent (idv.cjcat.stardust.twoD.initializers.DisplayObjectParent) package idv.cjcat.stardust.twoD.initializers { import flash.display.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.twoD.particles.*; public class DisplayObjectParent extends Initializer2D { public var container:DisplayObjectContainer; public function DisplayObjectParent(_arg1:DisplayObjectContainer=null){ priority = -100; this.container = _arg1; } override public function initialize(_arg1:Particle):void{ var _local2:Particle2D; var _local3:DisplayObject; if (!container){ return; }; _local2 = (_arg1 as Particle2D); _local3 = (_local2.target as DisplayObject); if (!_local3){ return; }; container.addChild(_local3); } override public function getXMLTagName():String{ return ("DisplayObjectParent"); } } }//package idv.cjcat.stardust.twoD.initializers
Section 198
//Initializer2D (idv.cjcat.stardust.twoD.initializers.Initializer2D) package idv.cjcat.stardust.twoD.initializers { import idv.cjcat.stardust.common.initializers.*; public class Initializer2D extends Initializer { public function Initializer2D(){ _supports3D = false; priority = Initializer2DPriority.getInstance().getPriority((Object(this).constructor as Class)); } } }//package idv.cjcat.stardust.twoD.initializers
Section 199
//Initializer2DPriority (idv.cjcat.stardust.twoD.initializers.Initializer2DPriority) package idv.cjcat.stardust.twoD.initializers { import idv.cjcat.stardust.common.initializers.*; public class Initializer2DPriority extends InitializerPriority { private static var _instance:Initializer2DPriority; final override protected function populatePriorities():void{ priorities[DisplayObjectClass] = 1; priorities[DisplayObjectParent] = 1; priorities[PooledDisplayObjectClass] = 1; } public static function getInstance():Initializer2DPriority{ if (!_instance){ _instance = new (Initializer2DPriority); }; return (_instance); } } }//package idv.cjcat.stardust.twoD.initializers
Section 200
//PooledDisplayObjectClass (idv.cjcat.stardust.twoD.initializers.PooledDisplayObjectClass) package idv.cjcat.stardust.twoD.initializers { import flash.display.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.twoD.display.*; import idv.cjcat.stardust.twoD.utils.*; public class PooledDisplayObjectClass extends Initializer2D { private var _pool:DisplayObjectPool; private var _constructorParams:Array; private var _displayObjectClass:Class; public function PooledDisplayObjectClass(_arg1:Class=null, _arg2:Array=null){ _pool = new DisplayObjectPool(); this.displayObjectClass = _arg1; this.constructorParams = _arg2; } override public function initialize(_arg1:Particle):void{ if (!displayObjectClass){ return; }; _arg1.target = _pool.get(); } public function get constructorParams():Array{ return (_constructorParams); } override public function getXMLTagName():String{ return ("PooledDisplayObjectClass"); } public function set displayObjectClass(_arg1:Class):void{ _displayObjectClass = _arg1; _pool.reset(_displayObjectClass, _constructorParams); } override public function needsRecycle():Boolean{ return (true); } public function set constructorParams(_arg1:Array):void{ _constructorParams = _arg1; _pool.reset(_displayObjectClass, _constructorParams); } public function get displayObjectClass():Class{ return (_displayObjectClass); } override public function recycleInfo(_arg1:Particle):void{ var _local2:DisplayObject; _local2 = (_arg1.target as DisplayObject); if (_local2){ if ((_local2 is IStardustSprite)){ IStardustSprite(_local2).disable(); }; if ((_local2 is _displayObjectClass)){ _pool.recycle(_local2); }; }; } } }//package idv.cjcat.stardust.twoD.initializers
Section 201
//Position (idv.cjcat.stardust.twoD.initializers.Position) package idv.cjcat.stardust.twoD.initializers { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.twoD.zones.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.twoD.particles.*; public class Position extends Initializer2D { private var _zone:Zone; public function Position(_arg1:Zone=null){ this.zone = _arg1; } public function get zone():Zone{ return (_zone); } override public function initialize(_arg1:Particle):void{ var _local2:Particle2D; var _local3:MotionData2D; _local2 = (_arg1 as Particle2D); _local3 = zone.getPoint(); _local2.x = _local3.x; _local2.y = _local3.y; MotionData2DPool.recycle(_local3); } public function set zone(_arg1:Zone):void{ if (!_arg1){ _arg1 = new SinglePoint(0, 0); }; _zone = _arg1; } override public function getRelatedObjects():Array{ return ([_zone]); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@zone = zone.name; return (_local1); } override public function getXMLTagName():String{ return ("Position"); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@zone.length()){ zone = (_arg2.getElementByName(_arg1.@zone) as Zone); }; } } }//package idv.cjcat.stardust.twoD.initializers
Section 202
//Velocity (idv.cjcat.stardust.twoD.initializers.Velocity) package idv.cjcat.stardust.twoD.initializers { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.twoD.zones.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.twoD.particles.*; public class Velocity extends Initializer2D { private var _zone:Zone; public function Velocity(_arg1:Zone=null){ this.zone = _arg1; } public function get zone():Zone{ return (_zone); } override public function initialize(_arg1:Particle):void{ var _local2:Particle2D; var _local3:MotionData2D; _local2 = (_arg1 as Particle2D); _local3 = zone.getPoint(); _local2.vx = _local3.x; _local2.vy = _local3.y; MotionData2DPool.recycle(_local3); } public function set zone(_arg1:Zone):void{ if (!_arg1){ _arg1 = new SinglePoint(0, 0); }; _zone = _arg1; } override public function getRelatedObjects():Array{ return ([_zone]); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@zone = zone.name; return (_local1); } override public function getXMLTagName():String{ return ("Velocity"); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@zone.length()){ zone = (_arg2.getElementByName(_arg1.@zone) as Zone); }; } } }//package idv.cjcat.stardust.twoD.initializers
Section 203
//Particle2D (idv.cjcat.stardust.twoD.particles.Particle2D) package idv.cjcat.stardust.twoD.particles { import idv.cjcat.stardust.common.particles.*; public class Particle2D extends Particle { public var vx:Number; public var vy:Number; public var omega:Number; public var y:Number; public var rotation:Number; public var x:Number; override public function init():void{ super.init(); x = 0; y = 0; vx = 0; vy = 0; rotation = 0; omega = 0; } } }//package idv.cjcat.stardust.twoD.particles
Section 204
//Particle2DPool (idv.cjcat.stardust.twoD.particles.Particle2DPool) package idv.cjcat.stardust.twoD.particles { import idv.cjcat.stardust.common.particles.*; public class Particle2DPool extends ParticlePool { private static var _instance:Particle2DPool; override protected function createNewParticle():Particle{ return (new Particle2D()); } public static function getInstance():Particle2DPool{ if (!_instance){ _instance = new (Particle2DPool); }; return (_instance); } } }//package idv.cjcat.stardust.twoD.particles
Section 205
//PooledParticle2DFactory (idv.cjcat.stardust.twoD.particles.PooledParticle2DFactory) package idv.cjcat.stardust.twoD.particles { import idv.cjcat.stardust.common.particles.*; public class PooledParticle2DFactory extends PooledParticleFactory { public function PooledParticle2DFactory(){ particlePool = Particle2DPool.getInstance(); } } }//package idv.cjcat.stardust.twoD.particles
Section 206
//DisplayObjectRenderer (idv.cjcat.stardust.twoD.renderers.DisplayObjectRenderer) package idv.cjcat.stardust.twoD.renderers { import flash.display.*; import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.events.*; import idv.cjcat.stardust.twoD.particles.*; import idv.cjcat.stardust.common.renderers.*; import idv.cjcat.stardust.twoD.display.*; public class DisplayObjectRenderer extends Renderer { public var forceParentChange:Boolean; public var container:DisplayObjectContainer; public var addChildMode:int; public function DisplayObjectRenderer(_arg1:DisplayObjectContainer=null, _arg2:int=0){ this.container = _arg1; this.addChildMode = _arg2; forceParentChange = false; } override protected function particlesAdded(_arg1:EmitterEvent):void{ var _local2:Particle; var _local3:ParticleIterator; var _local4:DisplayObject; if (!container){ return; }; _local3 = _arg1.particles.getIterator(); while ((_local2 = _local3.particle)) { _local4 = (_local2.target as DisplayObject); if (!forceParentChange){ //unresolved if _local3.next(); } else { switch (addChildMode){ case AddChildMode.RANDOM: container.addChildAt(_local4, Math.floor((Math.random() * container.numChildren))); break; case AddChildMode.TOP: container.addChild(_local4); break; case AddChildMode.BOTTOM: container.addChildAt(_local4, 0); break; default: container.addChildAt(_local4, Math.floor((Math.random() * container.numChildren))); break; }; _local3.next(); }; }; } override public function getXMLTagName():String{ return ("DisplayObjectRenderer"); } override protected function render(_arg1:EmitterEvent):void{ var _local2:Particle2D; var _local3:ParticleIterator; var _local4:DisplayObject; _local3 = _arg1.particles.getIterator(); while ((_local2 = (_local3.particle as Particle2D))) { _local4 = (_local2.target as DisplayObject); _local4.x = _local2.x; _local4.y = _local2.y; _local4.rotation = _local2.rotation; _local4.scaleX = (_local4.scaleY = _local2.scale); _local4.alpha = _local2.alpha; _local3.next(); }; } override protected function particlesRemoved(_arg1:EmitterEvent):void{ var _local2:Particle; var _local3:ParticleIterator; var _local4:DisplayObject; _local3 = _arg1.particles.getIterator(); while ((_local2 = _local3.particle)) { _local4 = (_local2.target as DisplayObject); if (_local4.parent){ DisplayObjectContainer(_local4.parent).removeChild(_local4); }; _local3.next(); }; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@addChildMode = addChildMode; _local1.@forceParentChange = forceParentChange; return (_local1); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@addChildMode.length()){ addChildMode = parseInt(_arg1.@addChildMode); }; if (_arg1.@forceParentChange.length()){ forceParentChange = (_arg1.@forceParentChange == "true"); }; } } }//package idv.cjcat.stardust.twoD.renderers
Section 207
//DisplayObjectPool (idv.cjcat.stardust.twoD.utils.DisplayObjectPool) package idv.cjcat.stardust.twoD.utils { import flash.display.*; import idv.cjcat.stardust.common.utils.*; public class DisplayObjectPool { private var _params:Array; private var _position:int;// = 0 private var i:int;// = 0 private var _vec:Array; private var _class:Class; private static var DEFAULT_SIZE:int = 32; public function DisplayObjectPool(){ _vec = []; _position = 0; i = 0; super(); } public function reset(_arg1:Class, _arg2:Array):void{ var _local3:int; _vec = new Array(DEFAULT_SIZE); _class = _arg1; _params = _arg2; _local3 = 0; while (_local3 < DEFAULT_SIZE) { _vec[_local3] = construct(_class, _params); _local3++; }; } public function recycle(_arg1:DisplayObject):void{ if (_position == 0){ return; }; if (!_arg1){ return; }; _vec[(_position - 1)] = _arg1; _position--; if (_position < 0){ _position = 0; }; if (_vec.length >= 16){ if (_position < (_vec.length >> 4)){ _vec.length = (_vec.length >> 1); }; }; } public function get():DisplayObject{ var _local1:int; if (_position == _vec.length){ _vec.length = (_vec.length << 1); _local1 = _position; while (_local1 < _vec.length) { _vec[_local1] = construct(_class, _params); _local1++; }; }; _position++; return ((_vec[(_position - 1)] as DisplayObject)); } } }//package idv.cjcat.stardust.twoD.utils
Section 208
//Contour (idv.cjcat.stardust.twoD.zones.Contour) package idv.cjcat.stardust.twoD.zones { import idv.cjcat.stardust.common.xml.*; public class Contour extends Zone { private var _virtualThickness:Number; public function Contour(){ _virtualThickness = 1; } final public function set virtualThickness(_arg1:Number):void{ _virtualThickness = _arg1; updateArea(); } override public function getXMLTagName():String{ return ("Contour"); } final public function get virtualThickness():Number{ return (_virtualThickness); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@virtualThickness.length()){ virtualThickness = parseFloat(_arg1.@virtualThickness); }; } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@virtualThickness = virtualThickness; return (_local1); } } }//package idv.cjcat.stardust.twoD.zones
Section 209
//LazySectorZone (idv.cjcat.stardust.twoD.zones.LazySectorZone) package idv.cjcat.stardust.twoD.zones { import flash.events.*; import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.twoD.events.*; public class LazySectorZone extends SectorZone { private var _directionVar:Number; private var _direction:Vec2D; private var _radius:Number; private var _radiusVar:Number; public function LazySectorZone(_arg1:Number=50, _arg2:Number=50){ _radius = _arg1; _radiusVar = _arg2; _direction = new Vec2D(0, -1); _direction.addEventListener(Vec2DEvent.CHANGE, updateSector); _directionVar = 180; updateSector(); } public function get radius():Number{ return (_radius); } override public function toXML():XML{ var _local1:XML; _local1 = getXMLTag(); _local1.@radius = radius; _local1.@radiusVar = radiusVar; _local1.@directionX = direction.x; _local1.@directionY = direction.y; _local1.@directionVar = directionVar; return (_local1); } override public function getXMLTagName():String{ return ("LazySectorZone"); } public function updateSector(_arg1:Event=null):void{ minRadius = (_radius - _radiusVar); maxRadius = (_radius + _radiusVar); minAngle = (_direction.angle - _directionVar); maxAngle = (_direction.angle + _directionVar); updateArea(); } public function get directionVar():Number{ return (_directionVar); } public function set radius(_arg1:Number):void{ _radius = _arg1; updateSector(); } public function get radiusVar():Number{ return (_radiusVar); } public function set directionVar(_arg1:Number):void{ _directionVar = _arg1; updateSector(); } public function set radiusVar(_arg1:Number):void{ _radiusVar = _arg1; updateSector(); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ var _local3:Number; var _local4:Number; super.parseXML(_arg1, _arg2); _direction.removeEventListener(Vec2DEvent.CHANGE, updateSector); if (_arg1.@radius.length()){ _radius = parseFloat(_arg1.@radius); }; if (_arg1.@radiusVar.length()){ _radiusVar = parseFloat(_arg1.@radiusVar); }; _local3 = 0; _local4 = 0; if (_arg1.@directionX.length()){ _local3 = parseFloat(_arg1.@directionX); }; if (_arg1.@directionY.length()){ _local4 = parseFloat(_arg1.@directionY); }; _direction.set(_local3, _local4); if (_arg1.@directionVar.length()){ _directionVar = parseFloat(_arg1.@directionVar); }; updateSector(); _direction.addEventListener(Vec2DEvent.CHANGE, updateSector); } public function get direction():Vec2D{ return (_direction); } } }//package idv.cjcat.stardust.twoD.zones
Section 210
//SectorZone (idv.cjcat.stardust.twoD.zones.SectorZone) package idv.cjcat.stardust.twoD.zones { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.common.math.*; public class SectorZone extends Zone { private var _minAngle:Number; private var _minRadius:Number; private var _maxAngleRad:Number; private var _r1SQ:Number; private var _maxRadius:Number; private var _randomT:Random; private var _maxAngle:Number; private var _r2SQ:Number; private var _minAngleRad:Number; public var x:Number; public var y:Number; public function SectorZone(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=100, _arg5:Number=0, _arg6:Number=360){ _randomT = new UniformRandom(); this.x = _arg1; this.y = _arg2; this._minRadius = _arg3; this._maxRadius = _arg4; this._minAngle = _arg5; this._maxAngle = _arg6; updateArea(); } public function get minRadius():Number{ return (_minRadius); } public function set maxAngle(_arg1:Number):void{ _maxAngle = _arg1; updateArea(); } override public function contains(_arg1:Number, _arg2:Number):Boolean{ return (false); } public function set minRadius(_arg1:Number):void{ _minRadius = _arg1; updateArea(); } public function get minAngle():Number{ return (_minAngle); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@x = x; _local1.@y = y; _local1.@minRadius = minRadius; _local1.@maxRadius = maxRadius; _local1.@minAngle = minAngle; _local1.@maxAngle = maxAngle; return (_local1); } override public function getXMLTagName():String{ return ("SectorZone"); } public function get maxRadius():Number{ return (_maxRadius); } public function set maxRadius(_arg1:Number):void{ _maxRadius = _arg1; updateArea(); } public function set minAngle(_arg1:Number):void{ _minAngle = _arg1; updateArea(); } public function get maxAngle():Number{ return (_maxAngle); } override public function calculateMotionData2D():MotionData2D{ var _local1:Number; var _local2:Number; if (_maxRadius == 0){ return (new MotionData2D(x, y)); }; _randomT.setRange(_minAngleRad, _maxAngleRad); _local1 = _randomT.random(); _local2 = StardustMath.interpolate(0, _minRadius, 1, _maxRadius, Math.sqrt(Math.random())); return (new MotionData2D(((_local2 * Math.cos(_local1)) + x), ((_local2 * Math.sin(_local1)) + y))); } override public function getRelatedObjects():Array{ return ([]); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@x.length()){ x = parseFloat(_arg1.@x); }; if (_arg1.@y.length()){ y = parseFloat(_arg1.@y); }; if (_arg1.@minRadius.length()){ minRadius = parseFloat(_arg1.@minRadius); }; if (_arg1.@maxRadius.length()){ maxRadius = parseFloat(_arg1.@maxRadius); }; if (_arg1.@minAngle.length()){ minAngle = parseFloat(_arg1.@minAngle); }; if (_arg1.@maxAngle.length()){ maxAngle = parseFloat(_arg1.@maxAngle); }; } override protected function updateArea():void{ var _local1:Number; var _local2:Number; _minAngleRad = (_minAngle * StardustMath.DEGREE_TO_RADIAN); _maxAngleRad = (_maxAngle * StardustMath.DEGREE_TO_RADIAN); _local1 = (_maxAngleRad - _minAngleRad); _r1SQ = (_minRadius * _minRadius); _r2SQ = (_maxRadius * _maxRadius); _local2 = (_r2SQ - _r1SQ); area = Math.abs((_local2 * _local1)); } } }//package idv.cjcat.stardust.twoD.zones
Section 211
//SinglePoint (idv.cjcat.stardust.twoD.zones.SinglePoint) package idv.cjcat.stardust.twoD.zones { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.twoD.geom.*; public class SinglePoint extends Contour { public var y:Number; public var x:Number; public function SinglePoint(_arg1:Number=0, _arg2:Number=0){ this.x = _arg1; this.y = _arg2; } override public function calculateMotionData2D():MotionData2D{ return (MotionData2DPool.get(x, y)); } override public function getXMLTagName():String{ return ("SinglePoint"); } override public function contains(_arg1:Number, _arg2:Number):Boolean{ if ((((this.x == _arg1)) && ((this.y == _arg2)))){ return (true); }; return (false); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@x.length()){ x = parseFloat(_arg1.@x); }; if (_arg1.@y.length()){ y = parseFloat(_arg1.@y); }; } override protected function updateArea():void{ area = ((virtualThickness * virtualThickness) * Math.PI); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@x = x; _local1.@y = y; return (_local1); } } }//package idv.cjcat.stardust.twoD.zones
Section 212
//Zone (idv.cjcat.stardust.twoD.zones.Zone) package idv.cjcat.stardust.twoD.zones { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.twoD.geom.*; import idv.cjcat.stardust.common.*; public class Zone extends StardustElement { protected var area:Number; public var rotation:Number; public function Zone(){ rotation = 0; } override public function getElementTypeXMLTag():XML{ return (<zones/> ); } final public function getArea():Number{ return (area); } public function calculateMotionData2D():MotionData2D{ return (null); } final public function getPoint():MotionData2D{ var _local1:MotionData2D; var _local2:Vec2D; _local1 = calculateMotionData2D(); if (rotation != 0){ _local2 = Vec2DPool.get(_local1.x, _local1.y); _local2.rotateThis(rotation); _local1.x = _local2.x; _local1.y = _local2.y; Vec2DPool.recycle(_local2); }; return (_local1); } override public function toXML():XML{ var _local1:XML; _local1 = super.toXML(); _local1.@rotation = rotation; return (_local1); } override public function getXMLTagName():String{ return ("Zone"); } public function contains(_arg1:Number, _arg2:Number):Boolean{ return (false); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); rotation = parseFloat(_arg1.@rotation); } protected function updateArea():void{ } } }//package idv.cjcat.stardust.twoD.zones
Section 213
//sd (idv.cjcat.stardust.sd) package idv.cjcat.stardust { public namespace sd = "http://cjcat.idv/stardust"; }//package idv.cjcat.stardust
Section 214
//Stardust (idv.cjcat.stardust.Stardust) package idv.cjcat.stardust { public class Stardust { public static const BLOG:String = "http://cjcat.blogspot.com"; public static const PROJECT_NAME:String = "Stardust Particle Engine"; public static const GALLERY:String = "http://cjcat2266.deviantart.com"; public static const PROJECT_HOMEPAGE:String = "http://code.google.com/p/stardust-particle-engine"; public static const AUTHOR:String = "CJ Cat (Allen Chou)"; public static const EMAIL:String = "cjcat2266@gmail.com"; public static const VERSION:String = "1.1.132 Beta"; } }//package idv.cjcat.stardust
Section 215
//Memory (memory.Memory) package memory { import flash.net.*; public class Memory { public var arrRecords:Array; public var allowSound:Boolean;// = true public var soundVolume:Number;// = 50 public var numUnlockedLevels:uint;// = 1 private var _so:SharedObject; private static var _instance:Memory; public function Memory(_arg1:SingletonEnforcer){ arrRecords = new Array(); super(); init(); } private function init():void{ _so = SharedObject.getLocal("cubedGameData"); if (_so.data.allowSound != undefined){ allowSound = _so.data.allowSound; }; if (_so.data.soundVolume != undefined){ soundVolume = _so.data.soundVolume; }; if (_so.data.numUnlockedLevels != undefined){ numUnlockedLevels = _so.data.numUnlockedLevels; } else { updateProgress(1); }; if (_so.data.arrRecords != undefined){ arrRecords = _so.data.arrRecords; }; } public function updateRecords(_arg1:uint, _arg2:uint):void{ _arg1--; if (arrRecords[_arg1]){ if (_arg2 > arrRecords[_arg1]){ arrRecords[_arg1] = _arg2; }; } else { arrRecords[_arg1] = _arg2; }; _so.data.arrRecords = arrRecords; _so.flush(); } public function clearProgress():void{ numUnlockedLevels = 1; arrRecords = new Array(); _so.data.numUnlockedLevels = numUnlockedLevels; _so.data.arrRecords = arrRecords; _so.flush(); } public function updateProgress(_arg1:uint):void{ if (_arg1 > numUnlockedLevels){ numUnlockedLevels = _arg1; _so.data.numUnlockedLevels = numUnlockedLevels; _so.flush(); }; } public static function getInstance():Memory{ if (_instance == null){ _instance = new Memory(new SingletonEnforcer()); }; return (_instance); } } }//package memory class SingletonEnforcer { private function SingletonEnforcer(){ } }
Section 216
//MochiCoins (mochi.as3.MochiCoins) package mochi.as3 { public class MochiCoins { public static const STORE_HIDE:String = "StoreHide"; public static const NO_USER:String = "NoUser"; public static const IO_ERROR:String = "IOError"; public static const ITEM_NEW:String = "ItemNew"; public static const ITEM_OWNED:String = "ItemOwned"; public static const STORE_ITEMS:String = "StoreItems"; public static const ERROR:String = "Error"; public static const STORE_SHOW:String = "StoreShow"; public static var _inventory:MochiInventory; public static function triggerEvent(_arg1:String, _arg2:Object):void{ MochiSocial.triggerEvent(_arg1, _arg2); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ MochiSocial.removeEventListener(_arg1, _arg2); } public static function addEventListener(_arg1:String, _arg2:Function):void{ MochiSocial.addEventListener(_arg1, _arg2); } public static function getStoreItems():void{ MochiServices.send("coins_getStoreItems"); } public static function get inventory():MochiInventory{ return (_inventory); } public static function showStore(_arg1:Object=null):void{ MochiServices.bringToTop(); MochiServices.send("coins_showStore", {options:_arg1}, null, null); } public static function showItem(_arg1:Object=null):void{ if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){ trace("ERROR: showItem call must pass an Object with an item key"); return; }; MochiServices.bringToTop(); MochiServices.send("coins_showItem", {options:_arg1}, null, null); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function showVideo(_arg1:Object=null):void{ if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){ trace("ERROR: showVideo call must pass an Object with an item key"); return; }; MochiServices.bringToTop(); MochiServices.send("coins_showVideo", {options:_arg1}, null, null); } MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{ _inventory = new MochiInventory(); }); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{ _inventory = null; }); } }//package mochi.as3
Section 217
//MochiDigits (mochi.as3.MochiDigits) package mochi.as3 { public final class MochiDigits { private var Sibling:MochiDigits; private var Fragment:Number; private var Encoder:Number; public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{ Encoder = 0; setValue(_arg1, _arg2); } public function reencode():void{ var _local1:uint = int((2147483647 * Math.random())); Fragment = (Fragment ^ (_local1 ^ Encoder)); Encoder = _local1; } public function set value(_arg1:Number):void{ setValue(_arg1); } public function toString():String{ var _local1:String = String.fromCharCode((Fragment ^ Encoder)); if (Sibling != null){ _local1 = (_local1 + Sibling.toString()); }; return (_local1); } public function setValue(_arg1:Number=0, _arg2:uint=0):void{ var _local3:String = _arg1.toString(); var _temp1 = _arg2; _arg2 = (_arg2 + 1); Fragment = (_local3.charCodeAt(_temp1) ^ Encoder); if (_arg2 < _local3.length){ Sibling = new MochiDigits(_arg1, _arg2); } else { Sibling = null; }; reencode(); } public function get value():Number{ return (Number(this.toString())); } public function addValue(_arg1:Number):void{ value = (value + _arg1); } } }//package mochi.as3
Section 218
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher) package mochi.as3 { public class MochiEventDispatcher { private var eventTable:Object; public function MochiEventDispatcher():void{ eventTable = {}; } public function triggerEvent(_arg1:String, _arg2:Object):void{ var _local3:Object; if (eventTable[_arg1] == undefined){ return; }; for (_local3 in eventTable[_arg1]) { var _local6 = eventTable[_arg1]; _local6[_local3](_arg2); }; } public function removeEventListener(_arg1:String, _arg2:Function):void{ var _local3:Object; if (eventTable[_arg1] == undefined){ eventTable[_arg1] = []; return; }; for (_local3 in eventTable[_arg1]) { if (eventTable[_arg1][_local3] != _arg2){ } else { eventTable[_arg1].splice(Number(_local3), 1); }; }; } public function addEventListener(_arg1:String, _arg2:Function):void{ removeEventListener(_arg1, _arg2); eventTable[_arg1].push(_arg2); } } }//package mochi.as3
Section 219
//MochiEvents (mochi.as3.MochiEvents) package mochi.as3 { import flash.display.*; public class MochiEvents { public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL"; public static const FORMAT_LONG:String = "LongForm"; public static const ALIGN_BOTTOM:String = "ALIGN_B"; public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived"; public static const FORMAT_SHORT:String = "ShortForm"; public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR"; public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR"; public static const ALIGN_TOP:String = "ALIGN_T"; public static const ALIGN_LEFT:String = "ALIGN_L"; public static const ALIGN_RIGHT:String = "ALIGN_R"; public static const ALIGN_TOP_LEFT:String = "ALIGN_TL"; public static const ALIGN_CENTER:String = "ALIGN_C"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); private static var gameStart:Number; private static var levelStart:Number; public static function endPlay():void{ MochiServices.send("events_clearRoundID", null, null, null); } public static function addEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.addEventListener(_arg1, _arg2); } public static function trackEvent(_arg1:String, _arg2=null):void{ MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.removeEventListener(_arg1, _arg2); } public static function startSession(_arg1:String):void{ MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null); } public static function triggerEvent(_arg1:String, _arg2:Object):void{ _dispatcher.triggerEvent(_arg1, _arg2); } public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{ var _local4:Object; var _local3:Object = {}; for (_local4 in _arg2) { _local3[_local4] = _arg2[_local4]; }; _local3.clip = _arg1; MochiServices.send("events_setNotifications", _local3, null, null); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function startPlay(_arg1:String="gameplay"):void{ MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null); } } }//package mochi.as3
Section 220
//MochiInventory (mochi.as3.MochiInventory) package mochi.as3 { import flash.events.*; import flash.utils.*; public dynamic class MochiInventory extends Proxy { private var _timer:Timer; private var _names:Array; private var _syncID:Number; private var _consumableProperties:Object; private var _storeSync:Object; private var _outstandingID:Number; private var _syncPending:Boolean; public static const READY:String = "InvReady"; public static const ERROR:String = "Error"; public static const IO_ERROR:String = "IoError"; private static const KEY_SALT:String = " syncMaint"; public static const WRITTEN:String = "InvWritten"; public static const NOT_READY:String = "InvNotReady"; public static const VALUE_ERROR:String = "InvValueError"; private static const CONSUMER_KEY:String = "MochiConsumables"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); public function MochiInventory():void{ MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned); MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems); MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut); _storeSync = new Object(); _syncPending = false; _outstandingID = 0; _syncID = 0; _timer = new Timer(1000); _timer.addEventListener(TimerEvent.TIMER, sync); _timer.start(); if (MochiSocial.loggedIn){ loggedIn(); } else { loggedOut(); }; } private function newItems(_arg1:Object):void{ if (!this[(_arg1.id + KEY_SALT)]){ this[(_arg1.id + KEY_SALT)] = 0; }; if (!this[_arg1.id]){ this[_arg1.id] = 0; }; this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count); this[_arg1.id] = (this[_arg1.id] + _arg1.count); if (_arg1.privateProperties.consumable){ if (!this[_arg1.privateProperties.tag]){ this[_arg1.privateProperties.tag] = 0; }; this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count)); }; } public function release():void{ MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems); MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn); MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){ if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return (-1); }; if (_consumableProperties[_arg1]){ return (MochiDigits(_consumableProperties[_arg1]).value); }; return (undefined); } private function loggedIn(_arg1:Object=null):void{ MochiUserData.get(CONSUMER_KEY, getConsumableBag); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{ if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return (false); }; if (_consumableProperties[_arg1] == undefined){ return (false); }; return (true); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{ return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1)); } private function putConsumableBag(_arg1:MochiUserData):void{ _syncPending = false; if (_arg1.error){ triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error}); _outstandingID = -1; }; triggerEvent(WRITTEN, {}); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{ var _local3:MochiDigits; if (_consumableProperties == null){ triggerEvent(ERROR, {type:NOT_READY}); return; }; if (!(_arg2 is Number)){ triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2}); return; }; if (_consumableProperties[_arg1]){ _local3 = MochiDigits(_consumableProperties[_arg1]); if (_local3.value == _arg2){ return; }; _local3.value = _arg2; } else { _names.push(_arg1); _consumableProperties[_arg1] = new MochiDigits(_arg2); }; _syncID++; } private function itemOwned(_arg1:Object):void{ _storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count}; } private function sync(_arg1:Event=null):void{ var _local3:String; if (((_syncPending) || ((_syncID == _outstandingID)))){ return; }; _outstandingID = _syncID; var _local2:Object = {}; for (_local3 in _consumableProperties) { _local2[_local3] = MochiDigits(_consumableProperties[_local3]).value; }; MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag); _syncPending = true; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{ return (_names[(_arg1 - 1)]); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{ if (!_consumableProperties[_arg1]){ return (false); }; _names.splice(_names.indexOf(_arg1), 1); delete _consumableProperties[_arg1]; return (true); } private function getConsumableBag(_arg1:MochiUserData):void{ var _local2:String; var _local3:Number; if (_arg1.error){ triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error}); return; }; _consumableProperties = {}; _names = new Array(); if (_arg1.data){ for (_local2 in _arg1.data) { _names.push(_local2); _consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]); }; }; for (_local2 in _storeSync) { _local3 = _storeSync[_local2].count; if (_consumableProperties[(_local2 + KEY_SALT)]){ _local3 = (_local3 - _consumableProperties[_local2]); }; if (_local3 == 0){ } else { newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties}); }; }; triggerEvent(READY, {}); } private function loggedOut(_arg1:Object=null):void{ _consumableProperties = null; } public static function triggerEvent(_arg1:String, _arg2:Object):void{ _dispatcher.triggerEvent(_arg1, _arg2); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.removeEventListener(_arg1, _arg2); } public static function addEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.addEventListener(_arg1, _arg2); } } }//package mochi.as3
Section 221
//MochiScores (mochi.as3.MochiScores) package mochi.as3 { import flash.display.*; import flash.text.*; public class MochiScores { private static var boardID:String; public static var onErrorHandler:Object; public static var onCloseHandler:Object; public static function showLeaderboard(_arg1:Object=null):void{ var n:Number; var options = _arg1; if (options != null){ delete options.clip; MochiServices.setContainer(); MochiServices.bringToTop(); if (options.name != null){ if ((options.name is TextField)){ if (options.name.text.length > 0){ options.name = options.name.text; }; }; }; if (options.score != null){ if ((options.score is TextField)){ if (options.score.text.length > 0){ options.score = options.score.text; }; } else { if ((options.score is MochiDigits)){ options.score = options.score.value; }; }; n = Number(options.score); if (isNaN(n)){ trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'")); } else { if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){ trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite")); } else { if (Math.floor(n) != n){ trace((("WARNING: Submitted score '" + options.score) + "' will be truncated")); }; options.score = n; }; }; }; if (options.onDisplay != null){ options.onDisplay(); } else { if (MochiServices.clip != null){ if ((MochiServices.clip is MovieClip)){ MochiServices.clip.stop(); } else { trace("Warning: Container is not a MovieClip, cannot call default onDisplay."); }; }; }; } else { options = {}; if ((MochiServices.clip is MovieClip)){ MochiServices.clip.stop(); } else { trace("Warning: Container is not a MovieClip, cannot call default onDisplay."); }; }; if (options.onClose != null){ onCloseHandler = options.onClose; } else { onCloseHandler = function ():void{ if ((MochiServices.clip is MovieClip)){ MochiServices.clip.play(); } else { trace("Warning: Container is not a MovieClip, cannot call default onClose."); }; }; }; if (options.onError != null){ onErrorHandler = options.onError; } else { onErrorHandler = null; }; if (options.boardID == null){ if (MochiScores.boardID != null){ options.boardID = MochiScores.boardID; }; }; MochiServices.warnID(options.boardID, true); trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal"); MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose); } public static function closeLeaderboard():void{ MochiServices.send("scores_closeLeaderboard"); } public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{ MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2); } public static function requestList(_arg1:Object, _arg2:Object=null):void{ MochiServices.send("scores_requestList", null, _arg1, _arg2); } public static function scoresArrayToObjects(_arg1:Object):Object{ var _local3:Number; var _local4:Number; var _local5:Object; var _local6:Object; var _local7:String; var _local8:String; var _local2:Object = {}; for (_local7 in _arg1) { if (typeof(_arg1[_local7]) == "object"){ if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){ _local2[_local7] = []; _local5 = _arg1[_local7]; _local4 = 0; while (_local4 < _local5.rows.length) { _local6 = {}; _local3 = 0; while (_local3 < _local5.cols.length) { _local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3]; _local3++; }; _local2[_local7].push(_local6); _local4++; }; } else { _local2[_local7] = {}; for (_local8 in _arg1[_local7]) { _local2[_local7][_local8] = _arg1[_local7][_local8]; }; }; } else { _local2[_local7] = _arg1[_local7]; }; }; return (_local2); } public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{ _arg1 = Number(_arg1); if (isNaN(_arg1)){ trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'")); } else { if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){ trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite")); } else { if (Math.floor(_arg1) != _arg1){ trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated")); }; _arg1 = Number(_arg1); }; }; MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4); } public static function onClose(_arg1:Object=null):void{ if (((((_arg1) && ((_arg1.error == true)))) && (onErrorHandler))){ if (_arg1.errorCode == null){ _arg1.errorCode = "IOError"; }; onErrorHandler(_arg1.errorCode); MochiServices.doClose(); return; }; onCloseHandler(); MochiServices.doClose(); } public static function setBoardID(_arg1:String):void{ MochiServices.warnID(_arg1, true); MochiScores.boardID = _arg1; MochiServices.send("scores_setBoardID", {boardID:_arg1}); } } }//package mochi.as3
Section 222
//MochiServices (mochi.as3.MochiServices) package mochi.as3 { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.net.*; import flash.system.*; import flash.geom.*; public class MochiServices { private static var _container:Object; private static var _connected:Boolean = false; private static var _queue:Array; private static var _swfVersion:String; private static var _preserved:Object; public static var netupAttempted:Boolean = false; private static var _sendChannel:LocalConnection; public static var servicesSync:MochiSync = new MochiSync(); private static var _nextCallbackID:Number; private static var _clip:MovieClip; private static var _id:String; private static var _services:String = "services.swf"; private static var _servURL:String = "http://www.mochiads.com/static/lib/services/"; public static var widget:Boolean = false; private static var _timer:Timer; private static var _sendChannelName:String; private static var _loader:Loader; private static var _callbacks:Object; private static var _connecting:Boolean = false; private static var _mochiLocalConnection:MovieClip; private static var _listenChannelName:String = "__ms_"; public static var onError:Object; public static var netup:Boolean = true; private static var _mochiLC:String = "MochiLC.swf"; public static function isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function get connected():Boolean{ return (_connected); } private static function onReceive(_arg1:Object):void{ var methodName:String; var pkg = _arg1; var cb:String = pkg.callbackID; var cblst:Object = _callbacks[cb]; if (!cblst){ return; }; var method:* = cblst.callbackMethod; methodName = ""; var obj:Object = cblst.callbackObject; if (((obj) && ((typeof(method) == "string")))){ methodName = method; if (obj[method] != null){ method = obj[method]; } else { trace((("Error: Method " + method) + " does not exist.")); }; }; if (method != undefined){ try { method.apply(obj, pkg.args); } catch(error:Error) { trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString())); }; } else { if (obj != null){ try { obj(pkg.args); } catch(error:Error) { trace(("Error invoking method on object: " + error.toString())); }; }; }; delete _callbacks[cb]; } public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{ if (_connected){ _mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_nextCallbackID}); } else { if ((((_clip == null)) || (!(_connecting)))){ trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1)); handleError(_arg2, _arg3, _arg4); flush(true); return; }; _queue.push({methodName:_arg1, args:_arg2, callbackID:_nextCallbackID}); }; if (_clip != null){ if (_callbacks != null){ _callbacks[_nextCallbackID] = {callbackObject:_arg3, callbackMethod:_arg4}; _nextCallbackID++; }; }; } private static function init(_arg1:String, _arg2:Object):void{ _id = _arg1; if (_arg2 != null){ _container = _arg2; loadCommunicator(_arg1, _container); }; } public static function get childClip():Object{ return (_clip); } private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{ var _local4:int; var _local14:Loader; var _local3:Array = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23]; var _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3]; var _local6:Array = [0, 64, 0, 0, 0]; var _local7:MovieClip = new MovieClip(); var _local8:LocalConnection = new LocalConnection(); var _local9:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time)); _local8 = new LocalConnection(); _local7.lc = _local8; _local7.click = _arg2; _local8.client = _local7; _local8.connect(_local9); var _local10:ByteArray = new ByteArray(); var _local11:ByteArray = new ByteArray(); _local11.endian = Endian.LITTLE_ENDIAN; _local11.writeShort(1); _local11.writeUTFBytes(((_arg1 + " ") + _local9)); _local11.writeByte(0); var _local12:uint = ((_local3.length + _local11.length) + 4); var _local13:uint = (_local12 + 35); _local10.endian = Endian.LITTLE_ENDIAN; _local10.writeUTFBytes("FWS"); _local10.writeByte(8); _local10.writeUnsignedInt(_local13); for each (_local4 in _local5) { _local10.writeByte(_local4); }; _local10.writeUnsignedInt(_local12); _local10.writeByte(136); _local10.writeShort(_local11.length); _local10.writeBytes(_local11); for each (_local4 in _local3) { _local10.writeByte(_local4); }; for each (_local4 in _local6) { _local10.writeByte(_local4); }; _local14 = new Loader(); _local14.loadBytes(_local10); _local7.addChild(_local14); return (_local7); } public static function stayOnTop():void{ _container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true); if (_clip != null){ _clip.visible = true; }; } public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{ var avm1Click:DisplayObject; var x:String; var req:URLRequest; var loader:Loader; var setURL:Function; var err:Function; var complete:Function; var url = _arg1; var burl = _arg2; var btn = _arg3; var onClick = _arg4; var vars:Object = new Object(); vars["mav"] = getVersion(); vars["swfv"] = "9"; vars["swfurl"] = btn.loaderInfo.loaderURL; vars["fv"] = Capabilities.version; vars["os"] = Capabilities.os; vars["lang"] = Capabilities.language; vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY); var s = "?"; var i:Number = 0; for (x in vars) { if (i != 0){ s = (s + "&"); }; i = (i + 1); s = (((s + x) + "=") + escape(vars[x])); }; req = new URLRequest("http://x.mochiads.com/linkping.swf"); loader = new Loader(); setURL = function (_arg1:String):void{ if (avm1Click){ btn.removeChild(avm1Click); }; avm1Click = clickMovie(_arg1, onClick); var _local2:Rectangle = btn.getBounds(btn); btn.addChild(avm1Click); avm1Click.x = _local2.x; avm1Click.y = _local2.y; avm1Click.scaleX = (0.01 * _local2.width); avm1Click.scaleY = (0.01 * _local2.height); }; err = function (_arg1:Object):void{ netup = false; _arg1.target.removeEventListener(_arg1.type, arguments.callee); setURL(burl); }; complete = function (_arg1:Object):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); }; if (netup){ setURL((url + s)); } else { setURL(burl); }; if (!((netupAttempted) || (_connected))){ netupAttempted = true; loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete); loader.load(req); }; } public static function disconnect():void{ if (((_connected) || (_connecting))){ if (_clip != null){ if (_clip.parent != null){ if ((_clip.parent is Sprite)){ Sprite(_clip.parent).removeChild(_clip); _clip = null; }; }; }; _connecting = (_connected = false); flush(true); try { _mochiLocalConnection.close(); } catch(error:Error) { }; }; if (_timer != null){ try { _timer.stop(); } catch(error:Error) { }; }; } public static function allowDomains(_arg1:String):String{ var _local2:String; if (Security.sandboxType != "application"){ Security.allowDomain("*"); Security.allowInsecureDomain("*"); }; if (_arg1.indexOf("http://") != -1){ _local2 = _arg1.split("/")[2].split(":")[0]; if (Security.sandboxType != "application"){ Security.allowDomain(_local2); Security.allowInsecureDomain(_local2); }; }; return (_local2); } public static function getVersion():String{ return ("3.8 as3"); } public static function doClose():void{ _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); } public static function warnID(_arg1:String, _arg2:Boolean):void{ _arg1 = _arg1.toLowerCase(); if (_arg1.length != 16){ trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length")); return; } else { if (_arg1 == "1e113c7239048b3f"){ if (_arg2){ trace("WARNING: Using testing board ID"); } else { trace("WARNING: Using testing board ID as game ID"); }; return; } else { if (_arg1 == "84993a1de4031cd8"){ if (_arg2){ trace("WARNING: Using testing game ID as board ID"); } else { trace("WARNING: Using testing game ID"); }; return; }; }; }; var _local3:Number = 0; while (_local3 < _arg1.length) { switch (_arg1.charAt(_local3)){ case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": case "a": case "b": case "c": case "d": case "e": case "f": break; default: trace(("WARNING: Board ID contains illegal characters: " + _arg1)); return; }; _local3++; }; } private static function flush(_arg1:Boolean):void{ var _local2:Object; var _local3:Object; if (((_clip) && (_queue))){ while (_queue.length > 0) { _local2 = _queue.shift(); _local3 = null; if (_local2 != null){ if (_local2.callbackID != null){ _local3 = _callbacks[_local2.callbackID]; }; delete _callbacks[_local2.callbackID]; if (((_arg1) && (!((_local3 == null))))){ handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod); }; }; }; }; } public static function get id():String{ return (_id); } private static function onEvent(_arg1:Object):void{ var _local2:String = _arg1.target; var _local3:String = _arg1.event; switch (_local2){ case "events": MochiEvents.triggerEvent(_arg1.event, _arg1.args); break; case "coins": MochiCoins.triggerEvent(_arg1.event, _arg1.args); break; case "sync": servicesSync.triggerEvent(_arg1.event, _arg1.args); break; }; } private static function urlOptions(_arg1:Object):Object{ var _local3:String; var _local4:Array; var _local5:Number; var _local6:Array; var _local2:Object = {}; if (_arg1.stage){ _local3 = _arg1.stage.loaderInfo.parameters.mochiad_options; } else { _local3 = _arg1.loaderInfo.parameters.mochiad_options; }; if (_local3){ _local4 = _local3.split("&"); _local5 = 0; while (_local5 < _local4.length) { _local6 = _local4[_local5].split("="); _local2[unescape(_local6[0])] = unescape(_local6[1]); _local5++; }; }; return (_local2); } public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{ if (_clip.parent){ _clip.parent.removeChild(_clip); }; if (_arg1 != null){ if ((_arg1 is DisplayObjectContainer)){ _container = _arg1; }; }; if (_arg2){ if ((_container is DisplayObjectContainer)){ DisplayObjectContainer(_container).addChild(_clip); }; }; } private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{ var args = _arg1; var callbackObject = _arg2; var callbackMethod = _arg3; if (args != null){ if (args.onError != null){ args.onError.apply(null, ["NotConnected"]); }; if (((!((args.options == null))) && (!((args.options.onError == null))))){ args.options.onError.apply(null, ["NotConnected"]); }; }; if (callbackMethod != null){ args = {}; args.error = true; args.errorCode = "NotConnected"; if (((!((callbackObject == null))) && ((callbackMethod is String)))){ try { var _local5 = callbackObject; _local5[callbackMethod](args); } catch(error:Error) { }; } else { if (callbackMethod != null){ try { callbackMethod.apply(args); } catch(error:Error) { }; }; }; }; } private static function loadError(_arg1:Object):void{ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load."); MochiServices.disconnect(); MochiServices.onError("IOError"); } private static function initComChannels():void{ if (!_connected){ trace("[SERVICES_API] connected!"); _connecting = false; _connected = true; _mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"}); _mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL}); _clip.onReceive = onReceive; _clip.onEvent = onEvent; _clip.onError = function ():void{ MochiServices.onError("IOError"); }; while (_queue.length > 0) { _mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift()); }; }; } private static function loadLCBridge(_arg1:Object):void{ var loader:Loader; var clip = _arg1; loader = new Loader(); var mochiLCURL:String = (_servURL + _mochiLC); var req:URLRequest = new URLRequest(mochiLCURL); var complete:Function = function (_arg1:Object):void{ _mochiLocalConnection = MovieClip(loader.content); listen(); }; loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError); loader.load(req); clip.addChild(loader); } private static function listen():void{ _mochiLocalConnection.connect(_listenChannelName); _clip.handshake = function (_arg1:Object):void{ MochiServices.comChannelName = _arg1.newChannel; }; trace("Waiting for MochiAds services to connect..."); } public static function get clip():Object{ return (_container); } public static function set comChannelName(_arg1:String):void{ if (_arg1 != null){ if (_arg1.length > 3){ _sendChannelName = (_arg1 + "_fromgame"); initComChannels(); }; }; } private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{ if (_clip != null){ return (_clip); }; if (!MochiServices.isNetworkAvailable()){ return (null); }; if (urlOptions(_arg2).servURL){ _servURL = urlOptions(_arg2).servURL; }; var _local3:String = (_servURL + _services); if (urlOptions(_arg2).servicesURL){ _local3 = urlOptions(_arg2).servicesURL; }; _listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999)))); MochiServices.allowDomains(_local3); _clip = new MovieClip(); loadLCBridge(_clip); _loader = new Loader(); _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError); var _local4:URLRequest = new URLRequest(_local3); var _local5:URLVariables = new URLVariables(); _local5.listenLC = _listenChannelName; _local5.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options; _local5.api_version = getVersion(); if (widget){ _local5.widget = true; }; _local4.data = _local5; _loader.load(_local4); _clip.addChild(_loader); _sendChannel = new LocalConnection(); _queue = []; _nextCallbackID = 0; _callbacks = {}; _timer = new Timer(10000, 1); _timer.addEventListener(TimerEvent.TIMER, connectWait); _timer.start(); return (_clip); } public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{ var id = _arg1; var clip = _arg2; var onError = _arg3; warnID(id, false); if ((clip is DisplayObject)){ if (clip.stage == null){ trace("MochiServices connect requires the containing clip be attached to the stage"); }; if (((!(_connected)) && ((_clip == null)))){ trace("MochiServices Connecting..."); _connecting = true; init(id, clip); }; } else { trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage."); }; if (onError != null){ MochiServices.onError = onError; } else { if (MochiServices.onError == null){ MochiServices.onError = function (_arg1:String):void{ trace(_arg1); }; }; }; } public static function updateCopy(_arg1:Object):void{ MochiServices.send("coins_updateCopy", _arg1, null, null); } public static function bringToTop(_arg1:Event=null):void{ var e = _arg1; if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){ try { if (MochiServices.clip.numChildren > 1){ MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1)); }; } catch(errorObject:Error) { trace("Warning: Depth sort error."); _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); }; }; } public static function connectWait(_arg1:TimerEvent):void{ if (!_connected){ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load. (timeout)"); MochiServices.disconnect(); MochiServices.onError("IOError"); }; } } }//package mochi.as3
Section 223
//MochiSocial (mochi.as3.MochiSocial) package mochi.as3 { public class MochiSocial { public static const LOGGED_IN:String = "LoggedIn"; public static const PROFILE_HIDE:String = "ProfileHide"; public static const NO_USER:String = "NoUser"; public static const PROPERTIES_SIZE:String = "PropertiesSize"; public static const IO_ERROR:String = "IOError"; public static const PROPERTIES_SAVED:String = "PropertySaved"; public static const WIDGET_LOADED:String = "WidgetLoaded"; public static const USER_INFO:String = "UserInfo"; public static const ERROR:String = "Error"; public static const LOGIN_SHOW:String = "LoginShow"; public static const LOGGED_OUT:String = "LoggedOut"; public static const PROFILE_SHOW:String = "ProfileShow"; public static const LOGIN_SHOWN:String = "LoginShown"; public static const LOGIN_HIDE:String = "LoginHide"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); public static var _user_info:Object = null; public static function getVersion():String{ return (MochiServices.getVersion()); } public static function saveUserProperties(_arg1:Object):void{ MochiServices.send("coins_saveUserProperties", _arg1); } public static function get loggedIn():Boolean{ return (!((_user_info == null))); } public static function triggerEvent(_arg1:String, _arg2:Object):void{ _dispatcher.triggerEvent(_arg1, _arg2); } public static function addEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.addEventListener(_arg1, _arg2); } public static function getUserInfo():void{ MochiServices.send("coins_getUserInfo"); } public static function showLoginWidget(_arg1:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("coins_showLoginWidget", {options:_arg1}); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.removeEventListener(_arg1, _arg2); } public static function requestLogin():void{ MochiServices.send("coins_requestLogin"); } public static function getAPIURL():String{ if (!_user_info){ return (null); }; return (_user_info.api_url); } public static function hideLoginWidget():void{ MochiServices.send("coins_hideLoginWidget"); } public static function getAPIToken():String{ if (!_user_info){ return (null); }; return (_user_info.api_token); } MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{ _user_info = _arg1; }); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{ _user_info = null; }); } }//package mochi.as3
Section 224
//MochiSync (mochi.as3.MochiSync) package mochi.as3 { import flash.utils.*; public dynamic class MochiSync extends Proxy { private var _syncContainer:Object; public static var SYNC_PROPERTY:String = "UpdateProperty"; public static var SYNC_REQUEST:String = "SyncRequest"; public function MochiSync():void{ _syncContainer = {}; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{ if (_syncContainer[_arg1] == _arg2){ return; }; var _local3:String = _arg1.toString(); _syncContainer[_local3] = _arg2; MochiServices.send("sync_propUpdate", {name:_local3, value:_arg2}); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){ return (_syncContainer[_arg1]); } public function triggerEvent(_arg1:String, _arg2:Object):void{ switch (_arg1){ case SYNC_REQUEST: MochiServices.send("sync_syncronize", _syncContainer); break; case SYNC_PROPERTY: _syncContainer[_arg2.name] = _arg2.value; break; }; } } }//package mochi.as3
Section 225
//MochiUserData (mochi.as3.MochiUserData) package mochi.as3 { import flash.events.*; import flash.utils.*; import flash.net.*; public class MochiUserData extends EventDispatcher { public var callback:Function;// = null public var operation:String;// = null public var error:Event;// = null public var data;// = null public var _loader:URLLoader; public var key:String;// = null public function MochiUserData(_arg1:String="", _arg2:Function=null){ this.key = _arg1; this.callback = _arg2; } public function serialize(_arg1):ByteArray{ var _local2:ByteArray = new ByteArray(); _local2.objectEncoding = ObjectEncoding.AMF3; _local2.writeObject(_arg1); _local2.compress(); return (_local2); } public function errorHandler(_arg1:IOErrorEvent):void{ data = null; error = _arg1; if (callback != null){ performCallback(); } else { dispatchEvent(_arg1); }; close(); } public function putEvent(_arg1):void{ request("put", serialize(_arg1)); } public function deserialize(_arg1:ByteArray){ _arg1.objectEncoding = ObjectEncoding.AMF3; _arg1.uncompress(); return (_arg1.readObject()); } public function securityErrorHandler(_arg1:SecurityErrorEvent):void{ errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString()))); } public function getEvent():void{ request("get", serialize(null)); } override public function toString():String{ return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]")); } public function performCallback():void{ try { callback(this); } catch(e:Error) { trace(("[MochiUserData] exception during callback: " + e)); }; } public function request(_arg1:String, _arg2:ByteArray):void{ var _operation = _arg1; var _data = _arg2; operation = _operation; var api_url:String = MochiSocial.getAPIURL(); var api_token:String = MochiSocial.getAPIToken(); if ((((api_url == null)) || ((api_token == null)))){ errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in")); return; }; _loader = new URLLoader(); var args:URLVariables = new URLVariables(); args.op = _operation; args.key = key; var req:URLRequest = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString())); req.method = URLRequestMethod.POST; req.contentType = "application/x-mochi-userdata"; req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)]; req.data = _data; _loader.dataFormat = URLLoaderDataFormat.BINARY; _loader.addEventListener(Event.COMPLETE, completeHandler); _loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); _loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); try { _loader.load(req); } catch(e:SecurityError) { errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString()))); }; } public function completeHandler(_arg1:Event):void{ var event = _arg1; try { if (_loader.data.length){ data = deserialize(_loader.data); } else { data = null; }; } catch(e:Error) { errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString()))); return; }; if (callback != null){ performCallback(); } else { dispatchEvent(event); }; close(); } public function close():void{ if (_loader){ _loader.removeEventListener(Event.COMPLETE, completeHandler); _loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler); _loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); _loader.close(); _loader = null; }; error = null; callback = null; } public static function get(_arg1:String, _arg2:Function):void{ var _local3:MochiUserData = new MochiUserData(_arg1, _arg2); _local3.getEvent(); } public static function put(_arg1:String, _arg2, _arg3:Function):void{ var _local4:MochiUserData = new MochiUserData(_arg1, _arg3); _local4.putEvent(_arg2); } } }//package mochi.as3
Section 226
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 227
//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 228
//SoundAsset (mx.core.SoundAsset) package mx.core { import flash.media.*; public class SoundAsset extends Sound implements IFlexAsset { mx_internal static const VERSION:String = "3.2.0.3958"; } }//package mx.core
Section 229
//Destroyable (org.casalib.core.Destroyable) package org.casalib.core { public class Destroyable implements IDestroyable { protected var _isDestroyed:Boolean; public function get destroyed():Boolean{ return (this._isDestroyed); } public function destroy():void{ this._isDestroyed = true; } } }//package org.casalib.core
Section 230
//IDestroyable (org.casalib.core.IDestroyable) package org.casalib.core { public interface IDestroyable { function get destroyed():Boolean; function destroy():void; } }//package org.casalib.core
Section 231
//ArrayContentsError (org.casalib.errors.ArrayContentsError) package org.casalib.errors { public class ArrayContentsError extends Error { public function ArrayContentsError(){ super("The Array is composed of an incorrect number of values, or values of an incorrect type."); } } }//package org.casalib.errors
Section 232
//IRemovableEventDispatcher (org.casalib.events.IRemovableEventDispatcher) package org.casalib.events { import flash.events.*; public interface IRemovableEventDispatcher extends IEventDispatcher { function removeEventsForListener(_arg1:Function):void; function removeEventListeners():void; function removeEventsForType(_arg1:String):void; } }//package org.casalib.events
Section 233
//KeyComboEvent (org.casalib.events.KeyComboEvent) package org.casalib.events { import flash.events.*; import org.casalib.ui.*; public class KeyComboEvent extends Event { protected var _keyCombo:KeyCombo; public static const SEQUENCE:String = "sequence"; public static const DOWN:String = "down"; public static const RELEASE:String = "release"; public function KeyComboEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){ super(_arg1, _arg2, _arg3); } override public function toString():String{ return (formatToString("VideoInfoEvent", "type", "bubbles", "cancelable", "keyCombo")); } override public function clone():Event{ var _local1:KeyComboEvent = new KeyComboEvent(this.type, this.bubbles, this.cancelable); _local1.keyCombo = this.keyCombo; return (_local1); } public function set keyCombo(_arg1:KeyCombo):void{ this._keyCombo = _arg1; } public function get keyCombo():KeyCombo{ return (this._keyCombo); } } }//package org.casalib.events
Section 234
//ListenerManager (org.casalib.events.ListenerManager) package org.casalib.events { import flash.events.*; import flash.utils.*; import org.casalib.core.*; public class ListenerManager extends Destroyable implements IRemovableEventDispatcher { protected var _blockRequest:Boolean; protected var _eventDispatcher:IEventDispatcher; protected var _events:Array; protected static var _proxyMap:Dictionary; public function ListenerManager(_arg1:EventInfo, _arg2:IEventDispatcher){ this._eventDispatcher = _arg2; this._events = new Array(); } public function dispatchEvent(_arg1:Event):Boolean{ return (this._eventDispatcher.dispatchEvent(_arg1)); } public function willTrigger(_arg1:String):Boolean{ return (this._eventDispatcher.willTrigger(_arg1)); } public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{ if (this._blockRequest){ return; }; var _local4:EventInfo = new EventInfo(_arg1, _arg2, _arg3); var _local5:int = this._events.length; while (_local5--) { if (this._events[_local5].equals(_local4)){ this._events.splice(_local5, 1); }; }; } public function removeEventListeners():void{ var _local2:EventInfo; this._blockRequest = true; var _local1:int = this._events.length; while (_local1--) { _local2 = this._events.splice(_local1, 1)[0]; this._eventDispatcher.removeEventListener(_local2.type, _local2.listener, _local2.useCapture); }; this._blockRequest = false; } public function removeEventsForListener(_arg1:Function):void{ var _local3:EventInfo; this._blockRequest = true; var _local2:int = this._events.length; while (_local2--) { _local3 = this._events[_local2]; if (_local3.listener == _arg1){ this._events.splice(_local2, 1); this._eventDispatcher.removeEventListener(_local3.type, _local3.listener, _local3.useCapture); }; }; this._blockRequest = false; } public function hasEventListener(_arg1:String):Boolean{ return (this._eventDispatcher.hasEventListener(_arg1)); } override public function destroy():void{ this.removeEventListeners(); delete ListenerManager._proxyMap[this._eventDispatcher]; this._eventDispatcher = null; super.destroy(); } public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{ var _local6:EventInfo = new EventInfo(_arg1, _arg2, _arg3); var _local7:int = this._events.length; while (_local7--) { if (this._events[_local7].equals(_local6)){ return; }; }; this._events.push(_local6); } public function removeEventsForType(_arg1:String):void{ var _local3:EventInfo; this._blockRequest = true; var _local2:int = this._events.length; while (_local2--) { _local3 = this._events[_local2]; if (_local3.type == _arg1){ this._events.splice(_local2, 1); this._eventDispatcher.removeEventListener(_local3.type, _local3.listener, _local3.useCapture); }; }; this._blockRequest = false; } public static function getManager(_arg1:IEventDispatcher):ListenerManager{ if (ListenerManager._proxyMap == null){ ListenerManager._proxyMap = new Dictionary(); }; if (!(_arg1 in ListenerManager._proxyMap)){ ListenerManager._proxyMap[_arg1] = new ListenerManager(new EventInfo(null, null, false), _arg1); }; return (ListenerManager._proxyMap[_arg1]); } } }//package org.casalib.events class EventInfo { public var listener:Function; public var type:String; public var useCapture:Boolean; private function EventInfo(_arg1:String, _arg2:Function, _arg3:Boolean){ this.type = _arg1; this.listener = _arg2; this.useCapture = _arg3; } public function equals(_arg1:EventInfo):Boolean{ return ((((((this.type == _arg1.type)) && ((this.listener == _arg1.listener)))) && ((this.useCapture == _arg1.useCapture)))); } }
Section 235
//RemovableEventDispatcher (org.casalib.events.RemovableEventDispatcher) package org.casalib.events { import flash.events.*; import org.casalib.core.*; public class RemovableEventDispatcher extends EventDispatcher implements IRemovableEventDispatcher, IDestroyable { protected var _isDestroyed:Boolean; protected var _listenerManager:ListenerManager; public function RemovableEventDispatcher(_arg1:IEventDispatcher=null){ super(_arg1); this._listenerManager = ListenerManager.getManager(this); } override public function dispatchEvent(_arg1:Event):Boolean{ if (this.willTrigger(_arg1.type)){ return (super.dispatchEvent(_arg1)); }; return (true); } public function removeEventsForType(_arg1:String):void{ this._listenerManager.removeEventsForType(_arg1); } public function removeEventListeners():void{ this._listenerManager.removeEventListeners(); } override public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{ super.removeEventListener(_arg1, _arg2, _arg3); this._listenerManager.removeEventListener(_arg1, _arg2, _arg3); } public function destroy():void{ this.removeEventListeners(); this._listenerManager.destroy(); this._isDestroyed = true; } public function removeEventsForListener(_arg1:Function):void{ this._listenerManager.removeEventsForListener(_arg1); } public function get destroyed():Boolean{ return (this._isDestroyed); } override public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{ super.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5); this._listenerManager.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5); } } }//package org.casalib.events
Section 236
//Percent (org.casalib.math.Percent) package org.casalib.math { public class Percent { protected var _percent:Number; public function Percent(_arg1:Number=0, _arg2:Boolean=true){ if (_arg2){ this.decimalPercentage = _arg1; } else { this.percentage = _arg1; }; } public function set percentage(_arg1:Number):void{ this._percent = (_arg1 * 0.01); } public function clone():Percent{ return (new Percent(this.decimalPercentage)); } public function get percentage():Number{ return ((100 * this._percent)); } public function get decimalPercentage():Number{ return (this._percent); } public function set decimalPercentage(_arg1:Number):void{ this._percent = _arg1; } public function toString():String{ return (this.decimalPercentage.toString()); } public function equals(_arg1:Percent):Boolean{ return ((this.decimalPercentage == _arg1.decimalPercentage)); } } }//package org.casalib.math
Section 237
//Key (org.casalib.ui.Key) package org.casalib.ui { import flash.events.*; import flash.display.*; import flash.utils.*; import org.casalib.events.*; import org.casalib.util.*; public class Key extends RemovableEventDispatcher { protected var _longestCombo:uint; protected var _combosDown:Array; protected var _combinations:Array; protected var _keysDown:Dictionary; protected var _keysTyped:Array; protected static var _instance:Key; public function Key(_arg1:SingletonEnforcer){ var _local2:Stage = StageReference.getStage(); _local2.addEventListener(KeyboardEvent.KEY_DOWN, this._onKeyDown); _local2.addEventListener(KeyboardEvent.KEY_UP, this._onKeyUp); _local2.addEventListener(Event.DEACTIVATE, this._onDeactivate); this._keysDown = new Dictionary(); this._keysTyped = new Array(); this._combosDown = new Array(); this._combinations = new Array(); this._longestCombo = 0; } override public function destroy():void{ throw (new Error("Cannot destroy a singleton.")); } public function isDown(_arg1:uint):Boolean{ return (this._keysDown[_arg1]); } public function addKeyCombo(_arg1:KeyCombo):void{ var _local2:uint = this._combinations.length; while (_local2--) { if (this._combinations[_local2].equals(_arg1)){ return; }; }; this._longestCombo = Math.max(this._longestCombo, _arg1.keyCodes.length); this._combinations.push(_arg1); } protected function _onKeyDown(_arg1:KeyboardEvent):void{ var _local2:Boolean = this._keysDown[_arg1.keyCode]; this._keysDown[_arg1.keyCode] = true; this._keysTyped.push(_arg1.keyCode); if (this._keysTyped.length > this._longestCombo){ this._keysTyped.splice(0, 1); }; var _local3:uint = this._combinations.length; while (_local3--) { this._checkedTypedKeys(this._combinations[_local3]); if (!_local2){ this._checkDownKeys(this._combinations[_local3]); }; }; this.dispatchEvent(_arg1.clone()); } protected function _checkedTypedKeys(_arg1:KeyCombo):void{ var _local2:KeyComboEvent; if (ArrayUtil.equals(_arg1.keyCodes, this._keysTyped.slice(-(_arg1.keyCodes.length)))){ _local2 = new KeyComboEvent(KeyComboEvent.SEQUENCE); _local2.keyCombo = _arg1; this.dispatchEvent(_local2); }; } protected function _onDeactivate(_arg1:Event):void{ var _local3:KeyComboEvent; var _local2:uint = this._combosDown.length; while (_local2--) { _local3 = new KeyComboEvent(KeyComboEvent.RELEASE); _local3.keyCombo = this._combosDown[_local2]; this.dispatchEvent(_local3); }; this._combosDown = new Array(); this._keysDown = new Dictionary(); } public function removeKeyCombo(_arg1:KeyCombo):void{ var _local4:uint; var _local2 = -1; var _local3:uint = this._combinations.length; while (_local3--) { if (this._combinations[_local3].equals(_arg1)){ _local2 = int(_local3); break; }; }; if (_local2 == -1){ return; }; this._combinations.splice(_local2, 1); if (_arg1.keyCodes.length == this._longestCombo){ _local4 = 0; _local3 = this._combinations.length; while (_local3--) { _local4 = Math.max(_local4, this._combinations[_local3].keyCodes.length); }; this._longestCombo = _local4; }; } protected function _onKeyUp(_arg1:KeyboardEvent):void{ var _local3:KeyComboEvent; var _local2:uint = this._combosDown.length; while (_local2--) { if (this._combosDown[_local2].keyCodes.indexOf(_arg1.keyCode) != -1){ _local3 = new KeyComboEvent(KeyComboEvent.RELEASE); _local3.keyCombo = this._combosDown[_local2]; this._combosDown.splice(_local2, 1); this.dispatchEvent(_local3); }; }; delete this._keysDown[_arg1.keyCode]; this.dispatchEvent(_arg1.clone()); } protected function _checkDownKeys(_arg1:KeyCombo):void{ var _local2:Array = ArrayUtil.removeDuplicates(_arg1.keyCodes); var _local3:uint = _local2.length; while (_local3--) { if (!this.isDown(_local2[_local3])){ return; }; }; var _local4:KeyComboEvent = new KeyComboEvent(KeyComboEvent.DOWN); _local4.keyCombo = _arg1; this._combosDown.push(_arg1); this.dispatchEvent(_local4); } public static function getInstance():Key{ if (_slot1._instance == null){ _slot1._instance = new Key(new SingletonEnforcer()); }; return (_slot1._instance); } } }//package org.casalib.ui class SingletonEnforcer { private function SingletonEnforcer(){ } }
Section 238
//KeyCombo (org.casalib.ui.KeyCombo) package org.casalib.ui { import org.casalib.util.*; import org.casalib.errors.*; public class KeyCombo { protected var _keyCodes:Array; public function KeyCombo(_arg1:Array){ if (_arg1.length < 2){ throw (new ArrayContentsError()); }; var _local2:uint = _arg1.length; while (_local2--) { if (!(_arg1[_local2] is uint)){ throw (new ArrayContentsError()); }; }; this._keyCodes = _arg1.concat(); } public function equals(_arg1:KeyCombo):Boolean{ if (_arg1 == this){ return (true); }; return (ArrayUtil.equals(this.keyCodes, _arg1.keyCodes)); } public function get keyCodes():Array{ return (this._keyCodes.concat()); } } }//package org.casalib.ui
Section 239
//ArrayUtil (org.casalib.util.ArrayUtil) package org.casalib.util { public class ArrayUtil { protected static function _sortRandom(_arg1, _arg2):int{ return ((NumberUtil.randomIntegerWithinRange(0, 1)) ? 1 : -1); } public static function containsAll(_arg1:Array, _arg2:Array):Boolean{ var _local3:uint = _arg2.length; while (_local3--) { if (_arg1.indexOf(_arg2[_local3]) == -1){ return (false); }; }; return (true); } protected static function _removeDuplicatesFilter(_arg1, _arg2:int, _arg3:Array):Boolean{ return (((_arg2)==0) ? true : (_arg3.lastIndexOf(_arg1, (_arg2 - 1)) == -1)); } public static function equals(_arg1:Array, _arg2:Array):Boolean{ var _local3:uint = _arg1.length; if (_local3 != _arg2.length){ return (false); }; while (_local3--) { if (_arg1[_local3] != _arg2[_local3]){ return (false); }; }; return (true); } public static function getHighestValue(_arg1:Array):Number{ return (_arg1[_arg1.sort((16 | 8))[(_arg1.length - 1)]]); } public static function sum(_arg1:Array):Number{ var _local2:Number = 0; var _local3:uint = _arg1.length; while (_local3--) { _local2 = (_local2 + _arg1[_local3]); }; return (_local2); } public static function removeDuplicates(_arg1:Array):Array{ return (_arg1.filter(ArrayUtil._removeDuplicatesFilter)); } public static function containsAny(_arg1:Array, _arg2:Array):Boolean{ var _local3:uint = _arg2.length; while (_local3--) { if (_arg1.indexOf(_arg2[_local3]) != -1){ return (true); }; }; return (false); } public static function getIndexOfDifference(_arg1:Array, _arg2:Array, _arg3:uint=0):int{ var _local4:int = (_arg3 - 1); while (++_local4 < _arg1.length) { if (_arg1[_local4] != _arg2[_local4]){ return (_local4); }; }; return (-1); } public static function randomize(_arg1:Array):Array{ var _local2:Array = new Array(); var _local3:Array = _arg1.sort(ArrayUtil._sortRandom, Array.RETURNINDEXEDARRAY); var _local4 = -1; while (++_local4 < _arg1.length) { _local2.push(_arg1[_local3[_local4]]); }; return (_local2); } public static function addItemsAt(_arg1:Array, _arg2:Array, _arg3:int=2147483647):Boolean{ if (_arg2.length == 0){ return (false); }; var _local4:Array = _arg2.concat(); _local4.splice(0, 0, _arg3, 0); _arg1.splice.apply(null, _local4); return (true); } public static function removeItem(_arg1:Array, _arg2):uint{ var _local3:int = _arg1.indexOf(_arg2); var _local4:uint; while (_local3 != -1) { _arg1.splice(_local3, 1); _local3 = _arg1.indexOf(_arg2, _local3); _local4++; }; return (_local4); } public static function getLowestValue(_arg1:Array):Number{ return (_arg1[_arg1.sort((16 | 8))[0]]); } public static function retainItems(_arg1:Array, _arg2:Array):Boolean{ var _local3:Boolean; var _local4:uint = _arg1.length; while (_local4--) { if (_arg2.indexOf(_arg1[_local4]) == -1){ _arg1.splice(_local4, 1); _local3 = true; }; }; return (_local3); } public static function removeItems(_arg1:Array, _arg2:Array):Boolean{ var _local3:Boolean; var _local4:uint = _arg1.length; while (_local4--) { if (_arg2.indexOf(_arg1[_local4]) != -1){ _arg1.splice(_local4, 1); _local3 = true; }; }; return (_local3); } public static function average(_arg1:Array):Number{ if (_arg1.length == 0){ return (0); }; return ((ArrayUtil.sum(_arg1) / _arg1.length)); } public static function contains(_arg1:Array, _arg2):uint{ var _local3:int = _arg1.indexOf(_arg2, 0); var _local4:uint; while (_local3 != -1) { _local3 = _arg1.indexOf(_arg2, (_local3 + 1)); _local4++; }; return (_local4); } } }//package org.casalib.util
Section 240
//NumberUtil (org.casalib.util.NumberUtil) package org.casalib.util { import org.casalib.math.*; public class NumberUtil { public static function interpolate(_arg1:Percent, _arg2:Number, _arg3:Number):Number{ return ((_arg2 + ((_arg3 - _arg2) * _arg1.decimalPercentage))); } public static function max(_arg1, _arg2):Number{ if (((((isNaN(_arg1)) && (isNaN(_arg2)))) || ((((_arg1 == null)) && ((_arg2 == null)))))){ return (NaN); }; if ((((_arg1 == null)) || ((_arg2 == null)))){ return (((_arg2)==null) ? _arg1 : _arg2); }; if (((isNaN(_arg1)) || (isNaN(_arg2)))){ return ((isNaN(_arg2)) ? _arg1 : _arg2); }; return (Math.max(_arg1, _arg2)); } public static function isOdd(_arg1:Number):Boolean{ return (!(NumberUtil.isEven(_arg1))); } public static function constrain(_arg1:Number, _arg2:Number, _arg3:Number):Number{ return (Math.min(Math.max(_arg1, Math.min(_arg2, _arg3)), Math.max(_arg2, _arg3))); } public static function roundDecimalToPlace(_arg1:Number, _arg2:uint):Number{ var _local3:Number = Math.pow(10, _arg2); return ((Math.round((_arg1 * _local3)) / _local3)); } public static function isEqual(_arg1:Number, _arg2:Number, _arg3:Number=0):Boolean{ return ((Math.abs((_arg1 - _arg2)) <= Math.abs(_arg3))); } public static function isEven(_arg1:Number):Boolean{ return (((_arg1 & 1) == 0)); } public static function getOrdinalSuffix(_arg1:int):String{ if ((((_arg1 >= 10)) && ((_arg1 <= 20)))){ return ("th"); }; switch ((_arg1 % 10)){ case 0: case 4: case 5: case 6: case 7: case 8: case 9: return ("th"); case 3: return ("rd"); case 2: return ("nd"); case 1: return ("st"); default: return (""); }; } public static function normalize(_arg1:Number, _arg2:Number, _arg3:Number):Percent{ return (new Percent(((_arg1 - _arg2) / (_arg3 - _arg2)))); } public static function loopIndex(_arg1:int, _arg2:uint):uint{ if (_arg1 < 0){ _arg1 = (_arg2 + (_arg1 % _arg2)); }; if (_arg1 >= _arg2){ return ((_arg1 % _arg2)); }; return (_arg1); } public static function randomWithinRange(_arg1:Number, _arg2:Number):Number{ return ((_arg1 + (Math.random() * (_arg2 - _arg1)))); } public static function min(_arg1, _arg2):Number{ if (((((isNaN(_arg1)) && (isNaN(_arg2)))) || ((((_arg1 == null)) && ((_arg2 == null)))))){ return (NaN); }; if ((((_arg1 == null)) || ((_arg2 == null)))){ return (((_arg2)==null) ? _arg1 : _arg2); }; if (((isNaN(_arg1)) || (isNaN(_arg2)))){ return ((isNaN(_arg2)) ? _arg1 : _arg2); }; return (Math.min(_arg1, _arg2)); } public static function isInteger(_arg1:Number):Boolean{ return (((_arg1 % 1) == 0)); } public static function isPrime(_arg1:Number):Boolean{ if ((((_arg1 == 1)) || ((_arg1 == 2)))){ return (true); }; if (NumberUtil.isEven(_arg1)){ return (false); }; var _local2:Number = Math.sqrt(_arg1); var _local3:Number = 3; while (_local3 <= _local2) { if ((_arg1 % _local3) == 0){ return (false); }; _local3++; }; return (true); } public static function randomIntegerWithinRange(_arg1:int, _arg2:int):int{ return (Math.round(NumberUtil.randomWithinRange(_arg1, _arg2))); } public static function format(_arg1:Number, _arg2:uint, _arg3:String=null, _arg4:String=null):String{ var _local7:Array; var _local8:uint; var _local9:uint; var _local10:String; var _local5:String = _arg1.toString(); var _local6:uint = _local5.length; if (_arg3 != null){ _local7 = _local5.split(""); _local8 = 3; _local9 = _local7.length; while (--_local9 > 0) { --_local8; if (_local8 == 0){ _local8 = 3; _local7.splice(_local9, 0, _arg3); }; }; _local5 = _local7.join(""); }; if (_arg2 != 0){ if (_local6 < _arg2){ _arg2 = (_arg2 - _local6); _local10 = ((_arg4)==null) ? "0" : _arg4; while (_arg2--) { _local5 = (_local10 + _local5); }; }; }; return (_local5); } public static function addLeadingZero(_arg1:Number):String{ return (((_arg1)<10) ? ("0" + _arg1) : _arg1.toString()); } public static function map(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Number{ return (NumberUtil.interpolate(NumberUtil.normalize(_arg1, _arg2, _arg3), _arg4, _arg5)); } public static function createStepsBetween(_arg1:Number, _arg2:Number, _arg3:Number):Array{ _arg3++; var _local4:uint; var _local5:Array = new Array(); var _local6:Number = ((_arg2 - _arg1) / _arg3); while (++_local4 < _arg3) { _local5.push(((_local4 * _local6) + _arg1)); }; return (_local5); } public static function isBetween(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{ return (!((((_arg1 < Math.min(_arg2, _arg3))) || ((_arg1 > Math.max(_arg2, _arg3)))))); } } }//package org.casalib.util
Section 241
//ObjectUtil (org.casalib.util.ObjectUtil) package org.casalib.util { import flash.utils.*; public class ObjectUtil { public static function isNull(_arg1:Object):Boolean{ return ((_arg1 === null)); } public static function isEmpty(_arg1):Boolean{ var _local2:String; if (_arg1 == undefined){ return (true); }; if ((_arg1 is Number)){ return (isNaN(_arg1)); }; if ((((_arg1 is Array)) || ((_arg1 is String)))){ return ((_arg1.length == 0)); }; if ((_arg1 is Object)){ for (_local2 in _arg1) { return (false); }; return (true); }; return (false); } public static function isUndefined(_arg1:Object):Boolean{ return ((_arg1 is undefined)); } public static function getKeys(_arg1:Object):Array{ var _local3:String; var _local2:Array = new Array(); for (_local3 in _arg1) { _local2.push(_local3); }; return (_local2); } public static function clone(_arg1:Object):Object{ var _local2:ByteArray = new ByteArray(); _local2.writeObject(_arg1); _local2.position = 0; return (_local2.readObject()); } public static function contains(_arg1:Object, _arg2:Object):Boolean{ var _local3:String; for (_local3 in _arg1) { if (_arg1[_local3] == _arg2){ return (true); }; }; return (false); } } }//package org.casalib.util
Section 242
//StageReference (org.casalib.util.StageReference) package org.casalib.util { import flash.display.*; import flash.utils.*; public class StageReference { public static const STAGE_DEFAULT:String = "stageDefault"; protected static var _stageMap:Dictionary; public static function removeStage(_arg1:String="stageDefault"):Boolean{ if (!(_arg1 in StageReference._getMap())){ return (false); }; StageReference.setStage(null, _arg1); return (true); } public static function getStageId(_arg1:Stage):String{ var _local3:String; var _local2:Dictionary = StageReference._getMap(); for (_local3 in _local2) { if (_local2[_local3] == _arg1){ return (_local3); }; }; return (null); } protected static function _getMap():Dictionary{ if (StageReference._stageMap == null){ StageReference._stageMap = new Dictionary(); }; return (StageReference._stageMap); } public static function getStage(_arg1:String="stageDefault"):Stage{ if (!(_arg1 in StageReference._getMap())){ throw (new Error((("Cannot get Stage (\"" + _arg1) + "\") before it has been set."))); }; return (StageReference._getMap()[_arg1]); } public static function getIds():Array{ return (ObjectUtil.getKeys(StageReference._getMap())); } public static function setStage(_arg1:Stage, _arg2:String="stageDefault"):void{ StageReference._getMap()[_arg2] = _arg1; } } }//package org.casalib.util
Section 243
//Action (org.flintparticles.common.actions.Action) package org.flintparticles.common.actions { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; public interface Action { function addedToEmitter(_arg1:Emitter):void; function removedFromEmitter(_arg1:Emitter):void; function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void; function getDefaultPriority():Number; } }//package org.flintparticles.common.actions
Section 244
//ActionBase (org.flintparticles.common.actions.ActionBase) package org.flintparticles.common.actions { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; public class ActionBase implements Action { public function removedFromEmitter(_arg1:Emitter):void{ } public function getDefaultPriority():Number{ return (0); } public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ } public function addedToEmitter(_arg1:Emitter):void{ } } }//package org.flintparticles.common.actions
Section 245
//Age (org.flintparticles.common.actions.Age) package org.flintparticles.common.actions { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; import org.flintparticles.common.energyEasing.*; public class Age extends ActionBase { private var _easing:Function; public function Age(_arg1:Function=null){ if (_arg1 == null){ _easing = Linear.easeNone; } else { _easing = _arg1; }; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ _arg2.age = (_arg2.age + _arg3); if (_arg2.age >= _arg2.lifetime){ _arg2.energy = 0; _arg2.isDead = true; } else { _arg2.energy = _easing(_arg2.age, _arg2.lifetime); }; } public function get easing():Function{ return (_easing); } public function set easing(_arg1:Function):void{ _easing = _arg1; } } }//package org.flintparticles.common.actions
Section 246
//Fade (org.flintparticles.common.actions.Fade) package org.flintparticles.common.actions { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; public class Fade extends ActionBase { private var _endAlpha:Number; private var _diffAlpha:Number; public function Fade(_arg1:Number=1, _arg2:Number=0){ _diffAlpha = (_arg1 - _arg2); _endAlpha = _arg2; } public function get startAlpha():Number{ return ((_endAlpha + _diffAlpha)); } public function set endAlpha(_arg1:Number):void{ _diffAlpha = ((_endAlpha + _diffAlpha) - _arg1); _endAlpha = _arg1; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Number; _local4 = (_endAlpha + (_diffAlpha * _arg2.energy)); _arg2.color = ((_arg2.color & 0xFFFFFF) | (Math.round((_local4 * 0xFF)) << 24)); } public function get endAlpha():Number{ return (_endAlpha); } public function set startAlpha(_arg1:Number):void{ _diffAlpha = (_arg1 - _endAlpha); } override public function getDefaultPriority():Number{ return (-5); } } }//package org.flintparticles.common.actions
Section 247
//Activity (org.flintparticles.common.activities.Activity) package org.flintparticles.common.activities { import org.flintparticles.common.emitters.*; public interface Activity { function initialize(_arg1:Emitter):void; function addedToEmitter(_arg1:Emitter):void; function removedFromEmitter(_arg1:Emitter):void; function update(_arg1:Emitter, _arg2:Number):void; function getDefaultPriority():Number; } }//package org.flintparticles.common.activities
Section 248
//Blast (org.flintparticles.common.counters.Blast) package org.flintparticles.common.counters { import org.flintparticles.common.emitters.*; public class Blast implements Counter { private var _startCount:uint; public function Blast(_arg1:uint){ _startCount = _arg1; } public function stop():void{ } public function updateEmitter(_arg1:Emitter, _arg2:Number):uint{ return (0); } public function resume():void{ } public function set startCount(_arg1:Number):void{ _startCount = _arg1; } public function startEmitter(_arg1:Emitter):uint{ return (_startCount); } public function get startCount():Number{ return (_startCount); } } }//package org.flintparticles.common.counters
Section 249
//Counter (org.flintparticles.common.counters.Counter) package org.flintparticles.common.counters { import org.flintparticles.common.emitters.*; public interface Counter { function stop():void; function updateEmitter(_arg1:Emitter, _arg2:Number):uint; function startEmitter(_arg1:Emitter):uint; function resume():void; } }//package org.flintparticles.common.counters
Section 250
//ZeroCounter (org.flintparticles.common.counters.ZeroCounter) package org.flintparticles.common.counters { import org.flintparticles.common.emitters.*; public class ZeroCounter implements Counter { public function stop():void{ } public function updateEmitter(_arg1:Emitter, _arg2:Number):uint{ return (0); } public function startEmitter(_arg1:Emitter):uint{ return (0); } public function resume():void{ } } }//package org.flintparticles.common.counters
Section 251
//Dot (org.flintparticles.common.displayObjects.Dot) package org.flintparticles.common.displayObjects { import flash.display.*; public class Dot extends Shape { public function Dot(_arg1:Number, _arg2:uint=0xFFFFFF, _arg3:String="normal"){ graphics.beginFill(_arg2); graphics.drawCircle(0, 0, _arg1); graphics.endFill(); blendMode = _arg3; } } }//package org.flintparticles.common.displayObjects
Section 252
//Emitter (org.flintparticles.common.emitters.Emitter) package org.flintparticles.common.emitters { import flash.events.*; import org.flintparticles.common.events.*; import org.flintparticles.common.particles.*; import org.flintparticles.common.initializers.*; import org.flintparticles.common.actions.*; import org.flintparticles.common.activities.*; import org.flintparticles.common.counters.*; import org.flintparticles.common.utils.*; public class Emitter extends EventDispatcher { protected var _running:Boolean;// = false protected var _activities:PriorityArray; protected var _particles:Array; protected var _initializers:PriorityArray; protected var _counter:Counter; protected var _started:Boolean;// = false protected var _actions:PriorityArray; protected var _useInternalTick:Boolean;// = true protected var _fixedFrameTime:Number;// = 0 protected var _particleFactory:ParticleFactory; protected var _maximumFrameTime:Number;// = 0.1 public function Emitter(){ _useInternalTick = true; _fixedFrameTime = 0; _running = false; _started = false; _maximumFrameTime = 0.1; super(); _particles = new Array(); _actions = new PriorityArray(); _initializers = new PriorityArray(); _activities = new PriorityArray(); _counter = new ZeroCounter(); } public function stop():void{ if (_useInternalTick){ FrameUpdater.instance.removeEventListener(UpdateEvent.UPDATE, updateEventListener); }; _started = false; killAllParticles(); } public function get counter():Counter{ return (_counter); } public function addInitializer(_arg1:Initializer, _arg2:Number=NaN):void{ if (isNaN(_arg2)){ _arg2 = _arg1.getDefaultPriority(); }; _initializers.add(_arg1, _arg2); _arg1.addedToEmitter(this); } public function killAllParticles():void{ var _local1:int; var _local2:int; _local1 = _particles.length; _local2 = 0; while (_local2 < _local1) { dispatchEvent(new ParticleEvent(ParticleEvent.PARTICLE_DEAD, _particles[_local2])); _particleFactory.disposeParticle(_particles[_local2]); _local2++; }; _particles.length = 0; } public function set fixedFrameTime(_arg1:Number):void{ _fixedFrameTime = _arg1; } public function get maximumFrameTime():Number{ return (_maximumFrameTime); } public function get useInternalTick():Boolean{ return (_useInternalTick); } public function get particleFactory():ParticleFactory{ return (_particleFactory); } private function updateEventListener(_arg1:UpdateEvent):void{ if (_fixedFrameTime){ update(_fixedFrameTime); } else { update(_arg1.time); }; } protected function createParticle():Particle{ var _local1:Particle; var _local2:int; var _local3:int; _local1 = _particleFactory.createParticle(); _local2 = _initializers.length; initParticle(_local1); _local3 = 0; while (_local3 < _local2) { _initializers[_local3].initialize(this, _local1); _local3++; }; _particles.push(_local1); dispatchEvent(new ParticleEvent(ParticleEvent.PARTICLE_CREATED, _local1)); return (_local1); } public function get particles():Array{ return (_particles); } protected function sortParticles():void{ } public function removeActivity(_arg1:Activity):void{ if (_activities.remove(_arg1)){ _arg1.removedFromEmitter(this); }; } public function set maximumFrameTime(_arg1:Number):void{ _maximumFrameTime = _arg1; } protected function initParticle(_arg1:Particle):void{ } public function addAction(_arg1:Action, _arg2:Number=NaN):void{ if (isNaN(_arg2)){ _arg2 = _arg1.getDefaultPriority(); }; _actions.add(_arg1, _arg2); _arg1.addedToEmitter(this); } public function hasInitializerOfType(_arg1:Class):Boolean{ var _local2:uint; var _local3:uint; _local2 = _initializers.length; _local3 = 0; while (_local3 < _local2) { if ((_initializers[_local3] is _arg1)){ return (true); }; _local3++; }; return (false); } public function resume():void{ _running = true; } public function removeInitializer(_arg1:Initializer):void{ if (_initializers.remove(_arg1)){ _arg1.removedFromEmitter(this); }; } public function get running():Boolean{ return (_running); } public function hasActionOfType(_arg1:Class):Boolean{ var _local2:uint; var _local3:uint; _local2 = _actions.length; _local3 = 0; while (_local3 < _local2) { if ((_actions[_local3] is _arg1)){ return (true); }; _local3++; }; return (false); } public function get fixedFrameTime():Number{ return (_fixedFrameTime); } public function set particleFactory(_arg1:ParticleFactory):void{ _particleFactory = _arg1; } public function hasActivity(_arg1:Activity):Boolean{ return (_activities.contains(_arg1)); } public function addActivity(_arg1:Activity, _arg2:Number=NaN):void{ if (isNaN(_arg2)){ _arg2 = _arg1.getDefaultPriority(); }; _activities.add(_arg1, _arg2); _arg1.addedToEmitter(this); } public function update(_arg1:Number):void{ var _local2:int; var _local3:Particle; var _local4:int; var _local5:Action; var _local6:int; var _local7:int; if (!_running){ return; }; if (_arg1 > _maximumFrameTime){ _arg1 = _maximumFrameTime; }; _local4 = _counter.updateEmitter(this, _arg1); _local2 = 0; while (_local2 < _local4) { createParticle(); _local2++; }; sortParticles(); _local4 = _activities.length; _local2 = 0; while (_local2 < _local4) { _activities[_local2].update(this, _arg1); _local2++; }; if (_particles.length > 0){ _local4 = _actions.length; _local6 = _particles.length; _local7 = 0; while (_local7 < _local4) { _local5 = _actions[_local7]; _local2 = 0; while (_local2 < _local6) { _local3 = _particles[_local2]; _local5.update(this, _local3, _arg1); _local2++; }; _local7++; }; _local2 = _local6; while (_local2--) { _local3 = _particles[_local2]; if (_local3.isDead){ dispatchEvent(new ParticleEvent(ParticleEvent.PARTICLE_DEAD, _local3)); _particleFactory.disposeParticle(_local3); _particles.splice(_local2, 1); }; }; } else { dispatchEvent(new EmitterEvent(EmitterEvent.EMITTER_EMPTY)); }; dispatchEvent(new EmitterEvent(EmitterEvent.EMITTER_UPDATED)); } public function removeAction(_arg1:Action):void{ if (_actions.remove(_arg1)){ _arg1.removedFromEmitter(this); }; } public function hasActivityOfType(_arg1:Class):Boolean{ var _local2:uint; var _local3:uint; _local2 = _activities.length; _local3 = 0; while (_local3 < _local2) { if ((_activities[_local3] is _arg1)){ return (true); }; _local3++; }; return (false); } public function addExistingParticles(_arg1:Array, _arg2:Boolean=false):void{ var _local3:int; var _local4:int; var _local5:int; var _local6:int; _local3 = _arg1.length; if (_arg2){ _local5 = _initializers.length; _local6 = 0; while (_local6 < _local5) { _local4 = 0; while (_local4 < _local3) { _initializers[_local6].initialize(this, _arg1[_local4]); _local4++; }; _local6++; }; }; _local4 = 0; while (_local4 < _local3) { _particles.push(_arg1[_local4]); dispatchEvent(new ParticleEvent(ParticleEvent.PARTICLE_ADDED, _arg1[_local4])); _local4++; }; } public function set useInternalTick(_arg1:Boolean):void{ if (_useInternalTick != _arg1){ _useInternalTick = _arg1; if (_started){ if (_useInternalTick){ FrameUpdater.instance.addEventListener(UpdateEvent.UPDATE, updateEventListener, false, 0, true); } else { FrameUpdater.instance.removeEventListener(UpdateEvent.UPDATE, updateEventListener); }; }; }; } public function hasInitializer(_arg1:Initializer):Boolean{ return (_initializers.contains(_arg1)); } public function start():void{ var _local1:int; var _local2:int; if (_useInternalTick){ FrameUpdater.instance.addEventListener(UpdateEvent.UPDATE, updateEventListener, false, 0, true); }; _started = true; _running = true; _local1 = _activities.length; _local2 = 0; while (_local2 < _local1) { _activities[_local2].initialize(this); _local2++; }; _local1 = _counter.startEmitter(this); _local2 = 0; while (_local2 < _local1) { createParticle(); _local2++; }; } public function hasAction(_arg1:Action):Boolean{ return (_actions.contains(_arg1)); } public function pause():void{ _running = false; } public function set counter(_arg1:Counter):void{ _counter = _arg1; if (running){ _counter.startEmitter(this); }; } public function runAhead(_arg1:Number, _arg2:Number=10):void{ var _local3:Number; var _local4:Number; _local3 = _maximumFrameTime; _local4 = (1 / _arg2); _maximumFrameTime = _local4; while (_arg1 > 0) { _arg1 = (_arg1 - _local4); update(_local4); }; _maximumFrameTime = _local3; } } }//package org.flintparticles.common.emitters
Section 253
//Linear (org.flintparticles.common.energyEasing.Linear) package org.flintparticles.common.energyEasing { public class Linear { public static function easeOut(_arg1:Number, _arg2:Number):Number{ return ((1 - (_arg1 / _arg2))); } public static function easeIn(_arg1:Number, _arg2:Number):Number{ return ((1 - (_arg1 / _arg2))); } public static function easeInOut(_arg1:Number, _arg2:Number):Number{ return ((1 - (_arg1 / _arg2))); } public static function easeNone(_arg1:Number, _arg2:Number):Number{ return ((1 - (_arg1 / _arg2))); } } }//package org.flintparticles.common.energyEasing
Section 254
//Quadratic (org.flintparticles.common.energyEasing.Quadratic) package org.flintparticles.common.energyEasing { public class Quadratic { public static function easeOut(_arg1:Number, _arg2:Number):Number{ _arg1 = (1 - (_arg1 / _arg2)); return ((_arg1 * _arg1)); } public static function easeIn(_arg1:Number, _arg2:Number):Number{ _arg1 = (_arg1 / _arg2); return ((1 - (_arg1 * _arg1))); } public static function easeInOut(_arg1:Number, _arg2:Number):Number{ _arg1 = (_arg1 / (_arg2 * 0.5)); if (_arg1 < 1){ return ((1 - ((_arg1 * _arg1) * 0.5))); }; _arg1 = (_arg1 - 2); return (((_arg1 * _arg1) * 0.5)); } } }//package org.flintparticles.common.energyEasing
Section 255
//EmitterEvent (org.flintparticles.common.events.EmitterEvent) package org.flintparticles.common.events { import flash.events.*; public class EmitterEvent extends Event { public static var EMITTER_UPDATED:String = "emitterUpdated"; public static var EMITTER_EMPTY:String = "emitterEmpty"; public function EmitterEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){ super(_arg1, _arg2, _arg3); } } }//package org.flintparticles.common.events
Section 256
//ParticleEvent (org.flintparticles.common.events.ParticleEvent) package org.flintparticles.common.events { import flash.events.*; import org.flintparticles.common.particles.*; public class ParticleEvent extends Event { public var particle:Particle; public var otherObject; public static var PARTICLES_COLLISION:String = "particlesCollision"; public static var PARTICLE_ADDED:String = "particleAdded"; public static var PARTICLE_DEAD:String = "particleDead"; public static var PARTICLE_CREATED:String = "particleCreated"; public function ParticleEvent(_arg1:String, _arg2:Particle=null, _arg3:Boolean=false, _arg4:Boolean=false){ super(_arg1, _arg3, _arg4); this.particle = _arg2; } } }//package org.flintparticles.common.events
Section 257
//UpdateEvent (org.flintparticles.common.events.UpdateEvent) package org.flintparticles.common.events { import flash.events.*; public class UpdateEvent extends Event { public var time:Number; public static var UPDATE:String = "update"; public function UpdateEvent(_arg1:String, _arg2:Number=NaN, _arg3:Boolean=false, _arg4:Boolean=false){ super(_arg1, _arg3, _arg4); this.time = _arg2; } } }//package org.flintparticles.common.events
Section 258
//ColorInit (org.flintparticles.common.initializers.ColorInit) package org.flintparticles.common.initializers { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; import org.flintparticles.common.utils.*; public class ColorInit extends InitializerBase { private var _max:uint; private var _min:uint; public function ColorInit(_arg1:uint, _arg2:uint){ _min = _arg1; _max = _arg2; } public function get color():uint{ return (((_min == _max)) ? _min : interpolateColors(_max, _min, 0.5)); } public function set color(_arg1:uint):void{ _max = (_min = _arg1); } public function set minColor(_arg1:uint):void{ _min = _arg1; } public function set maxColor(_arg1:uint):void{ _max = _arg1; } override public function initialize(_arg1:Emitter, _arg2:Particle):void{ if (_max == _min){ _arg2.color = _min; } else { _arg2.color = interpolateColors(_min, _max, Math.random()); }; } public function get minColor():uint{ return (_min); } public function get maxColor():uint{ return (_max); } } }//package org.flintparticles.common.initializers
Section 259
//Initializer (org.flintparticles.common.initializers.Initializer) package org.flintparticles.common.initializers { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; public interface Initializer { function initialize(_arg1:Emitter, _arg2:Particle):void; function addedToEmitter(_arg1:Emitter):void; function removedFromEmitter(_arg1:Emitter):void; function getDefaultPriority():Number; } }//package org.flintparticles.common.initializers
Section 260
//InitializerBase (org.flintparticles.common.initializers.InitializerBase) package org.flintparticles.common.initializers { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; public class InitializerBase implements Initializer { public function initialize(_arg1:Emitter, _arg2:Particle):void{ } public function removedFromEmitter(_arg1:Emitter):void{ } public function getDefaultPriority():Number{ return (0); } public function addedToEmitter(_arg1:Emitter):void{ } } }//package org.flintparticles.common.initializers
Section 261
//Lifetime (org.flintparticles.common.initializers.Lifetime) package org.flintparticles.common.initializers { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; public class Lifetime extends InitializerBase { private var _min:Number; private var _max:Number; public function Lifetime(_arg1:Number, _arg2:Number=NaN){ _max = _arg2; _min = _arg1; } public function set maxLifetime(_arg1:Number):void{ _max = _arg1; } public function get maxLifetime():Number{ return (_max); } override public function initialize(_arg1:Emitter, _arg2:Particle):void{ if (isNaN(_max)){ _arg2.lifetime = _min; } else { _arg2.lifetime = (_min + (Math.random() * (_max - _min))); }; } public function set lifetime(_arg1:Number):void{ _max = (_min = _arg1); } public function get lifetime():Number{ return (((_min == _max)) ? _min : ((_max + _min) * 0.5)); } public function get minLifetime():Number{ return (_min); } public function set minLifetime(_arg1:Number):void{ _min = _arg1; } } }//package org.flintparticles.common.initializers
Section 262
//SharedImage (org.flintparticles.common.initializers.SharedImage) package org.flintparticles.common.initializers { import flash.display.*; import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; public class SharedImage extends InitializerBase { private var _image:DisplayObject; public function SharedImage(_arg1:DisplayObject){ _image = _arg1; } override public function initialize(_arg1:Emitter, _arg2:Particle):void{ _arg2.image = _image; } public function get image():DisplayObject{ return (_image); } public function set image(_arg1:DisplayObject):void{ _image = _arg1; } } }//package org.flintparticles.common.initializers
Section 263
//Particle (org.flintparticles.common.particles.Particle) package org.flintparticles.common.particles { import flash.utils.*; import flash.geom.*; public class Particle { public var lifetime:Number;// = 0 public var scale:Number;// = 1 public var energy:Number;// = 1 public var image;// = null public var color:uint;// = 4294967295 public var collisionRadius:Number;// = 1 private var _colorTransform:ColorTransform;// = null private var _previousColor:uint; public var isDead:Boolean;// = false public var mass:Number;// = 1 private var _dictionary:Dictionary;// = null public var age:Number;// = 0 public function Particle(){ color = 4294967295; _colorTransform = null; scale = 1; mass = 1; collisionRadius = 1; image = null; lifetime = 0; age = 0; energy = 1; isDead = false; _dictionary = null; super(); } public function get dictionary():Dictionary{ if (_dictionary == null){ _dictionary = new Dictionary(true); }; return (_dictionary); } public function get colorTransform():ColorTransform{ if (((!(_colorTransform)) || (!((_previousColor == color))))){ _colorTransform = new ColorTransform((((color >>> 16) & 0xFF) / 0xFF), (((color >>> 8) & 0xFF) / 0xFF), ((color & 0xFF) / 0xFF), (((color >>> 24) & 0xFF) / 0xFF), 0, 0, 0, 0); _previousColor = color; }; return (_colorTransform); } protected function cloneInto(_arg1:Particle):Particle{ var _local2:Object; _arg1.color = color; _arg1.scale = scale; _arg1.mass = mass; _arg1.collisionRadius = collisionRadius; _arg1.lifetime = lifetime; _arg1.age = age; _arg1.energy = energy; _arg1.isDead = isDead; _arg1.image = image; if (_dictionary){ _arg1._dictionary = new Dictionary(true); for (_local2 in _dictionary) { _arg1._dictionary[_local2] = _dictionary[_local2]; }; }; return (_arg1); } public function get alpha():Number{ return ((((color & 4278190080) >>> 24) / 0xFF)); } public function clone(_arg1:ParticleFactory=null):Particle{ var _local2:Particle; if (_arg1){ _local2 = _arg1.createParticle(); } else { _local2 = new Particle(); }; return (cloneInto(_local2)); } public function initialize():void{ color = 4294967295; scale = 1; mass = 1; collisionRadius = 1; lifetime = 0; age = 0; energy = 1; isDead = false; image = null; _dictionary = null; _colorTransform = null; } } }//package org.flintparticles.common.particles
Section 264
//ParticleFactory (org.flintparticles.common.particles.ParticleFactory) package org.flintparticles.common.particles { public interface ParticleFactory { function createParticle():Particle; function disposeParticle(_arg1:Particle):void; } }//package org.flintparticles.common.particles
Section 265
//Renderer (org.flintparticles.common.renderers.Renderer) package org.flintparticles.common.renderers { import org.flintparticles.common.emitters.*; public interface Renderer { function removeEmitter(_arg1:Emitter):void; function addEmitter(_arg1:Emitter):void; } }//package org.flintparticles.common.renderers
Section 266
//SpriteRendererBase (org.flintparticles.common.renderers.SpriteRendererBase) package org.flintparticles.common.renderers { import flash.events.*; import flash.display.*; import org.flintparticles.common.events.*; import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; public class SpriteRendererBase extends Sprite implements Renderer { protected var _emitters:Array; public function SpriteRendererBase(){ _emitters = new Array(); mouseEnabled = false; mouseChildren = false; addEventListener(Event.ADDED_TO_STAGE, addedToStage, false, 0, true); } private function particleAdded(_arg1:ParticleEvent):void{ addParticle(_arg1.particle); if (stage){ stage.invalidate(); }; } private function addedToStage(_arg1:Event):void{ if (stage){ stage.invalidate(); }; } protected function removeParticle(_arg1:Particle):void{ } protected function addParticle(_arg1:Particle):void{ } public function removeEmitter(_arg1:Emitter):void{ var _local2:int; var _local3:Particle; _local2 = 0; while (_local2 < _emitters.length) { if (_emitters[_local2] == _arg1){ _emitters.splice(_local2, 1); _arg1.removeEventListener(EmitterEvent.EMITTER_UPDATED, emitterUpdated); _arg1.removeEventListener(ParticleEvent.PARTICLE_CREATED, particleAdded); _arg1.removeEventListener(ParticleEvent.PARTICLE_ADDED, particleAdded); _arg1.removeEventListener(ParticleEvent.PARTICLE_DEAD, particleRemoved); for each (_local3 in _arg1.particles) { removeParticle(_local3); }; if (_emitters.length == 0){ removeEventListener(Event.RENDER, updateParticles); renderParticles([]); } else { stage.invalidate(); }; return; }; _local2++; }; } private function emitterUpdated(_arg1:EmitterEvent):void{ if (stage){ stage.invalidate(); }; } public function addEmitter(_arg1:Emitter):void{ var _local2:Particle; _emitters.push(_arg1); if (stage){ stage.invalidate(); }; _arg1.addEventListener(EmitterEvent.EMITTER_UPDATED, emitterUpdated, false, 0, true); _arg1.addEventListener(ParticleEvent.PARTICLE_CREATED, particleAdded, false, 0, true); _arg1.addEventListener(ParticleEvent.PARTICLE_ADDED, particleAdded, false, 0, true); _arg1.addEventListener(ParticleEvent.PARTICLE_DEAD, particleRemoved, false, 0, true); for each (_local2 in _arg1.particles) { addParticle(_local2); }; if (_emitters.length == 1){ addEventListener(Event.RENDER, updateParticles, false, 0, true); }; } protected function renderParticles(_arg1:Array):void{ } public function get emitters():Array{ return (_emitters); } private function updateParticles(_arg1:Event):void{ var _local2:Array; var _local3:int; _local2 = new Array(); _local3 = 0; while (_local3 < _emitters.length) { _local2 = _local2.concat(_emitters[_local3].particles); _local3++; }; renderParticles(_local2); } private function particleRemoved(_arg1:ParticleEvent):void{ removeParticle(_arg1.particle); if (stage){ stage.invalidate(); }; } } }//package org.flintparticles.common.renderers
Section 267
//FrameUpdater (org.flintparticles.common.utils.FrameUpdater) package org.flintparticles.common.utils { import flash.events.*; import flash.display.*; import org.flintparticles.common.events.*; import flash.utils.*; public class FrameUpdater extends EventDispatcher { private var _shape:Shape; private var _time:Number; private static var _instance:FrameUpdater; public function FrameUpdater(){ _shape = new Shape(); _shape.addEventListener(Event.ENTER_FRAME, frameUpdate, false, 0, true); _time = getTimer(); } private function frameUpdate(_arg1:Event):void{ var _local2:int; var _local3:Number; _local2 = _time; _time = getTimer(); _local3 = ((_time - _local2) * 0.001); dispatchEvent(new UpdateEvent(UpdateEvent.UPDATE, _local3)); } public static function get instance():FrameUpdater{ if (_instance == null){ _instance = new (FrameUpdater); }; return (_instance); } } }//package org.flintparticles.common.utils
Section 268
//interpolateColors (org.flintparticles.common.utils.interpolateColors) package org.flintparticles.common.utils { public function interpolateColors(_arg1:uint, _arg2:uint, _arg3:Number):uint{ var _local4:Number; var _local5:uint; var _local6:uint; var _local7:uint; var _local8:uint; _local4 = (1 - _arg3); _local5 = Math.round(((((_arg1 >>> 16) & 0xFF) * _arg3) + (((_arg2 >>> 16) & 0xFF) * _local4))); _local6 = Math.round(((((_arg1 >>> 8) & 0xFF) * _arg3) + (((_arg2 >>> 8) & 0xFF) * _local4))); _local7 = Math.round((((_arg1 & 0xFF) * _arg3) + ((_arg2 & 0xFF) * _local4))); _local8 = Math.round(((((_arg1 >>> 24) & 0xFF) * _arg3) + (((_arg2 >>> 24) & 0xFF) * _local4))); return (((((_local8 << 24) | (_local5 << 16)) | (_local6 << 8)) | _local7)); } }//package org.flintparticles.common.utils
Section 269
//Maths (org.flintparticles.common.utils.Maths) package org.flintparticles.common.utils { public class Maths { private static const DEGTORAD:Number = 0.0174532925199433; private static const RADTODEG:Number = 57.2957795130823; public static function asRadians(_arg1:Number):Number{ return ((_arg1 * DEGTORAD)); } public static function asDegrees(_arg1:Number):Number{ return ((_arg1 * RADTODEG)); } } }//package org.flintparticles.common.utils
Section 270
//PriorityArray (org.flintparticles.common.utils.PriorityArray) package org.flintparticles.common.utils { import flash.utils.*; public class PriorityArray extends Proxy { private var _values:Array; public function PriorityArray(){ _values = new Array(); } public function remove(_arg1):Boolean{ var _local2:uint; _local2 = _values.length; while (_local2--) { if (_values[_local2].value == _arg1){ _values.splice(_local2, 1); return (true); }; }; return (false); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{ return ((_arg1 - 1).toString()); } public function removeAt(_arg1:uint){ var _local2:*; _local2 = _values[_arg1].value; _values.splice(_arg1, 1); return (_local2); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){ var _local2:int; _local2 = int(_arg1); if ((((((_local2 == _arg1)) && ((_local2 < _values.length)))) && (_values[_local2]))){ return (_values[_local2].value); }; return (undefined); } public function clear():void{ _values.length = 0; } public function add(_arg1, _arg2:Number):uint{ var _local3:uint; var _local4:uint; _local3 = _values.length; _local4 = 0; while (_local4 < _local3) { if (_values[_local4].priority < _arg2){ break; }; _local4++; }; _values.splice(_local4, 0, new Pair(_arg2, _arg1)); return (_values.length); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{ if (_arg1 < _values.length){ return ((_arg1 + 1)); }; return (0); } public function get length():uint{ return (_values.length); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{ var _local3:uint; _local3 = uint(_arg1); if ((((_local3 == _arg1)) && ((_local3 < _values.length)))){ _values[_local3].value = _arg2; }; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextValue(_arg1:int){ return (_values[(_arg1 - 1)].value); } public function contains(_arg1):Boolean{ var _local2:uint; _local2 = _values.length; while (_local2--) { if (_values[_local2].value == _arg1){ return (true); }; }; return (false); } } }//package org.flintparticles.common.utils class Pair { private var value; private var priority:Number; private function Pair(_arg1:Number, _arg2){ this.priority = _arg1; this.value = _arg2; } }
Section 271
//Accelerate (org.flintparticles.twoD.actions.Accelerate) package org.flintparticles.twoD.actions { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; import org.flintparticles.twoD.particles.*; import org.flintparticles.common.actions.*; public class Accelerate extends ActionBase { private var _x:Number; private var _y:Number; public function Accelerate(_arg1:Number, _arg2:Number){ _x = _arg1; _y = _arg2; } public function get y():Number{ return (_y); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D; _local4 = Particle2D(_arg2); Particle2D(_arg2).velX = (_local4.velX + (_x * _arg3)); _local4.velY = (_local4.velY + (_y * _arg3)); } public function set y(_arg1:Number):void{ _y = _arg1; } public function set x(_arg1:Number):void{ _x = _arg1; } public function get x():Number{ return (_x); } } }//package org.flintparticles.twoD.actions
Section 272
//LinearDrag (org.flintparticles.twoD.actions.LinearDrag) package org.flintparticles.twoD.actions { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; import org.flintparticles.twoD.particles.*; import org.flintparticles.common.actions.*; public class LinearDrag extends ActionBase { private var _drag:Number; public function LinearDrag(_arg1:Number){ _drag = _arg1; } public function set drag(_arg1:Number):void{ _drag = _arg1; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D; var _local5:Number; _local4 = Particle2D(_arg2); _local5 = (1 - ((_drag * _arg3) / _local4.mass)); if (_local5 < 0){ _local4.velX = 0; _local4.velY = 0; } else { _local4.velX = (_local4.velX * _local5); _local4.velY = (_local4.velY * _local5); }; } public function get drag():Number{ return (_drag); } } }//package org.flintparticles.twoD.actions
Section 273
//Move (org.flintparticles.twoD.actions.Move) package org.flintparticles.twoD.actions { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; import org.flintparticles.twoD.particles.*; import org.flintparticles.common.actions.*; public class Move extends ActionBase { private var p:Particle2D; override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ p = Particle2D(_arg2); p.x = (p.x + (p.velX * _arg3)); p.y = (p.y + (p.velY * _arg3)); } override public function getDefaultPriority():Number{ return (-10); } } }//package org.flintparticles.twoD.actions
Section 274
//Emitter2D (org.flintparticles.twoD.emitters.Emitter2D) package org.flintparticles.twoD.emitters { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; import org.flintparticles.twoD.particles.*; import org.flintparticles.common.utils.*; public class Emitter2D extends Emitter { protected var _y:Number;// = 0 protected var _x:Number;// = 0 public var spaceSort:Boolean;// = false public var spaceSortedX:Array; protected var _rotation:Number;// = 0 protected static var _creator:ParticleCreator2D = new ParticleCreator2D(); public function Emitter2D(){ _x = 0; _y = 0; _rotation = 0; spaceSort = false; super(); _particleFactory = _creator; } public function set rotation(_arg1:Number):void{ _rotation = Maths.asRadians(_arg1); } public function get y():Number{ return (_y); } public function set y(_arg1:Number):void{ _y = _arg1; } override protected function sortParticles():void{ var _local1:int; var _local2:int; if (spaceSort){ spaceSortedX = _particles.sortOn("x", (Array.NUMERIC | Array.RETURNINDEXEDARRAY)); _local1 = _particles.length; _local2 = 0; while (_local2 < _local1) { _particles[spaceSortedX[_local2]].sortID = _local2; _local2++; }; }; } override protected function initParticle(_arg1:Particle):void{ var _local2:Particle2D; _local2 = Particle2D(_arg1); _local2.x = _x; _local2.y = _y; _local2.rotation = _rotation; } public function set rotRadians(_arg1:Number):void{ _rotation = _arg1; } public function get rotRadians():Number{ return (_rotation); } public function set x(_arg1:Number):void{ _x = _arg1; } public function get rotation():Number{ return (Maths.asDegrees(_rotation)); } public function get x():Number{ return (_x); } public static function get defaultParticleFactory():ParticleFactory{ return (_creator); } } }//package org.flintparticles.twoD.emitters
Section 275
//Velocity (org.flintparticles.twoD.initializers.Velocity) package org.flintparticles.twoD.initializers { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; import flash.geom.*; import org.flintparticles.twoD.zones.*; import org.flintparticles.twoD.particles.*; import org.flintparticles.common.initializers.*; public class Velocity extends InitializerBase { private var _zone:Zone2D; public function Velocity(_arg1:Zone2D){ _zone = _arg1; } public function get zone():Zone2D{ return (_zone); } override public function initialize(_arg1:Emitter, _arg2:Particle):void{ var _local3:Particle2D; var _local4:Point; var _local5:Number; var _local6:Number; _local3 = Particle2D(_arg2); _local4 = _zone.getLocation(); if (_local3.rotation == 0){ _local3.velX = _local4.x; _local3.velY = _local4.y; } else { _local5 = Math.sin(_local3.rotation); _local6 = Math.cos(_local3.rotation); _local3.velX = ((_local6 * _local4.x) - (_local5 * _local4.y)); _local3.velY = ((_local6 * _local4.y) + (_local5 * _local4.x)); }; } public function set zone(_arg1:Zone2D):void{ _zone = _arg1; } } }//package org.flintparticles.twoD.initializers
Section 276
//Particle2D (org.flintparticles.twoD.particles.Particle2D) package org.flintparticles.twoD.particles { import org.flintparticles.common.particles.*; import flash.geom.*; public class Particle2D extends Particle { public var sortID:int;// = -1 public var rotation:Number;// = 0 private var _previousRadius:Number; public var velX:Number;// = 0 public var angVelocity:Number;// = 0 private var _previousMass:Number; public var velY:Number;// = 0 public var x:Number;// = 0 public var y:Number;// = 0 private var _inertia:Number; public function Particle2D(){ x = 0; y = 0; velX = 0; velY = 0; rotation = 0; angVelocity = 0; sortID = -1; super(); } public function get matrixTransform():Matrix{ var _local1:Number; var _local2:Number; _local1 = (scale * Math.cos(rotation)); _local2 = (scale * Math.sin(rotation)); return (new Matrix(_local1, _local2, -(_local2), _local1, x, y)); } override public function initialize():void{ super.initialize(); x = 0; y = 0; velX = 0; velY = 0; rotation = 0; angVelocity = 0; sortID = -1; } override public function clone(_arg1:ParticleFactory=null):Particle{ var _local2:Particle2D; if (_arg1){ _local2 = (_arg1.createParticle() as Particle2D); } else { _local2 = new Particle2D(); }; cloneInto(_local2); _local2.x = x; _local2.y = y; _local2.velX = velX; _local2.velY = velY; _local2.rotation = rotation; _local2.angVelocity = angVelocity; return (_local2); } public function get inertia():Number{ if (((!((mass == _previousMass))) || (!((collisionRadius == _previousRadius))))){ _inertia = (((mass * collisionRadius) * collisionRadius) * 0.5); _previousMass = mass; _previousRadius = collisionRadius; }; return (_inertia); } } }//package org.flintparticles.twoD.particles
Section 277
//ParticleCreator2D (org.flintparticles.twoD.particles.ParticleCreator2D) package org.flintparticles.twoD.particles { import org.flintparticles.common.particles.*; public class ParticleCreator2D implements ParticleFactory { private var _particles:Array; public function ParticleCreator2D(){ _particles = new Array(); } public function clearAllParticles():void{ _particles = new Array(); } public function createParticle():Particle{ if (_particles.length){ return (_particles.pop()); }; return (new Particle2D()); } public function disposeParticle(_arg1:Particle):void{ if ((_arg1 is Particle2D)){ _arg1.initialize(); _particles.push(_arg1); }; } } }//package org.flintparticles.twoD.particles
Section 278
//BitmapRenderer (org.flintparticles.twoD.renderers.BitmapRenderer) package org.flintparticles.twoD.renderers { import flash.display.*; import flash.geom.*; import flash.filters.*; import org.flintparticles.twoD.particles.*; import org.flintparticles.common.renderers.*; public class BitmapRenderer extends SpriteRendererBase { protected var _smoothing:Boolean; protected var _bitmapData:BitmapData; protected var _colorMap:Array; protected var _bitmap:Bitmap; protected var _postFilters:Array; protected var _preFilters:Array; protected var _canvas:Rectangle; protected static var ZERO_POINT:Point = new Point(0, 0); public function BitmapRenderer(_arg1:Rectangle, _arg2:Boolean=false){ mouseEnabled = false; mouseChildren = false; _smoothing = _arg2; _preFilters = new Array(); _postFilters = new Array(); _canvas = _arg1; createBitmap(); } public function setPaletteMap(_arg1:Array=null, _arg2:Array=null, _arg3:Array=null, _arg4:Array=null):void{ _colorMap = new Array(4); _colorMap[0] = _arg4; _colorMap[1] = _arg1; _colorMap[2] = _arg2; _colorMap[3] = _arg3; } public function clearPaletteMap():void{ _colorMap = null; } public function removeFilter(_arg1:BitmapFilter):void{ var _local2:int; _local2 = 0; while (_local2 < _preFilters.length) { if (_preFilters[_local2] == _arg1){ _preFilters.splice(_local2, 1); return; }; _local2++; }; _local2 = 0; while (_local2 < _postFilters.length) { if (_postFilters[_local2] == _arg1){ _postFilters.splice(_local2, 1); return; }; _local2++; }; } protected function createBitmap():void{ if (!_canvas){ return; }; if (((_bitmap) && (_bitmapData))){ _bitmapData.dispose(); _bitmapData = null; }; if (_bitmap){ removeChild(_bitmap); }; _bitmap = new Bitmap(null, "auto", _smoothing); _bitmapData = new BitmapData(_canvas.width, _canvas.height, true, 0); _bitmap.bitmapData = _bitmapData; addChild(_bitmap); _bitmap.x = _canvas.x; _bitmap.y = _canvas.y; } public function get canvas():Rectangle{ return (_canvas); } public function addFilter(_arg1:BitmapFilter, _arg2:Boolean=false):void{ if (_arg2){ _postFilters.push(_arg1); } else { _preFilters.push(_arg1); }; } public function get bitmapData():BitmapData{ return (_bitmapData); } override protected function renderParticles(_arg1:Array):void{ var _local2:int; var _local3:int; if (!_bitmap){ return; }; _bitmapData.lock(); _local3 = _preFilters.length; _local2 = 0; while (_local2 < _local3) { _bitmapData.applyFilter(_bitmapData, _bitmapData.rect, BitmapRenderer.ZERO_POINT, _preFilters[_local2]); _local2++; }; if ((((_local3 == 0)) && ((_postFilters.length == 0)))){ _bitmapData.fillRect(_bitmap.bitmapData.rect, 0); }; _local3 = _arg1.length; if (_local3){ _local2 = _local3; while (_local2--) { drawParticle(_arg1[_local2]); }; }; _local3 = _postFilters.length; _local2 = 0; while (_local2 < _local3) { _bitmapData.applyFilter(_bitmapData, _bitmapData.rect, BitmapRenderer.ZERO_POINT, _postFilters[_local2]); _local2++; }; if (_colorMap){ _bitmapData.paletteMap(_bitmapData, _bitmapData.rect, ZERO_POINT, _colorMap[1], _colorMap[2], _colorMap[3], _colorMap[0]); }; _bitmapData.unlock(); } public function set canvas(_arg1:Rectangle):void{ _canvas = _arg1; createBitmap(); } protected function drawParticle(_arg1:Particle2D):void{ var _local2:Matrix; _local2 = _arg1.matrixTransform; _local2.translate(-(_canvas.x), -(_canvas.y)); _bitmapData.draw(_arg1.image, _local2, _arg1.colorTransform, DisplayObject(_arg1.image).blendMode, null, _smoothing); } } }//package org.flintparticles.twoD.renderers
Section 279
//DiscZone (org.flintparticles.twoD.zones.DiscZone) package org.flintparticles.twoD.zones { import flash.geom.*; public class DiscZone implements Zone2D { private var _innerRadius:Number; private var _innerSq:Number; private var _outerRadius:Number; private var _center:Point; private var _outerSq:Number; private static const TWOPI:Number = 6.28318530717959; public function DiscZone(_arg1:Point, _arg2:Number, _arg3:Number=0){ if (_arg2 < _arg3){ throw (new Error((((("The outerRadius (" + _arg2) + ") can't be smaller than the innerRadius (") + _arg3) + ") in your DiscZone. N.B. the outerRadius is the second argument in the constructor and the innerRadius is the third argument."))); }; _center = _arg1; _innerRadius = _arg3; _outerRadius = _arg2; _innerSq = (_innerRadius * _innerRadius); _outerSq = (_outerRadius * _outerRadius); } public function getArea():Number{ return ((Math.PI * (_outerSq - _innerSq))); } public function get innerRadius():Number{ return (_innerRadius); } public function set innerRadius(_arg1:Number):void{ _innerRadius = _arg1; _innerSq = (_innerRadius * _innerRadius); } public function get center():Point{ return (_center); } public function set outerRadius(_arg1:Number):void{ _outerRadius = _arg1; _outerSq = (_outerRadius * _outerRadius); } public function contains(_arg1:Number, _arg2:Number):Boolean{ var _local3:Number; _arg1 = (_arg1 - _center.x); _arg2 = (_arg2 - _center.y); _local3 = ((_arg1 * _arg1) + (_arg2 * _arg2)); return ((((_local3 <= _outerSq)) && ((_local3 >= _innerSq)))); } public function get outerRadius():Number{ return (_outerRadius); } public function set center(_arg1:Point):void{ _center = _arg1; } public function getLocation():Point{ var _local1:Number; var _local2:Point; _local1 = Math.random(); _local2 = Point.polar((_innerRadius + ((1 - (_local1 * _local1)) * (_outerRadius - _innerRadius))), (Math.random() * TWOPI)); _local2.x = (_local2.x + _center.x); _local2.y = (_local2.y + _center.y); return (_local2); } } }//package org.flintparticles.twoD.zones
Section 280
//Zone2D (org.flintparticles.twoD.zones.Zone2D) package org.flintparticles.twoD.zones { import flash.geom.*; public interface Zone2D { function getArea():Number; function getLocation():Point; function contains(_arg1:Number, _arg2:Number):Boolean; } }//package org.flintparticles.twoD.zones
Section 281
//AntiTrash (sceneElements.sensors.AntiTrash) package sceneElements.sensors { import sceneElements.*; import sceneElements.shapes.*; public class AntiTrash extends BaseSceneElement { public function AntiTrash(_arg1:Object){ super(_arg1); } override protected function createSkins():Array{ return ([new AntiTrashSkin()]); } override protected function createBodies():Array{ var _local1:Array = [[[17.15, 9.05], [10.6, 18], [0, 14.55], [0, 3.45], [10.6, 0]]]; var _local2:ComplexShape = new ComplexShape({polygons:_local1, x:_x, y:_y, isSensor:false, isStatic:false, sensorType:"antiTrash"}); _local2.body.PutToSleep(); return ([_local2.body]); } } }//package sceneElements.sensors
Section 282
//Remover (sceneElements.sensors.Remover) package sceneElements.sensors { import flash.display.*; import sceneElements.*; import sceneElements.shapes.*; public class Remover extends BaseSceneElement { public function Remover(_arg1:Object){ super(_arg1); } override protected function createSkins():Array{ return ([new Sprite()]); } override protected function createBodies():Array{ var _local1:Array = [[[834.5, -432.5], [834.5, -360], [-34.5, -360], [-34.5, -432.5]], [[834.5, 840], [834.5, 902.5], [-34.5, 902.5], [-34.5, 840]], [[-34.5, -360], [30, -360], [30, 840], [-34.5, 840]], [[770, -360], [834.5, -360], [834.5, 840], [770, 840]]]; var _local2:ComplexShape = new ComplexShape({polygons:_local1, x:_x, y:_y, isSensor:true, isStatic:true, sensorType:"remover"}); _local2.body.PutToSleep(); return ([_local2.body]); } } }//package sceneElements.sensors
Section 283
//Trash (sceneElements.sensors.Trash) package sceneElements.sensors { import sceneElements.*; import sceneElements.shapes.*; public class Trash extends BaseSceneElement { public function Trash(_arg1:Object){ super(_arg1); } override protected function createSkins():Array{ return ([new TrashSkin()]); } override protected function createBodies():Array{ var _local1:Array = [[[13.8, 0], [18.4, 7.95], [13.8, 15.9], [4.6, 15.9], [0, 7.95], [4.6, 0]]]; var _local2:ComplexShape = new ComplexShape({polygons:_local1, x:_x, y:_y, isSensor:false, isStatic:false, sensorType:"trash"}); _local2.body.PutToSleep(); return ([_local2.body]); } } }//package sceneElements.sensors
Section 284
//ComplexShape (sceneElements.shapes.ComplexShape) package sceneElements.shapes { import core.engine.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import core.shape.shapeProps.*; import core.shape.*; public class ComplexShape extends BaseShape { private var _isSensor:Boolean; private var _sensorType:String; private var _isStatic:Boolean; private var _polygons:Array; private var _x:Number; private var _y:Number; private var _customShapeProps:DefaultShapeProps; public function ComplexShape(_arg1:Object){ _polygons = _arg1.polygons; _x = (_arg1.x) ? _arg1.x : 0; _y = (_arg1.y) ? _arg1.y : 0; _isStatic = ((_arg1.isStatic)!=null) ? _arg1.isStatic : true; _isSensor = ((_arg1.isSensor)!=null) ? _arg1.isSensor : false; _sensorType = (_arg1.sensorType) ? _arg1.sensorType : "shocker"; _customShapeProps = (_arg1.customShapeProps) ? _arg1.customShapeProps : null; super(); } override protected function createBody():b2Body{ var _local1:Array; var _local2:Array; var _local3:b2Body; var _local4:uint; var _local5:DefaultShapeProps; var _local7:b2PolygonDef; var _local10:UserData; if (_customShapeProps){ _local5 = _customShapeProps; } else { _local5 = (_isStatic) ? new DefaultStaticShapeProps() : new DefaultDynamicShapeProps(); }; var _local6:CoreEngine = CoreEngine.getInstance(); var _local8:b2BodyDef = new b2BodyDef(); _local8.position.x = (_x / _physScale); _local8.position.y = (_y / _physScale); _local8.angularDamping = _local5.angularDamping; _local8.linearDamping = _local5.linearDamping; var _local9:b2Body = _local6.world.CreateBody(_local8); for each (_local2 in _polygons) { _local1 = _local2; _local7 = new b2PolygonDef(); _local7.vertexCount = _local1.length; _local4 = 0; while (_local4 < _local1.length) { _local7.vertices[_local4].Set((_local1[_local4][0] / 30), (_local1[_local4][1] / 30)); _local4++; }; _local7.friction = _local5.friction; _local7.restitution = _local5.restitution; _local7.density = _local5.density; _local7.isSensor = _isSensor; if (_local5.categoryBits){ _local7.filter.categoryBits = _local5.categoryBits; }; if (_local5.maskBits){ _local7.filter.maskBits = _local5.maskBits; }; if (_local5.groupIndex){ _local7.filter.groupIndex = _local5.groupIndex; }; _local9.CreateShape(_local7); }; _local9.SetMassFromShapes(); _local10 = new UserData(); _local10.type = _sensorType; _local9.m_userData = _local10; return (_local9); } } }//package sceneElements.shapes
Section 285
//BaseSpaceship (sceneElements.spaceships.BaseSpaceship) package sceneElements.spaceships { import flash.display.*; import core.engine.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import core.*; import core.shape.shapeProps.*; import sceneElements.*; import core.shape.*; public class BaseSpaceship extends BaseSceneElement { private var _key:KeyboardListener; private var _categoryBits:uint; private var _power:Number; private var _dir:b2Vec2; private var _maskBits:uint; private var _efListener:Sprite; public function BaseSpaceship(_arg1:Object){ if (_arg1.categoryBits){ _categoryBits = _arg1.categoryBits; }; if (_arg1.maskBits){ _maskBits = _arg1.maskBits; }; _dir = _arg1.dir; _power = _arg1.power; super(_arg1); var _local2:b2Body = bodies[0]; var _local3:Number = Math.atan2(_dir.y, _dir.x); _local2.SetXForm(_local2.GetPosition(), _local3); var _local4:b2Vec2 = new b2Vec2(_dir.x, _dir.y); _local4.Multiply(_local2.m_mass); _local4.Multiply(_power); var _local5:b2Vec2 = _local2.GetWorldPoint(new b2Vec2(0, 0)); _local2.ApplyImpulse(_local4, _local5); } override protected function createBodies():Array{ var _local1:DefaultShapeProps = new DefaultDynamicShapeProps(); if (_categoryBits){ _local1.categoryBits = _categoryBits; }; if (_maskBits){ _local1.maskBits = _maskBits; }; _local1.restitution = 1.5; var _local2:CircleShape = new CircleShape(_x, _y, 10); UserData(_local2.body.m_userData).type = "hero"; CoreEngine.getInstance().controller.AddBody(_local2.body); return ([_local2.body]); } override protected function createSkins():Array{ _skin = new SpaceshipSkin(); return ([_skin]); } } }//package sceneElements.spaceships
Section 286
//BaseSceneElement (sceneElements.BaseSceneElement) package sceneElements { import flash.display.*; import core.engine.*; import core.renderer.*; import Box2D.Dynamics.*; import core.shape.shapeProps.*; public class BaseSceneElement { protected var _y:Number; private var _skinContainer:Sprite; protected var _isStatic:Boolean; protected var _skin:Sprite; protected var _bodies:Array; protected var _renderer:BaseRenderer; protected var _isSensor:Boolean;// = false protected var _h:Number; protected var _customType:String; protected var _w:Number; protected var _x:Number; protected var _r:Number; public function BaseSceneElement(_arg1:Object):void{ if (_arg1){ if (_arg1.x){ _x = _arg1.x; }; if (_arg1.y){ _y = _arg1.y; }; if (_arg1.r){ _r = _arg1.r; }; if (_arg1.w){ _w = _arg1.w; }; if (_arg1.h){ _h = _arg1.h; }; if (_arg1.skin){ _skin = _arg1.skin; }; if (_arg1.isStatic){ _isStatic = _arg1.isStatic; }; if (_arg1.isSensor != null){ _isSensor = _arg1.isSensor; }; if (_arg1.customType != null){ _customType = _arg1.customType; }; }; createChildren(); } public function get bodies():Array{ return (_bodies); } protected function createSkins():Array{ return (new Array()); } public function destruct():void{ } private function createChildren():void{ _bodies = createBodies(); var _local1:Array = createSkins(); _renderer = new BaseRenderer(_bodies, _local1); CoreEngine.getInstance().addRenderer(_renderer); changeUserData(); } private function changeUserData():void{ var _local1:b2Body; for each (_local1 in _bodies) { UserData(_local1.m_userData).renderer = _renderer; }; } protected function createBodies():Array{ return (new Array()); } public function get skin():Sprite{ return (_skin); } } }//package sceneElements
Section 287
//Bouncer (sceneElements.Bouncer) package sceneElements { import flash.display.*; import core.shape.shapeProps.*; import core.shape.*; public class Bouncer extends BaseSceneElement { public function Bouncer(_arg1:Object){ super(_arg1); } override protected function createSkins():Array{ var _local1:Sprite = new BouncerSkin(); _local1.width = (_local1.height = (_r * 2)); return ([_local1]); } override protected function createBodies():Array{ var _local1:Array = [[[110, 0], [140, 10], [0, 10], [30, 0]]]; var _local2:DefaultStaticShapeProps = new DefaultStaticShapeProps(); _local2.restitution = 1.6; var _local3:CircleShape = new CircleShape(_x, _y, _r, true, _local2); return ([_local3.body]); } } }//package sceneElements
Section 288
//Launcher (sceneElements.Launcher) package sceneElements { import flash.events.*; import events.*; import flash.display.*; import core.renderer.*; import Box2D.Common.Math.*; import sceneElements.spaceships.*; public class Launcher extends Sprite { private var _power:Number; private var _shoots:Number;// = 0 private var _skinBar:Sprite; private var _skin:Sprite; private var _isMouseDown:Boolean; private var _maxPower:Number;// = 18 private var _posX:Number; private var _posY:Number; private var _minPower:Number;// = 1 private var _isLocked:Boolean;// = false public function Launcher(_arg1:Object):void{ _posX = (_arg1.x) ? _arg1.x : 0; _posY = (_arg1.y) ? _arg1.y : 0; _isMouseDown = false; createSkin(); _skinBar.scaleX = 0; addEventListener(Event.ENTER_FRAME, onEnterFrame); Scene2DReference.getInstance().scene.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); Scene2DReference.getInstance().scene.addEventListener(MouseEvent.MOUSE_UP, onMouseUp); } private function onMouseUp(_arg1:MouseEvent):void{ _isMouseDown = false; _skinBar.scaleX = 0; fire(); } public function lock():void{ _isLocked = true; } public function unlock():void{ _isLocked = false; } private function onMouseDown(_arg1:MouseEvent):void{ _isMouseDown = true; _power = _minPower; } public function move(_arg1:Number, _arg2:Number):void{ _posX = _arg1; _posY = _arg2; _skin.x = _posX; _skin.y = _posY; } private function createSkin():void{ _skin = new Sprite(); _skin.x = _posX; _skin.y = _posY; _skin.addChild((new LauncherSkin() as Sprite)); _skinBar = new LauncherBar(); _skin.addChild(_skinBar); Scene2DReference.getInstance().scene.addChild(_skin); } public function emptyShootsCounter():void{ _shoots = 0; } private function onEnterFrame(_arg1:Event):void{ var _local6:Number; var _local2:Sprite = Scene2DReference.getInstance().scene; var _local3:Number = (_local2.mouseX - _posX); var _local4:Number = (_local2.mouseY - _posY); var _local5:Number = Math.atan2(_local4, _local3); _skin.rotation = ((_local5 * 180) / Math.PI); if (_isMouseDown){ _power = (_power + 0.25); if (_power > _maxPower){ _power = _maxPower; }; _local6 = (_power / _maxPower); _skinBar.scaleX = _local6; }; } private function fire():void{ var _local1:Sprite; var _local2:Number; var _local3:Number; var _local4:b2Vec2; var _local5:BaseSpaceship; var _local6:GameEvent; var _local7:Object; if (_isLocked){ return; }; if (_power > 3){ _local1 = Scene2DReference.getInstance().scene; _local2 = (_local1.mouseX - _posX); _local3 = (_local1.mouseY - _posY); _local4 = new b2Vec2(_local2, _local3); _local4.Normalize(); _local5 = new BaseSpaceship({x:(_posX + (_local4.x * 5)), y:(_posY + (_local4.y * 5)), r:3, dir:_local4, power:_power}); _local6 = new GameEvent(GameEvent.SHOOT); _local7 = new Object(); _local7.bullet = _local5.skin; _local6.data = _local7; dispatchEvent(_local6); }; } public function get shoots():Number{ return (_shoots); } } }//package sceneElements
Section 289
//VoluntaryBox (sceneElements.VoluntaryBox) package sceneElements { import flash.display.*; import core.shape.shapeProps.*; import core.shape.*; public class VoluntaryBox extends BaseSceneElement { public function VoluntaryBox(_arg1:Object){ super(_arg1); } override protected function createSkins():Array{ var _local1:Sprite = new VoluntaryBoxSkin(); _local1.width = _w; _local1.height = _h; return ([_local1]); } override protected function createBodies():Array{ var _local1:DefaultShapeProps; if (_isStatic){ _local1 = new DefaultStaticShapeProps(); } else { _local1 = new DefaultDynamicShapeProps(); }; _local1.restitution = 0.6; var _local2:BoxShape = new BoxShape(_x, _y, _w, _h, _isStatic, _local1); return ([_local2.body]); } } }//package sceneElements
Section 290
//BaseInstrument (sound.BaseInstrument) package sound { import flash.media.*; public class BaseInstrument { private var _c:Class; private var _sound:Sound; private var _soundChannel:SoundChannel; private var _volume:Number; private var _playTimes:Number;// = 1 private var _soundTransform:SoundTransform; public function BaseInstrument(_arg1:Class, _arg2:Number=1, _arg3:Boolean=false, _arg4:Boolean=false){ _c = _arg1; _sound = (new _c() as Sound); _volume = _arg2; _playTimes = (_arg3) ? 9999 : 1; _soundTransform = new SoundTransform(); _soundTransform.volume = _volume; if (_arg4){ mute(); }; } public function unmute():void{ _soundTransform.volume = _volume; if (_soundChannel){ _soundChannel.soundTransform = _soundTransform; }; } public function stop():void{ if (_soundChannel){ _soundChannel.stop(); }; } public function mute():void{ _soundTransform.volume = 0; if (_soundChannel){ _soundChannel.soundTransform = _soundTransform; }; } public function play():void{ stop(); _soundChannel = _sound.play(0, _playTimes); _soundChannel.soundTransform = _soundTransform; } } }//package sound
Section 291
//Samples (sound.Samples) package sound { public class Samples { public var ExplosionSndClass:Class; public var FireSndClass:Class; public var LevelLoopClass:Class; public var StarCollectedClass2:Class; public var MenuLoopSndClass:Class; public var StarCollectedClass1:Class; private static var _instance:Samples; public function Samples(_arg1:SingletonEnforcer){ FireSndClass = Samples_FireSndClass; MenuLoopSndClass = Samples_MenuLoopSndClass; ExplosionSndClass = Samples_ExplosionSndClass; LevelLoopClass = Samples_LevelLoopClass; StarCollectedClass1 = Samples_StarCollectedClass1; StarCollectedClass2 = Samples_StarCollectedClass2; super(); } public static function getInstance():Samples{ if (_instance == null){ _instance = new Samples(new SingletonEnforcer()); }; return (_instance); } } }//package sound class SingletonEnforcer { private function SingletonEnforcer(){ } }
Section 292
//Samples_ExplosionSndClass (sound.Samples_ExplosionSndClass) package sound { import mx.core.*; public class Samples_ExplosionSndClass extends SoundAsset { } }//package sound
Section 293
//Samples_FireSndClass (sound.Samples_FireSndClass) package sound { import mx.core.*; public class Samples_FireSndClass extends SoundAsset { } }//package sound
Section 294
//Samples_LevelLoopClass (sound.Samples_LevelLoopClass) package sound { import mx.core.*; public class Samples_LevelLoopClass extends SoundAsset { } }//package sound
Section 295
//Samples_MenuLoopSndClass (sound.Samples_MenuLoopSndClass) package sound { import mx.core.*; public class Samples_MenuLoopSndClass extends SoundAsset { } }//package sound
Section 296
//Samples_StarCollectedClass1 (sound.Samples_StarCollectedClass1) package sound { import mx.core.*; public class Samples_StarCollectedClass1 extends SoundAsset { } }//package sound
Section 297
//Samples_StarCollectedClass2 (sound.Samples_StarCollectedClass2) package sound { import mx.core.*; public class Samples_StarCollectedClass2 extends SoundAsset { } }//package sound
Section 298
//SoundPlayer (sound.SoundPlayer) package sound { public class SoundPlayer { private var _monsterDieSndInstr:BaseInstrument; private var _targetSndInstr:BaseInstrument; private var _starSndInstr:BaseInstrument; private var _ohSndInstr:BaseInstrument; private var _menuSndInstr:BaseInstrument; private var _isMuted:Boolean;// = false private var _levelSndInstr:BaseInstrument; private var _lvlSoundIdx:uint;// = 1 private var _fireSndInstr:BaseInstrument; private var _explosionSndInstr:BaseInstrument; private var _resetSndInstr:BaseInstrument; private static var _instance:SoundPlayer; public function SoundPlayer(_arg1:SingletonEnforcer){ } public function playStarCollectedSound():void{ _starSndInstr = ((Math.random())>0.5) ? new BaseInstrument(Samples.getInstance().StarCollectedClass1, 0.7, false, _isMuted) : new BaseInstrument(Samples.getInstance().StarCollectedClass2, 0.7, false, _isMuted); _starSndInstr.play(); } public function stopLevelSound():void{ if (_levelSndInstr){ _levelSndInstr.stop(); }; } public function playExplosionSound():void{ if (!_explosionSndInstr){ _explosionSndInstr = new BaseInstrument(Samples.getInstance().ExplosionSndClass, 0.7, false, _isMuted); }; _explosionSndInstr.play(); } public function stopMenuSound():void{ if (_menuSndInstr){ _menuSndInstr.stop(); }; } public function playMenuSound():void{ if (!_menuSndInstr){ _menuSndInstr = new BaseInstrument(Samples.getInstance().MenuLoopSndClass, 1, true, _isMuted); }; _menuSndInstr.play(); } public function playFireSound():void{ if (!_fireSndInstr){ _fireSndInstr = new BaseInstrument(Samples.getInstance().FireSndClass, 0.5, false, _isMuted); }; _fireSndInstr.play(); } public function muteSwitch():void{ if (!_isMuted){ if (_levelSndInstr){ _levelSndInstr.mute(); }; if (_menuSndInstr){ _menuSndInstr.mute(); }; if (_fireSndInstr){ _fireSndInstr.mute(); }; if (_ohSndInstr){ _ohSndInstr.mute(); }; if (_explosionSndInstr){ _explosionSndInstr.mute(); }; if (_starSndInstr){ _starSndInstr.mute(); }; if (_monsterDieSndInstr){ _monsterDieSndInstr.mute(); }; } else { if (_levelSndInstr){ _levelSndInstr.unmute(); }; if (_menuSndInstr){ _menuSndInstr.unmute(); }; if (_fireSndInstr){ _fireSndInstr.unmute(); }; if (_ohSndInstr){ _ohSndInstr.unmute(); }; if (_explosionSndInstr){ _explosionSndInstr.unmute(); }; if (_starSndInstr){ _starSndInstr.unmute(); }; if (_monsterDieSndInstr){ _monsterDieSndInstr.unmute(); }; }; _isMuted = !(_isMuted); } public function playLevelSound():void{ stopLevelSound(); _levelSndInstr = new BaseInstrument(Samples.getInstance().LevelLoopClass, 0.7, true, _isMuted); _levelSndInstr.play(); } public static function getInstance():SoundPlayer{ if (_instance == null){ _instance = new SoundPlayer(new SingletonEnforcer()); }; return (_instance); } } }//package sound class SingletonEnforcer { private function SingletonEnforcer(){ } }
Section 299
//BGAnimation_2 (SpaceBG_fla.BGAnimation_2) package SpaceBG_fla { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import flash.filters.*; import flash.text.*; import flash.net.*; import flash.media.*; import flash.system.*; import adobe.utils.*; import flash.accessibility.*; import flash.errors.*; import flash.external.*; import flash.printing.*; import flash.ui.*; import flash.xml.*; public dynamic class BGAnimation_2 extends MovieClip { public var count:uint; public var bf:BlurFilter; public var i:uint; public var particle:MovieClip; public var particleInst1:BGElement; public var particleInst2:BGElement; public function BGAnimation_2(){ addFrameScript(0, frame1); } function frame1(){ particleInst1.visible = false; particleInst2.visible = false; count = 100; i = 0; while (i < count) { particle = new BGElement(); var _local2 = particle; with (_local2) { x = (Math.random() * 700); y = (Math.random() * 480); rotation = (Math.random() * 360); scaleX = (scaleY = Math.random()); alpha = (Math.random() / 1.5); gotoAndStop(int((Math.random() * 6))); bf = new BlurFilter((scaleX * 7), (scaleX * 7), BitmapFilterQuality.HIGH); filters = [bf]; }; addChild(particle); i++; }; } } }//package SpaceBG_fla
Section 300
//fader_20 (SponsorPreloader_fla.fader_20) package SponsorPreloader_fla { import flash.display.*; public dynamic class fader_20 extends MovieClip { public function fader_20(){ addFrameScript(14, frame15); } function frame15(){ stop(); } } }//package SponsorPreloader_fla
Section 301
//playbutton_mc_9 (SponsorPreloader_fla.playbutton_mc_9) package SponsorPreloader_fla { import flash.events.*; import flash.display.*; public dynamic class playbutton_mc_9 extends MovieClip { public var btnPlay:SimpleButton; public function playbutton_mc_9(){ addFrameScript(12, frame13, 17, frame18); } function frame18(){ stop(); (parent as MovieClip).play(); } function frame13(){ stop(); btnPlay.addEventListener(MouseEvent.CLICK, onPlay); } public function onPlay(_arg1:MouseEvent):void{ play(); } } }//package SponsorPreloader_fla
Section 302
//preloaderBar_3 (SponsorPreloader_fla.preloaderBar_3) package SponsorPreloader_fla { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.net.*; import flash.system.*; import flash.geom.*; import adobe.utils.*; import flash.accessibility.*; import flash.errors.*; import flash.external.*; import flash.filters.*; import flash.media.*; import flash.printing.*; import flash.text.*; import flash.ui.*; import flash.xml.*; public dynamic class preloaderBar_3 extends MovieClip { public var preloaderInst; public var preloaderBar:MovieClip; public function preloaderBar_3(){ addFrameScript(0, frame1, 1, frame2); } function frame1(){ stop(); removeEventListener(Event.ENTER_FRAME, onEF); addEventListener(Event.ENTER_FRAME, onEF); trace("add listener"); preloaderInst = PreloaderReference.getInstance().preloader; trace(("preloaderInst: " + preloaderInst)); trace(("root: " + preloaderInst.root)); trace(("loaded: " + preloaderInst.root.loaderInfo.bytesLoaded)); trace(("total: " + preloaderInst.root.loaderInfo.bytesTotal)); } function frame2(){ stop(); } public function onEF(_arg1:Event):void{ if (preloaderInst.root.loaderInfo.bytesLoaded == preloaderInst.root.loaderInfo.bytesTotal){ trace("remove listener"); removeEventListener(Event.ENTER_FRAME, onEF); gotoAndStop(2); (parent as MovieClip).play(); } else { if (preloaderBar){ preloaderBar.scaleX = (preloaderInst.root.loaderInfo.bytesLoaded / preloaderInst.root.loaderInfo.bytesTotal); }; }; } } }//package SponsorPreloader_fla
Section 303
//sparkle_19 (SponsorPreloader_fla.sparkle_19) package SponsorPreloader_fla { import flash.display.*; public dynamic class sparkle_19 extends MovieClip { public function sparkle_19(){ addFrameScript(14, frame15); } function frame15(){ stop(); } } }//package SponsorPreloader_fla
Section 304
//sprite22_12 (SponsorPreloader_fla.sprite22_12) package SponsorPreloader_fla { import flash.display.*; public dynamic class sprite22_12 extends MovieClip { public function sprite22_12(){ addFrameScript(52, frame53); } function frame53(){ stop(); } } }//package SponsorPreloader_fla
Section 305
//OpenLevelEvent (ui.events.OpenLevelEvent) package ui.events { import flash.events.*; public class OpenLevelEvent extends Event { public var levelNo:uint; public static var TYPE:String = "selectLevel"; public function OpenLevelEvent(_arg1:String, _arg2:Boolean=false){ super(_arg1, _arg2); } } }//package ui.events
Section 306
//SubmitScoreEvent (ui.events.SubmitScoreEvent) package ui.events { import flash.events.*; public class SubmitScoreEvent extends Event { public var score:uint; public var name:String; public static var TYPE:String = "SubmitScore"; public function SubmitScoreEvent(_arg1:String){ super(_arg1); } } }//package ui.events
Section 307
//Performance (utils.Performance) package utils { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.text.*; import flash.system.*; public class Performance extends Sprite { private const GRAPHIC_HEIGHT:Number = 25; private const GRAPHIC_WIDTH:Number = 100; private const MEGABYTE:uint = 1048576; private var _fpsCount:uint; private var _back:Shape; private var _memoryStack:Array; private var _timer:Timer; private var _maxMemoryLabel:TextField; private var _graph:Shape; private var _memoryTimerCount:uint; private var _minMemoryLabel:TextField; private var _color:uint; private var _totalMemory:String; private var _fpsLabel:TextField; private var _fpsStack:Array; public function Performance(_arg1:uint=0){ _color = _arg1; _fpsStack = [0, 0, 0, 0]; _memoryStack = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; _memoryTimerCount = 0; _fpsCount = 0; _timer = new Timer(250); _fpsLabel = new TextField(); _minMemoryLabel = new TextField(); _maxMemoryLabel = new TextField(); _back = new Shape(); _graph = new Shape(); addEventListener(Event.ADDED_TO_STAGE, onAdded); } private function onRemoved(_arg1:Event):void{ removeEventListener(Event.REMOVED_FROM_STAGE, onRemoved); removeEventListener(Event.ENTER_FRAME, onEnter); _timer.removeEventListener(TimerEvent.TIMER, onTimer); _timer.stop(); removeChild(_back); removeChild(_graph); removeChild(_maxMemoryLabel); removeChild(_minMemoryLabel); removeChild(_fpsLabel); _back = null; _graph = null; _maxMemoryLabel = null; _minMemoryLabel = null; _fpsLabel = null; _fpsStack = null; _memoryStack = null; } private function onAdded(_arg1:Event):void{ var i:uint; var evt = _arg1; removeEventListener(Event.ADDED_TO_STAGE, onAdded); var _local3 = _fpsLabel; with (_local3) { defaultTextFormat = new TextFormat("Lucida", 10); selectable = false; autoSize = TextFieldAutoSize.LEFT; textColor = _color; antiAliasType = AntiAliasType.NORMAL; text = "Fps: Null\nMem: Null"; }; _local3 = _minMemoryLabel; with (_local3) { defaultTextFormat = new TextFormat("Lucida", 8); selectable = false; autoSize = TextFieldAutoSize.LEFT; textColor = _color; antiAliasType = AntiAliasType.NORMAL; text = "Null"; }; _local3 = _maxMemoryLabel; with (_local3) { defaultTextFormat = new TextFormat("Lucida", 8); selectable = false; autoSize = TextFieldAutoSize.LEFT; textColor = _color; antiAliasType = AntiAliasType.NORMAL; text = "Null"; }; _fpsLabel.mouseEnabled = false; _maxMemoryLabel.mouseEnabled = false; _minMemoryLabel.mouseEnabled = false; var widthStep:Number = (GRAPHIC_WIDTH / 10); var heightStep:Number = (GRAPHIC_HEIGHT / 5); _back.graphics.lineStyle(0, _color, 0.2); i = 0; while (i < 10) { _back.graphics.moveTo((widthStep * i), 0); _back.graphics.lineTo((widthStep * i), GRAPHIC_HEIGHT); i = (i + 1); }; i = 0; while (i <= 5) { _back.graphics.moveTo(0, (heightStep * i)); _back.graphics.lineTo((GRAPHIC_WIDTH - widthStep), (heightStep * i)); i = (i + 1); }; _fpsLabel.x = 0; _fpsLabel.y = 0; _back.x = 0; _back.y = ((_fpsLabel.y + _fpsLabel.textHeight) + 2); _graph.x = _back.x; _graph.y = _back.y; _maxMemoryLabel.x = ((_back.x + _back.width) + 2); _maxMemoryLabel.y = (_back.y - 2); _minMemoryLabel.x = ((_back.x + _back.width) + 2); _minMemoryLabel.y = ((_back.y + _back.height) - _minMemoryLabel.textHeight); addChild(_back); addChild(_graph); addChild(_fpsLabel); addChild(_maxMemoryLabel); addChild(_minMemoryLabel); _timer.start(); _timer.addEventListener(TimerEvent.TIMER, onTimer); addEventListener(Event.ENTER_FRAME, onEnter); addEventListener(Event.REMOVED_FROM_STAGE, onRemoved); } private function onTimer(_arg1:TimerEvent):void{ var _local4:uint; var _local5:uint; var _local6:uint; var _local7:uint; var _local8:uint; var _local2:uint; if (_memoryTimerCount == 4){ _memoryTimerCount = 0; _local4 = System.totalMemory; _totalMemory = ((Math.floor(((_local4 / MEGABYTE) * 100)) / 100).toString() + "Mb"); _local2 = 0; while (_local2 < 9) { _memoryStack[_local2] = _memoryStack[(_local2 + 1)]; _local2++; }; _memoryStack[9] = _local4; _local5 = 100000000000; _local6 = 0; _local7 = 0; _local2 = 0; while (_local2 < 10) { if (_memoryStack[_local2] > _local6){ _local6 = _memoryStack[_local2]; }; if (_memoryStack[_local2] < _local5){ _local5 = _memoryStack[_local2]; }; _local2++; }; _local7 = (_local6 - _local5); _maxMemoryLabel.text = ((Math.floor(((_local6 / MEGABYTE) * 1000)) / 1000).toString() + "Mb"); _minMemoryLabel.text = ((Math.floor(((_local5 / MEGABYTE) * 1000)) / 1000).toString() + "Mb"); _local8 = uint((GRAPHIC_WIDTH / 10)); _graph.graphics.clear(); _graph.graphics.lineStyle(0, _color); _graph.graphics.moveTo(0, ((GRAPHIC_HEIGHT * (_local6 - _memoryStack[0])) / _local7)); _local2 = 1; while (_local2 < 10) { _graph.graphics.lineTo((_local8 * _local2), ((GRAPHIC_HEIGHT * (_local6 - _memoryStack[_local2])) / _local7)); _local2++; }; } else { _memoryTimerCount++; }; while (_local2 < 3) { _fpsStack[_local2] = _fpsStack[(_local2 + 1)]; _local2++; }; _fpsStack[3] = _fpsCount; _fpsCount = 0; var _local3:uint = (((_fpsStack[0] + _fpsStack[1]) + _fpsStack[2]) + _fpsStack[3]); _fpsLabel.text = ((("Fps: " + _local3) + "\nMem: ") + _totalMemory); } private function onEnter(_arg1:Event):void{ _fpsCount++; } } }//package utils
Section 308
//SponsorLogo_5 (WinMenu_fla.SponsorLogo_5) package WinMenu_fla { import flash.events.*; import flash.display.*; import flash.net.*; public dynamic class SponsorLogo_5 extends MovieClip { public var btn:SimpleButton; public function SponsorLogo_5(){ addFrameScript(0, frame1); } function frame1(){ btn.addEventListener(MouseEvent.CLICK, onClick); } public function onClick(_arg1:MouseEvent):void{ var _local2:URLRequest; _local2 = new URLRequest("http://www.gamesbutler.com"); navigateToURL(_local2, "_blank"); } } }//package WinMenu_fla
Section 309
//AntiTrashSkin (AntiTrashSkin) package { import flash.display.*; public dynamic class AntiTrashSkin extends MovieClip { } }//package
Section 310
//BGElement (BGElement) package { import flash.display.*; public dynamic class BGElement extends MovieClip { } }//package
Section 311
//BouncerSkin (BouncerSkin) package { import flash.display.*; public dynamic class BouncerSkin extends MovieClip { } }//package
Section 312
//CompleteLevelMenu (CompleteLevelMenu) package { import flash.events.*; import flash.display.*; public dynamic class CompleteLevelMenu extends MovieClip { public var btnNext:SimpleButton; public var btnMenu:SimpleButton; public function CompleteLevelMenu(){ addFrameScript(0, frame1); } function frame1(){ btnMenu.addEventListener(MouseEvent.CLICK, onMenu); btnNext.addEventListener(MouseEvent.CLICK, onNext); } public function onNext(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("next", true); dispatchEvent(_local2); } public function onMenu(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("menu", true); dispatchEvent(_local2); } } }//package
Section 313
//ContactsManager (ContactsManager) package { import flash.events.*; import events.*; import core.engine.*; import core.renderer.*; import flash.utils.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import core.shape.shapeProps.*; public class ContactsManager extends EventDispatcher { public function ContactsManager():void{ init(); } private function init():void{ var _local1:BContactListener = CoreEngine.getInstance().contactListener; _local1.dispatcher.addEventListener(BContactListener.COLLIDE_ADD, collideAddHandler); } private function onFinishShoot(_arg1:b2Body):void{ UserData(_arg1.GetUserData()).type = ""; setTimeout(removeRenderer, 100, BaseRenderer(UserData(_arg1.GetUserData()).renderer)); var _local2:GameEvent = new GameEvent(GameEvent.FINISH_SHOOT); dispatchEvent(_local2); } private function removeRenderer(_arg1:BaseRenderer):void{ CoreEngine.getInstance().removeRenderer(_arg1); } private function onCollectAntiTrash(_arg1:b2Body):void{ UserData(_arg1.GetUserData()).type = ""; setTimeout(removeRenderer, 100, BaseRenderer(UserData(_arg1.GetUserData()).renderer)); var _local2:GameEvent = new GameEvent(GameEvent.COLLECT_ANTI_TRASH); dispatchEvent(_local2); } private function onCollectTrash(_arg1:b2Body):void{ UserData(_arg1.GetUserData()).type = ""; setTimeout(removeRenderer, 100, BaseRenderer(UserData(_arg1.GetUserData()).renderer)); var _local2:GameEvent = new GameEvent(GameEvent.COLLECT_TRASH); dispatchEvent(_local2); } private function collideAddHandler(_arg1:CoreEvent):void{ var _local2:b2ContactPoint = (_arg1.data as b2ContactPoint); var _local3:b2Shape = _local2.shape1; var _local4:b2Shape = _local2.shape2; var _local5:String = UserData(_local3.m_body.GetUserData()).type; var _local6:String = UserData(_local4.m_body.GetUserData()).type; if ((((_local5 == "remover")) && ((_local6 == "trash")))){ onCollectTrash(_local4.m_body); return; }; if ((((_local5 == "trash")) && ((_local6 == "remover")))){ onCollectTrash(_local3.m_body); return; }; if ((((_local5 == "remover")) && ((_local6 == "antiTrash")))){ onCollectAntiTrash(_local4.m_body); return; }; if ((((_local5 == "antiTrash")) && ((_local6 == "remover")))){ onCollectAntiTrash(_local3.m_body); return; }; if ((((_local5 == "remover")) && ((_local6 == "hero")))){ onFinishShoot(_local4.m_body); return; }; if ((((_local5 == "hero")) && ((_local6 == "remover")))){ onFinishShoot(_local3.m_body); return; }; } } }//package
Section 314
//Controls (Controls) package { import flash.events.*; import flash.display.*; import flash.text.*; public dynamic class Controls extends MovieClip { public var tfCollected:TextField; public var btnReset:SimpleButton; public var tfShootsTotal:TextField; public var btnHelp:SimpleButton; public var btnMenu:SimpleButton; public var tfShootsDone:TextField; public var tfTotal:TextField; public function Controls(){ addFrameScript(0, frame1); } public function disableReset():void{ btnReset.enabled = false; } function frame1(){ btnMenu.addEventListener(MouseEvent.CLICK, onClickMenu); btnReset.addEventListener(MouseEvent.CLICK, onClickReset); btnHelp.addEventListener(MouseEvent.CLICK, onClickHelp); } public function updateStatistic(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint):void{ tfCollected.text = String(_arg1); tfTotal.text = String(_arg2); tfShootsDone.text = String(_arg3); tfShootsTotal.text = String(_arg4); } public function enableReset():void{ btnReset.enabled = true; } public function onClickHelp(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("Help", true); dispatchEvent(_local2); } public function onClickReset(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("reset", true); dispatchEvent(_local2); } public function onClickMenu(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("menu", true); dispatchEvent(_local2); } } }//package
Section 315
//DefeatLevelMenu (DefeatLevelMenu) package { import flash.events.*; import flash.display.*; public dynamic class DefeatLevelMenu extends MovieClip { public var btnReplay:SimpleButton; public var btnMenu:SimpleButton; public function DefeatLevelMenu(){ addFrameScript(0, frame1); } function frame1(){ btnMenu.addEventListener(MouseEvent.CLICK, onMenu); btnReplay.addEventListener(MouseEvent.CLICK, onReplay); } public function onReplay(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("replay", true); dispatchEvent(_local2); } public function onMenu(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("menu", true); dispatchEvent(_local2); } } }//package
Section 316
//Dust (Dust) package { import flash.display.*; public dynamic class Dust extends MovieClip { } }//package
Section 317
//HelpMenu (HelpMenu) package { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import flash.filters.*; import flash.text.*; import flash.net.*; import flash.media.*; import flash.system.*; import adobe.utils.*; import flash.accessibility.*; import flash.errors.*; import flash.external.*; import flash.printing.*; import flash.ui.*; import flash.xml.*; public dynamic class HelpMenu extends MovieClip { public var btnDownload:SimpleButton; public var btnClose:SimpleButton; public var btnControls:SimpleButton; public var _content:MovieClip; public var btnCredits:SimpleButton; public function HelpMenu(){ addFrameScript(0, frame1); } public function onClose(_arg1:MouseEvent=null):void{ visible = false; } function frame1(){ btnControls.addEventListener(MouseEvent.CLICK, onControls); btnCredits.addEventListener(MouseEvent.CLICK, onCredits); btnDownload.addEventListener(MouseEvent.CLICK, onDownload); btnClose.addEventListener(MouseEvent.CLICK, onClose); _content.btnGoodLuck.addEventListener(MouseEvent.CLICK, onClose); } public function onDownload(_arg1:MouseEvent=null):void{ _content.gotoAndStop("download"); } public function showDialog():void{ visible = true; onControls(); } public function onControls(_arg1:MouseEvent=null):void{ _content.gotoAndStop("controls"); } public function onCredits(_arg1:MouseEvent=null):void{ _content.gotoAndStop("credits"); } } }//package
Section 318
//LauncherBar (LauncherBar) package { import flash.display.*; public dynamic class LauncherBar extends MovieClip { } }//package
Section 319
//LauncherSkin (LauncherSkin) package { import flash.display.*; public dynamic class LauncherSkin extends MovieClip { } }//package
Section 320
//LevelMenu (LevelMenu) package { import flash.events.*; import ui.events.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import flash.filters.*; import flash.text.*; import flash.net.*; import flash.media.*; import flash.system.*; import adobe.utils.*; import flash.accessibility.*; import flash.errors.*; import flash.external.*; import flash.printing.*; import flash.ui.*; import flash.xml.*; public dynamic class LevelMenu extends MovieClip { public var mcAreYouSure:MovieClip; public var btnReset:SimpleButton; public var lock1:MovieClip; public var lock2:MovieClip; public var lock3:MovieClip; public var lock4:MovieClip; public var lock5:MovieClip; public var lock6:MovieClip; public var lock8:MovieClip; public var lock9:MovieClip; public var b:SimpleButton; public var lock7:MovieClip; public var l:MovieClip; public var lock10:MovieClip; public var lock12:MovieClip; public var lock15:MovieClip; public var lock16:MovieClip; public var lock17:MovieClip; public var lock13:MovieClip; public var lock14:MovieClip; public var lock18:MovieClip; public var lock11:MovieClip; public var arrRecords:Array; public var lock20:MovieClip; public var lock19:MovieClip; public var arrLocks:Array; public var btnYes:SimpleButton; public var btnNo:SimpleButton; public var arrLevels:Array; public var mcPreview:MovieClip; public var btn1:SimpleButton; public var btn2:SimpleButton; public var btn3:SimpleButton; public var btn4:SimpleButton; public var btn6:SimpleButton; public var btn7:SimpleButton; public var btn9:SimpleButton; public var btn8:SimpleButton; public var btn5:SimpleButton; public var tfBestTime:TextField; public var btn10:SimpleButton; public var btn11:SimpleButton; public var btn12:SimpleButton; public var btn14:SimpleButton; public var btn16:SimpleButton; public var btn17:SimpleButton; public var btn18:SimpleButton; public var btn19:SimpleButton; public var btn13:SimpleButton; public var btn15:SimpleButton; public var arrBtns:Array; public var btn20:SimpleButton; public function LevelMenu(){ addFrameScript(0, frame1); } public function onNo(_arg1:MouseEvent):void{ hideResetConfirmation(); } public function hideResetConfirmation():void{ mcAreYouSure.visible = false; btnYes.visible = false; btnNo.visible = false; } function frame1(){ arrRecords = new Array(); arrBtns = [btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btn10, btn11, btn12, btn13, btn14, btn15, btn16, btn17, btn18, btn19, btn20]; for each (b in arrBtns) { b.addEventListener(MouseEvent.CLICK, onClick); b.addEventListener(MouseEvent.ROLL_OVER, onRollover); b.addEventListener(MouseEvent.ROLL_OUT, onRollout); }; mcPreview.gotoAndStop("default"); tfBestTime.visible = false; arrLevels = ["sc1", "sc2", "sc3", "sc4", "sc5", "sc6", "sc7", "sc8", "sc9", "sc10", "sc11", "sc12", "sc13", "sc14", "sc15", "sc16", "sc17", "sc18", "sc19", "sc20"]; arrLocks = [lock1, lock2, lock3, lock4, lock5, lock6, lock7, lock8, lock9, lock10, lock11, lock12, lock13, lock14, lock15, lock16, lock17, lock18, lock19, lock20]; for each (l in arrLocks) { l.enabled = false; l.buttonMode = false; }; btnReset.addEventListener(MouseEvent.CLICK, onReset); btnYes.addEventListener(MouseEvent.CLICK, onYes); btnNo.addEventListener(MouseEvent.CLICK, onNo); } public function onYes(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("resetProgress"); dispatchEvent(_local2); hideResetConfirmation(); } public function showDialog():void{ hideResetConfirmation(); visible = true; } public function onReset(_arg1:MouseEvent):void{ mcAreYouSure.visible = true; btnYes.visible = true; btnNo.visible = true; } public function onRollout(_arg1:MouseEvent):void{ mcPreview.gotoAndStop("default"); tfBestTime.visible = false; } public function onClick(_arg1:MouseEvent):void{ var _local2:uint; var _local3:OpenLevelEvent; if (_arg1.target.enabled == false){ return; }; _local2 = 0; while (_local2 < 20) { if (arrBtns[_local2] == _arg1.target){ _local3 = new OpenLevelEvent(OpenLevelEvent.TYPE); _local3.levelNo = (_local2 + 1); dispatchEvent(_local3); return; }; _local2++; }; } public function unlock(_arg1:uint):void{ var _local2:uint; if (_arg1 > arrLocks.length){ _arg1 = arrLocks.length; }; _local2 = 0; while (_local2 < _arg1) { arrLocks[_local2].visible = false; arrBtns[_local2].enabled = true; _local2++; }; _local2 = _arg1; while (_local2 < 20) { arrLocks[_local2].visible = true; arrBtns[_local2].enabled = false; _local2++; }; } public function onRollover(_arg1:MouseEvent):void{ var _local2:uint; _local2 = 0; while (_local2 < 20) { if (arrBtns[_local2] == _arg1.target){ mcPreview.gotoAndStop(arrLevels[_local2]); tfBestTime.visible = true; if (arrRecords[_local2]){ tfBestTime.text = ("Best level score: " + arrRecords[_local2]); } else { tfBestTime.text = ""; }; return; }; _local2++; }; mcPreview.gotoAndStop("default"); } } }//package
Section 321
//Main (Main) package { import flash.events.*; import ui.events.*; import events.*; import flash.display.*; import core.engine.*; import core.renderer.*; import flash.utils.*; import sound.*; import com.boristhebrave.Box2D.Controllers.*; import org.casalib.ui.*; import memory.*; import core.*; import sceneElements.*; import effects.*; import utils.*; import sceneElements.sensors.*; import org.casalib.util.*; import mochi.as3.*; import com.pixelfumes.reflect.*; public class Main extends Sprite { public var levelMenu:LevelMenu; private var _isDebug:Boolean;// = false private var _launcher:Launcher; private var _isAllowReset:Boolean;// = true private var _controller:b2BuoyancyController; public var helpMenu:HelpMenu; private var _completeLevelMenu:CompleteLevelMenu; public var winMenu:WinMenu; private var _highscoresID:String;// = "" private var _dustEffect:DustEffect; private var _levels:Array; private var _collectedItemsCount:uint; private var _startedShootsCount:uint; private var _sceneElements:Array; private var _finishedShootsCount:uint; private var _curLevelNo:uint; private var _totalAllowedShoots:uint; public var controls:Controls; private var _defeatLevelMenu:DefeatLevelMenu; public var startMenu:StartMenu; private var _foreground:Sprite; public var profiler:Performance; private var _totalItemsToCollect:uint; private var _heroSkin:Sprite; public function Main(){ _levels = [0, 1, 2, 3, 5, 8, 17, 9, 6, 13, 11, 4, 10, 7, 14, 15, 12, 18, 20, 16, 19]; super(); } private function generateLevel1():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 26; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:154, y:185}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:562, y:170, w:20, h:340, isStatic:true})); push(new Bouncer({x:475, y:77, r:15})); push(new Bouncer({x:432, y:0x0100, r:33})); push(new Trash({x:435, y:94})); push(new Trash({x:417, y:112})); push(new Trash({x:399, y:130})); push(new Trash({x:382, y:147})); push(new Trash({x:365, y:164})); push(new Trash({x:350, y:179})); push(new Trash({x:334, y:195})); push(new Trash({x:317, y:212})); push(new Trash({x:301, y:228})); push(new Trash({x:285, y:244})); push(new Trash({x:406, y:94})); push(new Trash({x:382, y:94})); push(new Trash({x:353, y:94})); push(new Trash({x:435, y:123})); push(new Trash({x:435, y:147})); push(new Trash({x:435, y:172})); push(new Trash({x:264, y:32})); push(new Trash({x:264, y:53})); push(new Trash({x:240, y:53})); push(new Trash({x:240, y:31})); push(new Trash({x:217, y:32})); push(new Trash({x:217, y:53})); push(new Trash({x:193, y:53})); push(new Trash({x:193, y:31})); push(new Trash({x:157, y:290})); push(new Trash({x:157, y:311})); push(new Trash({x:133, y:311})); push(new Trash({x:133, y:289})); push(new Trash({x:110, y:290})); push(new Trash({x:110, y:311})); push(new Trash({x:86, y:311})); push(new Trash({x:86, y:289})); }; } private function createProfiler():void{ profiler = new Performance(15661567); profiler.x = 500; profiler.name = "profilerName"; } private function generateLevel6():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 45; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:461, y:197}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:17, y:127, w:19, h:200, isStatic:true})); push(new VoluntaryBox({x:630, y:91, w:19, h:200, isStatic:true})); push(new VoluntaryBox({x:390, y:162, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:498, y:161, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:516, y:179, w:15, h:15, isStatic:true})); push(new VoluntaryBox({x:443, y:134, w:28, h:28, isStatic:true})); push(new VoluntaryBox({x:241, y:247, w:28, h:28, isStatic:true})); push(new VoluntaryBox({x:373, y:275, w:28, h:28, isStatic:true})); push(new VoluntaryBox({x:150, y:170, w:28, h:28, isStatic:true})); push(new VoluntaryBox({x:585, y:329, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:90, y:51, w:15, h:15, isStatic:true})); push(new Trash({x:515, y:9})); push(new Bouncer({x:90, y:310, r:63})); push(new Bouncer({x:310, y:343, r:22})); push(new Bouncer({x:220, y:323, r:15})); push(new Bouncer({x:423, y:375, r:47})); push(new Trash({x:589, y:11})); push(new Trash({x:552, y:10})); push(new Trash({x:474, y:9})); push(new Trash({x:429, y:10})); push(new Trash({x:389, y:13})); push(new Trash({x:344, y:17})); push(new Trash({x:304, y:22})); push(new Trash({x:264, y:30})); push(new Trash({x:223, y:41})); push(new Trash({x:185, y:56})); push(new Trash({x:150, y:75})); push(new Trash({x:119, y:101})); push(new Trash({x:95, y:136})); push(new Trash({x:83, y:184})); push(new Trash({x:491, y:28})); push(new Trash({x:448, y:37})); push(new Trash({x:406, y:47})); push(new Trash({x:362, y:59})); push(new Trash({x:315, y:76})); push(new Trash({x:276, y:93})); push(new Trash({x:237, y:116})); push(new Trash({x:203, y:152})); push(new Trash({x:192, y:195})); push(new Trash({x:531, y:31})); push(new Trash({x:477, y:51})); push(new Trash({x:440, y:67})); push(new Trash({x:396, y:88})); push(new Trash({x:359, y:109})); push(new Trash({x:320, y:137})); push(new Trash({x:289, y:173})); push(new Trash({x:283, y:213})); push(new Bouncer({x:475, y:142, r:10})); push(new Bouncer({x:413, y:142, r:10})); push(new Trash({x:588, y:38})); push(new Trash({x:585, y:73})); push(new Trash({x:580, y:110})); push(new Trash({x:572, y:147})); push(new Trash({x:537, y:243})); push(new Trash({x:522, y:273})); push(new Trash({x:504, y:304})); push(new Trash({x:482, y:335})); push(new Trash({x:622, y:213})); push(new Trash({x:622, y:253})); push(new Trash({x:622, y:292})); push(new Trash({x:622, y:333})); push(new Trash({x:46, y:4})); push(new Trash({x:82, y:4})); push(new Trash({x:120, y:4})); push(new Trash({x:155, y:4})); push(new Trash({x:46, y:40})); push(new Trash({x:46, y:72})); push(new Trash({x:46, y:106})); push(new Trash({x:46, y:138})); push(new Trash({x:622, y:370})); push(new Trash({x:589, y:370})); push(new Trash({x:557, y:370})); }; } private function createMask():void{ var _local1:MainMask = new MainMask(); addChild(_local1); } private function generateLevel8():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 48; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:112, y:268}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:268, y:152, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:398, y:149, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:442, y:26, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:485, y:148, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:616, y:152, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:0x0200, y:231, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:550, y:356, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:442, y:282, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:335, y:356, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:372, y:231, w:20, h:20, isStatic:true})); push(new Bouncer({x:250, y:263, r:15})); push(new Trash({x:447, y:181})); push(new Trash({x:325, y:142})); push(new Trash({x:412, y:79})); push(new Trash({x:455, y:79})); push(new Trash({x:542, y:142})); push(new Trash({x:556, y:183})); push(new Trash({x:523, y:285})); push(new Trash({x:488, y:311})); push(new Trash({x:380, y:311})); push(new Trash({x:345, y:285})); push(new Trash({x:312, y:183})); push(new Trash({x:294, y:143})); push(new Trash({x:356, y:143})); push(new Trash({x:402, y:107})); push(new Trash({x:422, y:50})); push(new Trash({x:446, y:52})); push(new Trash({x:466, y:107})); push(new Trash({x:511, y:141})); push(new Trash({x:572, y:142})); push(new Trash({x:580, y:165})); push(new Trash({x:532, y:201})); push(new Trash({x:0x0202, y:0xFF})); push(new Trash({x:531, y:313})); push(new Trash({x:511, y:327})); push(new Trash({x:463, y:294})); push(new Trash({x:405, y:294})); push(new Trash({x:356, y:328})); push(new Trash({x:337, y:313})); push(new Trash({x:354, y:0xFF})); push(new Trash({x:336, y:201})); push(new Trash({x:290, y:167})); push(new Trash({x:434, y:140})); push(new Trash({x:377, y:181})); push(new Trash({x:399, y:248})); push(new Trash({x:469, y:248})); push(new Trash({x:491, y:181})); push(new Trash({x:420, y:181})); push(new Trash({x:456, y:207})); push(new Trash({x:434, y:223})); push(new Trash({x:412, y:207})); push(new Trash({x:529, y:169})); push(new Trash({x:337, y:168})); push(new Trash({x:434, y:100})); push(new Trash({x:492, y:279})); push(new Trash({x:376, y:280})); push(new Trash({x:156, y:88})); push(new Trash({x:122, y:85})); push(new Trash({x:88, y:81})); push(new Trash({x:54, y:78})); push(new Trash({x:19, y:74})); push(new Trash({x:110, y:62})); push(new Trash({x:76, y:43})); push(new Trash({x:42, y:24})); push(new Trash({x:8, y:5})); push(new Trash({x:105, y:104})); push(new Trash({x:70, y:116})); push(new Trash({x:34, y:127})); push(new Trash({x:0, y:138})); }; } private function generateLevel3():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 45; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:561, y:275}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:367, y:339, w:40, h:40, isStatic:true})); push(new VoluntaryBox({x:393, y:77, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:315, y:185, w:30, h:30, isStatic:true})); push(new Bouncer({x:26, y:239, r:15})); push(new Bouncer({x:58, y:333, r:33})); push(new Trash({x:317, y:65})); push(new Bouncer({x:151, y:344, r:15})); push(new Bouncer({x:22, y:132, r:15})); push(new Trash({x:288, y:65})); push(new Trash({x:258, y:65})); push(new Trash({x:229, y:65})); push(new Trash({x:199, y:65})); push(new Trash({x:170, y:65})); push(new Trash({x:140, y:65})); push(new Trash({x:111, y:65})); push(new Trash({x:81, y:65})); push(new Trash({x:81, y:246})); push(new Trash({x:252, y:246})); push(new Trash({x:252, y:119})); push(new Trash({x:129, y:119})); push(new Trash({x:129, y:201})); push(new Trash({x:202, y:201})); push(new Trash({x:202, y:160})); push(new Trash({x:171, y:160})); push(new Trash({x:166, y:201})); push(new Trash({x:129, y:160})); push(new Trash({x:160, y:119})); push(new Trash({x:191, y:119})); push(new Trash({x:222, y:119})); push(new Trash({x:252, y:151})); push(new Trash({x:252, y:183})); push(new Trash({x:252, y:214})); push(new Trash({x:218, y:246})); push(new Trash({x:184, y:246})); push(new Trash({x:150, y:246})); push(new Trash({x:116, y:246})); push(new Trash({x:81, y:210})); push(new Trash({x:81, y:174})); push(new Trash({x:81, y:137})); push(new Trash({x:81, y:101})); push(new Trash({x:426, y:69})); push(new Trash({x:578, y:69})); push(new Trash({x:548, y:69})); push(new Trash({x:518, y:69})); push(new Trash({x:487, y:69})); push(new Trash({x:457, y:69})); push(new Trash({x:578, y:101})); push(new Trash({x:578, y:133})); push(new Trash({x:578, y:165})); push(new Trash({x:578, y:197})); push(new Trash({x:549, y:197})); push(new Trash({x:519, y:197})); push(new Trash({x:489, y:197})); push(new Trash({x:459, y:197})); push(new Trash({x:429, y:197})); push(new Trash({x:429, y:170})); push(new Trash({x:429, y:143})); push(new Trash({x:429, y:116})); push(new Trash({x:453, y:116})); push(new Trash({x:479, y:116})); push(new Trash({x:504, y:116})); push(new Trash({x:528, y:116})); push(new Trash({x:528, y:139})); push(new Trash({x:528, y:161})); push(new Trash({x:502, y:161})); }; } private function generateLevel4():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 38; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:97, y:166}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:245, y:104, w:14, h:158, isStatic:true})); push(new VoluntaryBox({x:426, y:218, w:14, h:76, isStatic:true})); push(new VoluntaryBox({x:633, y:152, w:14, h:404, isStatic:true})); push(new VoluntaryBox({x:145, y:34, w:185, h:18, isStatic:true})); push(new Bouncer({x:215, y:318, r:26})); push(new Trash({x:315, y:259})); push(new Bouncer({x:338, y:363, r:60})); push(new Trash({x:288, y:39})); push(new Trash({x:288, y:65})); push(new Trash({x:288, y:117})); push(new Trash({x:288, y:143})); push(new Trash({x:288, y:195})); push(new Trash({x:288, y:221})); push(new Trash({x:342, y:39})); push(new Trash({x:368, y:39})); push(new Trash({x:421, y:39})); push(new Trash({x:448, y:39})); push(new Trash({x:501, y:39})); push(new Trash({x:527, y:39})); push(new Trash({x:580, y:39})); push(new Trash({x:580, y:66})); push(new Trash({x:580, y:120})); push(new Trash({x:580, y:147})); push(new Trash({x:580, y:201})); push(new Trash({x:580, y:228})); push(new Trash({x:580, y:282})); push(new Trash({x:580, y:309})); push(new Trash({x:350, y:128})); push(new Trash({x:350, y:154})); push(new Trash({x:350, y:206})); push(new Trash({x:350, y:232})); push(new Trash({x:375, y:102})); push(new Trash({x:425, y:102})); push(new Trash({x:450, y:102})); push(new Trash({x:500, y:102})); push(new Trash({x:524, y:102})); push(new Trash({x:524, y:127})); push(new Trash({x:524, y:177})); push(new Trash({x:524, y:202})); push(new Trash({x:524, y:252})); push(new Trash({x:524, y:277})); push(new Trash({x:524, y:327})); push(new Trash({x:204, y:57})); push(new Trash({x:180, y:57})); push(new Trash({x:208, y:84})); push(new Trash({x:351, y:259})); push(new Trash({x:148, y:259})); push(new Trash({x:127, y:295})); push(new Trash({x:127, y:339})); push(new Trash({x:468, y:162})); push(new Trash({x:468, y:188})); push(new Trash({x:468, y:244})); push(new Trash({x:468, y:270})); push(new Trash({x:468, y:326})); }; } private function showProfiler():void{ if (getChildByName("profilerName")){ removeChild(profiler); profiler = null; } else { createProfiler(); addChild(profiler); }; } private function generateLevel(_arg1:Event=null, _arg2:Boolean=false):void{ prepareForNewLevel(); setTimeout(generateCurLevel, 100); } public function init(_arg1:Boolean):void{ MochiBot.track(this, "9dfe6830"); if (_arg1){ showSponsorsIntro(); }; } private function generateLevel9():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 46; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:584, y:208}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:205, y:200, w:70, h:20, isStatic:true})); push(new VoluntaryBox({x:409, y:195, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:347, y:121, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:68, y:121, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:342, y:279, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:71, y:279, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:262, y:250, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:262, y:145, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:154, y:145, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:154, y:252, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:287, y:51, w:20, h:20, isStatic:true})); push(new Trash({x:156, y:113})); push(new Trash({x:153, y:10})); push(new Trash({x:201, y:101})); push(new Trash({x:250, y:10})); push(new Trash({x:247, y:113})); push(new Trash({x:334, y:59})); push(new Trash({x:280, y:146})); push(new Trash({x:382, y:143})); push(new Trash({x:292, y:191})); push(new Trash({x:382, y:240})); push(new Trash({x:280, y:236})); push(new Trash({x:334, y:324})); push(new Trash({x:247, y:269})); push(new Trash({x:250, y:372})); push(new Trash({x:201, y:282})); push(new Trash({x:153, y:372})); push(new Trash({x:156, y:269})); push(new Trash({x:69, y:324})); push(new Trash({x:123, y:236})); push(new Trash({x:20, y:240})); push(new Trash({x:111, y:191})); push(new Trash({x:21, y:143})); push(new Trash({x:123, y:146})); push(new Trash({x:69, y:59})); push(new Trash({x:155, y:61})); push(new Trash({x:177, y:55})); push(new Trash({x:226, y:55})); push(new Trash({x:248, y:61})); push(new Trash({x:331, y:144})); push(new Trash({x:337, y:167})); push(new Trash({x:337, y:215})); push(new Trash({x:331, y:238})); push(new Trash({x:248, y:321})); push(new Trash({x:226, y:327})); push(new Trash({x:177, y:327})); push(new Trash({x:155, y:321})); push(new Trash({x:72, y:238})); push(new Trash({x:66, y:215})); push(new Trash({x:66, y:167})); push(new Trash({x:72, y:144})); push(new Trash({x:96, y:237})); push(new Trash({x:87, y:204})); push(new Trash({x:88, y:179})); push(new Trash({x:96, y:145})); push(new Trash({x:155, y:87})); push(new Trash({x:189, y:78})); push(new Trash({x:247, y:87})); push(new Trash({x:304, y:145})); push(new Trash({x:315, y:179})); push(new Trash({x:314, y:203})); push(new Trash({x:305, y:237})); push(new Trash({x:247, y:294})); push(new Trash({x:213, y:303})); push(new Trash({x:189, y:304})); push(new Trash({x:155, y:296})); push(new Trash({x:214, y:78})); push(new Bouncer({x:206, y:174, r:15})); push(new Bouncer({x:183, y:181, r:7})); push(new Bouncer({x:230, y:181, r:7})); push(new Bouncer({x:387, y:377, r:25})); push(new Bouncer({x:156, y:204, r:7})); push(new Bouncer({x:253, y:204, r:7})); }; } private function generateLevel2():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 50; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:346, y:247}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new Bouncer({x:575, y:61, r:33})); push(new Trash({x:83, y:142})); push(new Trash({x:548, y:142})); push(new Trash({x:548, y:335})); push(new Trash({x:83, y:335})); push(new Trash({x:317, y:20})); push(new Trash({x:289, y:35})); push(new Trash({x:260, y:50})); push(new Trash({x:232, y:64})); push(new Trash({x:203, y:79})); push(new Trash({x:175, y:94})); push(new Trash({x:146, y:109})); push(new Trash({x:118, y:124})); push(new Trash({x:345, y:35})); push(new Trash({x:373, y:50})); push(new Trash({x:402, y:64})); push(new Trash({x:430, y:79})); push(new Trash({x:458, y:94})); push(new Trash({x:486, y:109})); push(new Trash({x:0x0202, y:124})); push(new Trash({x:83, y:174})); push(new Trash({x:83, y:206})); push(new Trash({x:83, y:238})); push(new Trash({x:83, y:270})); push(new Trash({x:83, y:302})); push(new Trash({x:548, y:169})); push(new Trash({x:548, y:196})); push(new Trash({x:548, y:223})); push(new Trash({x:548, y:250})); push(new Trash({x:548, y:277})); push(new Trash({x:548, y:304})); push(new Trash({x:119, y:335})); push(new Trash({x:155, y:335})); push(new Trash({x:191, y:335})); push(new Trash({x:227, y:335})); push(new Trash({x:263, y:335})); push(new Trash({x:299, y:335})); push(new Trash({x:335, y:335})); push(new Trash({x:371, y:335})); push(new Trash({x:407, y:335})); push(new Trash({x:443, y:335})); push(new Trash({x:479, y:335})); push(new Trash({x:515, y:335})); push(new Trash({x:141, y:142})); push(new Trash({x:199, y:142})); push(new Trash({x:0x0101, y:142})); push(new Trash({x:315, y:142})); push(new Trash({x:373, y:142})); push(new Trash({x:431, y:142})); push(new Trash({x:489, y:142})); push(new Trash({x:239, y:179})); push(new Trash({x:394, y:179})); push(new Trash({x:394, y:292})); push(new Trash({x:239, y:292})); push(new Trash({x:239, y:236})); push(new Trash({x:317, y:179})); push(new Trash({x:394, y:236})); push(new Trash({x:317, y:292})); push(new Trash({x:278, y:292})); push(new Trash({x:355, y:292})); push(new Trash({x:239, y:264})); push(new Trash({x:239, y:206})); push(new Trash({x:276, y:179})); push(new Trash({x:354, y:179})); push(new Trash({x:394, y:206})); push(new Trash({x:394, y:264})); push(new Bouncer({x:62, y:61, r:33})); }; } private function generateLevel5():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 35; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:97, y:166}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:629, y:175, w:14, h:326, isStatic:true})); push(new Bouncer({x:351, y:121, r:36})); push(new Trash({x:423, y:27})); push(new Bouncer({x:343, y:266, r:47})); push(new Trash({x:507, y:55})); push(new Trash({x:535, y:65})); push(new Trash({x:563, y:74})); push(new Trash({x:538, y:90})); push(new Trash({x:488, y:121})); push(new Trash({x:463, y:137})); push(new Trash({x:434, y:155})); push(new Trash({x:464, y:163})); push(new Trash({x:494, y:171})); push(new Trash({x:524, y:179})); push(new Trash({x:554, y:187})); push(new Trash({x:588, y:197})); push(new Trash({x:561, y:214})); push(new Trash({x:533, y:232})); push(new Trash({x:450, y:284})); push(new Trash({x:423, y:301})); push(new Trash({x:454, y:311})); push(new Trash({x:485, y:321})); push(new Trash({x:548, y:342})); push(new Trash({x:579, y:352})); push(new Trash({x:200, y:123})); push(new Trash({x:225, y:136})); push(new Trash({x:250, y:149})); push(new Trash({x:274, y:163})); push(new Trash({x:243, y:180})); push(new Trash({x:211, y:197})); push(new Trash({x:179, y:214})); push(new Trash({x:83, y:265})); push(new Trash({x:49, y:283})); push(new Trash({x:83, y:293})); push(new Trash({x:115, y:304})); push(new Trash({x:147, y:314})); push(new Trash({x:178, y:325})); push(new Trash({x:210, y:336})); push(new Trash({x:242, y:347})); push(new Trash({x:274, y:357})); push(new Trash({x:343, y:8})); push(new Trash({x:343, y:33})); push(new Trash({x:343, y:58})); push(new Trash({x:343, y:166})); push(new Trash({x:343, y:191})); push(new Trash({x:333, y:321})); push(new Trash({x:333, y:346})); push(new Trash({x:333, y:371})); }; } private function generateLevel7():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 40; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:333, y:360}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:376, y:282, w:15, h:134, isStatic:true})); push(new VoluntaryBox({x:280, y:282, w:15, h:134, isStatic:true})); push(new Bouncer({x:324, y:31, r:68})); push(new Trash({x:406, y:73})); push(new Trash({x:443, y:35})); push(new Trash({x:475, y:45})); push(new Trash({x:505, y:58})); push(new Trash({x:537, y:75})); push(new Trash({x:565, y:94})); push(new Trash({x:591, y:116})); push(new Trash({x:615, y:140})); push(new Trash({x:430, y:94})); push(new Trash({x:455, y:118})); push(new Trash({x:479, y:143})); push(new Trash({x:501, y:168})); push(new Trash({x:541, y:221})); push(new Trash({x:522, y:195})); push(new Trash({x:559, y:247})); push(new Trash({x:579, y:279})); push(new Trash({x:384, y:137})); push(new Trash({x:405, y:167})); push(new Trash({x:424, y:201})); push(new Trash({x:441, y:238})); push(new Trash({x:454, y:275})); push(new Trash({x:464, y:313})); push(new Bouncer({x:18, y:349, r:18})); push(new Bouncer({x:75, y:377, r:18})); push(new Bouncer({x:614, y:349, r:18})); push(new Bouncer({x:555, y:377, r:18})); push(new Trash({x:189, y:35})); push(new Trash({x:160, y:44})); push(new Trash({x:134, y:55})); push(new Trash({x:106, y:69})); push(new Trash({x:80, y:86})); push(new Trash({x:57, y:102})); push(new Trash({x:35, y:122})); push(new Trash({x:17, y:141})); push(new Trash({x:226, y:73})); push(new Trash({x:202, y:95})); push(new Trash({x:177, y:119})); push(new Trash({x:154, y:144})); push(new Trash({x:131, y:169})); push(new Trash({x:111, y:194})); push(new Trash({x:90, y:223})); push(new Trash({x:71, y:252})); push(new Trash({x:54, y:279})); push(new Trash({x:248, y:137})); push(new Trash({x:228, y:168})); push(new Trash({x:209, y:201})); push(new Trash({x:194, y:231})); push(new Trash({x:182, y:265})); push(new Trash({x:172, y:299})); push(new Trash({x:166, y:336})); push(new Trash({x:596, y:194})); push(new Trash({x:50, y:183})); push(new Trash({x:415, y:341})); push(new Trash({x:217, y:341})); }; } private function onKeyPressed(_arg1:KeyboardEvent):void{ switch (_arg1.keyCode){ case 82: onReset(); break; case 77: onMenu(); break; case 123: showProfiler(); break; }; } private function createChildren():void{ createRenderer(); createControls(); createController(); createProfiler(); createMask(); createDustEffect(); if (_isDebug){ createDebugDraw(); }; addEventListener(GameEvent.SHOOT, onShoot); } private function prepareForNewLevel():void{ var _local1:BaseSceneElement; _launcher = null; if (_completeLevelMenu){ _completeLevelMenu.visible = false; }; if (_defeatLevelMenu){ _defeatLevelMenu.visible = false; }; if (_sceneElements){ for each (_local1 in _sceneElements) { _local1.destruct(); }; }; _sceneElements = new Array(); CoreEngine.getInstance().createWorld(); createRenderer(); _collectedItemsCount = 0; _finishedShootsCount = 0; _totalAllowedShoots = 5; } private function checkForDefeat():void{ if ((((_collectedItemsCount < _totalItemsToCollect)) && ((_finishedShootsCount == _totalAllowedShoots)))){ showDefeatLevelMenu(); }; } private function onNextLevel(_arg1:Event):void{ _curLevelNo++; generateLevel(); } private function onOpenLevel(_arg1:OpenLevelEvent):void{ SoundPlayer.getInstance().playLevelSound(); levelMenu.visible = false; _curLevelNo = _arg1.levelNo; generateLevel(); } private function createStartMenu():void{ startMenu = new StartMenu(); startMenu.addEventListener("Play", onPlay); startMenu.addEventListener("Help", onHelp); startMenu.addEventListener("Highscores", onHighscores); startMenu.addEventListener("Download", onDownload); startMenu.visible = true; addChild(startMenu); } private function showCompleteLevelMenu():void{ if (_defeatLevelMenu){ _defeatLevelMenu.visible = false; }; var _local1:Number = (((_totalAllowedShoots - _finishedShootsCount) * 300) + 1000); Memory.getInstance().updateRecords(_curLevelNo, _local1); if (_curLevelNo == 20){ onWin(); return; }; if (!_completeLevelMenu){ _completeLevelMenu = new CompleteLevelMenu(); _completeLevelMenu.addEventListener("menu", onMenu); _completeLevelMenu.addEventListener("next", onNextLevel); addChild(_completeLevelMenu); }; _completeLevelMenu.visible = true; Memory.getInstance().updateProgress((_curLevelNo + 1)); SoundPlayer.getInstance().playStarCollectedSound(); } private function showDefeatLevelMenu():void{ if (((_completeLevelMenu) && (_completeLevelMenu.visible))){ return; }; if (!_defeatLevelMenu){ _defeatLevelMenu = new DefeatLevelMenu(); _defeatLevelMenu.addEventListener("menu", onMenu); _defeatLevelMenu.addEventListener("replay", generateLevel); addChild(_defeatLevelMenu); }; _defeatLevelMenu.visible = true; } private function showSponsorsIntro():void{ startGame(); } private function generateLevel11():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 45; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:41, y:224}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:626, y:75, w:19, h:115, isStatic:true})); push(new VoluntaryBox({x:166, y:0x0101, w:19, h:90, isStatic:true})); push(new Bouncer({x:604, y:190, r:41})); push(new Trash({x:190, y:310})); push(new Trash({x:205, y:286})); push(new Trash({x:223, y:265})); push(new Trash({x:246, y:247})); push(new Trash({x:272, y:234})); push(new Trash({x:299, y:227})); push(new Trash({x:330, y:225})); push(new Trash({x:356, y:226})); push(new Trash({x:383, y:231})); push(new Trash({x:409, y:238})); push(new Trash({x:434, y:246})); push(new Trash({x:461, y:0x0100})); push(new Trash({x:491, y:270})); push(new Trash({x:513, y:281})); push(new Trash({x:536, y:293})); push(new Trash({x:557, y:306})); push(new Trash({x:209, y:328})); push(new Trash({x:234, y:343})); push(new Trash({x:263, y:354})); push(new Trash({x:293, y:359})); push(new Trash({x:323, y:361})); push(new Trash({x:355, y:361})); push(new Trash({x:388, y:358})); push(new Trash({x:418, y:354})); push(new Trash({x:447, y:349})); push(new Trash({x:477, y:342})); push(new Trash({x:506, y:335})); push(new Trash({x:534, y:328})); push(new Trash({x:574, y:316})); push(new Trash({x:585, y:291})); push(new Trash({x:605, y:268})); push(new Trash({x:585, y:346})); push(new Trash({x:605, y:368})); push(new Trash({x:599, y:306})); push(new Trash({x:599, y:329})); push(new Trash({x:0xFF, y:275})); push(new Trash({x:282, y:336})); push(new Trash({x:303, y:321})); push(new AntiTrash({x:291, y:201})); push(new Bouncer({x:547, y:54, r:23})); push(new AntiTrash({x:274, y:173})); push(new AntiTrash({x:249, y:150})); push(new AntiTrash({x:216, y:133})); push(new AntiTrash({x:173, y:130})); push(new AntiTrash({x:305, y:175})); push(new AntiTrash({x:330, y:152})); push(new AntiTrash({x:359, y:139})); push(new AntiTrash({x:391, y:137})); push(new AntiTrash({x:286, y:152})); push(new AntiTrash({x:292, y:118})); push(new AntiTrash({x:306, y:89})); push(new Trash({x:4, y:369})); push(new Trash({x:33, y:347})); push(new Trash({x:64, y:368})); push(new Trash({x:92, y:350})); push(new Trash({x:126, y:368})); push(new Trash({x:156, y:358})); push(new Trash({x:187, y:370})); push(new Trash({x:21, y:24})); push(new Trash({x:47, y:6})); push(new Trash({x:77, y:6})); push(new Trash({x:105, y:19})); push(new Trash({x:39, y:48})); push(new Trash({x:60, y:35})); push(new Trash({x:81, y:48})); push(new Trash({x:420, y:24})); push(new Trash({x:448, y:8})); push(new Trash({x:478, y:9})); push(new Trash({x:461, y:35})); push(new Trash({x:485, y:51})); }; } private function generateLevel12():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 56; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:584, y:340}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:289, y:104, w:5, h:56, isStatic:true})); push(new VoluntaryBox({x:318, y:99, w:5, h:54, isStatic:true})); push(new VoluntaryBox({x:347, y:104, w:5, h:53, isStatic:true})); push(new Bouncer({x:217, y:131, r:24})); push(new Bouncer({x:443, y:145, r:23})); push(new Trash({x:153, y:81})); push(new Trash({x:179, y:68})); push(new Trash({x:206, y:57})); push(new Trash({x:234, y:50})); push(new Trash({x:260, y:45})); push(new Trash({x:284, y:42})); push(new Trash({x:309, y:41})); push(new Trash({x:333, y:41})); push(new Trash({x:360, y:43})); push(new Trash({x:389, y:48})); push(new Trash({x:416, y:54})); push(new Trash({x:443, y:63})); push(new Trash({x:470, y:76})); push(new Trash({x:494, y:90})); push(new Trash({x:517, y:108})); push(new Trash({x:540, y:135})); push(new Trash({x:553, y:161})); push(new Trash({x:129, y:97})); push(new Trash({x:109, y:114})); push(new Trash({x:90, y:137})); push(new Trash({x:78, y:163})); push(new Trash({x:73, y:189})); push(new Trash({x:75, y:219})); push(new Trash({x:84, y:246})); push(new Trash({x:98, y:267})); push(new Trash({x:116, y:285})); push(new Trash({x:135, y:301})); push(new Trash({x:156, y:314})); push(new Trash({x:182, y:327})); push(new Trash({x:206, y:336})); push(new Trash({x:232, y:343})); push(new Trash({x:260, y:348})); push(new Trash({x:286, y:351})); push(new Trash({x:310, y:352})); push(new Trash({x:336, y:351})); push(new Trash({x:363, y:349})); push(new Trash({x:393, y:344})); push(new Trash({x:422, y:337})); push(new Trash({x:450, y:327})); push(new Trash({x:478, y:313})); push(new Trash({x:504, y:296})); push(new Trash({x:525, y:277})); push(new Trash({x:547, y:248})); push(new Trash({x:557, y:221})); push(new Trash({x:559, y:191})); push(new Trash({x:496, y:57})); push(new Trash({x:522, y:46})); push(new Trash({x:546, y:40})); push(new Trash({x:568, y:37})); push(new Trash({x:571, y:64})); push(new Trash({x:569, y:93})); push(new Trash({x:564, y:125})); push(new Trash({x:76, y:23})); push(new Trash({x:100, y:34})); push(new Trash({x:135, y:58})); push(new Trash({x:118, y:44})); push(new Trash({x:75, y:49})); push(new Trash({x:77, y:80})); push(new Trash({x:82, y:108})); push(new AntiTrash({x:262, y:185})); push(new AntiTrash({x:320, y:185})); push(new AntiTrash({x:291, y:185})); push(new AntiTrash({x:276, y:205})); push(new AntiTrash({x:289, y:225})); push(new AntiTrash({x:305, y:205})); push(new Trash({x:335, y:238})); push(new Trash({x:309, y:235})); push(new Trash({x:362, y:236})); push(new Trash({x:383, y:232})); push(new Trash({x:407, y:225})); push(new Trash({x:268, y:235})); push(new Trash({x:245, y:239})); push(new Trash({x:220, y:235})); push(new Trash({x:197, y:225})); }; } private function generateLevel13():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 36; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:445, y:231}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:383, y:201, w:19, h:141, isStatic:true})); push(new Bouncer({x:579, y:64, r:60})); push(new Trash({x:94, y:279})); push(new AntiTrash({x:387, y:276})); push(new Trash({x:111, y:199})); push(new Trash({x:117, y:149})); push(new Trash({x:180, y:104})); push(new Trash({x:153, y:108})); push(new Trash({x:131, y:125})); push(new Trash({x:241, y:147})); push(new Trash({x:206, y:108})); push(new Trash({x:227, y:125})); push(new Trash({x:112, y:172})); push(new Trash({x:247, y:199})); push(new Trash({x:246, y:173})); push(new Trash({x:194, y:216})); push(new Trash({x:221, y:211})); push(new Trash({x:167, y:216})); push(new Trash({x:136, y:210})); push(new Trash({x:90, y:160})); push(new Trash({x:67, y:176})); push(new Trash({x:53, y:200})); push(new Trash({x:57, y:229})); push(new Trash({x:82, y:252})); push(new Trash({x:124, y:266})); push(new Trash({x:176, y:270})); push(new Trash({x:231, y:266})); push(new Trash({x:275, y:253})); push(new Trash({x:305, y:233})); push(new Trash({x:313, y:203})); push(new Trash({x:298, y:176})); push(new Trash({x:273, y:159})); push(new Trash({x:82, y:215})); push(new Trash({x:150, y:247})); push(new Trash({x:246, y:235})); push(new Trash({x:275, y:197})); push(new Trash({x:82, y:307})); push(new Trash({x:264, y:283})); push(new Trash({x:275, y:307})); push(new AntiTrash({x:542, y:154})); push(new AntiTrash({x:569, y:172})); push(new AntiTrash({x:542, y:203})); push(new AntiTrash({x:573, y:215})); push(new AntiTrash({x:573, y:253})); push(new AntiTrash({x:604, y:279})); push(new AntiTrash({x:569, y:297})); push(new AntiTrash({x:604, y:319})); push(new Bouncer({x:436, y:379, r:42})); push(new AntiTrash({x:90, y:7})); push(new AntiTrash({x:293, y:64})); push(new Trash({x:203, y:269})); push(new Trash({x:149, y:269})); push(new AntiTrash({x:437, y:25})); push(new AntiTrash({x:185, y:25})); push(new Trash({x:495, y:18})); push(new Trash({x:484, y:64})); push(new Trash({x:510, y:116})); push(new Trash({x:495, y:357})); push(new Trash({x:467, y:315})); push(new Trash({x:414, y:301})); push(new Trash({x:374, y:325})); push(new Trash({x:356, y:364})); }; } private function generateLevel14():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 25; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:121, y:295}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new Bouncer({x:454, y:207, r:26})); push(new AntiTrash({x:615, y:50})); push(new Trash({x:445, y:153})); push(new Trash({x:483, y:172})); push(new Trash({x:487, y:218})); push(new Trash({x:406, y:176})); push(new Trash({x:407, y:223})); push(new Trash({x:450, y:243})); push(new Trash({x:526, y:195})); push(new Trash({x:490, y:266})); push(new Trash({x:409, y:268})); push(new Trash({x:367, y:201})); push(new Trash({x:404, y:131})); push(new Trash({x:484, y:128})); push(new Trash({x:565, y:217})); push(new Trash({x:566, y:263})); push(new Trash({x:531, y:286})); push(new Trash({x:453, y:334})); push(new Trash({x:489, y:312})); push(new Trash({x:412, y:314})); push(new Trash({x:330, y:270})); push(new Trash({x:370, y:292})); push(new Trash({x:329, y:225})); push(new Trash({x:366, y:110})); push(new Trash({x:325, y:135})); push(new Trash({x:326, y:179})); push(new Trash({x:443, y:62})); push(new Trash({x:481, y:82})); push(new Trash({x:403, y:86})); push(new Trash({x:560, y:122})); push(new Trash({x:524, y:104})); push(new Trash({x:566, y:169})); push(new Bouncer({x:373, y:163, r:14})); push(new Bouncer({x:375, y:0xFF, r:14})); push(new Bouncer({x:451, y:114, r:14})); push(new Bouncer({x:533, y:156, r:14})); push(new Bouncer({x:535, y:247, r:14})); push(new Bouncer({x:458, y:297, r:14})); push(new AntiTrash({x:615, y:16})); push(new AntiTrash({x:578, y:16})); push(new AntiTrash({x:24, y:293})); push(new AntiTrash({x:444, y:7})); push(new AntiTrash({x:402, y:10})); push(new AntiTrash({x:354, y:16})); push(new AntiTrash({x:312, y:22})); push(new AntiTrash({x:269, y:30})); push(new AntiTrash({x:224, y:41})); push(new AntiTrash({x:182, y:55})); push(new AntiTrash({x:142, y:72})); push(new AntiTrash({x:105, y:92})); push(new AntiTrash({x:70, y:119})); push(new AntiTrash({x:42, y:150})); push(new AntiTrash({x:22, y:185})); push(new AntiTrash({x:11, y:224})); push(new AntiTrash({x:7, y:269})); push(new AntiTrash({x:342, y:61})); push(new AntiTrash({x:258, y:80})); push(new AntiTrash({x:298, y:70})); push(new AntiTrash({x:217, y:94})); push(new AntiTrash({x:181, y:110})); push(new AntiTrash({x:146, y:130})); push(new AntiTrash({x:113, y:155})); push(new AntiTrash({x:85, y:182})); push(new AntiTrash({x:61, y:214})); push(new AntiTrash({x:42, y:249})); push(new Trash({x:247, y:132})); push(new Trash({x:209, y:143})); push(new Trash({x:174, y:163})); push(new Trash({x:145, y:186})); push(new Trash({x:120, y:217})); }; } private function generateLevel15():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 23; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:94, y:233}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:197, y:238, w:20, h:186, isStatic:true})); push(new VoluntaryBox({x:298, y:9, w:322, h:21, isStatic:true})); push(new Bouncer({x:27, y:28, r:49})); push(new Trash({x:238, y:306})); push(new Trash({x:263, y:282})); push(new Trash({x:287, y:0x0101})); push(new Trash({x:312, y:233})); push(new Trash({x:336, y:208})); push(new Trash({x:361, y:184})); push(new Trash({x:385, y:159})); push(new Trash({x:410, y:135})); push(new Trash({x:434, y:110})); push(new Trash({x:459, y:86})); push(new Trash({x:483, y:61})); push(new Trash({x:508, y:37})); push(new Trash({x:285, y:306})); push(new Trash({x:307, y:331})); push(new Trash({x:329, y:356})); push(new Trash({x:361, y:233})); push(new Trash({x:383, y:0x0101})); push(new Trash({x:405, y:282})); push(new Trash({x:433, y:159})); push(new Trash({x:455, y:184})); push(new Trash({x:477, y:208})); push(new Trash({x:505, y:86})); push(new Trash({x:528, y:111})); push(new Trash({x:550, y:136})); push(new AntiTrash({x:7, y:110})); push(new AntiTrash({x:7, y:143})); push(new AntiTrash({x:7, y:173})); push(new AntiTrash({x:7, y:204})); push(new AntiTrash({x:7, y:234})); push(new AntiTrash({x:100, y:4})); push(new AntiTrash({x:608, y:273})); push(new AntiTrash({x:608, y:300})); push(new AntiTrash({x:608, y:329})); push(new Trash({x:7, y:266})); push(new Trash({x:7, y:297})); push(new Trash({x:7, y:328})); push(new Trash({x:7, y:359})); push(new Trash({x:215, y:340})); push(new Trash({x:215, y:365})); push(new Trash({x:215, y:219})); push(new Trash({x:215, y:189})); push(new Trash({x:215, y:160})); push(new Trash({x:603, y:18})); push(new Trash({x:603, y:44})); push(new Trash({x:603, y:70})); push(new Trash({x:603, y:97})); push(new Trash({x:603, y:125})); }; } private function generateLevel16():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 25; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:561, y:220}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:9, y:232, w:20, h:303, isStatic:true})); push(new VoluntaryBox({x:298, y:9, w:322, h:21, isStatic:true})); push(new Bouncer({x:613, y:34, r:49})); push(new Trash({x:398, y:194})); push(new AntiTrash({x:431, y:135})); push(new AntiTrash({x:431, y:160})); push(new AntiTrash({x:431, y:185})); push(new AntiTrash({x:431, y:210})); push(new AntiTrash({x:431, y:235})); push(new AntiTrash({x:431, y:260})); push(new AntiTrash({x:431, y:285})); push(new AntiTrash({x:431, y:310})); push(new AntiTrash({x:431, y:335})); push(new AntiTrash({x:431, y:360})); push(new AntiTrash({x:210, y:135})); push(new AntiTrash({x:210, y:160})); push(new AntiTrash({x:210, y:185})); push(new AntiTrash({x:210, y:210})); push(new AntiTrash({x:210, y:235})); push(new AntiTrash({x:210, y:260})); push(new AntiTrash({x:210, y:285})); push(new AntiTrash({x:210, y:310})); push(new AntiTrash({x:210, y:335})); push(new AntiTrash({x:210, y:360})); push(new Trash({x:367, y:184})); push(new Trash({x:336, y:175})); push(new Trash({x:305, y:165})); push(new Trash({x:274, y:155})); push(new Trash({x:243, y:146})); push(new Trash({x:394, y:291})); push(new Trash({x:363, y:283})); push(new Trash({x:332, y:274})); push(new Trash({x:301, y:266})); push(new Trash({x:270, y:258})); push(new Trash({x:241, y:250})); push(new Trash({x:347, y:310})); push(new Trash({x:299, y:330})); push(new Trash({x:252, y:349})); push(new Trash({x:354, y:210})); push(new Trash({x:320, y:222})); push(new Trash({x:284, y:235})); push(new Trash({x:38, y:187})); push(new Trash({x:68, y:176})); push(new Trash({x:97, y:164})); push(new Trash({x:126, y:153})); push(new Trash({x:155, y:142})); push(new Trash({x:43, y:302})); push(new Trash({x:70, y:289})); push(new Trash({x:97, y:277})); push(new Trash({x:123, y:264})); push(new Trash({x:150, y:251})); push(new Trash({x:177, y:238})); push(new Trash({x:76, y:201})); push(new Trash({x:108, y:213})); push(new Trash({x:140, y:224})); push(new Trash({x:81, y:316})); push(new Trash({x:109, y:327})); push(new Trash({x:141, y:338})); }; } private function generateLevel10():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 39; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:584, y:191}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:470, y:189, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:172, y:146, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:217, y:150, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:259, y:146, w:20, h:20, isStatic:true})); push(new Bouncer({x:445, y:347, r:38})); push(new Trash({x:380, y:136})); push(new Trash({x:359, y:123})); push(new Trash({x:332, y:109})); push(new Trash({x:308, y:99})); push(new Trash({x:283, y:91})); push(new Trash({x:258, y:85})); push(new Trash({x:231, y:81})); push(new Trash({x:204, y:81})); push(new Trash({x:180, y:83})); push(new Trash({x:155, y:89})); push(new Trash({x:106, y:107})); push(new Trash({x:82, y:120})); push(new Trash({x:57, y:136})); push(new Trash({x:129, y:97})); push(new Trash({x:358, y:150})); push(new Trash({x:336, y:162})); push(new Trash({x:311, y:173})); push(new Trash({x:286, y:181})); push(new Trash({x:262, y:186})); push(new Trash({x:235, y:190})); push(new Trash({x:209, y:190})); push(new Trash({x:182, y:188})); push(new Trash({x:157, y:182})); push(new Trash({x:133, y:175})); push(new Trash({x:106, y:164})); push(new Trash({x:83, y:152})); push(new Trash({x:22, y:94})); push(new Trash({x:21, y:175})); push(new Trash({x:40, y:115})); push(new Trash({x:28, y:137})); push(new Trash({x:39, y:156})); push(new Trash({x:311, y:127})); push(new Trash({x:245, y:52})); push(new Trash({x:218, y:33})); push(new Trash({x:204, y:52})); push(new Trash({x:165, y:214})); push(new Trash({x:193, y:213})); push(new AntiTrash({x:262, y:10})); push(new AntiTrash({x:290, y:14})); push(new AntiTrash({x:317, y:20})); push(new AntiTrash({x:345, y:29})); push(new AntiTrash({x:373, y:42})); push(new AntiTrash({x:400, y:60})); push(new AntiTrash({x:421, y:80})); push(new AntiTrash({x:438, y:101})); push(new AntiTrash({x:453, y:126})); push(new AntiTrash({x:463, y:150})); push(new AntiTrash({x:140, y:13})); push(new AntiTrash({x:113, y:18})); push(new AntiTrash({x:164, y:10})); push(new AntiTrash({x:84, y:27})); push(new AntiTrash({x:58, y:40})); push(new AntiTrash({x:38, y:57})); push(new Bouncer({x:104, y:350, r:29})); push(new Trash({x:492, y:27})); push(new Trash({x:522, y:11})); push(new Trash({x:522, y:45})); push(new Trash({x:522, y:317})); push(new Trash({x:554, y:296})); push(new Trash({x:554, y:334})); push(new Trash({x:191, y:334})); push(new Trash({x:209, y:299})); push(new Trash({x:231, y:334})); push(new Trash({x:325, y:0x0101})); push(new Trash({x:357, y:0x0101})); push(new Trash({x:341, y:287})); push(new Trash({x:46, y:239})); push(new Trash({x:55, y:275})); push(new Trash({x:20, y:0x0101})); }; } private function generateLevel18():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 23; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:167, y:76}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:610, y:286, w:20, h:200, isStatic:true})); push(new VoluntaryBox({x:520, y:286, w:20, h:200, isStatic:true})); push(new VoluntaryBox({x:430, y:286, w:20, h:200, isStatic:true})); push(new VoluntaryBox({x:340, y:286, w:20, h:200, isStatic:true})); push(new VoluntaryBox({x:250, y:286, w:20, h:200, isStatic:true})); push(new Bouncer({x:341, y:174, r:11})); push(new AntiTrash({x:484, y:176})); push(new Trash({x:574, y:176})); push(new AntiTrash({x:484, y:232})); push(new AntiTrash({x:484, y:288})); push(new AntiTrash({x:484, y:344})); push(new AntiTrash({x:454, y:203})); push(new AntiTrash({x:454, y:259})); push(new AntiTrash({x:454, y:315})); push(new AntiTrash({x:454, y:371})); push(new Trash({x:574, y:233})); push(new Trash({x:574, y:290})); push(new Trash({x:574, y:347})); push(new Trash({x:538, y:203})); push(new Trash({x:538, y:260})); push(new Trash({x:538, y:317})); push(new Trash({x:538, y:374})); push(new Trash({x:392, y:176})); push(new Trash({x:392, y:233})); push(new Trash({x:392, y:290})); push(new Trash({x:392, y:347})); push(new Trash({x:356, y:203})); push(new Trash({x:356, y:260})); push(new Trash({x:356, y:317})); push(new Trash({x:356, y:374})); push(new Trash({x:304, y:176})); push(new Trash({x:304, y:233})); push(new Trash({x:304, y:290})); push(new Trash({x:304, y:347})); push(new Trash({x:268, y:203})); push(new Trash({x:268, y:260})); push(new Trash({x:268, y:317})); push(new Trash({x:268, y:374})); push(new Bouncer({x:431, y:174, r:11})); push(new Bouncer({x:521, y:174, r:11})); push(new Bouncer({x:614, y:37, r:59})); push(new AntiTrash({x:8, y:162})); push(new AntiTrash({x:80, y:162})); push(new AntiTrash({x:8, y:194})); push(new AntiTrash({x:80, y:194})); push(new AntiTrash({x:8, y:226})); push(new AntiTrash({x:80, y:226})); push(new AntiTrash({x:8, y:258})); push(new AntiTrash({x:80, y:258})); push(new Trash({x:41, y:187})); push(new Trash({x:41, y:218})); push(new Trash({x:41, y:249})); push(new Trash({x:41, y:280})); push(new Trash({x:41, y:311})); push(new Trash({x:41, y:342})); push(new Trash({x:41, y:373})); }; } private function generateLevel19():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 45; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:319, y:144}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:275, y:229, w:16, h:70, isStatic:true})); push(new VoluntaryBox({x:363, y:229, w:16, h:70, isStatic:true})); push(new VoluntaryBox({x:320, y:10, w:162, h:20, isStatic:true})); push(new Bouncer({x:320, y:396, r:59})); push(new AntiTrash({x:249, y:161})); push(new Trash({x:8, y:347})); push(new AntiTrash({x:249, y:133})); push(new AntiTrash({x:249, y:105})); push(new AntiTrash({x:249, y:77})); push(new AntiTrash({x:375, y:161})); push(new AntiTrash({x:375, y:133})); push(new AntiTrash({x:375, y:105})); push(new AntiTrash({x:375, y:77})); push(new Bouncer({x:20, y:239, r:38})); push(new Bouncer({x:624, y:239, r:38})); push(new Trash({x:231, y:312})); push(new Trash({x:391, y:312})); push(new Trash({x:610, y:347})); push(new Trash({x:112, y:326})); push(new Trash({x:167, y:318})); push(new Trash({x:57, y:336})); push(new Trash({x:507, y:325})); push(new Trash({x:450, y:317})); push(new Trash({x:557, y:334})); push(new Trash({x:200, y:263})); push(new Trash({x:142, y:242})); push(new Trash({x:87, y:215})); push(new Trash({x:417, y:263})); push(new Trash({x:477, y:241})); push(new Trash({x:531, y:214})); push(new Trash({x:126, y:156})); push(new Trash({x:186, y:167})); push(new Trash({x:60, y:140})); push(new Trash({x:434, y:165})); push(new Trash({x:493, y:154})); push(new Trash({x:557, y:137})); push(new Trash({x:160, y:52})); push(new Trash({x:92, y:66})); push(new Trash({x:23, y:85})); push(new Trash({x:461, y:53})); push(new Trash({x:526, y:66})); push(new Trash({x:591, y:85})); push(new Trash({x:447, y:253})); push(new Trash({x:504, y:229})); push(new Trash({x:172, y:254})); push(new Trash({x:113, y:229})); push(new Trash({x:157, y:162})); push(new Trash({x:90, y:148})); push(new Trash({x:463, y:160})); push(new Trash({x:526, y:146})); push(new AntiTrash({x:213, y:105})); push(new AntiTrash({x:411, y:105})); push(new AntiTrash({x:401, y:131})); push(new AntiTrash({x:222, y:129})); push(new Trash({x:382, y:215})); push(new Trash({x:413, y:215})); push(new Trash({x:443, y:215})); push(new Trash({x:178, y:215})); push(new Trash({x:209, y:215})); push(new Trash({x:239, y:215})); push(new AntiTrash({x:197, y:77})); push(new AntiTrash({x:426, y:77})); push(new Trash({x:610, y:10})); push(new Trash({x:579, y:10})); push(new Trash({x:548, y:10})); push(new Trash({x:517, y:10})); push(new Trash({x:486, y:10})); push(new Trash({x:133, y:10})); push(new Trash({x:102, y:10})); push(new Trash({x:71, y:10})); push(new Trash({x:40, y:10})); push(new Trash({x:9, y:10})); push(new Trash({x:160, y:105})); push(new Trash({x:129, y:105})); push(new Trash({x:98, y:105})); push(new Trash({x:517, y:105})); push(new Trash({x:486, y:105})); push(new Trash({x:455, y:105})); }; } private function startGame():void{ stage.scaleMode = StageScaleMode.NO_SCALE; stage.frameRate = 50; StageReference.setStage(stage); var _local1:ContactsManager = new ContactsManager(); _local1.addEventListener(GameEvent.COLLECT_TRASH, onCollectTrash); _local1.addEventListener(GameEvent.COLLECT_ANTI_TRASH, onCollectAntiTrash); _local1.addEventListener(GameEvent.FINISH_SHOOT, onFinishShoot); var _local2:Key = Key.getInstance(); _local2.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed); KeyboardListener.getInstance().listen(stage); createChildren(); addEventListener(Event.ENTER_FRAME, onEnterFrame); SoundPlayer.getInstance().playMenuSound(); } private function generateLevel17():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 19; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:66, y:209}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:532, y:192, w:20, h:303, isStatic:true})); push(new VoluntaryBox({x:196, y:153, w:20, h:88, isStatic:true})); push(new Bouncer({x:358, y:404, r:83})); push(new Trash({x:447, y:107})); push(new AntiTrash({x:134, y:8})); push(new AntiTrash({x:134, y:35})); push(new AntiTrash({x:134, y:62})); push(new AntiTrash({x:134, y:89})); push(new AntiTrash({x:134, y:116})); push(new AntiTrash({x:134, y:143})); push(new AntiTrash({x:134, y:170})); push(new AntiTrash({x:134, y:197})); push(new AntiTrash({x:188, y:28})); push(new AntiTrash({x:188, y:55})); push(new AntiTrash({x:188, y:82})); push(new AntiTrash({x:161, y:210})); push(new AntiTrash({x:188, y:0})); push(new Trash({x:418, y:97})); push(new Trash({x:398, y:70})); push(new Trash({x:399, y:39})); push(new Trash({x:447, y:6})); push(new Trash({x:418, y:14})); push(new Trash({x:427, y:271})); push(new Trash({x:398, y:261})); push(new Trash({x:378, y:234})); push(new Trash({x:379, y:203})); push(new Trash({x:427, y:170})); push(new Trash({x:398, y:178})); push(new Trash({x:358, y:157})); push(new Trash({x:329, y:147})); push(new Trash({x:309, y:120})); push(new Trash({x:310, y:89})); push(new Trash({x:358, y:56})); push(new Trash({x:329, y:64})); push(new Trash({x:280, y:82})); push(new Trash({x:251, y:72})); push(new Trash({x:231, y:45})); push(new Trash({x:232, y:14})); push(new Trash({x:280, y:232})); push(new Trash({x:251, y:222})); push(new Trash({x:231, y:195})); push(new Trash({x:232, y:164})); push(new Trash({x:280, y:131})); push(new Trash({x:251, y:139})); }; } private function onWin():void{ var _local3:uint; var _local1:Number = 0; var _local2:Array = Memory.getInstance().arrRecords; for each (_local3 in _local2) { _local1 = (_local1 + _local3); }; winMenu = new WinMenu(); winMenu.addEventListener(SubmitScoreEvent.TYPE, onSubmitScore); winMenu.setText(0, _local1); addChild(winMenu); } private function allowReset():void{ controls.enableReset(); _isAllowReset = true; } private function onDownload(_arg1:Event):void{ onHelp(_arg1); helpMenu.onDownload(); } private function onHighscores(_arg1:Event):void{ var e = _arg1; var o:Object = {n:[2, 15, 5, 0, 6, 0, 3, 14, 10, 7, 11, 9, 3, 14, 14, 14], f:function (_arg1:Number, _arg2:String):String{ if (_arg2.length == 16){ return (_arg2); }; return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16)))); }}; var boardID:String = o.f(0, ""); MochiScores.showLeaderboard({boardID:boardID}); } private function generateLevel20():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = 20; updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:69, y:193}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:52, y:287, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:71, y:280, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:91, y:273, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:110, y:266, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:130, y:259, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:149, y:252, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:52, y:99, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:72, y:103, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:92, y:108, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:112, y:112, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:132, y:116, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:152, y:120, w:20, h:20, isStatic:true})); push(new AntiTrash({x:416, y:76})); push(new Trash({x:378, y:75})); push(new Bouncer({x:559, y:133, r:49})); push(new Bouncer({x:479, y:228, r:34})); push(new Trash({x:339, y:23})); push(new Trash({x:285, y:84})); push(new Trash({x:243, y:23})); push(new Trash({x:180, y:78})); push(new Trash({x:132, y:6})); push(new Trash({x:73, y:58})); push(new Trash({x:19, y:13})); push(new Trash({x:359, y:49})); push(new Trash({x:312, y:54})); push(new Trash({x:264, y:54})); push(new Trash({x:212, y:51})); push(new Trash({x:156, y:42})); push(new Trash({x:103, y:32})); push(new Trash({x:46, y:36})); push(new Trash({x:378, y:293})); push(new Trash({x:287, y:276})); push(new Trash({x:249, y:347})); push(new Trash({x:190, y:291})); push(new Trash({x:132, y:358})); push(new Trash({x:83, y:316})); push(new Trash({x:35, y:362})); push(new Trash({x:345, y:340})); push(new Trash({x:362, y:316})); push(new Trash({x:316, y:308})); push(new Trash({x:268, y:311})); push(new Trash({x:220, y:319})); push(new Trash({x:161, y:324})); push(new Trash({x:108, y:337})); push(new Trash({x:59, y:339})); push(new AntiTrash({x:438, y:57})); push(new AntiTrash({x:461, y:41})); push(new AntiTrash({x:484, y:29})); push(new AntiTrash({x:508, y:21})); push(new AntiTrash({x:532, y:19})); push(new AntiTrash({x:556, y:24})); push(new AntiTrash({x:578, y:36})); push(new AntiTrash({x:599, y:54})); push(new AntiTrash({x:615, y:74})); push(new AntiTrash({x:593, y:193})); push(new AntiTrash({x:584, y:218})); push(new AntiTrash({x:573, y:240})); push(new AntiTrash({x:561, y:259})); push(new AntiTrash({x:545, y:279})); push(new AntiTrash({x:525, y:296})); push(new AntiTrash({x:503, y:309})); push(new AntiTrash({x:480, y:318})); push(new AntiTrash({x:455, y:324})); push(new AntiTrash({x:429, y:327})); push(new AntiTrash({x:619, y:261})); push(new AntiTrash({x:615, y:287})); push(new AntiTrash({x:602, y:307})); push(new AntiTrash({x:584, y:327})); push(new AntiTrash({x:563, y:342})); push(new AntiTrash({x:539, y:353})); push(new AntiTrash({x:515, y:360})); push(new AntiTrash({x:491, y:364})); push(new AntiTrash({x:469, y:366})); push(new AntiTrash({x:443, y:366})); }; } private function onShoot(_arg1:GameEvent):void{ _dustEffect.stop(); _dustEffect.start(_arg1.data.bullet); SoundPlayer.getInstance().playExplosionSound(); _startedShootsCount++; updateStatistic(); if (_startedShootsCount == _totalAllowedShoots){ _launcher.lock(); }; } private function onMute(_arg1:Event=null):void{ SoundPlayer.getInstance().muteSwitch(); } private function createDebugDraw():void{ var _local1:Sprite = new Sprite(); addChild(_local1); CoreEngine.getInstance().debugDrawContainer = _local1; CoreEngine.getInstance().createWorld(); } private function updateStatistic():void{ controls.updateStatistic(_collectedItemsCount, _totalItemsToCollect, _startedShootsCount, _totalAllowedShoots); } private function onCollectTrash(_arg1:GameEvent):void{ _collectedItemsCount++; updateStatistic(); if (_collectedItemsCount == _totalItemsToCollect){ showCompleteLevelMenu(); }; } private function onReset(_arg1:Event=null):void{ if (_isAllowReset){ generateLevel(null, true); setTimeout(allowReset, 1000); controls.disableReset(); _isAllowReset = false; }; } private function onPlay(_arg1:Event):void{ removeStartMenu(); onMenu(null, true); } private function onEnterFrame(_arg1:Event):void{ } private function createController():void{ var _local1:b2GravityController = new b2GravityController(); CoreEngine.getInstance().controller = _local1; } private function generateCurLevel():void{ SoundPlayer.getInstance().stopMenuSound(); var _local1 = this; _local1[("generateLevel" + _levels[_curLevelNo])](); } private function onHelp(_arg1:Event):void{ if (!helpMenu){ helpMenu = new HelpMenu(); addChild(helpMenu); }; helpMenu.showDialog(); } private function removeStartMenu():void{ startMenu.removeEventListener("Play", onPlay); startMenu.removeEventListener("Help", onHelp); startMenu.removeEventListener("Highscores", onHighscores); startMenu.removeEventListener("Download", onDownload); startMenu.destroyEffects(); removeChild(startMenu); startMenu = null; } private function initLauncher(_arg1:Object):void{ if (!_launcher){ _launcher = new Launcher(_arg1); _launcher.addEventListener(GameEvent.SHOOT, onShoot); } else { _launcher.move(_arg1.x, _arg1.y); }; _launcher.unlock(); } private function createControls():void{ controls = new Controls(); controls.y = 400; controls.addEventListener("menu", onMenu); controls.addEventListener("reset", onReset); controls.addEventListener("Help", onHelp); controls.addEventListener("Mute", onMute); addChild(controls); levelMenu = new LevelMenu(); levelMenu.addEventListener(OpenLevelEvent.TYPE, onOpenLevel); levelMenu.addEventListener("resetProgress", onResetProgress); levelMenu.visible = false; addChild(levelMenu); createStartMenu(); } private function onMenu(_arg1:Event=null, _arg2:Boolean=false):void{ SoundPlayer.getInstance().stopLevelSound(); if (!_arg2){ SoundPlayer.getInstance().playMenuSound(); }; prepareForNewLevel(); if (_completeLevelMenu){ _completeLevelMenu.visible = false; }; if (_defeatLevelMenu){ _defeatLevelMenu.visible = false; }; var _local3:Memory = Memory.getInstance(); levelMenu.unlock(_local3.numUnlockedLevels); var _local4:Array = _local3.arrRecords; levelMenu.arrRecords = _local4; levelMenu.showDialog(); } private function createRenderer():void{ if (_foreground){ removeChild(_foreground); _foreground = null; }; _foreground = new Sprite(); addChildAt(_foreground, 0); Scene2DReference.getInstance().scene = _foreground; } private function onCollectAntiTrash(_arg1:GameEvent):void{ _collectedItemsCount = ((_collectedItemsCount)>0) ? (_collectedItemsCount - 1) : _collectedItemsCount; updateStatistic(); } private function onFinishShoot(_arg1:GameEvent):void{ _finishedShootsCount++; updateStatistic(); if (_finishedShootsCount == _totalAllowedShoots){ setTimeout(checkForDefeat, 1000); }; } private function onSubmitScore(_arg1:SubmitScoreEvent):void{ var e = _arg1; winMenu.removeEventListener(SubmitScoreEvent.TYPE, onSubmitScore); removeChild(winMenu); winMenu = null; createStartMenu(); var o:Object = {n:[2, 15, 5, 0, 6, 0, 3, 14, 10, 7, 11, 9, 3, 14, 14, 14], f:function (_arg1:Number, _arg2:String):String{ if (_arg2.length == 16){ return (_arg2); }; return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16)))); }}; var boardID:String = o.f(0, ""); MochiScores.showLeaderboard({boardID:boardID, name:e.name, score:e.score}); } private function onResetProgress(_arg1:Event):void{ Memory.getInstance().clearProgress(); levelMenu.unlock(1); levelMenu.arrRecords = []; } private function createDustEffect():void{ _dustEffect = new DustEffect(); addChild(_dustEffect); } } }//package
Section 322
//MainMask (MainMask) package { import flash.display.*; public dynamic class MainMask extends MovieClip { } }//package
Section 323
//MochiBot (MochiBot) package { import flash.display.*; import flash.net.*; import flash.system.*; public dynamic class MochiBot extends Sprite { public static function track(_arg1:Sprite, _arg2:String):MochiBot{ if (Security.sandboxType == "localWithFile"){ return (null); }; var _local3:MochiBot = new (MochiBot); _arg1.addChild(_local3); Security.allowDomain("*"); Security.allowInsecureDomain("*"); var _local4 = "http://core.mochibot.com/my/core.swf"; var _local5:URLVariables = new URLVariables(); _local5["sb"] = Security.sandboxType; _local5["v"] = Capabilities.version; _local5["swfid"] = _arg2; _local5["mv"] = "8"; _local5["fv"] = "9"; var _local6:String = _local3.root.loaderInfo.loaderURL; if (_local6.indexOf("http") == 0){ _local5["url"] = _local6; } else { _local5["url"] = "local"; }; var _local7:URLRequest = new URLRequest(_local4); _local7.contentType = "application/x-www-form-urlencoded"; _local7.method = URLRequestMethod.POST; _local7.data = _local5; var _local8:Loader = new Loader(); _local3.addChild(_local8); _local8.load(_local7); return (_local3); } } }//package
Section 324
//Preloader (Preloader) package { import flash.events.*; import flash.display.*; import mochi.as3.*; import flash.utils.*; import CPMStar.*; public dynamic class Preloader extends MovieClip { private var _sp:SponsorPreloader; public static var MAIN_CLASS:String = "Main"; public function Preloader(){ PreloaderReference.getInstance().preloader = this; showPreloader(); MochiServices.connect("20cfa03a9fe01357", this); } private function showPreloader():void{ stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; stage.frameRate = 30; _sp = new SponsorPreloader(); _sp.x = 320; _sp.y = 200; addChild(_sp); _sp.addEventListener("endIntro", gotoNextFrame); } private function gotoNextFrame(_arg1:Event=null):void{ var _local2:Class = Class(getDefinitionByName(MAIN_CLASS)); var _local3:Object = new (_local2); addChild((_local3 as DisplayObject)); if (_local3.init){ removeChild(_sp); _sp = null; _local3.init(true); }; } private function isOnFLG():Boolean{ var _local1:String = root.stage.loaderInfo.loaderURL; if (_local1.indexOf("flashgamelicense") == -1){ return (false); }; return (true); } } }//package
Section 325
//PreloaderReference (PreloaderReference) package { public class PreloaderReference { public var preloader:Preloader; private static var _instance:PreloaderReference; public function PreloaderReference(_arg1:SingletonEnforcer){ } public static function getInstance():PreloaderReference{ if (_instance == null){ _instance = new PreloaderReference(new SingletonEnforcer()); }; return (_instance); } } }//package class SingletonEnforcer { private function SingletonEnforcer(){ } }
Section 326
//SpaceBG (SpaceBG) package { import flash.display.*; public dynamic class SpaceBG extends MovieClip { } }//package
Section 327
//SpaceshipSkin (SpaceshipSkin) package { import flash.display.*; public dynamic class SpaceshipSkin extends MovieClip { } }//package
Section 328
//SponsorPreloader (SponsorPreloader) package { import flash.events.*; import flash.display.*; import flash.net.*; public dynamic class SponsorPreloader extends MovieClip { public var ngbutton:SimpleButton; public var btnOpenSite:SimpleButton; public var loading:MovieClip; public var preloaderBar:MovieClip; public function SponsorPreloader(){ addFrameScript(17, frame18, 38, frame39, 199, frame200); } function frame200(){ stop(); dispatchEvent(new Event("endIntro")); } function frame18(){ stop(); btnOpenSite.addEventListener(MouseEvent.CLICK, onOpenSiteClick); } function frame39(){ stop(); } public function onOpenSiteClick(_arg1:MouseEvent):void{ var _local2:URLRequest; _local2 = new URLRequest("http://www.gamesbutler.com"); navigateToURL(_local2, "_blank"); } } }//package
Section 329
//StartMenu (StartMenu) package { import flash.events.*; import flash.display.*; import effects.*; import flash.net.*; public dynamic class StartMenu extends MovieClip { public var btnDownload:SimpleButton; public var dustTarget:MovieClip; public var dustEffect:DustEffect; public var btnPlay:SimpleButton; public var btnHelp:SimpleButton; public var btnPlayMoreGames:SimpleButton; public var btnHighscores:SimpleButton; public function StartMenu(){ addFrameScript(0, frame1); } function frame1(){ btnPlay.addEventListener(MouseEvent.CLICK, onPlay); btnHelp.addEventListener(MouseEvent.CLICK, onHelp); btnHighscores.addEventListener(MouseEvent.CLICK, onHighscores); btnDownload.addEventListener(MouseEvent.CLICK, onDownload); btnPlayMoreGames.addEventListener(MouseEvent.CLICK, onPlayMoreGames); dustEffect = new DustEffect(); addChildAt(dustEffect, 1); dustEffect.start(dustTarget); dustTarget.addEventListener(Event.ENTER_FRAME, moveDustTarget); } public function onDownload(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("Download"); dispatchEvent(_local2); } public function onHighscores(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("Highscores"); dispatchEvent(_local2); } public function destroyEffects():void{ dustEffect.stop(); removeChild(dustEffect); } public function moveDustTarget(_arg1:Event):void{ dustTarget.x = (dustTarget.x + ((mouseX - dustTarget.x) / 10)); dustTarget.y = (dustTarget.y + ((mouseY - dustTarget.y) / 10)); } public function onPlay(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("Play"); dispatchEvent(_local2); } public function onHelp(_arg1:MouseEvent):void{ var _local2:Event; _local2 = new Event("Help"); dispatchEvent(_local2); } public function onPlayMoreGames(_arg1:MouseEvent):void{ var _local2:URLRequest; _local2 = new URLRequest("http://www.gamesbutler.com"); navigateToURL(_local2, "_blank"); } } }//package
Section 330
//TrashSkin (TrashSkin) package { import flash.display.*; public dynamic class TrashSkin extends MovieClip { public var skinItem:MovieClip; public function TrashSkin(){ addFrameScript(0, frame1); } function frame1(){ skinItem.gotoAndStop(int((Math.random() * 8))); } } }//package
Section 331
//WinMenu (WinMenu) package { import flash.events.*; import ui.events.*; import flash.display.*; import org.flintparticles.common.events.*; import flash.geom.*; import org.flintparticles.twoD.zones.*; import flash.filters.*; import org.flintparticles.common.initializers.*; import org.flintparticles.common.actions.*; import org.flintparticles.common.counters.*; import flash.text.*; import org.flintparticles.twoD.emitters.*; import org.flintparticles.twoD.renderers.*; import org.flintparticles.twoD.actions.*; import org.flintparticles.common.displayObjects.*; import org.flintparticles.twoD.initializers.*; import org.flintparticles.common.energyEasing.*; import flash.ui.*; public dynamic class WinMenu extends MovieClip { public var tfName:TextField; public var tfScore:TextField; public var emitter:Emitter2D; public var btnSubmitScore:SimpleButton; public var _score:uint; public var renderer:BitmapRenderer; public function WinMenu(){ addFrameScript(0, frame1); } public function onKeyDowmName(_arg1:KeyboardEvent):void{ if (_arg1.keyCode == Keyboard.ENTER){ submitScore(); }; } public function restart(_arg1:EmitterEvent):void{ Emitter2D(_arg1.target).start(); } public function submitScore(_arg1:MouseEvent=null):void{ var _local2:SubmitScoreEvent; if (((!((tfName.text == ""))) && (!((tfName.text == "Enter your name"))))){ _local2 = new SubmitScoreEvent(SubmitScoreEvent.TYPE); _local2.name = tfName.text; _local2.score = _score; dispatchEvent(_local2); return; }; } public function onFocusName(_arg1:FocusEvent):void{ tfName.text = ""; } function frame1(){ tfName.addEventListener(FocusEvent.FOCUS_IN, onFocusName); tfName.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDowmName); btnSubmitScore.addEventListener(MouseEvent.CLICK, submitScore); emitter = new Emitter2D(); emitter.counter = new Blast(300); emitter.addInitializer(new SharedImage(new Dot(2))); emitter.addInitializer(new ColorInit(4294967295, 4288867839)); emitter.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 320, 0))); emitter.addInitializer(new Lifetime(4)); emitter.addAction(new Age(Quadratic.easeIn)); emitter.addAction(new Move()); emitter.addAction(new Fade()); emitter.addAction(new Accelerate(0, 50)); emitter.addAction(new LinearDrag(0.5)); emitter.addEventListener(EmitterEvent.EMITTER_EMPTY, restart, false, 0, true); renderer = new BitmapRenderer(new Rectangle(0, 0, 640, 480)); renderer.addFilter(new BlurFilter(2, 2, 1)); renderer.addFilter(new ColorMatrixFilter([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0.95, 0])); renderer.addEmitter(emitter); addChildAt(renderer, 3); emitter.x = 320; emitter.y = 150; emitter.start(); } public function setText(_arg1:uint, _arg2:uint):void{ tfScore.text = ("Final score: " + _arg2); _score = _arg2; } } }//package
Section 332
//VoluntaryBoxSkin (VoluntaryBoxSkin) package { import flash.display.*; public dynamic class VoluntaryBoxSkin extends MovieClip { } }//package

Library Items

Symbol 1 GraphicUsed by:49
Symbol 2 GraphicUsed by:49
Symbol 3 GraphicUsed by:18 49
Symbol 4 GraphicUsed by:5
Symbol 5 MovieClipUses:4Used by:49
Symbol 6 GraphicUsed by:7
Symbol 7 MovieClipUses:6Used by:15 49
Symbol 8 FontUsed by:9 10 11 12 19
Symbol 9 TextUses:8Used by:13
Symbol 10 TextUses:8Used by:13
Symbol 11 TextUses:8Used by:13
Symbol 12 TextUses:8Used by:13
Symbol 13 MovieClipUses:9 10 11 12Used by:14
Symbol 14 MovieClipUses:13Used by:15 49
Symbol 15 MovieClip {SponsorPreloader_fla.preloaderBar_3} [SponsorPreloader_fla.preloaderBar_3]Uses:7 14Used by:49
Symbol 16 GraphicUsed by:17
Symbol 17 ButtonUses:16Used by:49
Symbol 18 ButtonUses:3Used by:49
Symbol 19 TextUses:8Used by:21
Symbol 20 GraphicUsed by:21
Symbol 21 ButtonUses:19 20Used by:22
Symbol 22 MovieClip {SponsorPreloader_fla.playbutton_mc_9} [SponsorPreloader_fla.playbutton_mc_9]Uses:21Used by:49
Symbol 23 GraphicUsed by:26
Symbol 24 GraphicUsed by:25
Symbol 25 MovieClipUses:24Used by:26
Symbol 26 MovieClipUses:23 25Used by:40
Symbol 27 GraphicUsed by:28
Symbol 28 MovieClipUses:27Used by:40
Symbol 29 GraphicUsed by:30
Symbol 30 MovieClipUses:29Used by:40
Symbol 31 GraphicUsed by:40
Symbol 32 ShapeTweeningUsed by:39
Symbol 33 ShapeTweeningUsed by:39
Symbol 34 ShapeTweeningUsed by:39
Symbol 35 ShapeTweeningUsed by:39
Symbol 36 ShapeTweeningUsed by:39
Symbol 37 ShapeTweeningUsed by:39
Symbol 38 GraphicUsed by:39
Symbol 39 MovieClipUses:32 33 34 35 36 37 38Used by:40
Symbol 40 MovieClip {SponsorPreloader_fla.sprite22_12} [SponsorPreloader_fla.sprite22_12]Uses:26 28 30 31 39Used by:49
Symbol 41 SoundUsed by:49
Symbol 42 GraphicUsed by:43
Symbol 43 MovieClipUses:42Used by:49
Symbol 44 GraphicUsed by:46
Symbol 45 SoundUsed by:46
Symbol 46 MovieClip {SponsorPreloader_fla.sparkle_19} [SponsorPreloader_fla.sparkle_19]Uses:44 45Used by:49
Symbol 47 GraphicUsed by:48
Symbol 48 MovieClip {SponsorPreloader_fla.fader_20} [SponsorPreloader_fla.fader_20]Uses:47Used by:49
Symbol 49 MovieClip {SponsorPreloader} [SponsorPreloader]Uses:1 2 3 5 15 17 7 14 18 22 40 41 43 46 48
Symbol 50 GraphicUsed by:58
Symbol 51 GraphicUsed by:56
Symbol 52 GraphicUsed by:56
Symbol 53 GraphicUsed by:56
Symbol 54 GraphicUsed by:56
Symbol 55 GraphicUsed by:56
Symbol 56 MovieClip {BGElement} [BGElement]Uses:51 52 53 54 55Used by:57
Symbol 57 MovieClip {SpaceBG_fla.BGAnimation_2} [SpaceBG_fla.BGAnimation_2]Uses:56Used by:58
Symbol 58 MovieClip {SpaceBG} [SpaceBG]Uses:50 57
Symbol 59 BitmapUsed by:60 262
Symbol 60 GraphicUses:59Used by:63
Symbol 61 GraphicUsed by:62
Symbol 62 MovieClipUses:61Used by:63 297 301
Symbol 63 MovieClipUses:60 62Used by:88 203 218 259
Symbol 64 GraphicUsed by:65
Symbol 65 MovieClip {Dust} [Dust]Uses:64Used by:66
Symbol 66 MovieClipUses:65Used by:88
Symbol 67 FontUsed by:68 71 72 75 76 79 80 82 83 85 86
Symbol 68 TextUses:67Used by:74
Symbol 69 GraphicUsed by:70
Symbol 70 MovieClipUses:69Used by:74 203 309 319
Symbol 71 TextUses:67Used by:74
Symbol 72 TextUses:67Used by:74
Symbol 73 GraphicUsed by:74 81 84 87
Symbol 74 ButtonUses:68 70 71 72 73Used by:88
Symbol 75 TextUses:67Used by:78
Symbol 76 TextUses:67Used by:78
Symbol 77 GraphicUsed by:78
Symbol 78 ButtonUses:75 76 77Used by:88
Symbol 79 TextUses:67Used by:81
Symbol 80 TextUses:67Used by:81
Symbol 81 ButtonUses:79 80 73Used by:88
Symbol 82 TextUses:67Used by:84
Symbol 83 TextUses:67Used by:84
Symbol 84 ButtonUses:82 83 73Used by:88
Symbol 85 TextUses:67Used by:87
Symbol 86 TextUses:67Used by:87
Symbol 87 ButtonUses:85 86 73Used by:88
Symbol 88 MovieClip {StartMenu} [StartMenu]Uses:63 66 74 78 81 84 87
Symbol 89 FontUsed by:90 91 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 141 144 145 148 263 268 271 274 292 295
Symbol 90 TextUses:89Used by:203
Symbol 91 TextUses:89Used by:203
Symbol 92 GraphicUsed by:93
Symbol 93 MovieClipUses:92Used by:203
Symbol 94 GraphicUsed by:95 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137
Symbol 95 MovieClipUses:94Used by:99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137
Symbol 96 GraphicUsed by:97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137
Symbol 97 MovieClipUses:96Used by:99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137
Symbol 98 TextUses:89Used by:99
Symbol 99 ButtonUses:95 97 98 94 96Used by:203
Symbol 100 TextUses:89Used by:101
Symbol 101 ButtonUses:95 97 100 94 96Used by:203
Symbol 102 TextUses:89Used by:103
Symbol 103 ButtonUses:95 97 102 94 96Used by:203
Symbol 104 TextUses:89Used by:105
Symbol 105 ButtonUses:95 97 104 94 96Used by:203
Symbol 106 TextUses:89Used by:107
Symbol 107 ButtonUses:95 97 106 94 96Used by:203
Symbol 108 TextUses:89Used by:109
Symbol 109 ButtonUses:95 97 108 94 96Used by:203
Symbol 110 TextUses:89Used by:111
Symbol 111 ButtonUses:95 97 110 94 96Used by:203
Symbol 112 TextUses:89Used by:113
Symbol 113 ButtonUses:95 97 112 94 96Used by:203
Symbol 114 TextUses:89Used by:115
Symbol 115 ButtonUses:95 97 114 94 96Used by:203
Symbol 116 TextUses:89Used by:117
Symbol 117 ButtonUses:95 97 116 94 96Used by:203
Symbol 118 TextUses:89Used by:119
Symbol 119 ButtonUses:95 97 118 94 96Used by:203
Symbol 120 TextUses:89Used by:121
Symbol 121 ButtonUses:95 97 120 94 96Used by:203
Symbol 122 TextUses:89Used by:123
Symbol 123 ButtonUses:95 97 122 94 96Used by:203
Symbol 124 TextUses:89Used by:125
Symbol 125 ButtonUses:95 97 124 94 96Used by:203
Symbol 126 TextUses:89Used by:127
Symbol 127 ButtonUses:95 97 126 94 96Used by:203
Symbol 128 TextUses:89Used by:129
Symbol 129 ButtonUses:95 97 128 94 96Used by:203
Symbol 130 TextUses:89Used by:131
Symbol 131 ButtonUses:95 97 130 94 96Used by:203
Symbol 132 TextUses:89Used by:133
Symbol 133 ButtonUses:95 97 132 94 96Used by:203
Symbol 134 TextUses:89Used by:135
Symbol 135 ButtonUses:95 97 134 94 96Used by:203
Symbol 136 TextUses:89Used by:137
Symbol 137 ButtonUses:95 97 136 94 96Used by:203
Symbol 138 TextUses:89Used by:139
Symbol 139 MovieClipUses:138Used by:203
Symbol 140 TextUses:89Used by:143
Symbol 141 TextUses:89Used by:143
Symbol 142 GraphicUsed by:143
Symbol 143 ButtonUses:140 141 142Used by:203
Symbol 144 TextUses:89Used by:147
Symbol 145 TextUses:89Used by:147
Symbol 146 GraphicUsed by:147
Symbol 147 ButtonUses:144 145 146Used by:203
Symbol 148 TextUses:89Used by:150
Symbol 149 GraphicUsed by:150
Symbol 150 ButtonUses:148 149Used by:203
Symbol 151 GraphicUsed by:152
Symbol 152 MovieClipUses:151Used by:153
Symbol 153 MovieClipUses:152Used by:203
Symbol 154 BitmapUsed by:155
Symbol 155 GraphicUses:154Used by:194
Symbol 156 BitmapUsed by:157
Symbol 157 GraphicUses:156Used by:194
Symbol 158 BitmapUsed by:159
Symbol 159 GraphicUses:158Used by:194
Symbol 160 BitmapUsed by:161
Symbol 161 GraphicUses:160Used by:194
Symbol 162 BitmapUsed by:163
Symbol 163 GraphicUses:162Used by:194
Symbol 164 BitmapUsed by:165
Symbol 165 GraphicUses:164Used by:194
Symbol 166 BitmapUsed by:167
Symbol 167 GraphicUses:166Used by:194
Symbol 168 BitmapUsed by:169
Symbol 169 GraphicUses:168Used by:194
Symbol 170 BitmapUsed by:171
Symbol 171 GraphicUses:170Used by:194
Symbol 172 BitmapUsed by:173
Symbol 173 GraphicUses:172Used by:194
Symbol 174 BitmapUsed by:175
Symbol 175 GraphicUses:174Used by:194
Symbol 176 BitmapUsed by:177
Symbol 177 GraphicUses:176Used by:194
Symbol 178 BitmapUsed by:179
Symbol 179 GraphicUses:178Used by:194
Symbol 180 BitmapUsed by:181
Symbol 181 GraphicUses:180Used by:194
Symbol 182 BitmapUsed by:183
Symbol 183 GraphicUses:182Used by:194
Symbol 184 BitmapUsed by:185
Symbol 185 GraphicUses:184Used by:194
Symbol 186 BitmapUsed by:187
Symbol 187 GraphicUses:186Used by:194
Symbol 188 BitmapUsed by:189
Symbol 189 GraphicUses:188Used by:194
Symbol 190 BitmapUsed by:191
Symbol 191 GraphicUses:190Used by:194
Symbol 192 BitmapUsed by:193
Symbol 193 GraphicUses:192Used by:194
Symbol 194 MovieClipUses:155 157 159 161 163 165 167 169 171 173 175 177 179 181 183 185 187 189 191 193Used by:203
Symbol 195 FontUsed by:196 209 210
Symbol 196 EditableTextUses:195Used by:203
Symbol 197 GraphicUsed by:201
Symbol 198 GraphicUsed by:199
Symbol 199 MovieClipUses:198Used by:201 237
Symbol 200 GraphicUsed by:201
Symbol 201 ButtonUses:197 199 200Used by:202
Symbol 202 MovieClip {Controls_fla.SponsorLogo_58} [Controls_fla.SponsorLogo_58]Uses:201Used by:203
Symbol 203 MovieClip {LevelMenu} [LevelMenu]Uses:63 90 91 93 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 143 147 150 153 194 196 70 202
Symbol 204 FontUsed by:205 206 211
Symbol 205 TextUses:204Used by:208
Symbol 206 TextUses:204Used by:208
Symbol 207 GraphicUsed by:208
Symbol 208 ButtonUses:205 206 207Used by:218
Symbol 209 EditableTextUses:195Used by:218
Symbol 210 EditableTextUses:195Used by:218
Symbol 211 TextUses:204Used by:218
Symbol 212 GraphicUsed by:216
Symbol 213 GraphicUsed by:214
Symbol 214 MovieClipUses:213Used by:216
Symbol 215 GraphicUsed by:216
Symbol 216 ButtonUses:212 214 215Used by:217
Symbol 217 MovieClip {WinMenu_fla.SponsorLogo_5} [WinMenu_fla.SponsorLogo_5]Uses:216Used by:218
Symbol 218 MovieClip {WinMenu} [WinMenu]Uses:63 208 209 210 211 217
Symbol 219 GraphicUsed by:259
Symbol 220 GraphicUsed by:221 242
Symbol 221 MovieClipUses:220Used by:244 254 256 258
Symbol 222 GraphicUsed by:244
Symbol 223 FontUsed by:224 228 229 232 233 234 240 243 247 248
Symbol 224 TextUses:223Used by:244
Symbol 225 GraphicUsed by:244
Symbol 226 GraphicUsed by:227
Symbol 227 MovieClipUses:226Used by:244 322
Symbol 228 TextUses:223Used by:231
Symbol 229 TextUses:223Used by:231
Symbol 230 GraphicUsed by:231
Symbol 231 ButtonUses:228 229 230Used by:244
Symbol 232 TextUses:223Used by:244
Symbol 233 TextUses:223Used by:244
Symbol 234 TextUses:223Used by:244
Symbol 235 GraphicUsed by:237
Symbol 236 GraphicUsed by:237
Symbol 237 ButtonUses:235 199 236Used by:238
Symbol 238 MovieClip {HelpMenu_fla.SponsorLogo_8} [HelpMenu_fla.SponsorLogo_8]Uses:237Used by:244
Symbol 239 GraphicUsed by:242
Symbol 240 TextUses:223Used by:242
Symbol 241 GraphicUsed by:242
Symbol 242 ButtonUses:239 240 241 220Used by:244
Symbol 243 TextUses:223Used by:244
Symbol 244 MovieClip {HelpMenu_fla.HelpContent_4} [HelpMenu_fla.HelpContent_4]Uses:221 222 224 225 227 231 232 233 234 238 242 243Used by:259
Symbol 245 GraphicUsed by:246
Symbol 246 MovieClipUses:245Used by:250
Symbol 247 TextUses:223Used by:250
Symbol 248 TextUses:223Used by:250
Symbol 249 GraphicUsed by:250
Symbol 250 ButtonUses:246 247 248 249Used by:259
Symbol 251 FontUsed by:252 255 257
Symbol 252 TextUses:251Used by:254
Symbol 253 GraphicUsed by:254 256 258
Symbol 254 ButtonUses:252 221 253Used by:259
Symbol 255 TextUses:251Used by:256
Symbol 256 ButtonUses:255 221 253Used by:259
Symbol 257 TextUses:251Used by:258
Symbol 258 ButtonUses:257 221 253Used by:259
Symbol 259 MovieClip {HelpMenu} [HelpMenu]Uses:63 219 244 250 254 256 258
Symbol 260 GraphicUsed by:261
Symbol 261 MovieClip {MainMask} [MainMask]Uses:260
Symbol 262 GraphicUses:59Used by:297
Symbol 263 TextUses:89Used by:297
Symbol 264 FontUsed by:265 266 267 269 270
Symbol 265 EditableTextUses:264Used by:297
Symbol 266 TextUses:264Used by:297
Symbol 267 EditableTextUses:264Used by:297
Symbol 268 TextUses:89Used by:297
Symbol 269 EditableTextUses:264Used by:297
Symbol 270 EditableTextUses:264Used by:297
Symbol 271 TextUses:89Used by:279
Symbol 272 GraphicUsed by:279
Symbol 273 GraphicUsed by:279
Symbol 274 TextUses:89Used by:279
Symbol 275 GraphicUsed by:279
Symbol 276 GraphicUsed by:279
Symbol 277 GraphicUsed by:279
Symbol 278 GraphicUsed by:279
Symbol 279 ButtonUses:271 272 273 274 275 276 277 278Used by:280
Symbol 280 MovieClip {Controls_fla.Symbol44_2} [Controls_fla.Symbol44_2]Uses:279Used by:297
Symbol 281 GraphicUsed by:282
Symbol 282 MovieClipUses:281Used by:284
Symbol 283 GraphicUsed by:284
Symbol 284 ButtonUses:282 283Used by:297
Symbol 285 GraphicUsed by:286
Symbol 286 MovieClipUses:285Used by:291
Symbol 287 GraphicUsed by:290
Symbol 288 GraphicUsed by:290
Symbol 289 GraphicUsed by:290
Symbol 290 ButtonUses:287 288 289Used by:291
Symbol 291 MovieClip {Controls_fla.MuteControl_7} [Controls_fla.MuteControl_7]Uses:286 290Used by:297
Symbol 292 TextUses:89Used by:294
Symbol 293 GraphicUsed by:294 296
Symbol 294 ButtonUses:292 293Used by:297
Symbol 295 TextUses:89Used by:296
Symbol 296 ButtonUses:295 293Used by:297
Symbol 297 MovieClip {Controls} [Controls]Uses:262 263 265 266 267 268 269 270 280 284 62 291 294 296
Symbol 298 GraphicUsed by:309
Symbol 299 GraphicUsed by:301
Symbol 300 GraphicUsed by:301
Symbol 301 MovieClipUses:299 62 300Used by:309 319
Symbol 302 FontUsed by:303 304 307
Symbol 303 TextUses:302Used by:309
Symbol 304 TextUses:302Used by:306
Symbol 305 GraphicUsed by:306 308
Symbol 306 ButtonUses:304 305Used by:309
Symbol 307 TextUses:302Used by:308
Symbol 308 ButtonUses:307 305Used by:309
Symbol 309 MovieClip {DefeatLevelMenu} [DefeatLevelMenu]Uses:298 301 70 303 306 308
Symbol 310 GraphicUsed by:319
Symbol 311 FontUsed by:312 313 316
Symbol 312 TextUses:311Used by:319
Symbol 313 TextUses:311Used by:315
Symbol 314 GraphicUsed by:315
Symbol 315 ButtonUses:313 314Used by:319
Symbol 316 TextUses:311Used by:318
Symbol 317 GraphicUsed by:318
Symbol 318 ButtonUses:316 317Used by:319
Symbol 319 MovieClip {CompleteLevelMenu} [CompleteLevelMenu]Uses:310 301 312 315 318 70
Symbol 320 GraphicUsed by:321
Symbol 321 MovieClip {AntiTrashSkin} [AntiTrashSkin]Uses:320
Symbol 322 MovieClipUses:227Used by:323
Symbol 323 MovieClip {TrashSkin} [TrashSkin]Uses:322
Symbol 324 GraphicUsed by:325
Symbol 325 MovieClip {LauncherBar} [LauncherBar]Uses:324
Symbol 326 GraphicUsed by:327
Symbol 327 MovieClip {LauncherSkin} [LauncherSkin]Uses:326
Symbol 328 GraphicUsed by:329
Symbol 329 MovieClipUses:328Used by:330
Symbol 330 MovieClip {VoluntaryBoxSkin} [VoluntaryBoxSkin]Uses:329
Symbol 331 GraphicUsed by:336
Symbol 332 GraphicUsed by:333
Symbol 333 MovieClipUses:332Used by:336
Symbol 334 GraphicUsed by:335
Symbol 335 MovieClipUses:334Used by:336
Symbol 336 MovieClipUses:331 333 335Used by:337
Symbol 337 MovieClip {BouncerSkin} [BouncerSkin]Uses:336
Symbol 338 GraphicUsed by:339
Symbol 339 MovieClip {SpaceshipSkin} [SpaceshipSkin]Uses:338
Symbol 340 Sound {sound.Samples_FireSndClass} [sound.Samples_FireSndClass]
Symbol 341 Sound {sound.Samples_LevelLoopClass} [sound.Samples_LevelLoopClass]
Symbol 342 Sound {sound.Samples_StarCollectedClass1} [StarCollected1]
Symbol 343 Sound {sound.Samples_ExplosionSndClass} [sound.Samples_ExplosionSndClass]
Symbol 344 Sound {sound.Samples_StarCollectedClass2} [StarCollected2]
Symbol 345 Sound {sound.Samples_MenuLoopSndClass} [sound.Samples_MenuLoopSndClass]

Instance Names

"preloaderBar"Symbol 15 MovieClip {SponsorPreloader_fla.preloaderBar_3} [SponsorPreloader_fla.preloaderBar_3] Frame 1Symbol 7 MovieClip
"btnPlay"Symbol 22 MovieClip {SponsorPreloader_fla.playbutton_mc_9} [SponsorPreloader_fla.playbutton_mc_9] Frame 13Symbol 21 Button
"loading"Symbol 49 MovieClip {SponsorPreloader} [SponsorPreloader] Frame 18Symbol 15 MovieClip {SponsorPreloader_fla.preloaderBar_3} [SponsorPreloader_fla.preloaderBar_3]
"btnOpenSite"Symbol 49 MovieClip {SponsorPreloader} [SponsorPreloader] Frame 18Symbol 17 Button
"preloaderBar"Symbol 49 MovieClip {SponsorPreloader} [SponsorPreloader] Frame 22Symbol 7 MovieClip
"ngbutton"Symbol 49 MovieClip {SponsorPreloader} [SponsorPreloader] Frame 24Symbol 18 Button
"particleInst1"Symbol 57 MovieClip {SpaceBG_fla.BGAnimation_2} [SpaceBG_fla.BGAnimation_2] Frame 1Symbol 56 MovieClip {BGElement} [BGElement]
"particleInst2"Symbol 57 MovieClip {SpaceBG_fla.BGAnimation_2} [SpaceBG_fla.BGAnimation_2] Frame 1Symbol 56 MovieClip {BGElement} [BGElement]
"dustTarget"Symbol 88 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 66 MovieClip
"btnPlay"Symbol 88 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 74 Button
"btnHelp"Symbol 88 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 78 Button
"btnHighscores"Symbol 88 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 81 Button
"btnDownload"Symbol 88 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 84 Button
"btnPlayMoreGames"Symbol 88 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 87 Button
"btn"Symbol 202 MovieClip {Controls_fla.SponsorLogo_58} [Controls_fla.SponsorLogo_58] Frame 1Symbol 201 Button
"btn1"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 99 Button
"btn2"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 101 Button
"btn3"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 103 Button
"btn4"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 105 Button
"btn5"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 107 Button
"btn6"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 109 Button
"btn7"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 111 Button
"btn8"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 113 Button
"btn9"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 115 Button
"btn10"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 117 Button
"btn11"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 119 Button
"btn12"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 121 Button
"btn13"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 123 Button
"btn14"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 125 Button
"btn15"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 127 Button
"btn16"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 129 Button
"btn17"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 131 Button
"btn18"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 133 Button
"btn19"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 135 Button
"btn20"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 137 Button
"mcAreYouSure"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"btnYes"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 143 Button
"btnNo"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 147 Button
"btnReset"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 150 Button
"lock1"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock2"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock3"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock4"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock5"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock10"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock9"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock8"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock7"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock6"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock11"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock12"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock13"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock14"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock15"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock16"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock17"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock18"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock19"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"lock20"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 153 MovieClip
"mcPreview"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 194 MovieClip
"tfBestTime"Symbol 203 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 196 EditableText
"btn"Symbol 217 MovieClip {WinMenu_fla.SponsorLogo_5} [WinMenu_fla.SponsorLogo_5] Frame 1Symbol 216 Button
"btnSubmitScore"Symbol 218 MovieClip {WinMenu} [WinMenu] Frame 1Symbol 208 Button
"tfName"Symbol 218 MovieClip {WinMenu} [WinMenu] Frame 1Symbol 209 EditableText
"tfScore"Symbol 218 MovieClip {WinMenu} [WinMenu] Frame 1Symbol 210 EditableText
"btn"Symbol 238 MovieClip {HelpMenu_fla.SponsorLogo_8} [HelpMenu_fla.SponsorLogo_8] Frame 1Symbol 237 Button
"btnGoodLuck"Symbol 244 MovieClip {HelpMenu_fla.HelpContent_4} [HelpMenu_fla.HelpContent_4] Frame 1Symbol 231 Button
"btnDownload"Symbol 244 MovieClip {HelpMenu_fla.HelpContent_4} [HelpMenu_fla.HelpContent_4] Frame 20Symbol 242 Button
"_content"Symbol 259 MovieClip {HelpMenu} [HelpMenu] Frame 1Symbol 244 MovieClip {HelpMenu_fla.HelpContent_4} [HelpMenu_fla.HelpContent_4]
"btnClose"Symbol 259 MovieClip {HelpMenu} [HelpMenu] Frame 1Symbol 250 Button
"btnCredits"Symbol 259 MovieClip {HelpMenu} [HelpMenu] Frame 1Symbol 254 Button
"btnControls"Symbol 259 MovieClip {HelpMenu} [HelpMenu] Frame 1Symbol 256 Button
"btnDownload"Symbol 259 MovieClip {HelpMenu} [HelpMenu] Frame 1Symbol 258 Button
"btn"Symbol 280 MovieClip {Controls_fla.Symbol44_2} [Controls_fla.Symbol44_2] Frame 1Symbol 279 Button
"mcWaves"Symbol 291 MovieClip {Controls_fla.MuteControl_7} [Controls_fla.MuteControl_7] Frame 1Symbol 286 MovieClip
"btnMute"Symbol 291 MovieClip {Controls_fla.MuteControl_7} [Controls_fla.MuteControl_7] Frame 1Symbol 290 Button
"tfCollected"Symbol 297 MovieClip {Controls} [Controls] Frame 1Symbol 265 EditableText
"tfTotal"Symbol 297 MovieClip {Controls} [Controls] Frame 1Symbol 267 EditableText
"tfShootsDone"Symbol 297 MovieClip {Controls} [Controls] Frame 1Symbol 269 EditableText
"tfShootsTotal"Symbol 297 MovieClip {Controls} [Controls] Frame 1Symbol 270 EditableText
"btnHelp"Symbol 297 MovieClip {Controls} [Controls] Frame 1Symbol 284 Button
"btnMenu"Symbol 297 MovieClip {Controls} [Controls] Frame 1Symbol 294 Button
"btnReset"Symbol 297 MovieClip {Controls} [Controls] Frame 1Symbol 296 Button
"btnMenu"Symbol 309 MovieClip {DefeatLevelMenu} [DefeatLevelMenu] Frame 1Symbol 306 Button
"btnReplay"Symbol 309 MovieClip {DefeatLevelMenu} [DefeatLevelMenu] Frame 1Symbol 308 Button
"btnNext"Symbol 319 MovieClip {CompleteLevelMenu} [CompleteLevelMenu] Frame 1Symbol 315 Button
"btnMenu"Symbol 319 MovieClip {CompleteLevelMenu} [CompleteLevelMenu] Frame 1Symbol 318 Button
"skinItem"Symbol 323 MovieClip {TrashSkin} [TrashSkin] Frame 1Symbol 322 MovieClip

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 49 as "SponsorPreloader"
ExportAssets (56)Timeline Frame 1Symbol 22 as "SponsorPreloader_fla.playbutton_mc_9"
ExportAssets (56)Timeline Frame 1Symbol 40 as "SponsorPreloader_fla.sprite22_12"
ExportAssets (56)Timeline Frame 1Symbol 48 as "SponsorPreloader_fla.fader_20"
ExportAssets (56)Timeline Frame 1Symbol 46 as "SponsorPreloader_fla.sparkle_19"
ExportAssets (56)Timeline Frame 1Symbol 15 as "SponsorPreloader_fla.preloaderBar_3"
ExportAssets (56)Timeline Frame 2Symbol 58 as "SpaceBG"
ExportAssets (56)Timeline Frame 2Symbol 88 as "StartMenu"
ExportAssets (56)Timeline Frame 2Symbol 203 as "LevelMenu"
ExportAssets (56)Timeline Frame 2Symbol 218 as "WinMenu"
ExportAssets (56)Timeline Frame 2Symbol 259 as "HelpMenu"
ExportAssets (56)Timeline Frame 2Symbol 261 as "MainMask"
ExportAssets (56)Timeline Frame 2Symbol 297 as "Controls"
ExportAssets (56)Timeline Frame 2Symbol 309 as "DefeatLevelMenu"
ExportAssets (56)Timeline Frame 2Symbol 319 as "CompleteLevelMenu"
ExportAssets (56)Timeline Frame 2Symbol 57 as "SpaceBG_fla.BGAnimation_2"
ExportAssets (56)Timeline Frame 2Symbol 202 as "Controls_fla.SponsorLogo_58"
ExportAssets (56)Timeline Frame 2Symbol 217 as "WinMenu_fla.SponsorLogo_5"
ExportAssets (56)Timeline Frame 2Symbol 321 as "AntiTrashSkin"
ExportAssets (56)Timeline Frame 2Symbol 244 as "HelpMenu_fla.HelpContent_4"
ExportAssets (56)Timeline Frame 2Symbol 323 as "TrashSkin"
ExportAssets (56)Timeline Frame 2Symbol 325 as "LauncherBar"
ExportAssets (56)Timeline Frame 2Symbol 327 as "LauncherSkin"
ExportAssets (56)Timeline Frame 2Symbol 291 as "Controls_fla.MuteControl_7"
ExportAssets (56)Timeline Frame 2Symbol 280 as "Controls_fla.Symbol44_2"
ExportAssets (56)Timeline Frame 2Symbol 330 as "VoluntaryBoxSkin"
ExportAssets (56)Timeline Frame 2Symbol 337 as "BouncerSkin"
ExportAssets (56)Timeline Frame 2Symbol 56 as "BGElement"
ExportAssets (56)Timeline Frame 2Symbol 238 as "HelpMenu_fla.SponsorLogo_8"
ExportAssets (56)Timeline Frame 2Symbol 339 as "SpaceshipSkin"
ExportAssets (56)Timeline Frame 2Symbol 340 as "sound.Samples_FireSndClass"
ExportAssets (56)Timeline Frame 2Symbol 341 as "sound.Samples_LevelLoopClass"
ExportAssets (56)Timeline Frame 2Symbol 342 as "StarCollected1"
ExportAssets (56)Timeline Frame 2Symbol 343 as "sound.Samples_ExplosionSndClass"
ExportAssets (56)Timeline Frame 2Symbol 344 as "StarCollected2"
ExportAssets (56)Timeline Frame 2Symbol 345 as "sound.Samples_MenuLoopSndClass"
ExportAssets (56)Timeline Frame 2Symbol 65 as "Dust"
SerialNumber (41)Timeline Frame 1

Labels

"Preloader"Frame 1
"Main"Frame 2
"default"Symbol 194 MovieClip Frame 1
"sc1"Symbol 194 MovieClip Frame 10
"sc2"Symbol 194 MovieClip Frame 15
"sc3"Symbol 194 MovieClip Frame 20
"sc4"Symbol 194 MovieClip Frame 25
"sc5"Symbol 194 MovieClip Frame 30
"sc6"Symbol 194 MovieClip Frame 35
"sc7"Symbol 194 MovieClip Frame 40
"sc8"Symbol 194 MovieClip Frame 45
"sc9"Symbol 194 MovieClip Frame 50
"sc10"Symbol 194 MovieClip Frame 55
"sc11"Symbol 194 MovieClip Frame 60
"sc12"Symbol 194 MovieClip Frame 65
"sc13"Symbol 194 MovieClip Frame 70
"sc14"Symbol 194 MovieClip Frame 75
"sc15"Symbol 194 MovieClip Frame 80
"sc16"Symbol 194 MovieClip Frame 85
"sc17"Symbol 194 MovieClip Frame 90
"sc18"Symbol 194 MovieClip Frame 95
"sc19"Symbol 194 MovieClip Frame 100
"sc20"Symbol 194 MovieClip Frame 105
"controls"Symbol 244 MovieClip {HelpMenu_fla.HelpContent_4} [HelpMenu_fla.HelpContent_4] Frame 1
"credits"Symbol 244 MovieClip {HelpMenu_fla.HelpContent_4} [HelpMenu_fla.HelpContent_4] Frame 10
"download"Symbol 244 MovieClip {HelpMenu_fla.HelpContent_4} [HelpMenu_fla.HelpContent_4] Frame 20




http://swfchan.com/19/90771/info.shtml
Created: 28/3 -2019 06:11:48 Last modified: 28/3 -2019 06:11:48 Server time: 22/12 -2024 10:08:11