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

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

Boomz - fantastic arcade for fun and relax.swf

This is the info page for
Flash #136020

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


Text
Bunus +1 score!

Collected:

00

/

00

Shoots:

00

Menu

Menu

Menu

Replay

Replay

Replay

Bonus +1 Shot !!!

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

Good Luck!

Good Luck!

Thanks to:

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

DOWNLOAD

DOWNLOAD

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

Back

Back

Credits

Credits

Credits

Controls

Controls

Controls

Download

Download

Download

Victory!

Next Level

Next Level

Next Level

Select level

Preview

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

BOOM!

v 0.9

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've completed all levels!

Defeat

PLAY

PLAY

Help

Help

Highscores

Highscores

Download this game

Download this game

Play more games

Play more games

Play more games

ActionScript [AS3]

Section 1
//BGAnimation_64 (assetsNewDesign_fla.BGAnimation_64) package assetsNewDesign_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.profiler.*; import flash.sampler.*; import flash.ui.*; import flash.xml.*; public dynamic class BGAnimation_64 extends MovieClip { public var particleInst2:BGElement; public var particleInst1:BGElement; public var i:uint; public var count:uint; public var particle:MovieClip; public var bf:BlurFilter; public function BGAnimation_64(){ 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 assetsNewDesign_fla
Section 2
//HelpContent_12 (assetsNewDesign_fla.HelpContent_12) package assetsNewDesign_fla { import flash.events.*; import flash.display.*; import flash.net.*; public dynamic class HelpContent_12 extends MovieClip { public var btnGoodLuck:SimpleButton; public var btnDownload:SimpleButton; public function HelpContent_12(){ addFrameScript(0, frame1, 9, frame10, 19, frame20); } public function onDownload(_arg1:MouseEvent):void{ var _local2:URLRequest = new URLRequest("http://cdn.mochiads.com/c/g/boom_v587882.zip"); navigateToURL(_local2, "_blank"); } function frame1(){ stop(); btnGoodLuck.visible = true; } function frame10(){ btnGoodLuck.visible = false; } function frame20(){ btnGoodLuck.visible = false; btnDownload.addEventListener(MouseEvent.CLICK, onDownload); } } }//package assetsNewDesign_fla
Section 3
//MuteControl_5 (assetsNewDesign_fla.MuteControl_5) package assetsNewDesign_fla { import flash.events.*; import flash.display.*; public dynamic class MuteControl_5 extends MovieClip { public var btnMute:SimpleButton; public var mcWaves:MovieClip; public function MuteControl_5(){ addFrameScript(0, frame1); } public function onClick(_arg1:MouseEvent):void{ mcWaves.visible = !(mcWaves.visible); dispatchEvent(new Event("Mute", true)); } function frame1(){ btnMute.addEventListener(MouseEvent.CLICK, onClick); } } }//package assetsNewDesign_fla
Section 4
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2CircleDef extends b2ShapeDef { public var localPosition:b2Vec2; public var radius:Number; public function b2CircleDef(){ this.localPosition = new b2Vec2(0, 0); super(); type = b2Shape.e_circleShape; this.radius = 1; } } }//package Box2D.Collision.Shapes
Section 5
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape) package Box2D.Collision.Shapes { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2CircleShape extends b2Shape { public var m_localPosition:b2Vec2; public var m_radius:Number; public function b2CircleShape(_arg1:b2ShapeDef){ this.m_localPosition = new b2Vec2(); super(_arg1); var _local2:b2CircleDef = (_arg1 as b2CircleDef); m_type = e_circleShape; this.m_localPosition.SetV(_local2.localPosition); this.m_radius = _local2.radius; } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Mat22 = _arg1.R; var _local4:Number = (_arg1.position.x + ((_local3.col1.x * this.m_localPosition.x) + (_local3.col2.x * this.m_localPosition.y))); var _local5:Number = (_arg1.position.y + ((_local3.col1.y * this.m_localPosition.x) + (_local3.col2.y * this.m_localPosition.y))); _local4 = (_arg2.x - _local4); _local5 = (_arg2.y - _local5); return ((((_local4 * _local4) + (_local5 * _local5)) <= (this.m_radius * this.m_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 * this.m_localPosition.x) + (_local6.col2.x * this.m_localPosition.y))); var _local8:Number = (_arg1.position.x + ((_local6.col1.y * this.m_localPosition.x) + (_local6.col2.y * this.m_localPosition.y))); var _local9:Number = (_arg4.p1.x - _local7); _local10 = (_arg4.p1.y - _local8); var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (this.m_radius * this.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 ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22 = _arg2.R; var _local4:Number = (_arg2.position.x + ((_local3.col1.x * this.m_localPosition.x) + (_local3.col2.x * this.m_localPosition.y))); var _local5:Number = (_arg2.position.y + ((_local3.col1.y * this.m_localPosition.x) + (_local3.col2.y * this.m_localPosition.y))); _arg1.lowerBound.Set((_local4 - this.m_radius), (_local5 - this.m_radius)); _arg1.upperBound.Set((_local4 + this.m_radius), (_local5 + this.m_radius)); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2Mat22; _local4 = _arg2.R; var _local5:Number = (_arg2.position.x + ((_local4.col1.x * this.m_localPosition.x) + (_local4.col2.x * this.m_localPosition.y))); var _local6:Number = (_arg2.position.y + ((_local4.col1.y * this.m_localPosition.x) + (_local4.col2.y * this.m_localPosition.y))); _local4 = _arg3.R; var _local7:Number = (_arg3.position.x + ((_local4.col1.x * this.m_localPosition.x) + (_local4.col2.x * this.m_localPosition.y))); var _local8:Number = (_arg3.position.y + ((_local4.col1.y * this.m_localPosition.x) + (_local4.col2.y * this.m_localPosition.y))); _arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - this.m_radius), (((_local6 < _local8)) ? _local6 : _local8 - this.m_radius)); _arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + this.m_radius), (((_local6 > _local8)) ? _local6 : _local8 + this.m_radius)); } override public function ComputeMass(_arg1:b2MassData):void{ _arg1.mass = (((m_density * b2Settings.b2_pi) * this.m_radius) * this.m_radius); _arg1.center.SetV(this.m_localPosition); _arg1.I = (_arg1.mass * (((0.5 * this.m_radius) * this.m_radius) + ((this.m_localPosition.x * this.m_localPosition.x) + (this.m_localPosition.y * this.m_localPosition.y)))); } override public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2XForm, _arg4:b2Vec2):Number{ var _local5:b2Vec2 = b2Math.b2MulX(_arg3, this.m_localPosition); var _local6:Number = -((b2Math.b2Dot(_arg1, _local5) - _arg2)); if (_local6 < (-(this.m_radius) + Number.MIN_VALUE)){ return (0); }; if (_local6 > this.m_radius){ _arg4.SetV(_local5); return (((b2Settings.b2_pi * this.m_radius) * this.m_radius)); }; var _local7:Number = (this.m_radius * this.m_radius); var _local8:Number = (_local6 * _local6); var _local9:Number = ((_local7 * (Math.asin((_local6 / this.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 (this.m_localPosition); } public function GetRadius():Number{ return (this.m_radius); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:Number = (this.m_localPosition.x - _arg1.x); var _local3:Number = (this.m_localPosition.y - _arg1.y); _local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3))); m_sweepRadius = ((_local2 + this.m_radius) - b2Settings.b2_toiSlop); } } }//package Box2D.Collision.Shapes
Section 6
//b2FilterData (Box2D.Collision.Shapes.b2FilterData) package Box2D.Collision.Shapes { public class b2FilterData { public var categoryBits:uint;// = 1 public var maskBits:uint;// = 0xFFFF public var groupIndex:int;// = 0 public function Copy():b2FilterData{ var _local1:b2FilterData = new b2FilterData(); _local1.categoryBits = this.categoryBits; _local1.maskBits = this.maskBits; _local1.groupIndex = this.groupIndex; return (_local1); } } }//package Box2D.Collision.Shapes
Section 7
//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(){ this.center = new b2Vec2(0, 0); super(); } } }//package Box2D.Collision.Shapes
Section 8
//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(){ this.vertices = new Array(b2Settings.b2_maxPolygonVertices); super(); type = b2Shape.e_polygonShape; this.vertexCount = 0; var _local1:int; while (_local1 < b2Settings.b2_maxPolygonVertices) { this.vertices[_local1] = new b2Vec2(); _local1++; }; } public function SetAsBox(_arg1:Number, _arg2:Number):void{ this.vertexCount = 4; this.vertices[0].Set(-(_arg1), -(_arg2)); this.vertices[1].Set(_arg1, -(_arg2)); this.vertices[2].Set(_arg1, _arg2); this.vertices[3].Set(-(_arg1), _arg2); } public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{ var _local5:b2Vec2; var _local6:b2Mat22; var _local7:int; this.vertexCount = 4; this.vertices[0].Set(-(_arg1), -(_arg2)); this.vertices[1].Set(_arg1, -(_arg2)); this.vertices[2].Set(_arg1, _arg2); this.vertices[3].Set(-(_arg1), _arg2); if (_arg3){ _local5 = _arg3; _local6 = s_mat; _local6.Set(_arg4); _local7 = 0; while (_local7 < this.vertexCount) { _arg3 = this.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++; }; }; } } }//package Box2D.Collision.Shapes
Section 9
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape) package Box2D.Collision.Shapes { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolygonShape extends b2Shape { private var s_supportVec:b2Vec2; public var m_centroid:b2Vec2; public var m_obb:b2OBB; public var m_vertices:Array; public var m_normals:Array; public var m_coreVertices:Array; 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; this.s_supportVec = new b2Vec2(); this.m_obb = new b2OBB(); this.m_vertices = new Array(b2Settings.b2_maxPolygonVertices); this.m_normals = new Array(b2Settings.b2_maxPolygonVertices); this.m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices); super(_arg1); m_type = e_polygonShape; var _local2:b2PolygonDef = (_arg1 as b2PolygonDef); this.m_vertexCount = _local2.vertexCount; var _local4:int = _local3; var _local5:int = _local3; _local3 = 0; while (_local3 < this.m_vertexCount) { this.m_vertices[_local3] = _local2.vertices[_local3].Copy(); _local3++; }; _local3 = 0; while (_local3 < this.m_vertexCount) { _local4 = _local3; _local5 = (((_local3 + 1) < this.m_vertexCount)) ? (_local3 + 1) : 0; _local6 = (this.m_vertices[_local5].x - this.m_vertices[_local4].x); _local7 = (this.m_vertices[_local5].y - this.m_vertices[_local4].y); _local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); this.m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8)); _local3++; }; this.m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount); ComputeOBB(this.m_obb, this.m_vertices, this.m_vertexCount); _local3 = 0; while (_local3 < this.m_vertexCount) { _local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (this.m_vertexCount - 1); _local5 = _local3; _local9 = this.m_normals[_local4].x; _local10 = this.m_normals[_local4].y; _local11 = this.m_normals[_local5].x; _local12 = this.m_normals[_local5].y; _local13 = (this.m_vertices[_local3].x - this.m_centroid.x); _local14 = (this.m_vertices[_local3].y - this.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))); this.m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + this.m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + this.m_centroid.y)); _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 < this.m_vertexCount) { _local3 = this.m_vertices[_local9]; _local5 = (_local7 - _local3.x); _local6 = (_local8 - _local3.y); _local3 = this.m_normals[_local9]; _local10 = ((_local3.x * _local5) + (_local3.y * _local6)); if (_local10 > 0){ return (false); }; _local9++; }; return (true); } 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 < this.m_vertexCount) { _local11 = this.m_vertices[_local19]; _local8 = (_local11.x - _local12); _local9 = (_local11.y - _local13); _local11 = this.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 = this.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 ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22; var _local4:b2Vec2; var _local5:b2Mat22 = s_computeMat; _local3 = _arg2.R; _local4 = this.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 = this.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 = this.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 = this.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 ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2AABB = s_sweptAABB1; var _local5:b2AABB = s_sweptAABB2; this.ComputeAABB(_local4, _arg2); this.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); } 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 < this.m_vertexCount) { _local10 = this.m_vertices[_local9]; _local11 = (((_local9 + 1) < this.m_vertexCount)) ? this.m_vertices[int((_local9 + 1))] : this.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); } 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 < this.m_vertexCount) { _local11 = this.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(); this.ComputeMass(_local25); _arg4.SetV(b2Math.b2MulX(_arg3, _local25.center)); return ((_local25.mass / m_density)); }; return (0); case 1: if (_local9 == -1){ _local9 = (this.m_vertexCount - 1); } else { _local10 = (this.m_vertexCount - 1); }; break; }; var _local14:int = ((_local9 + 1) % this.m_vertexCount); var _local15:int = ((_local10 + 1) % this.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(((this.m_vertices[_local9].x * (1 - _local16)) + (this.m_vertices[_local14].x * _local16)), ((this.m_vertices[_local9].y * (1 - _local16)) + (this.m_vertices[_local14].y * _local16))); var _local19:b2Vec2 = new b2Vec2(((this.m_vertices[_local10].x * (1 - _local17)) + (this.m_vertices[_local15].x * _local17)), ((this.m_vertices[_local10].y * (1 - _local17)) + (this.m_vertices[_local15].y * _local17))); var _local20:Number = 0; _arg4.Set(0, 0); var _local21:b2Vec2 = this.m_vertices[_local14]; var _local23:Number = (1 / 3); _local13 = _local14; while (_local13 != _local15) { _local13 = ((_local13 + 1) % this.m_vertexCount); if (_local13 == _local15){ _local22 = _local19; } else { _local22 = this.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); } public function GetOBB():b2OBB{ return (this.m_obb); } public function GetCentroid():b2Vec2{ return (this.m_centroid); } public function GetVertexCount():int{ return (this.m_vertexCount); } public function GetVertices():Array{ return (this.m_vertices); } public function GetCoreVertices():Array{ return (this.m_coreVertices); } public function GetNormals():Array{ return (this.m_normals); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, this.m_coreVertices[0])); } public function Centroid(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, this.m_centroid)); } 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 = this.m_coreVertices[0]; var _local9:Number = ((_local4.x * _local6) + (_local4.y * _local7)); var _local10 = 1; while (_local10 < this.m_vertexCount) { _local4 = this.m_coreVertices[_local10]; _local11 = ((_local4.x * _local6) + (_local4.y * _local7)); if (_local11 > _local9){ _local8 = _local10; _local9 = _local11; }; _local10++; }; _local5 = _arg1.R; _local4 = this.m_coreVertices[_local8]; this.s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y))); this.s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y))); return (this.s_supportVec); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:b2Vec2; var _local4:Number; var _local5:Number; m_sweepRadius = 0; var _local3:int; while (_local3 < this.m_vertexCount) { _local2 = this.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++; }; } 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 10
//b2Shape (Box2D.Collision.Shapes.b2Shape) package Box2D.Collision.Shapes { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; public class b2Shape { public var m_type:int; public var m_next:b2Shape; public var m_body:b2Body; public var m_sweepRadius:Number; public var m_density:Number; public var m_friction:Number; public var m_restitution:Number; public var m_proxyId:uint; public var m_filter:b2FilterData; public var m_isSensor:Boolean; public var m_userData; public static const e_unknownShape:int = -1; public static const e_circleShape:int = 0; public static const e_polygonShape:int = 1; public static const e_shapeTypeCount:int = 2; private static var s_proxyAABB:b2AABB = new b2AABB(); private static var s_syncAABB:b2AABB = new b2AABB(); private static var s_resetAABB:b2AABB = new b2AABB(); public function b2Shape(_arg1:b2ShapeDef){ this.m_userData = _arg1.userData; this.m_friction = _arg1.friction; this.m_restitution = _arg1.restitution; this.m_density = _arg1.density; this.m_body = null; this.m_sweepRadius = 0; this.m_next = null; this.m_proxyId = b2Pair.b2_nullProxy; this.m_filter = _arg1.filter.Copy(); this.m_isSensor = _arg1.isSensor; } public function GetType():int{ return (this.m_type); } public function IsSensor():Boolean{ return (this.m_isSensor); } public function SetFilterData(_arg1:b2FilterData):void{ this.m_filter = _arg1.Copy(); } public function GetFilterData():b2FilterData{ return (this.m_filter.Copy()); } public function GetBody():b2Body{ return (this.m_body); } public function GetNext():b2Shape{ return (this.m_next); } public function GetUserData(){ return (this.m_userData); } public function SetUserData(_arg1):void{ this.m_userData = _arg1; } public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ return (false); } public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{ return (false); } public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ } public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ } public function ComputeMass(_arg1:b2MassData):void{ } public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2XForm, _arg4:b2Vec2):Number{ return (0); } public function GetSweepRadius():Number{ return (this.m_sweepRadius); } public function GetFriction():Number{ return (this.m_friction); } public function GetRestitution():Number{ return (this.m_restitution); } public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ var _local3:b2AABB = s_proxyAABB; this.ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ this.m_proxyId = _arg1.CreateProxy(_local3, this); } else { this.m_proxyId = b2Pair.b2_nullProxy; }; } public function DestroyProxy(_arg1:b2BroadPhase):void{ if (this.m_proxyId != b2Pair.b2_nullProxy){ _arg1.DestroyProxy(this.m_proxyId); this.m_proxyId = b2Pair.b2_nullProxy; }; } public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{ if (this.m_proxyId == b2Pair.b2_nullProxy){ return (false); }; var _local4:b2AABB = s_syncAABB; this.ComputeSweptAABB(_local4, _arg2, _arg3); if (_arg1.InRange(_local4)){ _arg1.MoveProxy(this.m_proxyId, _local4); return (true); }; return (false); } public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ if (this.m_proxyId == b2Pair.b2_nullProxy){ return; }; _arg1.DestroyProxy(this.m_proxyId); var _local3:b2AABB = s_resetAABB; this.ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ this.m_proxyId = _arg1.CreateProxy(_local3, this); } else { this.m_proxyId = b2Pair.b2_nullProxy; }; } public function UpdateSweepRadius(_arg1:b2Vec2):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); }; } public static function Destroy(_arg1:b2Shape, _arg2):void{ } } }//package Box2D.Collision.Shapes
Section 11
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef) package Box2D.Collision.Shapes { public class b2ShapeDef { public var type:int;// = -1 public var userData;// = null public var friction:Number;// = 0.2 public var restitution:Number;// = 0 public var density:Number;// = 0 public var isSensor:Boolean;// = false public var filter:b2FilterData; public function b2ShapeDef(){ this.filter = new b2FilterData(); super(); } } }//package Box2D.Collision.Shapes
Section 12
//b2AABB (Box2D.Collision.b2AABB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2AABB { public var lowerBound:b2Vec2; public var upperBound:b2Vec2; public function b2AABB(){ this.lowerBound = new b2Vec2(); this.upperBound = new b2Vec2(); super(); } public function IsValid():Boolean{ var _local1:Number = (this.upperBound.x - this.lowerBound.x); var _local2:Number = (this.upperBound.y - this.lowerBound.y); var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0))); _local3 = ((((_local3) && (this.lowerBound.IsValid()))) && (this.upperBound.IsValid())); return (_local3); } } }//package Box2D.Collision
Section 13
//b2Bound (Box2D.Collision.b2Bound) package Box2D.Collision { public class b2Bound { public var value:uint; public var proxyId:uint; public var stabbingCount:uint; public function IsLower():Boolean{ return (((this.value & 1) == 0)); } public function IsUpper():Boolean{ return (((this.value & 1) == 1)); } public function Swap(_arg1:b2Bound):void{ var _local2:uint = this.value; var _local3:uint = this.proxyId; var _local4:uint = this.stabbingCount; this.value = _arg1.value; this.proxyId = _arg1.proxyId; this.stabbingCount = _arg1.stabbingCount; _arg1.value = _local2; _arg1.proxyId = _local3; _arg1.stabbingCount = _local4; } } }//package Box2D.Collision
Section 14
//b2BoundValues (Box2D.Collision.b2BoundValues) package Box2D.Collision { public class b2BoundValues { public var lowerValues:Array; public var upperValues:Array; public function b2BoundValues(){ this.lowerValues = [0, 0]; this.upperValues = [0, 0]; super(); } } }//package Box2D.Collision
Section 15
//b2BroadPhase (Box2D.Collision.b2BroadPhase) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2BroadPhase { public var m_pairManager:b2PairManager; public var m_proxyPool:Array; public var m_freeProxy:uint; public var m_bounds:Array; public var m_queryResults:Array; public var m_queryResultCount:int; public var m_worldAABB:b2AABB; public var m_quantizationFactor:b2Vec2; public var m_proxyCount:int; public var m_timeStamp:uint; public static const b2_invalid:uint = b2Settings.USHRT_MAX; public static const b2_nullEdge: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; this.m_pairManager = new b2PairManager(); this.m_proxyPool = new Array(b2Settings.b2_maxPairs); this.m_bounds = new Array((2 * b2Settings.b2_maxProxies)); this.m_queryResults = new Array(b2Settings.b2_maxProxies); this.m_quantizationFactor = new b2Vec2(); super(); this.m_pairManager.Initialize(this, _arg2); this.m_worldAABB = _arg1; this.m_proxyCount = 0; _local3 = 0; while (_local3 < b2Settings.b2_maxProxies) { this.m_queryResults[_local3] = 0; _local3++; }; this.m_bounds = new Array(2); _local3 = 0; while (_local3 < 2) { this.m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies)); _local7 = 0; while (_local7 < (2 * b2Settings.b2_maxProxies)) { this.m_bounds[_local3][_local7] = new b2Bound(); _local7++; }; _local3++; }; var _local4:Number = (_arg1.upperBound.x - _arg1.lowerBound.x); _local5 = (_arg1.upperBound.y - _arg1.lowerBound.y); this.m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4); this.m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5); _local3 = 0; while (_local3 < (b2Settings.b2_maxProxies - 1)) { _local6 = new b2Proxy(); this.m_proxyPool[_local3] = _local6; _local6.SetNext((_local3 + 1)); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; _local3++; }; _local6 = new b2Proxy(); this.m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6; _local6.SetNext(b2Pair.b2_nullProxy); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; this.m_freeProxy = 0; this.m_timeStamp = 1; this.m_queryResultCount = 0; } 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 - this.m_worldAABB.upperBound.x); _local3 = (_local3 - this.m_worldAABB.upperBound.y); _local4 = this.m_worldAABB.lowerBound.x; _local5 = this.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 GetProxy(_arg1:int):b2Proxy{ var _local2:b2Proxy = this.m_proxyPool[_arg1]; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){ return (null); }; return (_local2); } 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 = this.m_freeProxy; _local4 = this.m_proxyPool[_local5]; this.m_freeProxy = _local4.GetNext(); _local4.overlapCount = 0; _local4.userData = _arg2; var _local6:uint = (2 * this.m_proxyCount); var _local7:Array = new Array(); var _local8:Array = new Array(); this.ComputeBounds(_local7, _local8, _arg1); var _local9:int; while (_local9 < 2) { _local11 = this.m_bounds[_local9]; _local14 = [_local12]; _local15 = [_local13]; this.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 = this.m_proxyPool[_local19.proxyId]; if (_local19.IsLower()){ _local23.lowerBounds[_local9] = _local3; } else { _local23.upperBounds[_local9] = _local3; }; _local3++; }; _local9++; }; this.m_proxyCount++; var _local10:int; while (_local10 < this.m_queryResultCount) { this.m_pairManager.AddBufferedPair(_local5, this.m_queryResults[_local10]); _local10++; }; this.m_pairManager.Commit(); this.m_queryResultCount = 0; this.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 = this.m_proxyPool[_arg1]; var _local5:int = (2 * this.m_proxyCount); var _local6:int; while (_local6 < 2) { _local8 = this.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 = this.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++; }; this.Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6); _local6++; }; var _local7:int; while (_local7 < this.m_queryResultCount) { this.m_pairManager.RemoveBufferedPair(_arg1, this.m_queryResults[_local7]); _local7++; }; this.m_pairManager.Commit(); this.m_queryResultCount = 0; this.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(this.m_freeProxy); this.m_freeProxy = _arg1; this.m_proxyCount--; } 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 * this.m_proxyCount); var _local13:b2Proxy = this.m_proxyPool[_arg1]; var _local14:b2BoundValues = new b2BoundValues(); this.ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2); var _local15:b2BoundValues = new b2BoundValues(); _local5 = 0; while (_local5 < 2) { _local7 = this.m_bounds[_local5][_local13.lowerBounds[_local5]]; _local15.lowerValues[_local5] = _local7.value; _local7 = this.m_bounds[_local5][_local13.upperBounds[_local5]]; _local15.upperValues[_local5] = _local7.value; _local5++; }; _local5 = 0; while (_local5 < 2) { _local16 = this.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 = this.m_proxyPool[_local8.proxyId]; _local8.stabbingCount++; if (_local8.IsUpper() == true){ if (this.TestOverlap(_local14, _local24)){ this.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 = this.m_proxyPool[_local10]; _local9.stabbingCount++; if (_local9.IsLower() == true){ if (this.TestOverlap(_local14, _local11)){ this.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 = this.m_proxyPool[_local10]; _local9.stabbingCount--; if (_local9.IsUpper()){ if (this.TestOverlap(_local15, _local11)){ this.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 = this.m_proxyPool[_local23]; _local8.stabbingCount--; if (_local8.IsLower() == true){ if (this.TestOverlap(_local15, _local24)){ this.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 function Commit():void{ this.m_pairManager.Commit(); } 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(); this.ComputeBounds(_local4, _local5, _arg1); var _local8:Array = [_local6]; var _local9:Array = [_local7]; this.Query(_local8, _local9, _local4[0], _local5[0], this.m_bounds[0], (2 * this.m_proxyCount), 0); this.Query(_local8, _local9, _local4[1], _local5[1], this.m_bounds[1], (2 * this.m_proxyCount), 1); var _local10:int; var _local11:int; while ((((_local11 < this.m_queryResultCount)) && ((_local10 < _arg3)))) { _local12 = this.m_proxyPool[this.m_queryResults[_local11]]; _arg2[_local11] = _local12.userData; _local11++; _local10++; }; this.m_queryResultCount = 0; this.IncrementTimeStamp(); return (_local10); } 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 = this.m_bounds[_local5]; _local7 = (2 * this.m_proxyCount); _local8 = 0; _local9 = 0; while (_local9 < _local7) { _local10 = _local6[_local9]; if (_local10.IsLower() == true){ _local8++; } else { _local8--; }; _local9++; }; _local5++; }; } 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, this.m_worldAABB.upperBound.x); _local5 = b2Math.b2Min(_local5, this.m_worldAABB.upperBound.y); _local4 = b2Math.b2Max(_local4, this.m_worldAABB.lowerBound.x); _local5 = b2Math.b2Max(_local5, this.m_worldAABB.lowerBound.y); var _local6:Number = _arg3.upperBound.x; var _local7:Number = _arg3.upperBound.y; _local6 = b2Math.b2Min(_local6, this.m_worldAABB.upperBound.x); _local7 = b2Math.b2Min(_local7, this.m_worldAABB.upperBound.y); _local6 = b2Math.b2Max(_local6, this.m_worldAABB.lowerBound.x); _local7 = b2Math.b2Max(_local7, this.m_worldAABB.lowerBound.y); _arg1[0] = (uint((this.m_quantizationFactor.x * (_local4 - this.m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1)); _arg2[0] = ((uint((this.m_quantizationFactor.x * (_local6 - this.m_worldAABB.lowerBound.x))) & 0xFFFF) | 1); _arg1[1] = (uint((this.m_quantizationFactor.y * (_local5 - this.m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1)); _arg2[1] = ((uint((this.m_quantizationFactor.y * (_local7 - this.m_worldAABB.lowerBound.y))) & 0xFFFF) | 1); } private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local5:b2Bound; var _local6:b2Bound; var _local3:int; while (_local3 < 2) { _local4 = this.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); } public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local5:b2Bound; var _local3:int; while (_local3 < 2) { _local4 = this.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); } 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()){ this.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 = this.m_proxyPool[_local10.proxyId]; if (_local8 <= _local14.upperBounds[_arg7]){ this.IncrementOverlapCount(_local10.proxyId); _local13--; }; }; _local12--; }; }; _arg1[0] = _local8; _arg2[0] = _local9; } private function IncrementOverlapCount(_arg1:uint):void{ var _local2:b2Proxy = this.m_proxyPool[_arg1]; if (_local2.timeStamp < this.m_timeStamp){ _local2.timeStamp = this.m_timeStamp; _local2.overlapCount = 1; } else { _local2.overlapCount = 2; this.m_queryResults[this.m_queryResultCount] = _arg1; this.m_queryResultCount++; }; } private function IncrementTimeStamp():void{ var _local1:uint; if (this.m_timeStamp == b2Settings.USHRT_MAX){ _local1 = 0; while (_local1 < b2Settings.b2_maxProxies) { (this.m_proxyPool[_local1] as b2Proxy).timeStamp = 0; _local1++; }; this.m_timeStamp = 1; } else { this.m_timeStamp++; }; } 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 16
//b2BufferedPair (Box2D.Collision.b2BufferedPair) package Box2D.Collision { public class b2BufferedPair { public var proxyId1:uint; public var proxyId2:uint; } }//package Box2D.Collision
Section 17
//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 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 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 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 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 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; } 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); } } }//package Box2D.Collision
Section 18
//b2ContactID (Box2D.Collision.b2ContactID) package Box2D.Collision { public class b2ContactID { public var features:Features; public var _key:uint; public function b2ContactID(){ this.features = new Features(); super(); this.features._m_id = this; } public function Set(_arg1:b2ContactID):void{ this.key = _arg1._key; } public function Copy():b2ContactID{ var _local1:b2ContactID = new b2ContactID(); _local1.key = this.key; return (_local1); } public function get key():uint{ return (this._key); } public function set key(_arg1:uint):void{ this._key = _arg1; this.features._referenceEdge = (this._key & 0xFF); this.features._incidentEdge = (((this._key & 0xFF00) >> 8) & 0xFF); this.features._incidentVertex = (((this._key & 0xFF0000) >> 16) & 0xFF); this.features._flip = (((this._key & 4278190080) >> 24) & 0xFF); } } }//package Box2D.Collision
Section 19
//b2ContactPoint (Box2D.Collision.b2ContactPoint) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2ContactPoint { public var shape1:b2Shape; public var shape2:b2Shape; public var position:b2Vec2; public var velocity:b2Vec2; public var normal:b2Vec2; public var separation:Number; public var friction:Number; public var restitution:Number; public var id:b2ContactID; public function b2ContactPoint(){ this.position = new b2Vec2(); this.velocity = new b2Vec2(); this.normal = new b2Vec2(); this.id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 20
//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_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_p2s: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 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); } 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 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 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); } } }//package Box2D.Collision
Section 21
//b2Manifold (Box2D.Collision.b2Manifold) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Manifold { public var points:Array; public var normal:b2Vec2; public var pointCount:int;// = 0 public function b2Manifold(){ this.points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { this.points[_local1] = new b2ManifoldPoint(); _local1++; }; this.normal = new b2Vec2(); } public function Reset():void{ var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { (this.points[_local1] as b2ManifoldPoint).Reset(); _local1++; }; this.normal.SetZero(); this.pointCount = 0; } public function Set(_arg1:b2Manifold):void{ this.pointCount = _arg1.pointCount; var _local2:int; while (_local2 < b2Settings.b2_maxManifoldPoints) { (this.points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]); _local2++; }; this.normal.SetV(_arg1.normal); } } }//package Box2D.Collision
Section 22
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint) package Box2D.Collision { import Box2D.Common.Math.*; public class b2ManifoldPoint { public var localPoint1:b2Vec2; public var localPoint2:b2Vec2; public var separation:Number; public var normalImpulse:Number; public var tangentImpulse:Number; public var id:b2ContactID; public function b2ManifoldPoint(){ this.localPoint1 = new b2Vec2(); this.localPoint2 = new b2Vec2(); this.id = new b2ContactID(); super(); } public function Reset():void{ this.localPoint1.SetZero(); this.localPoint2.SetZero(); this.separation = 0; this.normalImpulse = 0; this.tangentImpulse = 0; this.id.key = 0; } public function Set(_arg1:b2ManifoldPoint):void{ this.localPoint1.SetV(_arg1.localPoint1); this.localPoint2.SetV(_arg1.localPoint2); this.separation = _arg1.separation; this.normalImpulse = _arg1.normalImpulse; this.tangentImpulse = _arg1.tangentImpulse; this.id.key = _arg1.id.key; } } }//package Box2D.Collision
Section 23
//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(){ this.R = new b2Mat22(); this.center = new b2Vec2(); this.extents = new b2Vec2(); super(); } } }//package Box2D.Collision
Section 24
//b2Pair (Box2D.Collision.b2Pair) package Box2D.Collision { import Box2D.Common.*; public class b2Pair { public var userData;// = null public var proxyId1:uint; public var proxyId2:uint; public var next:uint; public var status:uint; public static var b2_nullPair:uint = b2Settings.USHRT_MAX; public static var b2_nullProxy:uint = b2Settings.USHRT_MAX; public static var b2_tableCapacity:int = b2Settings.b2_maxPairs; public static var b2_tableMask:int = (b2_tableCapacity - 1); public static var e_pairBuffered:uint = 1; public static var e_pairRemoved:uint = 2; public static var e_pairFinal:uint = 4; public function SetBuffered():void{ this.status = (this.status | e_pairBuffered); } public function ClearBuffered():void{ this.status = (this.status & ~(e_pairBuffered)); } public function IsBuffered():Boolean{ return (((this.status & e_pairBuffered) == e_pairBuffered)); } public function SetRemoved():void{ this.status = (this.status | e_pairRemoved); } public function ClearRemoved():void{ this.status = (this.status & ~(e_pairRemoved)); } public function IsRemoved():Boolean{ return (((this.status & e_pairRemoved) == e_pairRemoved)); } public function SetFinal():void{ this.status = (this.status | e_pairFinal); } public function IsFinal():Boolean{ return (((this.status & e_pairFinal) == e_pairFinal)); } } }//package Box2D.Collision
Section 25
//b2PairCallback (Box2D.Collision.b2PairCallback) package Box2D.Collision { public class b2PairCallback { public function PairAdded(_arg1, _arg2){ return (null); } public function PairRemoved(_arg1, _arg2, _arg3):void{ } } }//package Box2D.Collision
Section 26
//b2PairManager (Box2D.Collision.b2PairManager) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PairManager { public var m_broadPhase:b2BroadPhase; public var m_callback:b2PairCallback; public var m_pairs:Array; public var m_freePair:uint; public var m_pairCount:int; public var m_pairBuffer:Array; public var m_pairBufferCount:int; public var m_hashTable:Array; public function b2PairManager(){ var _local1:uint; super(); this.m_hashTable = new Array(b2Pair.b2_tableCapacity); _local1 = 0; while (_local1 < b2Pair.b2_tableCapacity) { this.m_hashTable[_local1] = b2Pair.b2_nullPair; _local1++; }; this.m_pairs = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { this.m_pairs[_local1] = new b2Pair(); _local1++; }; this.m_pairBuffer = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { this.m_pairBuffer[_local1] = new b2BufferedPair(); _local1++; }; _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { this.m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy; this.m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy; this.m_pairs[_local1].userData = null; this.m_pairs[_local1].status = 0; this.m_pairs[_local1].next = (_local1 + 1); _local1++; }; this.m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair; this.m_pairCount = 0; this.m_pairBufferCount = 0; } public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{ this.m_broadPhase = _arg1; this.m_callback = _arg2; } public function AddBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair = this.AddPair(_arg1, _arg2); if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = this.m_pairBuffer[this.m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; this.m_pairBufferCount++; }; _local4.ClearRemoved(); if (b2BroadPhase.s_validate){ this.ValidateBuffer(); }; } public function RemoveBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair = this.Find(_arg1, _arg2); if (_local4 == null){ return; }; if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = this.m_pairBuffer[this.m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; this.m_pairBufferCount++; }; _local4.SetRemoved(); if (b2BroadPhase.s_validate){ this.ValidateBuffer(); }; } 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 = this.m_broadPhase.m_proxyPool; _local2 = 0; while (_local2 < this.m_pairBufferCount) { _local1 = this.m_pairBuffer[_local2]; _local5 = this.Find(_local1.proxyId1, _local1.proxyId2); _local5.ClearBuffered(); _local6 = _local4[_local5.proxyId1]; _local7 = _local4[_local5.proxyId2]; if (_local5.IsRemoved()){ if (_local5.IsFinal() == true){ this.m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData); }; _local1 = this.m_pairBuffer[_local3]; _local1.proxyId1 = _local5.proxyId1; _local1.proxyId2 = _local5.proxyId2; _local3++; } else { if (_local5.IsFinal() == false){ _local5.userData = this.m_callback.PairAdded(_local6.userData, _local7.userData); _local5.SetFinal(); }; }; _local2++; }; _local2 = 0; while (_local2 < _local3) { _local1 = this.m_pairBuffer[_local2]; this.RemovePair(_local1.proxyId1, _local1.proxyId2); _local2++; }; this.m_pairBufferCount = 0; if (b2BroadPhase.s_validate){ this.ValidateTable(); }; } 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 = this.FindHash(_arg1, _arg2, _local3); if (_local4 != null){ return (_local4); }; var _local5:uint = this.m_freePair; _local4 = this.m_pairs[_local5]; this.m_freePair = _local4.next; _local4.proxyId1 = _arg1; _local4.proxyId2 = _arg2; _local4.status = 0; _local4.userData = null; _local4.next = this.m_hashTable[_local3]; this.m_hashTable[_local3] = _local5; this.m_pairCount++; return (_local4); } 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 = this.m_hashTable[_local4]; var _local6:b2Pair; while (_local5 != b2Pair.b2_nullPair) { if (Equals(this.m_pairs[_local5], _arg1, _arg2)){ _local8 = _local5; _local3 = this.m_pairs[_local5]; if (_local6){ _local6.next = _local3.next; } else { this.m_hashTable[_local4] = _local3.next; }; _local3 = this.m_pairs[_local8]; _local9 = _local3.userData; _local3.next = this.m_freePair; _local3.proxyId1 = b2Pair.b2_nullProxy; _local3.proxyId2 = b2Pair.b2_nullProxy; _local3.userData = null; _local3.status = 0; this.m_freePair = _local8; this.m_pairCount--; return (_local9); } else { _local6 = this.m_pairs[_local5]; _local5 = _local6.next; }; }; return (null); } 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 (this.FindHash(_arg1, _arg2, _local3)); } private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{ var _local4:b2Pair; var _local5:uint = this.m_hashTable[_arg3]; _local4 = this.m_pairs[_local5]; while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) { _local5 = _local4.next; _local4 = this.m_pairs[_local5]; }; if (_local5 == b2Pair.b2_nullPair){ return (null); }; return (_local4); } private function ValidateBuffer():void{ } private function ValidateTable():void{ } 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)))); } public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{ return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2)))); } } }//package Box2D.Collision
Section 27
//b2Point (Box2D.Collision.b2Point) package Box2D.Collision { import Box2D.Common.Math.*; public class b2Point { public var p:b2Vec2; public function b2Point(){ this.p = new b2Vec2(); super(); } public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{ return (this.p); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (this.p); } } }//package Box2D.Collision
Section 28
//b2Proxy (Box2D.Collision.b2Proxy) package Box2D.Collision { public class b2Proxy { public var lowerBounds:Array; public var upperBounds:Array; public var overlapCount:uint; public var timeStamp:uint; public var userData;// = null public function b2Proxy(){ this.lowerBounds = [uint(0), uint(0)]; this.upperBounds = [uint(0), uint(0)]; super(); } public function GetNext():uint{ return (this.lowerBounds[0]); } public function SetNext(_arg1:uint):void{ this.lowerBounds[0] = (_arg1 & 0xFFFF); } public function IsValid():Boolean{ return (!((this.overlapCount == b2BroadPhase.b2_invalid))); } } }//package Box2D.Collision
Section 29
//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(){ this.p1 = new b2Vec2(); this.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 = (this.p2.x - this.p1.x); var _local9:Number = (this.p2.y - this.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 - this.p1.x); _local15 = (_local5.y - this.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 30
//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_p1:b2Vec2 = new b2Vec2(); public static var s_p2:b2Vec2 = new b2Vec2(); public static var s_xf1:b2XForm = new b2XForm(); public static var s_xf2:b2XForm = new b2XForm(); 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 31
//ClipVertex (Box2D.Collision.ClipVertex) package Box2D.Collision { import Box2D.Common.Math.*; public class ClipVertex { public var v:b2Vec2; public var id:b2ContactID; public function ClipVertex(){ this.v = new b2Vec2(); this.id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 32
//Features (Box2D.Collision.Features) package Box2D.Collision { public class Features { public var _referenceEdge:int; public var _incidentEdge:int; public var _incidentVertex:int; public var _flip:int; public var _m_id:b2ContactID; public function set referenceEdge(_arg1:int):void{ this._referenceEdge = _arg1; this._m_id._key = ((this._m_id._key & 4294967040) | (this._referenceEdge & 0xFF)); } public function get referenceEdge():int{ return (this._referenceEdge); } public function set incidentEdge(_arg1:int):void{ this._incidentEdge = _arg1; this._m_id._key = ((this._m_id._key & 4294902015) | ((this._incidentEdge << 8) & 0xFF00)); } public function get incidentEdge():int{ return (this._incidentEdge); } public function set incidentVertex(_arg1:int):void{ this._incidentVertex = _arg1; this._m_id._key = ((this._m_id._key & 4278255615) | ((this._incidentVertex << 16) & 0xFF0000)); } public function get incidentVertex():int{ return (this._incidentVertex); } public function set flip(_arg1:int):void{ this._flip = _arg1; this._m_id._key = ((this._m_id._key & 0xFFFFFF) | ((this._flip << 24) & 4278190080)); } public function get flip():int{ return (this._flip); } } }//package Box2D.Collision
Section 33
//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; this.col1 = new b2Vec2(); this.col2 = new b2Vec2(); super(); if (((!((_arg2 == null))) && (!((_arg3 == null))))){ this.col1.SetV(_arg2); this.col2.SetV(_arg3); } else { _local4 = Math.cos(_arg1); _local5 = Math.sin(_arg1); this.col1.x = _local4; this.col2.x = -(_local5); this.col1.y = _local5; this.col2.y = _local4; }; } public function Set(_arg1:Number):void{ var _local2:Number; _local2 = Math.cos(_arg1); var _local3:Number = Math.sin(_arg1); this.col1.x = _local2; this.col2.x = -(_local3); this.col1.y = _local3; this.col2.y = _local2; } public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{ this.col1.SetV(_arg1); this.col2.SetV(_arg2); } public function Copy():b2Mat22{ return (new b2Mat22(0, this.col1, this.col2)); } public function SetM(_arg1:b2Mat22):void{ this.col1.SetV(_arg1.col1); this.col2.SetV(_arg1.col2); } public function AddM(_arg1:b2Mat22):void{ this.col1.x = (this.col1.x + _arg1.col1.x); this.col1.y = (this.col1.y + _arg1.col1.y); this.col2.x = (this.col2.x + _arg1.col2.x); this.col2.y = (this.col2.y + _arg1.col2.y); } public function SetIdentity():void{ this.col1.x = 1; this.col2.x = 0; this.col1.y = 0; this.col2.y = 1; } public function SetZero():void{ this.col1.x = 0; this.col2.x = 0; this.col1.y = 0; this.col2.y = 0; } public function GetAngle():Number{ return (Math.atan2(this.col1.y, this.col1.x)); } public function Invert(_arg1:b2Mat22):b2Mat22{ var _local2:Number; var _local4:Number; var _local6:Number; _local2 = this.col1.x; var _local3:Number = this.col2.x; _local4 = this.col1.y; var _local5:Number = this.col2.y; _local6 = ((_local2 * _local5) - (_local3 * _local4)); _local6 = (1 / _local6); _arg1.col1.x = (_local6 * _local5); _arg1.col2.x = (-(_local6) * _local3); _arg1.col1.y = (-(_local6) * _local4); _arg1.col2.y = (_local6 * _local2); return (_arg1); } public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:Number = this.col1.x; var _local5:Number = this.col2.x; var _local6:Number = this.col1.y; var _local7:Number = this.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); } public function Abs():void{ this.col1.Abs(); this.col2.Abs(); } } }//package Box2D.Common.Math
Section 34
//b2Math (Box2D.Common.Math.b2Math) package Box2D.Common.Math { public class b2Math { public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0); 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 function b2IsValid(_arg1:Number):Boolean{ return (isFinite(_arg1)); } public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y))); } public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x))); } 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 b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x)); return (_local3); } 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); } 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 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 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 AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y)); return (_local3); } 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 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 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 MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y)); 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 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 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 b2Abs(_arg1:Number):Number{ return (((_arg1 > 0)) ? _arg1 : -(_arg1)); } public static function b2AbsV(_arg1:b2Vec2):b2Vec2{ var _local2:b2Vec2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y)); return (_local2); } public static function b2AbsM(_arg1:b2Mat22):b2Mat22{ var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2)); return (_local2); } public static function b2Min(_arg1:Number, _arg2:Number):Number{ return (((_arg1 < _arg2)) ? _arg1 : _arg2); } 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 b2Max(_arg1:Number, _arg2:Number):Number{ return (((_arg1 > _arg2)) ? _arg1 : _arg2); } 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 b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{ return (b2Max(_arg2, b2Min(_arg1, _arg3))); } public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{ return (b2MaxV(_arg2, b2MinV(_arg1, _arg3))); } public static function b2Swap(_arg1:Array, _arg2:Array):void{ var _local3:* = _arg1[0]; _arg1[0] = _arg2[0]; _arg2[0] = _local3; } public static function b2Random():Number{ return (((Math.random() * 2) - 1)); } public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{ var _local3:Number = Math.random(); _local3 = (((_arg2 - _arg1) * _local3) + _arg1); 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 b2IsPowerOfTwo(_arg1:uint):Boolean{ var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0))); return (_local2); } } }//package Box2D.Common.Math
Section 35
//b2Sweep (Box2D.Common.Math.b2Sweep) package Box2D.Common.Math { public class b2Sweep { public var localCenter:b2Vec2; public var c0:b2Vec2; public var c:b2Vec2; public var a0:Number; public var a:Number; public var t0:Number; public function b2Sweep(){ this.localCenter = new b2Vec2(); this.c0 = new b2Vec2(); this.c = new b2Vec2(); super(); } public function GetXForm(_arg1:b2XForm, _arg2:Number):void{ var _local4:Number; var _local5:Number; if ((1 - this.t0) > Number.MIN_VALUE){ _local4 = ((_arg2 - this.t0) / (1 - this.t0)); _arg1.position.x = (((1 - _local4) * this.c0.x) + (_local4 * this.c.x)); _arg1.position.y = (((1 - _local4) * this.c0.y) + (_local4 * this.c.y)); _local5 = (((1 - _local4) * this.a0) + (_local4 * this.a)); _arg1.R.Set(_local5); } else { _arg1.position.SetV(this.c); _arg1.R.Set(this.a); }; var _local3:b2Mat22 = _arg1.R; _arg1.position.x = (_arg1.position.x - ((_local3.col1.x * this.localCenter.x) + (_local3.col2.x * this.localCenter.y))); _arg1.position.y = (_arg1.position.y - ((_local3.col1.y * this.localCenter.x) + (_local3.col2.y * this.localCenter.y))); } public function Advance(_arg1:Number):void{ var _local2:Number; if ((((this.t0 < _arg1)) && (((1 - this.t0) > Number.MIN_VALUE)))){ _local2 = ((_arg1 - this.t0) / (1 - this.t0)); this.c0.x = (((1 - _local2) * this.c0.x) + (_local2 * this.c.x)); this.c0.y = (((1 - _local2) * this.c0.y) + (_local2 * this.c.y)); this.a0 = (((1 - _local2) * this.a0) + (_local2 * this.a)); this.t0 = _arg1; }; } } }//package Box2D.Common.Math
Section 36
//b2Vec2 (Box2D.Common.Math.b2Vec2) package Box2D.Common.Math { public class b2Vec2 { public var x:Number; public var y:Number; public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{ this.x = _arg1; this.y = _arg2; } public function SetZero():void{ this.x = 0; this.y = 0; } public function Set(_arg1:Number=0, _arg2:Number=0):void{ this.x = _arg1; this.y = _arg2; } public function SetV(_arg1:b2Vec2):void{ this.x = _arg1.x; this.y = _arg1.y; } public function Negative():b2Vec2{ return (new b2Vec2(-(this.x), -(this.y))); } public function Copy():b2Vec2{ return (new b2Vec2(this.x, this.y)); } public function Add(_arg1:b2Vec2):void{ this.x = (this.x + _arg1.x); this.y = (this.y + _arg1.y); } public function Subtract(_arg1:b2Vec2):void{ this.x = (this.x - _arg1.x); this.y = (this.y - _arg1.y); } public function Multiply(_arg1:Number):void{ this.x = (this.x * _arg1); this.y = (this.y * _arg1); } public function MulM(_arg1:b2Mat22):void{ var _local2:Number = this.x; this.x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * this.y)); this.y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * this.y)); } public function MulTM(_arg1:b2Mat22):void{ var _local2:Number = b2Math.b2Dot(this, _arg1.col1); this.y = b2Math.b2Dot(this, _arg1.col2); this.x = _local2; } public function CrossVF(_arg1:Number):void{ var _local2:Number = this.x; this.x = (_arg1 * this.y); this.y = (-(_arg1) * _local2); } public function CrossFV(_arg1:Number):void{ var _local2:Number = this.x; this.x = (-(_arg1) * this.y); this.y = (_arg1 * _local2); } public function MinV(_arg1:b2Vec2):void{ this.x = ((this.x < _arg1.x)) ? this.x : _arg1.x; this.y = ((this.y < _arg1.y)) ? this.y : _arg1.y; } public function MaxV(_arg1:b2Vec2):void{ this.x = ((this.x > _arg1.x)) ? this.x : _arg1.x; this.y = ((this.y > _arg1.y)) ? this.y : _arg1.y; } public function Abs():void{ if (this.x < 0){ this.x = -(this.x); }; if (this.y < 0){ this.y = -(this.y); }; } public function Length():Number{ return (Math.sqrt(((this.x * this.x) + (this.y * this.y)))); } public function LengthSquared():Number{ return (((this.x * this.x) + (this.y * this.y))); } public function Normalize():Number{ var _local1:Number = Math.sqrt(((this.x * this.x) + (this.y * this.y))); if (_local1 < Number.MIN_VALUE){ return (0); }; var _local2:Number = (1 / _local1); this.x = (this.x * _local2); this.y = (this.y * _local2); return (_local1); } public function IsValid():Boolean{ return (((b2Math.b2IsValid(this.x)) && (b2Math.b2IsValid(this.y)))); } public static function Make(_arg1:Number, _arg2:Number):b2Vec2{ return (new b2Vec2(_arg1, _arg2)); } } }//package Box2D.Common.Math
Section 37
//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{ this.position = new b2Vec2(); this.R = new b2Mat22(); super(); if (_arg1){ this.position.SetV(_arg1); this.R.SetM(_arg2); }; } public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{ this.position.SetV(_arg1); this.R.SetM(_arg2); } public function SetIdentity():void{ this.position.SetZero(); this.R.SetIdentity(); } public function Set(_arg1:b2XForm):void{ this.position.SetV(_arg1.position); this.R.SetM(_arg1.R); } } }//package Box2D.Common.Math
Section 38
//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){ this._r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); this._g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); this._b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{ this._r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); this._g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); this._b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function set r(_arg1:Number):void{ this._r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function set g(_arg1:Number):void{ this._g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function set b(_arg1:Number):void{ this._b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function get color():uint{ return (((this._r | (this._g << 8)) | (this._b << 16))); } } }//package Box2D.Common
Section 39
//b2Settings (Box2D.Common.b2Settings) package Box2D.Common { import Box2D.Common.Math.*; public class b2Settings { public static const USHRT_MAX:int = 0xFFFF; public static const b2_pi:Number = 3.14159265358979; public static const b2_maxManifoldPoints:int = 2; public static const b2_maxPolygonVertices:int = 8; public static const b2_maxProxies:int = 0x0200; public static const b2_maxPairs:int = 4096; public static const b2_linearSlop:Number = 0.005; public static const b2_angularSlop:Number = 0.0349065850398866; public static const b2_toiSlop:Number = 0.04; public static const b2_maxTOIContactsPerIsland:int = 32; public static const b2_velocityThreshold:Number = 1; public static const b2_maxLinearCorrection:Number = 0.2; public static const b2_maxAngularCorrection:Number = 0.139626340159546; public static const b2_maxLinearVelocity:Number = 200; public static const b2_maxLinearVelocitySquared:Number = 40000; public static const b2_maxAngularVelocity:Number = 250; public static const b2_maxAngularVelocitySquared:Number = 62500; public static const b2_contactBaumgarte:Number = 0.2; public static const b2_timeToSleep:Number = 0.5; public static const b2_linearSleepTolerance:Number = 0.01; public static const b2_angularSleepTolerance:Number = 0.0111111111111111; public static function b2Assert(_arg1:Boolean):void{ var _local2:b2Vec2; if (!_arg1){ _local2.x++; }; } } }//package Box2D.Common
Section 40
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2CircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){ this.m_manifolds = [new b2Manifold()]; this.m0 = new b2Manifold(); super(_arg1, _arg2); this.m_manifold = this.m_manifolds[0]; this.m_manifold.pointCount = 0; var _local3:b2ManifoldPoint = this.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; this.m0.Set(this.m_manifold); b2Collision.b2CollideCircles(this.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 (this.m_manifold.pointCount > 0){ m_manifoldCount = 1; _local8 = this.m_manifold.points[0]; if (this.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(this.m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Add(_local7); }; } else { _local4 = this.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(this.m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Persist(_local7); }; }; } else { m_manifoldCount = 0; if ((((this.m0.pointCount > 0)) && (_arg1))){ _local4 = this.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(this.m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; }; } override public function GetManifolds():Array{ return (this.m_manifolds); } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2CircleContact(_arg1, _arg2)); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } } }//package Box2D.Dynamics.Contacts
Section 41
//b2Contact (Box2D.Dynamics.Contacts.b2Contact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2Contact { public var m_flags:uint; public var m_prev:b2Contact; public var m_next:b2Contact; public var m_node1:b2ContactEdge; public var m_node2:b2ContactEdge; public var m_shape1:b2Shape; public var m_shape2:b2Shape; public var m_manifoldCount:int; public var m_friction:Number; public var m_restitution:Number; public var m_toi:Number; public static var e_nonSolidFlag:uint = 1; public static var e_slowFlag:uint = 2; public static var e_islandFlag:uint = 4; public static var e_toiFlag:uint = 8; public static var s_registers:Array; public static var s_initialized:Boolean = false; public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){ this.m_node1 = new b2ContactEdge(); this.m_node2 = new b2ContactEdge(); super(); this.m_flags = 0; if (((!(_arg1)) || (!(_arg2)))){ this.m_shape1 = null; this.m_shape2 = null; return; }; if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){ this.m_flags = (this.m_flags | e_nonSolidFlag); }; this.m_shape1 = _arg1; this.m_shape2 = _arg2; this.m_manifoldCount = 0; this.m_friction = Math.sqrt((this.m_shape1.m_friction * this.m_shape2.m_friction)); this.m_restitution = b2Math.b2Max(this.m_shape1.m_restitution, this.m_shape2.m_restitution); this.m_prev = null; this.m_next = null; this.m_node1.contact = null; this.m_node1.prev = null; this.m_node1.next = null; this.m_node1.other = null; this.m_node2.contact = null; this.m_node2.prev = null; this.m_node2.next = null; this.m_node2.other = null; } public function GetManifolds():Array{ return (null); } public function GetManifoldCount():int{ return (this.m_manifoldCount); } public function IsSolid():Boolean{ return (((this.m_flags & e_nonSolidFlag) == 0)); } public function GetNext():b2Contact{ return (this.m_next); } public function GetShape1():b2Shape{ return (this.m_shape1); } public function GetShape2():b2Shape{ return (this.m_shape2); } public function Update(_arg1:b2ContactListener):void{ var _local2:int = this.m_manifoldCount; this.Evaluate(_arg1); var _local3:int = this.m_manifoldCount; var _local4:b2Body = this.m_shape1.m_body; var _local5:b2Body = this.m_shape2.m_body; if ((((_local3 == 0)) && ((_local2 > 0)))){ _local4.WakeUp(); _local5.WakeUp(); }; if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){ this.m_flags = (this.m_flags & ~(e_slowFlag)); } else { this.m_flags = (this.m_flags | e_slowFlag); }; } public function Evaluate(_arg1:b2ContactListener):void{ } 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 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 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); } 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); } } }//package Box2D.Dynamics.Contacts
Section 42
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactConstraint { public var points:Array; public var normal:b2Vec2; public var manifold:b2Manifold; public var body1:b2Body; public var body2:b2Body; public var friction:Number; public var restitution:Number; public var pointCount:int; public function b2ContactConstraint(){ this.normal = new b2Vec2(); super(); this.points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { this.points[_local1] = new b2ContactConstraintPoint(); _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 43
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; public class b2ContactConstraintPoint { public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var r1:b2Vec2; public var r2:b2Vec2; public var normalImpulse:Number; public var tangentImpulse:Number; public var positionImpulse:Number; public var normalMass:Number; public var tangentMass:Number; public var equalizedMass:Number; public var separation:Number; public var velocityBias:Number; public function b2ContactConstraintPoint(){ this.localAnchor1 = new b2Vec2(); this.localAnchor2 = new b2Vec2(); this.r1 = new b2Vec2(); this.r2 = new b2Vec2(); super(); } } }//package Box2D.Dynamics.Contacts
Section 44
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2ContactEdge { public var other:b2Body; public var contact:b2Contact; public var prev:b2ContactEdge; public var next:b2ContactEdge; } }//package Box2D.Dynamics.Contacts
Section 45
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister) package Box2D.Dynamics.Contacts { public class b2ContactRegister { public var createFcn:Function; public var destroyFcn:Function; public var primary:Boolean; } }//package Box2D.Dynamics.Contacts
Section 46
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; public class b2ContactResult { public var shape1:b2Shape; public var shape2:b2Shape; public var position:b2Vec2; public var normal:b2Vec2; public var normalImpulse:Number; public var tangentImpulse:Number; public var id:b2ContactID; public function b2ContactResult(){ this.position = new b2Vec2(); this.normal = new b2Vec2(); this.id = new b2ContactID(); super(); } } }//package Box2D.Dynamics.Contacts
Section 47
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactSolver { public var m_step:b2TimeStep; public var m_allocator; public var m_constraints:Array; public var m_constraintCount:int; 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; this.m_step = new b2TimeStep(); this.m_constraints = new Array(); super(); this.m_step.dt = _arg1.dt; this.m_step.inv_dt = _arg1.inv_dt; this.m_step.maxIterations = _arg1.maxIterations; this.m_allocator = _arg4; this.m_constraintCount = 0; _local6 = 0; while (_local6 < _arg3) { _local5 = _arg2[_local6]; this.m_constraintCount = (this.m_constraintCount + _local5.m_manifoldCount); _local6++; }; _local6 = 0; while (_local6 < this.m_constraintCount) { this.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 = this.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 < this.m_constraintCount) { _local6 = this.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 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 < this.m_constraintCount) { _local20 = this.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 < this.m_constraintCount) { _local2 = this.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++; }; } 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 < this.m_constraintCount) { _local6 = this.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))); } } }//package Box2D.Dynamics.Contacts
Section 48
//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 49
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolyAndCircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){ this.m_manifolds = [new b2Manifold()]; this.m0 = new b2Manifold(); super(_arg1, _arg2); this.m_manifold = this.m_manifolds[0]; b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape)); b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape)); this.m_manifold.pointCount = 0; var _local3:b2ManifoldPoint = this.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; this.m0.Set(this.m_manifold); b2Collision.b2CollidePolygonAndCircle(this.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 (this.m_manifold.pointCount > 0){ _local2 = 0; while (_local2 < this.m_manifold.pointCount) { _local10 = this.m_manifold.points[_local2]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < this.m0.pointCount) { if (_local8[_local13] == true){ } else { _local5 = this.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(this.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(this.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 < this.m0.pointCount) { if (_local8[_local2]){ } else { _local5 = this.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(this.m0.normal); _local9.separation = _local5.separation; _local9.id.key = _local5.id._key; _arg1.Remove(_local9); }; _local2++; }; } override public function GetManifolds():Array{ return (this.m_manifolds); } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolyAndCircleContact(_arg1, _arg2)); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } } }//package Box2D.Dynamics.Contacts
Section 50
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolygonContact extends b2Contact { private var m0:b2Manifold; private var m_manifolds:Array; public var m_manifold:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{ this.m0 = new b2Manifold(); this.m_manifolds = [new b2Manifold()]; super(_arg1, _arg2); this.m_manifold = this.m_manifolds[0]; this.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; this.m0.Set(this.m_manifold); b2Collision.b2CollidePolygons(this.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 (this.m_manifold.pointCount > 0){ _local8 = 0; while (_local8 < this.m_manifold.pointCount) { _local10 = this.m_manifold.points[_local8]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < this.m0.pointCount) { if (_local9[_local13] == true){ } else { _local4 = this.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(this.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(this.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 < this.m0.pointCount) { if (_local9[_local8]){ } else { _local4 = this.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(this.m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; _local8++; }; } override public function GetManifolds():Array{ return (this.m_manifolds); } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolygonContact(_arg1, _arg2)); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } } }//package Box2D.Dynamics.Contacts
Section 51
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2DistanceJoint extends b2Joint { public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_u:b2Vec2; public var m_frequencyHz:Number; public var m_dampingRatio:Number; public var m_gamma:Number; public var m_bias:Number; public var m_impulse:Number; public var m_mass:Number; public var m_length:Number; public function b2DistanceJoint(_arg1:b2DistanceJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; this.m_localAnchor1 = new b2Vec2(); this.m_localAnchor2 = new b2Vec2(); this.m_u = new b2Vec2(); super(_arg1); this.m_localAnchor1.SetV(_arg1.localAnchor1); this.m_localAnchor2.SetV(_arg1.localAnchor2); this.m_length = _arg1.length; this.m_frequencyHz = _arg1.frequencyHz; this.m_dampingRatio = _arg1.dampingRatio; this.m_impulse = 0; this.m_gamma = 0; this.m_bias = 0; m_inv_dt = 0; } 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 = (this.m_localAnchor1.x - _local4.m_sweep.localCenter.x); var _local7:Number = (this.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 = (this.m_localAnchor2.x - _local5.m_sweep.localCenter.x); var _local9:Number = (this.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; this.m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6); this.m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7); var _local10:Number = Math.sqrt(((this.m_u.x * this.m_u.x) + (this.m_u.y * this.m_u.y))); if (_local10 > b2Settings.b2_linearSlop){ this.m_u.Multiply((1 / _local10)); } else { this.m_u.SetZero(); }; var _local11:Number = ((_local6 * this.m_u.y) - (_local7 * this.m_u.x)); var _local12:Number = ((_local8 * this.m_u.y) - (_local9 * this.m_u.x)); var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12)); this.m_mass = (1 / _local13); if (this.m_frequencyHz > 0){ _local14 = (_local10 - this.m_length); _local15 = ((2 * Math.PI) * this.m_frequencyHz); _local16 = (((2 * this.m_mass) * this.m_dampingRatio) * _local15); _local17 = ((this.m_mass * _local15) * _local15); this.m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17)))); this.m_bias = (((_local14 * _arg1.dt) * _local17) * this.m_gamma); this.m_mass = (1 / (_local13 + this.m_gamma)); }; if (_arg1.warmStarting){ this.m_impulse = (this.m_impulse * _arg1.dtRatio); _local18 = (this.m_impulse * this.m_u.x); _local19 = (this.m_impulse * this.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 { this.m_impulse = 0; }; } 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 = (this.m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local6:Number = (this.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 = (this.m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local9:Number = (this.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 = ((this.m_u.x * (_local12 - _local10)) + (this.m_u.y * (_local13 - _local11))); var _local15:Number = (-(this.m_mass) * ((_local14 + this.m_bias) + (this.m_gamma * this.m_impulse))); this.m_impulse = (this.m_impulse + _local15); var _local16:Number = (_local15 * this.m_u.x); var _local17:Number = (_local15 * this.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)))); } override public function SolvePositionConstraints():Boolean{ var _local1:b2Mat22; if (this.m_frequencyHz > 0){ return (true); }; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local1 = _local2.m_xf.R; var _local4:Number = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local5:Number = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local8:Number = (this.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 - this.m_length); _local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local13:Number = (-(this.m_mass) * _local12); this.m_u.Set(_local9, _local10); var _local14:Number = (_local13 * this.m_u.x); var _local15:Number = (_local13 * this.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 GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(this.m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(this.m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2(); _local1.SetV(this.m_u); _local1.Multiply((m_inv_dt * this.m_impulse)); return (_local1); } override public function GetReactionTorque():Number{ return (0); } } }//package Box2D.Dynamics.Joints
Section 52
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2DistanceJointDef extends b2JointDef { public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var length:Number; public var frequencyHz:Number; public var dampingRatio:Number; public function b2DistanceJointDef(){ this.localAnchor1 = new b2Vec2(); this.localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_distanceJoint; this.length = 1; this.frequencyHz = 0; this.dampingRatio = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; this.localAnchor1.SetV(body1.GetLocalPoint(_arg3)); this.localAnchor2.SetV(body2.GetLocalPoint(_arg4)); var _local5:Number = (_arg4.x - _arg3.x); var _local6:Number = (_arg4.y - _arg3.y); this.length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6))); this.frequencyHz = 0; this.dampingRatio = 0; } } }//package Box2D.Dynamics.Joints
Section 53
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2GearJoint extends b2Joint { public var m_ground1:b2Body; public var m_ground2:b2Body; public var m_revolute1:b2RevoluteJoint; public var m_prismatic1:b2PrismaticJoint; public var m_revolute2:b2RevoluteJoint; public var m_prismatic2:b2PrismaticJoint; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_J:b2Jacobian; public var m_constant:Number; public var m_ratio:Number; public var m_mass:Number; public var m_force:Number; public function b2GearJoint(_arg1:b2GearJointDef){ var _local4:Number; var _local5:Number; this.m_groundAnchor1 = new b2Vec2(); this.m_groundAnchor2 = new b2Vec2(); this.m_localAnchor1 = new b2Vec2(); this.m_localAnchor2 = new b2Vec2(); this.m_J = new b2Jacobian(); super(_arg1); var _local2:int = _arg1.joint1.m_type; var _local3:int = _arg1.joint2.m_type; this.m_revolute1 = null; this.m_prismatic1 = null; this.m_revolute2 = null; this.m_prismatic2 = null; this.m_ground1 = _arg1.joint1.m_body1; m_body1 = _arg1.joint1.m_body2; if (_local2 == b2Joint.e_revoluteJoint){ this.m_revolute1 = (_arg1.joint1 as b2RevoluteJoint); this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1); this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2); _local4 = this.m_revolute1.GetJointAngle(); } else { this.m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint); this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1); this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2); _local4 = this.m_prismatic1.GetJointTranslation(); }; this.m_ground2 = _arg1.joint2.m_body1; m_body2 = _arg1.joint2.m_body2; if (_local3 == b2Joint.e_revoluteJoint){ this.m_revolute2 = (_arg1.joint2 as b2RevoluteJoint); this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1); this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2); _local5 = this.m_revolute2.GetJointAngle(); } else { this.m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint); this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1); this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2); _local5 = this.m_prismatic2.GetJointTranslation(); }; this.m_ratio = _arg1.ratio; this.m_constant = (_local4 + (this.m_ratio * _local5)); this.m_force = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(this.m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(this.m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2((this.m_force * this.m_J.linear2.x), (this.m_force * this.m_J.linear2.y)); return (_local1); } override public function GetReactionTorque():Number{ var _local1:b2Mat22 = m_body2.m_xf.R; var _local2:Number = (this.m_localAnchor1.x - m_body2.m_sweep.localCenter.x); var _local3:Number = (this.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 = ((this.m_force * this.m_J.angular2) - ((_local2 * (this.m_force * this.m_J.linear2.y)) - (_local3 * (this.m_force * this.m_J.linear2.x)))); return (_local4); } public function GetRatio():Number{ return (this.m_ratio); } 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 = this.m_ground1; var _local3:b2Body = this.m_ground2; var _local4:b2Body = m_body1; var _local5:b2Body = m_body2; var _local14:Number = 0; this.m_J.SetZero(); if (this.m_revolute1){ this.m_J.angular1 = -1; _local14 = (_local14 + _local4.m_invI); } else { _local10 = _local2.m_xf.R; _local11 = this.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 = (this.m_localAnchor1.x - _local4.m_sweep.localCenter.x); _local9 = (this.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)); this.m_J.linear1.Set(-(_local6), -(_local7)); this.m_J.angular1 = -(_local12); _local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12))); }; if (this.m_revolute2){ this.m_J.angular2 = -(this.m_ratio); _local14 = (_local14 + ((this.m_ratio * this.m_ratio) * _local5.m_invI)); } else { _local10 = _local3.m_xf.R; _local11 = this.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 = (this.m_localAnchor2.x - _local5.m_sweep.localCenter.x); _local9 = (this.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)); this.m_J.linear2.Set((-(this.m_ratio) * _local6), (-(this.m_ratio) * _local7)); this.m_J.angular2 = (-(this.m_ratio) * _local12); _local14 = (_local14 + ((this.m_ratio * this.m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12)))); }; this.m_mass = (1 / _local14); if (_arg1.warmStarting){ _local15 = (_arg1.dt * this.m_force); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * this.m_J.linear1.x)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * this.m_J.linear1.y)); _local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * this.m_J.angular1)); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * this.m_J.linear2.x)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * this.m_J.linear2.y)); _local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * this.m_J.angular2)); } else { this.m_force = 0; }; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; var _local4:Number = this.m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local5:Number = ((-(_arg1.inv_dt) * this.m_mass) * _local4); this.m_force = (this.m_force + _local5); var _local6:Number = (_arg1.dt * _local5); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * this.m_J.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * this.m_J.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * this.m_J.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * this.m_J.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * this.m_J.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * this.m_J.angular2)); } 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 (this.m_revolute1){ _local4 = this.m_revolute1.GetJointAngle(); } else { _local4 = this.m_prismatic1.GetJointTranslation(); }; if (this.m_revolute2){ _local5 = this.m_revolute2.GetJointAngle(); } else { _local5 = this.m_prismatic2.GetJointTranslation(); }; var _local6:Number = (this.m_constant - (_local4 + (this.m_ratio * _local5))); var _local7:Number = (-(this.m_mass) * _local6); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * this.m_J.linear1.x)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * this.m_J.linear1.y)); _local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * this.m_J.angular1)); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * this.m_J.linear2.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * this.m_J.linear2.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * this.m_J.angular2)); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((_local1 < b2Settings.b2_linearSlop)); } } }//package Box2D.Dynamics.Joints
Section 54
//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; this.joint1 = null; this.joint2 = null; this.ratio = 1; } } }//package Box2D.Dynamics.Joints
Section 55
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2Jacobian { public var linear1:b2Vec2; public var angular1:Number; public var linear2:b2Vec2; public var angular2:Number; public function b2Jacobian(){ this.linear1 = new b2Vec2(); this.linear2 = new b2Vec2(); super(); } public function SetZero():void{ this.linear1.SetZero(); this.angular1 = 0; this.linear2.SetZero(); this.angular2 = 0; } public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{ this.linear1.SetV(_arg1); this.angular1 = _arg2; this.linear2.SetV(_arg3); this.angular2 = _arg4; } public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{ return ((((((this.linear1.x * _arg1.x) + (this.linear1.y * _arg1.y)) + (this.angular1 * _arg2)) + ((this.linear2.x * _arg3.x) + (this.linear2.y * _arg3.y))) + (this.angular2 * _arg4))); } } }//package Box2D.Dynamics.Joints
Section 56
//b2Joint (Box2D.Dynamics.Joints.b2Joint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2Joint { public var m_type:int; public var m_prev:b2Joint; public var m_next:b2Joint; public var m_node1:b2JointEdge; public var m_node2:b2JointEdge; public var m_body1:b2Body; public var m_body2:b2Body; public var m_inv_dt:Number; public var m_islandFlag:Boolean; public var m_collideConnected:Boolean; public var m_userData; public static const e_unknownJoint:int = 0; public static const e_revoluteJoint:int = 1; public static const e_prismaticJoint:int = 2; public static const e_distanceJoint:int = 3; public static const e_pulleyJoint:int = 4; public static const e_mouseJoint:int = 5; public static const e_gearJoint:int = 6; public static const e_inactiveLimit:int = 0; public static const e_atLowerLimit:int = 1; public static const e_atUpperLimit:int = 2; public static const e_equalLimits:int = 3; public function b2Joint(_arg1:b2JointDef){ this.m_node1 = new b2JointEdge(); this.m_node2 = new b2JointEdge(); super(); this.m_type = _arg1.type; this.m_prev = null; this.m_next = null; this.m_body1 = _arg1.body1; this.m_body2 = _arg1.body2; this.m_collideConnected = _arg1.collideConnected; this.m_islandFlag = false; this.m_userData = _arg1.userData; } public function GetType():int{ return (this.m_type); } public function GetAnchor1():b2Vec2{ return (null); } public function GetAnchor2():b2Vec2{ return (null); } public function GetReactionForce():b2Vec2{ return (null); } public function GetReactionTorque():Number{ return (0); } public function GetBody1():b2Body{ return (this.m_body1); } public function GetBody2():b2Body{ return (this.m_body2); } public function GetNext():b2Joint{ return (this.m_next); } public function GetUserData(){ return (this.m_userData); } public function SetUserData(_arg1):void{ this.m_userData = _arg1; } public function InitVelocityConstraints(_arg1:b2TimeStep):void{ } public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ } public function InitPositionConstraints():void{ } public function SolvePositionConstraints():Boolean{ return (false); } 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); } public static function Destroy(_arg1:b2Joint, _arg2):void{ } } }//package Box2D.Dynamics.Joints
Section 57
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointDef { public var type:int; public var userData; public var body1:b2Body; public var body2:b2Body; public var collideConnected:Boolean; public function b2JointDef(){ this.type = b2Joint.e_unknownJoint; this.userData = null; this.body1 = null; this.body2 = null; this.collideConnected = false; } } }//package Box2D.Dynamics.Joints
Section 58
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointEdge { public var other:b2Body; public var joint:b2Joint; public var prev:b2JointEdge; public var next:b2JointEdge; } }//package Box2D.Dynamics.Joints
Section 59
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2MouseJoint extends b2Joint { private var K:b2Mat22; private var K1:b2Mat22; private var K2:b2Mat22; public var m_localAnchor:b2Vec2; public var m_target:b2Vec2; public var m_impulse:b2Vec2; public var m_mass:b2Mat22; public var m_C:b2Vec2; public var m_maxForce:Number; public var m_beta:Number; public var m_gamma:Number; public function b2MouseJoint(_arg1:b2MouseJointDef){ var _local3:Number; this.K = new b2Mat22(); this.K1 = new b2Mat22(); this.K2 = new b2Mat22(); this.m_localAnchor = new b2Vec2(); this.m_target = new b2Vec2(); this.m_impulse = new b2Vec2(); this.m_mass = new b2Mat22(); this.m_C = new b2Vec2(); super(_arg1); this.m_target.SetV(_arg1.target); var _local2:Number = (this.m_target.x - m_body2.m_xf.position.x); _local3 = (this.m_target.y - m_body2.m_xf.position.y); var _local4:b2Mat22 = m_body2.m_xf.R; this.m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y)); this.m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y)); this.m_maxForce = _arg1.maxForce; this.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)); this.m_gamma = (1 / (_local7 + _local8)); this.m_beta = (_local8 / (_local7 + _local8)); } override public function GetAnchor1():b2Vec2{ return (this.m_target); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(this.m_localAnchor)); } override public function GetReactionForce():b2Vec2{ return (this.m_impulse); } override public function GetReactionTorque():Number{ return (0); } public function SetTarget(_arg1:b2Vec2):void{ if (m_body2.IsSleeping()){ m_body2.WakeUp(); }; this.m_target = _arg1; } 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 = (this.m_localAnchor.x - _local2.m_sweep.localCenter.x); _local5 = (this.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; this.K1.col1.x = _local7; this.K1.col2.x = 0; this.K1.col1.y = 0; this.K1.col2.y = _local7; this.K2.col1.x = ((_local8 * _local5) * _local5); this.K2.col2.x = ((-(_local8) * _local4) * _local5); this.K2.col1.y = ((-(_local8) * _local4) * _local5); this.K2.col2.y = ((_local8 * _local4) * _local4); this.K.SetM(this.K1); this.K.AddM(this.K2); this.K.col1.x = (this.K.col1.x + this.m_gamma); this.K.col2.y = (this.K.col2.y + this.m_gamma); this.K.Invert(this.m_mass); this.m_C.x = ((_local2.m_sweep.c.x + _local4) - this.m_target.x); this.m_C.y = ((_local2.m_sweep.c.y + _local5) - this.m_target.y); _local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98); var _local9:Number = (_arg1.dt * this.m_impulse.x); var _local10:Number = (_arg1.dt * this.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 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 = (this.m_localAnchor.x - _local2.m_sweep.localCenter.x); var _local7:Number = (this.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 = this.m_mass; _local4 = ((_local8 + ((this.m_beta * _arg1.inv_dt) * this.m_C.x)) + ((this.m_gamma * _arg1.dt) * this.m_impulse.x)); _local5 = ((_local9 + ((this.m_beta * _arg1.inv_dt) * this.m_C.y)) + ((this.m_gamma * _arg1.dt) * this.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 = this.m_impulse.x; var _local13:Number = this.m_impulse.y; this.m_impulse.x = (this.m_impulse.x + _local10); this.m_impulse.y = (this.m_impulse.y + _local11); var _local14:Number = this.m_impulse.Length(); if (_local14 > this.m_maxForce){ this.m_impulse.Multiply((this.m_maxForce / _local14)); }; _local10 = (this.m_impulse.x - _local12); _local11 = (this.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)))); } override public function SolvePositionConstraints():Boolean{ return (true); } } }//package Box2D.Dynamics.Joints
Section 60
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2MouseJointDef extends b2JointDef { public var target:b2Vec2; public var maxForce:Number; public var frequencyHz:Number; public var dampingRatio:Number; public var timeStep:Number; public function b2MouseJointDef(){ this.target = new b2Vec2(); super(); type = b2Joint.e_mouseJoint; this.maxForce = 0; this.frequencyHz = 5; this.dampingRatio = 0.7; this.timeStep = (1 / 60); } } }//package Box2D.Dynamics.Joints
Section 61
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PrismaticJoint extends b2Joint { public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_localXAxis1:b2Vec2; public var m_localYAxis1:b2Vec2; public var m_refAngle:Number; public var m_linearJacobian:b2Jacobian; public var m_linearMass:Number; public var m_force:Number; public var m_angularMass:Number; public var m_torque:Number; public var m_motorJacobian:b2Jacobian; public var m_motorMass:Number; public var m_motorForce:Number; public var m_limitForce:Number; public var m_limitPositionImpulse:Number; public var m_lowerTranslation:Number; public var m_upperTranslation:Number; public var m_maxMotorForce:Number; public var m_motorSpeed:Number; public var m_enableLimit:Boolean; public var m_enableMotor:Boolean; public var m_limitState:int; public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; this.m_localAnchor1 = new b2Vec2(); this.m_localAnchor2 = new b2Vec2(); this.m_localXAxis1 = new b2Vec2(); this.m_localYAxis1 = new b2Vec2(); this.m_linearJacobian = new b2Jacobian(); this.m_motorJacobian = new b2Jacobian(); super(_arg1); this.m_localAnchor1.SetV(_arg1.localAnchor1); this.m_localAnchor2.SetV(_arg1.localAnchor2); this.m_localXAxis1.SetV(_arg1.localAxis1); this.m_localYAxis1.x = -(this.m_localXAxis1.y); this.m_localYAxis1.y = this.m_localXAxis1.x; this.m_refAngle = _arg1.referenceAngle; this.m_linearJacobian.SetZero(); this.m_linearMass = 0; this.m_force = 0; this.m_angularMass = 0; this.m_torque = 0; this.m_motorJacobian.SetZero(); this.m_motorMass = 0; this.m_motorForce = 0; this.m_limitForce = 0; this.m_limitPositionImpulse = 0; this.m_lowerTranslation = _arg1.lowerTranslation; this.m_upperTranslation = _arg1.upperTranslation; this.m_maxMotorForce = _arg1.maxMotorForce; this.m_motorSpeed = _arg1.motorSpeed; this.m_enableLimit = _arg1.enableLimit; this.m_enableMotor = _arg1.enableMotor; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(this.m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(this.m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Mat22 = m_body1.m_xf.R; var _local2:Number = (this.m_limitForce * ((_local1.col1.x * this.m_localXAxis1.x) + (_local1.col2.x * this.m_localXAxis1.y))); var _local3:Number = (this.m_limitForce * ((_local1.col1.y * this.m_localXAxis1.x) + (_local1.col2.y * this.m_localXAxis1.y))); var _local4:Number = (this.m_force * ((_local1.col1.x * this.m_localYAxis1.x) + (_local1.col2.x * this.m_localYAxis1.y))); var _local5:Number = (this.m_force * ((_local1.col1.y * this.m_localYAxis1.x) + (_local1.col2.y * this.m_localYAxis1.y))); return (new b2Vec2(((this.m_limitForce * _local2) + (this.m_force * _local4)), ((this.m_limitForce * _local3) + (this.m_force * _local5)))); } override public function GetReactionTorque():Number{ return (this.m_torque); } public function GetJointTranslation():Number{ var _local3:b2Mat22; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; var _local4:b2Vec2 = _local1.GetWorldPoint(this.m_localAnchor1); var _local5:b2Vec2 = _local2.GetWorldPoint(this.m_localAnchor2); var _local6:Number = (_local5.x - _local4.x); var _local7:Number = (_local5.y - _local4.y); var _local8:b2Vec2 = _local1.GetWorldVector(this.m_localXAxis1); var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7)); return (_local9); } 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 = (this.m_localAnchor1.x - _local1.m_sweep.localCenter.x); var _local5:Number = (this.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 = (this.m_localAnchor2.x - _local2.m_sweep.localCenter.x); var _local8:Number = (this.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(this.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); } public function IsLimitEnabled():Boolean{ return (this.m_enableLimit); } public function EnableLimit(_arg1:Boolean):void{ this.m_enableLimit = _arg1; } public function GetLowerLimit():Number{ return (this.m_lowerTranslation); } public function GetUpperLimit():Number{ return (this.m_upperTranslation); } public function SetLimits(_arg1:Number, _arg2:Number):void{ this.m_lowerTranslation = _arg1; this.m_upperTranslation = _arg2; } public function IsMotorEnabled():Boolean{ return (this.m_enableMotor); } public function EnableMotor(_arg1:Boolean):void{ this.m_enableMotor = _arg1; } public function SetMotorSpeed(_arg1:Number):void{ this.m_motorSpeed = _arg1; } public function GetMotorSpeed():Number{ return (this.m_motorSpeed); } public function SetMaxMotorForce(_arg1:Number):void{ this.m_maxMotorForce = _arg1; } public function GetMotorForce():Number{ return (this.m_motorForce); } 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 = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local7:Number = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (this.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 * this.m_localYAxis1.x) + (_local4.col2.x * this.m_localYAxis1.y)); var _local15:Number = ((_local4.col1.y * this.m_localYAxis1.x) + (_local4.col2.y * this.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); this.m_linearJacobian.linear1.x = -(_local14); this.m_linearJacobian.linear1.y = -(_local15); this.m_linearJacobian.linear2.x = _local14; this.m_linearJacobian.linear2.y = _local15; this.m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14))); this.m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14)); this.m_linearMass = (((_local10 + ((_local12 * this.m_linearJacobian.angular1) * this.m_linearJacobian.angular1)) + _local11) + ((_local13 * this.m_linearJacobian.angular2) * this.m_linearJacobian.angular2)); this.m_linearMass = (1 / this.m_linearMass); this.m_angularMass = (_local12 + _local13); if (this.m_angularMass > Number.MIN_VALUE){ this.m_angularMass = (1 / this.m_angularMass); }; if (((this.m_enableLimit) || (this.m_enableMotor))){ _local4 = _local2.m_xf.R; _local18 = ((_local4.col1.x * this.m_localXAxis1.x) + (_local4.col2.x * this.m_localXAxis1.y)); _local19 = ((_local4.col1.y * this.m_localXAxis1.x) + (_local4.col2.y * this.m_localXAxis1.y)); this.m_motorJacobian.linear1.x = -(_local18); this.m_motorJacobian.linear1.y = -(_local19); this.m_motorJacobian.linear2.x = _local18; this.m_motorJacobian.linear2.y = _local19; this.m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18))); this.m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18)); this.m_motorMass = (((_local10 + ((_local12 * this.m_motorJacobian.angular1) * this.m_motorJacobian.angular1)) + _local11) + ((_local13 * this.m_motorJacobian.angular2) * this.m_motorJacobian.angular2)); this.m_motorMass = (1 / this.m_motorMass); if (this.m_enableLimit){ _local20 = (_local16 - _local6); _local21 = (_local17 - _local7); _local22 = ((_local18 * _local20) + (_local19 * _local21)); if (b2Math.b2Abs((this.m_upperTranslation - this.m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){ this.m_limitState = e_equalLimits; } else { if (_local22 <= this.m_lowerTranslation){ if (this.m_limitState != e_atLowerLimit){ this.m_limitForce = 0; }; this.m_limitState = e_atLowerLimit; } else { if (_local22 >= this.m_upperTranslation){ if (this.m_limitState != e_atUpperLimit){ this.m_limitForce = 0; }; this.m_limitState = e_atUpperLimit; } else { this.m_limitState = e_inactiveLimit; this.m_limitForce = 0; }; }; }; }; }; if (this.m_enableMotor == false){ this.m_motorForce = 0; }; if (this.m_enableLimit == false){ this.m_limitForce = 0; }; if (_arg1.warmStarting){ _local23 = (_arg1.dt * ((this.m_force * this.m_linearJacobian.linear1.x) + ((this.m_motorForce + this.m_limitForce) * this.m_motorJacobian.linear1.x))); _local24 = (_arg1.dt * ((this.m_force * this.m_linearJacobian.linear1.y) + ((this.m_motorForce + this.m_limitForce) * this.m_motorJacobian.linear1.y))); _local25 = (_arg1.dt * ((this.m_force * this.m_linearJacobian.linear2.x) + ((this.m_motorForce + this.m_limitForce) * this.m_motorJacobian.linear2.x))); _local26 = (_arg1.dt * ((this.m_force * this.m_linearJacobian.linear2.y) + ((this.m_motorForce + this.m_limitForce) * this.m_motorJacobian.linear2.y))); _local27 = (_arg1.dt * (((this.m_force * this.m_linearJacobian.angular1) - this.m_torque) + ((this.m_motorForce + this.m_limitForce) * this.m_motorJacobian.angular1))); _local28 = (_arg1.dt * (((this.m_force * this.m_linearJacobian.angular2) + this.m_torque) + ((this.m_motorForce + this.m_limitForce) * this.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 { this.m_force = 0; this.m_torque = 0; this.m_limitForce = 0; this.m_motorForce = 0; }; this.m_limitPositionImpulse = 0; } 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 = this.m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local10:Number = ((-(_arg1.inv_dt) * this.m_linearMass) * _local9); this.m_force = (this.m_force + _local10); var _local11:Number = (_arg1.dt * _local10); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * this.m_linearJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * this.m_linearJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * this.m_linearJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * this.m_linearJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * this.m_linearJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * this.m_linearJacobian.angular2)); var _local12:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity); var _local13:Number = ((-(_arg1.inv_dt) * this.m_angularMass) * _local12); this.m_torque = (this.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 (((this.m_enableMotor) && (!((this.m_limitState == e_equalLimits))))){ _local15 = (this.m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - this.m_motorSpeed); _local16 = ((-(_arg1.inv_dt) * this.m_motorMass) * _local15); _local17 = this.m_motorForce; this.m_motorForce = b2Math.b2Clamp((this.m_motorForce + _local16), -(this.m_maxMotorForce), this.m_maxMotorForce); _local16 = (this.m_motorForce - _local17); _local11 = (_arg1.dt * _local16); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * this.m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * this.m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * this.m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * this.m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * this.m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * this.m_motorJacobian.angular2)); }; if (((this.m_enableLimit) && (!((this.m_limitState == e_inactiveLimit))))){ _local18 = this.m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local19 = ((-(_arg1.inv_dt) * this.m_motorMass) * _local18); if (this.m_limitState == e_equalLimits){ this.m_limitForce = (this.m_limitForce + _local19); } else { if (this.m_limitState == e_atLowerLimit){ _local8 = this.m_limitForce; this.m_limitForce = b2Math.b2Max((this.m_limitForce + _local19), 0); _local19 = (this.m_limitForce - _local8); } else { if (this.m_limitState == e_atUpperLimit){ _local8 = this.m_limitForce; this.m_limitForce = b2Math.b2Min((this.m_limitForce + _local19), 0); _local19 = (this.m_limitForce - _local8); }; }; }; _local11 = (_arg1.dt * _local19); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * this.m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * this.m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * this.m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * this.m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * this.m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * this.m_motorJacobian.angular2)); }; } 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 = (this.m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local12:Number = (this.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 = (this.m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local14:Number = (this.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 * this.m_localYAxis1.x) + (_local9.col2.x * this.m_localYAxis1.y)); var _local22:Number = ((_local9.col1.y * this.m_localYAxis1.x) + (_local9.col2.y * this.m_localYAxis1.y)); var _local23:Number = ((_local21 * _local19) + (_local22 * _local20)); _local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local24:Number = (-(this.m_linearMass) * _local23); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * this.m_linearJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * this.m_linearJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * this.m_linearJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * this.m_linearJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * this.m_linearJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * this.m_linearJacobian.angular2)); var _local25:Number = b2Math.b2Abs(_local23); var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - this.m_refAngle); _local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); var _local27:Number = (-(this.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 (((this.m_enableLimit) && (!((this.m_limitState == e_inactiveLimit))))){ _local9 = _local3.m_xf.R; _local11 = (this.m_localAnchor1.x - _local3.m_sweep.localCenter.x); _local12 = (this.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 = (this.m_localAnchor2.x - _local4.m_sweep.localCenter.x); _local14 = (this.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 * this.m_localXAxis1.x) + (_local9.col2.x * this.m_localXAxis1.y)); _local30 = ((_local9.col1.y * this.m_localXAxis1.x) + (_local9.col2.y * this.m_localXAxis1.y)); _local31 = ((_local29 * _local19) + (_local30 * _local20)); _local32 = 0; if (this.m_limitState == e_equalLimits){ _local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local32 = (-(this.m_motorMass) * _local1); _local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26)); } else { if (this.m_limitState == e_atLowerLimit){ _local1 = (_local31 - this.m_lowerTranslation); _local25 = b2Math.b2Max(_local25, -(_local1)); _local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local32 = (-(this.m_motorMass) * _local1); _local2 = this.m_limitPositionImpulse; this.m_limitPositionImpulse = b2Math.b2Max((this.m_limitPositionImpulse + _local32), 0); _local32 = (this.m_limitPositionImpulse - _local2); } else { if (this.m_limitState == e_atUpperLimit){ _local1 = (_local31 - this.m_upperTranslation); _local25 = b2Math.b2Max(_local25, _local1); _local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection); _local32 = (-(this.m_motorMass) * _local1); _local2 = this.m_limitPositionImpulse; this.m_limitPositionImpulse = b2Math.b2Min((this.m_limitPositionImpulse + _local32), 0); _local32 = (this.m_limitPositionImpulse - _local2); }; }; }; _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * this.m_motorJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * this.m_motorJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * this.m_motorJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * this.m_motorJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * this.m_motorJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * this.m_motorJacobian.angular2)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop)))); } } }//package Box2D.Dynamics.Joints
Section 62
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2PrismaticJointDef extends b2JointDef { public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var localAxis1:b2Vec2; public var referenceAngle:Number; public var enableLimit:Boolean; public var lowerTranslation:Number; public var upperTranslation:Number; public var enableMotor:Boolean; public var maxMotorForce:Number; public var motorSpeed:Number; public function b2PrismaticJointDef(){ this.localAnchor1 = new b2Vec2(); this.localAnchor2 = new b2Vec2(); this.localAxis1 = new b2Vec2(); super(); type = b2Joint.e_prismaticJoint; this.localAxis1.Set(1, 0); this.referenceAngle = 0; this.enableLimit = false; this.lowerTranslation = 0; this.upperTranslation = 0; this.enableMotor = false; this.maxMotorForce = 0; this.motorSpeed = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; this.localAnchor1 = body1.GetLocalPoint(_arg3); this.localAnchor2 = body2.GetLocalPoint(_arg3); this.localAxis1 = body1.GetLocalVector(_arg4); this.referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 63
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PulleyJoint extends b2Joint { public var m_ground:b2Body; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_u1:b2Vec2; public var m_u2:b2Vec2; public var m_constant:Number; public var m_ratio:Number; public var m_maxLength1:Number; public var m_maxLength2:Number; public var m_pulleyMass:Number; public var m_limitMass1:Number; public var m_limitMass2:Number; public var m_force:Number; public var m_limitForce1:Number; public var m_limitForce2:Number; public var m_positionImpulse:Number; public var m_limitPositionImpulse1:Number; public var m_limitPositionImpulse2:Number; public var m_state:int; public var m_limitState1:int; public var m_limitState2:int; public static const b2_minPulleyLength:Number = 2; public function b2PulleyJoint(_arg1:b2PulleyJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; this.m_groundAnchor1 = new b2Vec2(); this.m_groundAnchor2 = new b2Vec2(); this.m_localAnchor1 = new b2Vec2(); this.m_localAnchor2 = new b2Vec2(); this.m_u1 = new b2Vec2(); this.m_u2 = new b2Vec2(); super(_arg1); this.m_ground = m_body1.m_world.m_groundBody; this.m_groundAnchor1.x = (_arg1.groundAnchor1.x - this.m_ground.m_xf.position.x); this.m_groundAnchor1.y = (_arg1.groundAnchor1.y - this.m_ground.m_xf.position.y); this.m_groundAnchor2.x = (_arg1.groundAnchor2.x - this.m_ground.m_xf.position.x); this.m_groundAnchor2.y = (_arg1.groundAnchor2.y - this.m_ground.m_xf.position.y); this.m_localAnchor1.SetV(_arg1.localAnchor1); this.m_localAnchor2.SetV(_arg1.localAnchor2); this.m_ratio = _arg1.ratio; this.m_constant = (_arg1.length1 + (this.m_ratio * _arg1.length2)); this.m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (this.m_constant - (this.m_ratio * b2_minPulleyLength))); this.m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((this.m_constant - b2_minPulleyLength) / this.m_ratio)); this.m_force = 0; this.m_limitForce1 = 0; this.m_limitForce2 = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(this.m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(this.m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = this.m_u2.Copy(); _local1.Multiply(this.m_force); return (_local1); } override public function GetReactionTorque():Number{ return (0); } public function GetGroundAnchor1():b2Vec2{ var _local1:b2Vec2 = this.m_ground.m_xf.position.Copy(); _local1.Add(this.m_groundAnchor1); return (_local1); } public function GetGroundAnchor2():b2Vec2{ var _local1:b2Vec2 = this.m_ground.m_xf.position.Copy(); _local1.Add(this.m_groundAnchor2); return (_local1); } public function GetLength1():Number{ var _local1:b2Vec2 = m_body1.GetWorldPoint(this.m_localAnchor1); var _local2:Number = (this.m_ground.m_xf.position.x + this.m_groundAnchor1.x); var _local3:Number = (this.m_ground.m_xf.position.y + this.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(this.m_localAnchor2); var _local2:Number = (this.m_ground.m_xf.position.x + this.m_groundAnchor2.x); var _local3:Number = (this.m_ground.m_xf.position.y + this.m_groundAnchor2.y); var _local4:Number = (_local1.x - _local2); var _local5:Number = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetRatio():Number{ return (this.m_ratio); } 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 = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local6:Number = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (this.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 = (this.m_ground.m_xf.position.x + this.m_groundAnchor1.x); var _local15:Number = (this.m_ground.m_xf.position.y + this.m_groundAnchor1.y); var _local16:Number = (this.m_ground.m_xf.position.x + this.m_groundAnchor2.x); var _local17:Number = (this.m_ground.m_xf.position.y + this.m_groundAnchor2.y); this.m_u1.Set((_local10 - _local14), (_local11 - _local15)); this.m_u2.Set((_local12 - _local16), (_local13 - _local17)); var _local18:Number = this.m_u1.Length(); var _local19:Number = this.m_u2.Length(); if (_local18 > b2Settings.b2_linearSlop){ this.m_u1.Multiply((1 / _local18)); } else { this.m_u1.SetZero(); }; if (_local19 > b2Settings.b2_linearSlop){ this.m_u2.Multiply((1 / _local19)); } else { this.m_u2.SetZero(); }; var _local20:Number = ((this.m_constant - _local18) - (this.m_ratio * _local19)); if (_local20 > 0){ this.m_state = e_inactiveLimit; this.m_force = 0; } else { this.m_state = e_atUpperLimit; this.m_positionImpulse = 0; }; if (_local18 < this.m_maxLength1){ this.m_limitState1 = e_inactiveLimit; this.m_limitForce1 = 0; } else { this.m_limitState1 = e_atUpperLimit; this.m_limitPositionImpulse1 = 0; }; if (_local19 < this.m_maxLength2){ this.m_limitState2 = e_inactiveLimit; this.m_limitForce2 = 0; } else { this.m_limitState2 = e_atUpperLimit; this.m_limitPositionImpulse2 = 0; }; var _local21:Number = ((_local5 * this.m_u1.y) - (_local6 * this.m_u1.x)); var _local22:Number = ((_local8 * this.m_u2.y) - (_local9 * this.m_u2.x)); this.m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21)); this.m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22)); this.m_pulleyMass = (this.m_limitMass1 + ((this.m_ratio * this.m_ratio) * this.m_limitMass2)); this.m_limitMass1 = (1 / this.m_limitMass1); this.m_limitMass2 = (1 / this.m_limitMass2); this.m_pulleyMass = (1 / this.m_pulleyMass); if (_arg1.warmStarting){ _local23 = ((_arg1.dt * (-(this.m_force) - this.m_limitForce1)) * this.m_u1.x); _local24 = ((_arg1.dt * (-(this.m_force) - this.m_limitForce1)) * this.m_u1.y); _local25 = ((_arg1.dt * ((-(this.m_ratio) * this.m_force) - this.m_limitForce2)) * this.m_u2.x); _local26 = ((_arg1.dt * ((-(this.m_ratio) * this.m_force) - this.m_limitForce2)) * this.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 { this.m_force = 0; this.m_limitForce1 = 0; this.m_limitForce2 = 0; }; } 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 = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local6:Number = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (this.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 (this.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 = (-(((this.m_u1.x * _local10) + (this.m_u1.y * _local11))) - (this.m_ratio * ((this.m_u2.x * _local12) + (this.m_u2.y * _local13)))); _local19 = ((-(_arg1.inv_dt) * this.m_pulleyMass) * _local18); _local20 = this.m_force; this.m_force = b2Math.b2Max(0, (this.m_force + _local19)); _local19 = (this.m_force - _local20); _local14 = ((-(_arg1.dt) * _local19) * this.m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * this.m_u1.y); _local16 = (((-(_arg1.dt) * this.m_ratio) * _local19) * this.m_u2.x); _local17 = (((-(_arg1.dt) * this.m_ratio) * _local19) * this.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 (this.m_limitState1 == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local18 = -(((this.m_u1.x * _local10) + (this.m_u1.y * _local11))); _local19 = ((-(_arg1.inv_dt) * this.m_limitMass1) * _local18); _local20 = this.m_limitForce1; this.m_limitForce1 = b2Math.b2Max(0, (this.m_limitForce1 + _local19)); _local19 = (this.m_limitForce1 - _local20); _local14 = ((-(_arg1.dt) * _local19) * this.m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * this.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 (this.m_limitState2 == e_atUpperLimit){ _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = -(((this.m_u2.x * _local12) + (this.m_u2.y * _local13))); _local19 = ((-(_arg1.inv_dt) * this.m_limitMass2) * _local18); _local20 = this.m_limitForce2; this.m_limitForce2 = b2Math.b2Max(0, (this.m_limitForce2 + _local19)); _local19 = (this.m_limitForce2 - _local20); _local16 = ((-(_arg1.dt) * _local19) * this.m_u2.x); _local17 = ((-(_arg1.dt) * _local19) * this.m_u2.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; } override public function 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 = (this.m_ground.m_xf.position.x + this.m_groundAnchor1.x); var _local5:Number = (this.m_ground.m_xf.position.y + this.m_groundAnchor1.y); var _local6:Number = (this.m_ground.m_xf.position.x + this.m_groundAnchor2.x); var _local7:Number = (this.m_ground.m_xf.position.y + this.m_groundAnchor2.y); var _local23:Number = 0; if (this.m_state == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (this.m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (this.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 = (this.m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (this.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); this.m_u1.Set((_local12 - _local4), (_local13 - _local5)); this.m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local16 = this.m_u1.Length(); _local17 = this.m_u2.Length(); if (_local16 > b2Settings.b2_linearSlop){ this.m_u1.Multiply((1 / _local16)); } else { this.m_u1.SetZero(); }; if (_local17 > b2Settings.b2_linearSlop){ this.m_u2.Multiply((1 / _local17)); } else { this.m_u2.SetZero(); }; _local18 = ((this.m_constant - _local16) - (this.m_ratio * _local17)); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(this.m_pulleyMass) * _local18); _local20 = this.m_positionImpulse; this.m_positionImpulse = b2Math.b2Max(0, (this.m_positionImpulse + _local19)); _local19 = (this.m_positionImpulse - _local20); _local12 = (-(_local19) * this.m_u1.x); _local13 = (-(_local19) * this.m_u1.y); _local14 = ((-(this.m_ratio) * _local19) * this.m_u2.x); _local15 = ((-(this.m_ratio) * _local19) * this.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 (this.m_limitState1 == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (this.m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (this.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); this.m_u1.Set((_local12 - _local4), (_local13 - _local5)); _local16 = this.m_u1.Length(); if (_local16 > b2Settings.b2_linearSlop){ this.m_u1.x = (this.m_u1.x * (1 / _local16)); this.m_u1.y = (this.m_u1.y * (1 / _local16)); } else { this.m_u1.SetZero(); }; _local18 = (this.m_maxLength1 - _local16); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(this.m_limitMass1) * _local18); _local21 = this.m_limitPositionImpulse1; this.m_limitPositionImpulse1 = b2Math.b2Max(0, (this.m_limitPositionImpulse1 + _local19)); _local19 = (this.m_limitPositionImpulse1 - _local21); _local12 = (-(_local19) * this.m_u1.x); _local13 = (-(_local19) * this.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 (this.m_limitState2 == e_atUpperLimit){ _local3 = _local2.m_xf.R; _local10 = (this.m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (this.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); this.m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local17 = this.m_u2.Length(); if (_local17 > b2Settings.b2_linearSlop){ this.m_u2.x = (this.m_u2.x * (1 / _local17)); this.m_u2.y = (this.m_u2.y * (1 / _local17)); } else { this.m_u2.SetZero(); }; _local18 = (this.m_maxLength2 - _local17); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(this.m_limitMass2) * _local18); _local21 = this.m_limitPositionImpulse2; this.m_limitPositionImpulse2 = b2Math.b2Max(0, (this.m_limitPositionImpulse2 + _local19)); _local19 = (this.m_limitPositionImpulse2 - _local21); _local14 = (-(_local19) * this.m_u2.x); _local15 = (-(_local19) * this.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)); } } }//package Box2D.Dynamics.Joints
Section 64
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2PulleyJointDef extends b2JointDef { public var groundAnchor1:b2Vec2; public var groundAnchor2:b2Vec2; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var length1:Number; public var maxLength1:Number; public var length2:Number; public var maxLength2:Number; public var ratio:Number; public function b2PulleyJointDef(){ this.groundAnchor1 = new b2Vec2(); this.groundAnchor2 = new b2Vec2(); this.localAnchor1 = new b2Vec2(); this.localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_pulleyJoint; this.groundAnchor1.Set(-1, 1); this.groundAnchor2.Set(1, 1); this.localAnchor1.Set(-1, 0); this.localAnchor2.Set(1, 0); this.length1 = 0; this.maxLength1 = 0; this.length2 = 0; this.maxLength2 = 0; this.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; this.groundAnchor1.SetV(_arg3); this.groundAnchor2.SetV(_arg4); this.localAnchor1 = body1.GetLocalPoint(_arg5); this.localAnchor2 = body2.GetLocalPoint(_arg6); var _local8:Number = (_arg5.x - _arg3.x); var _local9:Number = (_arg5.y - _arg3.y); this.length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); var _local10:Number = (_arg6.x - _arg4.x); var _local11:Number = (_arg6.y - _arg4.y); this.length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); this.ratio = _arg7; var _local12:Number = (this.length1 + (this.ratio * this.length2)); this.maxLength1 = (_local12 - (this.ratio * b2PulleyJoint.b2_minPulleyLength)); this.maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / this.ratio); } } }//package Box2D.Dynamics.Joints
Section 65
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2RevoluteJoint extends b2Joint { private var K:b2Mat22; private var K1:b2Mat22; private var K2:b2Mat22; private var K3:b2Mat22; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_pivotForce:b2Vec2; public var m_motorForce:Number; public var m_limitForce:Number; public var m_limitPositionImpulse:Number; public var m_pivotMass:b2Mat22; public var m_motorMass:Number; public var m_enableMotor:Boolean; public var m_maxMotorTorque:Number; public var m_motorSpeed:Number; public var m_enableLimit:Boolean; public var m_referenceAngle:Number; public var m_lowerAngle:Number; public var m_upperAngle:Number; public var m_limitState:int; public static var tImpulse:b2Vec2 = new b2Vec2(); public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){ this.K = new b2Mat22(); this.K1 = new b2Mat22(); this.K2 = new b2Mat22(); this.K3 = new b2Mat22(); this.m_localAnchor1 = new b2Vec2(); this.m_localAnchor2 = new b2Vec2(); this.m_pivotForce = new b2Vec2(); this.m_pivotMass = new b2Mat22(); super(_arg1); this.m_localAnchor1.SetV(_arg1.localAnchor1); this.m_localAnchor2.SetV(_arg1.localAnchor2); this.m_referenceAngle = _arg1.referenceAngle; this.m_pivotForce.Set(0, 0); this.m_motorForce = 0; this.m_limitForce = 0; this.m_limitPositionImpulse = 0; this.m_lowerAngle = _arg1.lowerAngle; this.m_upperAngle = _arg1.upperAngle; this.m_maxMotorTorque = _arg1.maxMotorTorque; this.m_motorSpeed = _arg1.motorSpeed; this.m_enableLimit = _arg1.enableLimit; this.m_enableMotor = _arg1.enableMotor; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(this.m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(this.m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ return (this.m_pivotForce); } override public function GetReactionTorque():Number{ return (this.m_limitForce); } public function GetJointAngle():Number{ return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - this.m_referenceAngle)); } public function GetJointSpeed():Number{ return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity)); } public function IsLimitEnabled():Boolean{ return (this.m_enableLimit); } public function EnableLimit(_arg1:Boolean):void{ this.m_enableLimit = _arg1; } public function GetLowerLimit():Number{ return (this.m_lowerAngle); } public function GetUpperLimit():Number{ return (this.m_upperAngle); } public function SetLimits(_arg1:Number, _arg2:Number):void{ this.m_lowerAngle = _arg1; this.m_upperAngle = _arg2; } public function IsMotorEnabled():Boolean{ return (this.m_enableMotor); } public function EnableMotor(_arg1:Boolean):void{ this.m_enableMotor = _arg1; } public function SetMotorSpeed(_arg1:Number):void{ this.m_motorSpeed = _arg1; } public function GetMotorSpeed():Number{ return (this.m_motorSpeed); } public function SetMaxMotorTorque(_arg1:Number):void{ this.m_maxMotorTorque = _arg1; } public function GetMotorTorque():Number{ return (this.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 = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x); _local7 = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (this.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; this.K1.col1.x = (_local10 + _local11); this.K1.col2.x = 0; this.K1.col1.y = 0; this.K1.col2.y = (_local10 + _local11); this.K2.col1.x = ((_local12 * _local7) * _local7); this.K2.col2.x = ((-(_local12) * _local6) * _local7); this.K2.col1.y = ((-(_local12) * _local6) * _local7); this.K2.col2.y = ((_local12 * _local6) * _local6); this.K3.col1.x = ((_local13 * _local9) * _local9); this.K3.col2.x = ((-(_local13) * _local8) * _local9); this.K3.col1.y = ((-(_local13) * _local8) * _local9); this.K3.col2.y = ((_local13 * _local8) * _local8); this.K.SetM(this.K1); this.K.AddM(this.K2); this.K.AddM(this.K3); this.K.Invert(this.m_pivotMass); this.m_motorMass = (1 / (_local12 + _local13)); if (this.m_enableMotor == false){ this.m_motorForce = 0; }; if (this.m_enableLimit){ _local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - this.m_referenceAngle); if (b2Math.b2Abs((this.m_upperAngle - this.m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){ this.m_limitState = e_equalLimits; } else { if (_local14 <= this.m_lowerAngle){ if (this.m_limitState != e_atLowerLimit){ this.m_limitForce = 0; }; this.m_limitState = e_atLowerLimit; } else { if (_local14 >= this.m_upperAngle){ if (this.m_limitState != e_atUpperLimit){ this.m_limitForce = 0; }; this.m_limitState = e_atUpperLimit; } else { this.m_limitState = e_inactiveLimit; this.m_limitForce = 0; }; }; }; } else { this.m_limitForce = 0; }; if (_arg1.warmStarting){ _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * this.m_pivotForce.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * this.m_pivotForce.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * this.m_pivotForce.y) - (_local7 * this.m_pivotForce.x)) + this.m_motorForce) + this.m_limitForce))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * this.m_pivotForce.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * this.m_pivotForce.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * this.m_pivotForce.y) - (_local9 * this.m_pivotForce.x)) + this.m_motorForce) + this.m_limitForce))); } else { this.m_pivotForce.SetZero(); this.m_motorForce = 0; this.m_limitForce = 0; }; this.m_limitPositionImpulse = 0; } 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 = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local7:Number = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (this.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) * ((this.m_pivotMass.col1.x * _local11) + (this.m_pivotMass.col2.x * _local12))); var _local14:Number = (-(_arg1.inv_dt) * ((this.m_pivotMass.col1.y * _local11) + (this.m_pivotMass.col2.y * _local12))); this.m_pivotForce.x = (this.m_pivotForce.x + _local13); this.m_pivotForce.y = (this.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 (((this.m_enableMotor) && (!((this.m_limitState == e_equalLimits))))){ _local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - this.m_motorSpeed); _local18 = ((-(_arg1.inv_dt) * this.m_motorMass) * _local17); _local19 = this.m_motorForce; this.m_motorForce = b2Math.b2Clamp((this.m_motorForce + _local18), -(this.m_maxMotorTorque), this.m_maxMotorTorque); _local18 = (this.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 (((this.m_enableLimit) && (!((this.m_limitState == e_inactiveLimit))))){ _local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity); _local21 = ((-(_arg1.inv_dt) * this.m_motorMass) * _local20); if (this.m_limitState == e_equalLimits){ this.m_limitForce = (this.m_limitForce + _local21); } else { if (this.m_limitState == e_atLowerLimit){ _local10 = this.m_limitForce; this.m_limitForce = b2Math.b2Max((this.m_limitForce + _local21), 0); _local21 = (this.m_limitForce - _local10); } else { if (this.m_limitState == e_atUpperLimit){ _local10 = this.m_limitForce; this.m_limitForce = b2Math.b2Min((this.m_limitForce + _local21), 0); _local21 = (this.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 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 = (this.m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local8:Number = (this.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 = (this.m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local11:Number = (this.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; this.K1.col1.x = (_local18 + _local19); this.K1.col2.x = 0; this.K1.col1.y = 0; this.K1.col2.y = (_local18 + _local19); this.K2.col1.x = ((_local20 * _local8) * _local8); this.K2.col2.x = ((-(_local20) * _local7) * _local8); this.K2.col1.y = ((-(_local20) * _local7) * _local8); this.K2.col2.y = ((_local20 * _local7) * _local7); this.K3.col1.x = ((_local21 * _local11) * _local11); this.K3.col2.x = ((-(_local21) * _local10) * _local11); this.K3.col1.y = ((-(_local21) * _local10) * _local11); this.K3.col2.y = ((_local21 * _local10) * _local10); this.K.SetM(this.K1); this.K.AddM(this.K2); this.K.AddM(this.K3); this.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 (((this.m_enableLimit) && (!((this.m_limitState == e_inactiveLimit))))){ _local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - this.m_referenceAngle); _local26 = 0; if (this.m_limitState == e_equalLimits){ _local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); _local26 = (-(this.m_motorMass) * _local2); _local24 = b2Math.b2Abs(_local2); } else { if (this.m_limitState == e_atLowerLimit){ _local2 = (_local25 - this.m_lowerAngle); _local24 = b2Math.b2Max(0, -(_local2)); _local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0); _local26 = (-(this.m_motorMass) * _local2); _local1 = this.m_limitPositionImpulse; this.m_limitPositionImpulse = b2Math.b2Max((this.m_limitPositionImpulse + _local26), 0); _local26 = (this.m_limitPositionImpulse - _local1); } else { if (this.m_limitState == e_atUpperLimit){ _local2 = (_local25 - this.m_upperAngle); _local24 = b2Math.b2Max(0, _local2); _local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection); _local26 = (-(this.m_motorMass) * _local2); _local1 = this.m_limitPositionImpulse; this.m_limitPositionImpulse = b2Math.b2Min((this.m_limitPositionImpulse + _local26), 0); _local26 = (this.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)))); } } }//package Box2D.Dynamics.Joints
Section 66
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2RevoluteJointDef extends b2JointDef { public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var referenceAngle:Number; public var enableLimit:Boolean; public var lowerAngle:Number; public var upperAngle:Number; public var enableMotor:Boolean; public var motorSpeed:Number; public var maxMotorTorque:Number; public function b2RevoluteJointDef(){ this.localAnchor1 = new b2Vec2(); this.localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_revoluteJoint; this.localAnchor1.Set(0, 0); this.localAnchor2.Set(0, 0); this.referenceAngle = 0; this.lowerAngle = 0; this.upperAngle = 0; this.maxMotorTorque = 0; this.motorSpeed = 0; this.enableLimit = false; this.enableMotor = false; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{ body1 = _arg1; body2 = _arg2; this.localAnchor1 = body1.GetLocalPoint(_arg3); this.localAnchor2 = body2.GetLocalPoint(_arg3); this.referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 67
//b2Body (Box2D.Dynamics.b2Body) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.Contacts.*; public class b2Body { public var m_flags:uint; public var m_type:int; public var m_xf:b2XForm; public var m_sweep:b2Sweep; public var m_linearVelocity:b2Vec2; public var m_angularVelocity:Number; public var m_force:b2Vec2; public var m_torque:Number; public var m_world:b2World; public var m_prev:b2Body; public var m_next:b2Body; public var m_shapeList:b2Shape; public var m_shapeCount:int; public var m_jointList:b2JointEdge; public var m_contactList:b2ContactEdge; public var m_mass:Number; public var m_invMass:Number; public var m_I:Number; public var m_invI:Number; public var m_linearDamping:Number; public var m_angularDamping:Number; public var m_sleepTime:Number; public var m_userData; private static var s_massData:b2MassData = new b2MassData(); private static var s_xf1:b2XForm = new b2XForm(); public static var e_frozenFlag:uint = 2; public static var e_islandFlag:uint = 4; public static var e_sleepFlag:uint = 8; public static var e_allowSleepFlag:uint = 16; public static var e_bulletFlag:uint = 32; public static var e_fixedRotationFlag:uint = 64; public static var e_staticType:uint = 1; public static var e_dynamicType:uint = 2; public static var e_maxTypes:uint = 3; public function b2Body(_arg1:b2BodyDef, _arg2:b2World){ this.m_xf = new b2XForm(); this.m_sweep = new b2Sweep(); this.m_linearVelocity = new b2Vec2(); this.m_force = new b2Vec2(); super(); this.m_flags = 0; if (_arg1.isBullet){ this.m_flags = (this.m_flags | e_bulletFlag); }; if (_arg1.fixedRotation){ this.m_flags = (this.m_flags | e_fixedRotationFlag); }; if (_arg1.allowSleep){ this.m_flags = (this.m_flags | e_allowSleepFlag); }; if (_arg1.isSleeping){ this.m_flags = (this.m_flags | e_sleepFlag); }; this.m_world = _arg2; this.m_xf.position.SetV(_arg1.position); this.m_xf.R.Set(_arg1.angle); this.m_sweep.localCenter.SetV(_arg1.massData.center); this.m_sweep.t0 = 1; this.m_sweep.a0 = (this.m_sweep.a = _arg1.angle); var _local3:b2Mat22 = this.m_xf.R; var _local4:b2Vec2 = this.m_sweep.localCenter; this.m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); this.m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); this.m_sweep.c.x = (this.m_sweep.c.x + this.m_xf.position.x); this.m_sweep.c.y = (this.m_sweep.c.y + this.m_xf.position.y); this.m_sweep.c0.SetV(this.m_sweep.c); this.m_jointList = null; this.m_contactList = null; this.m_prev = null; this.m_next = null; this.m_linearDamping = _arg1.linearDamping; this.m_angularDamping = _arg1.angularDamping; this.m_force.Set(0, 0); this.m_torque = 0; this.m_linearVelocity.SetZero(); this.m_angularVelocity = 0; this.m_sleepTime = 0; this.m_invMass = 0; this.m_I = 0; this.m_invI = 0; this.m_mass = _arg1.massData.mass; if (this.m_mass > 0){ this.m_invMass = (1 / this.m_mass); }; if ((this.m_flags & b2Body.e_fixedRotationFlag) == 0){ this.m_I = _arg1.massData.I; }; if (this.m_I > 0){ this.m_invI = (1 / this.m_I); }; if ((((this.m_invMass == 0)) && ((this.m_invI == 0)))){ this.m_type = e_staticType; } else { this.m_type = e_dynamicType; }; this.m_userData = _arg1.userData; this.m_shapeList = null; this.m_shapeCount = 0; } public function CreateShape(_arg1:b2ShapeDef):b2Shape{ var _local2:b2Shape; if (this.m_world.m_lock == true){ return (null); }; _local2 = b2Shape.Create(_arg1, this.m_world.m_blockAllocator); _local2.m_next = this.m_shapeList; this.m_shapeList = _local2; this.m_shapeCount++; _local2.m_body = this; _local2.CreateProxy(this.m_world.m_broadPhase, this.m_xf); _local2.UpdateSweepRadius(this.m_sweep.localCenter); return (_local2); } public function DestroyShape(_arg1:b2Shape):void{ if (this.m_world.m_lock == true){ return; }; _arg1.DestroyProxy(this.m_world.m_broadPhase); var _local2:b2Shape = this.m_shapeList; var _local3:b2Shape; var _local4:Boolean; while (_local2 != null) { if (_local2 == _arg1){ if (_local3){ _local3.m_next = _arg1.m_next; } else { this.m_shapeList = _arg1.m_next; }; _local4 = true; break; }; _local3 = _local2; _local2 = _local2.m_next; }; _arg1.m_body = null; _arg1.m_next = null; this.m_shapeCount--; b2Shape.Destroy(_arg1, this.m_world.m_blockAllocator); } public function SetMass(_arg1:b2MassData):void{ var _local2:b2Shape; if (this.m_world.m_lock == true){ return; }; this.m_invMass = 0; this.m_I = 0; this.m_invI = 0; this.m_mass = _arg1.mass; if (this.m_mass > 0){ this.m_invMass = (1 / this.m_mass); }; if ((this.m_flags & b2Body.e_fixedRotationFlag) == 0){ this.m_I = _arg1.I; }; if (this.m_I > 0){ this.m_invI = (1 / this.m_I); }; this.m_sweep.localCenter.SetV(_arg1.center); var _local3:b2Mat22 = this.m_xf.R; var _local4:b2Vec2 = this.m_sweep.localCenter; this.m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); this.m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); this.m_sweep.c.x = (this.m_sweep.c.x + this.m_xf.position.x); this.m_sweep.c.y = (this.m_sweep.c.y + this.m_xf.position.y); this.m_sweep.c0.SetV(this.m_sweep.c); _local2 = this.m_shapeList; while (_local2) { _local2.UpdateSweepRadius(this.m_sweep.localCenter); _local2 = _local2.m_next; }; var _local5:int = this.m_type; if ((((this.m_invMass == 0)) && ((this.m_invI == 0)))){ this.m_type = e_staticType; } else { this.m_type = e_dynamicType; }; if (_local5 != this.m_type){ _local2 = this.m_shapeList; while (_local2) { _local2.RefilterProxy(this.m_world.m_broadPhase, this.m_xf); _local2 = _local2.m_next; }; }; } public function SetMassFromShapes():void{ var _local1:b2Shape; if (this.m_world.m_lock == true){ return; }; this.m_mass = 0; this.m_invMass = 0; this.m_I = 0; this.m_invI = 0; var _local2:Number = 0; var _local3:Number = 0; var _local4:b2MassData = s_massData; _local1 = this.m_shapeList; while (_local1) { _local1.ComputeMass(_local4); this.m_mass = (this.m_mass + _local4.mass); _local2 = (_local2 + (_local4.mass * _local4.center.x)); _local3 = (_local3 + (_local4.mass * _local4.center.y)); this.m_I = (this.m_I + _local4.I); _local1 = _local1.m_next; }; if (this.m_mass > 0){ this.m_invMass = (1 / this.m_mass); _local2 = (_local2 * this.m_invMass); _local3 = (_local3 * this.m_invMass); }; if ((((this.m_I > 0)) && (((this.m_flags & e_fixedRotationFlag) == 0)))){ this.m_I = (this.m_I - (this.m_mass * ((_local2 * _local2) + (_local3 * _local3)))); this.m_invI = (1 / this.m_I); } else { this.m_I = 0; this.m_invI = 0; }; this.m_sweep.localCenter.Set(_local2, _local3); var _local5:b2Mat22 = this.m_xf.R; var _local6:b2Vec2 = this.m_sweep.localCenter; this.m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)); this.m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)); this.m_sweep.c.x = (this.m_sweep.c.x + this.m_xf.position.x); this.m_sweep.c.y = (this.m_sweep.c.y + this.m_xf.position.y); this.m_sweep.c0.SetV(this.m_sweep.c); _local1 = this.m_shapeList; while (_local1) { _local1.UpdateSweepRadius(this.m_sweep.localCenter); _local1 = _local1.m_next; }; var _local7:int = this.m_type; if ((((this.m_invMass == 0)) && ((this.m_invI == 0)))){ this.m_type = e_staticType; } else { this.m_type = e_dynamicType; }; if (_local7 != this.m_type){ _local1 = this.m_shapeList; while (_local1) { _local1.RefilterProxy(this.m_world.m_broadPhase, this.m_xf); _local1 = _local1.m_next; }; }; } public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{ var _local3:b2Shape; var _local7:Boolean; if (this.m_world.m_lock == true){ return (true); }; if (this.IsFrozen()){ return (false); }; this.m_xf.R.Set(_arg2); this.m_xf.position.SetV(_arg1); var _local4:b2Mat22 = this.m_xf.R; var _local5:b2Vec2 = this.m_sweep.localCenter; this.m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y)); this.m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y)); this.m_sweep.c.x = (this.m_sweep.c.x + this.m_xf.position.x); this.m_sweep.c.y = (this.m_sweep.c.y + this.m_xf.position.y); this.m_sweep.c0.SetV(this.m_sweep.c); this.m_sweep.a0 = (this.m_sweep.a = _arg2); var _local6:Boolean; _local3 = this.m_shapeList; while (_local3) { _local7 = _local3.Synchronize(this.m_world.m_broadPhase, this.m_xf, this.m_xf); if (_local7 == false){ _local6 = true; break; }; _local3 = _local3.m_next; }; if (_local6 == true){ this.m_flags = (this.m_flags | e_frozenFlag); this.m_linearVelocity.SetZero(); this.m_angularVelocity = 0; _local3 = this.m_shapeList; while (_local3) { _local3.DestroyProxy(this.m_world.m_broadPhase); _local3 = _local3.m_next; }; return (false); }; this.m_world.m_broadPhase.Commit(); return (true); } public function GetXForm():b2XForm{ return (this.m_xf); } public function GetPosition():b2Vec2{ return (this.m_xf.position); } public function GetAngle():Number{ return (this.m_sweep.a); } public function GetWorldCenter():b2Vec2{ return (this.m_sweep.c); } public function GetLocalCenter():b2Vec2{ return (this.m_sweep.localCenter); } public function SetLinearVelocity(_arg1:b2Vec2):void{ this.m_linearVelocity.SetV(_arg1); } public function GetLinearVelocity():b2Vec2{ return (this.m_linearVelocity); } public function SetAngularVelocity(_arg1:Number):void{ this.m_angularVelocity = _arg1; } public function GetAngularVelocity():Number{ return (this.m_angularVelocity); } public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (this.IsSleeping()){ this.WakeUp(); }; this.m_force.x = (this.m_force.x + _arg1.x); this.m_force.y = (this.m_force.y + _arg1.y); this.m_torque = (this.m_torque + (((_arg2.x - this.m_sweep.c.x) * _arg1.y) - ((_arg2.y - this.m_sweep.c.y) * _arg1.x))); } public function ApplyTorque(_arg1:Number):void{ if (this.IsSleeping()){ this.WakeUp(); }; this.m_torque = (this.m_torque + _arg1); } public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (this.IsSleeping()){ this.WakeUp(); }; this.m_linearVelocity.x = (this.m_linearVelocity.x + (this.m_invMass * _arg1.x)); this.m_linearVelocity.y = (this.m_linearVelocity.y + (this.m_invMass * _arg1.y)); this.m_angularVelocity = (this.m_angularVelocity + (this.m_invI * (((_arg2.x - this.m_sweep.c.x) * _arg1.y) - ((_arg2.y - this.m_sweep.c.y) * _arg1.x)))); } public function GetMass():Number{ return (this.m_mass); } public function GetInertia():Number{ return (this.m_I); } public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22 = this.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 + this.m_xf.position.x); _local3.y = (_local3.y + this.m_xf.position.y); return (_local3); } public function GetWorldVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulMV(this.m_xf.R, _arg1)); } public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulXT(this.m_xf, _arg1)); } public function GetLocalVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulTMV(this.m_xf.R, _arg1)); } public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{ return (new b2Vec2((this.m_linearVelocity.x - (this.m_angularVelocity * (_arg1.y - this.m_sweep.c.y))), (this.m_linearVelocity.y + (this.m_angularVelocity * (_arg1.x - this.m_sweep.c.x))))); } public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22 = this.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 + this.m_xf.position.x); _local3.y = (_local3.y + this.m_xf.position.y); return (new b2Vec2((this.m_linearVelocity.x + (this.m_angularVelocity * (_local3.y - this.m_sweep.c.y))), (this.m_linearVelocity.x - (this.m_angularVelocity * (_local3.x - this.m_sweep.c.x))))); } public function IsBullet():Boolean{ return (((this.m_flags & e_bulletFlag) == e_bulletFlag)); } public function SetBullet(_arg1:Boolean):void{ if (_arg1){ this.m_flags = (this.m_flags | e_bulletFlag); } else { this.m_flags = (this.m_flags & ~(e_bulletFlag)); }; } public function IsStatic():Boolean{ return ((this.m_type == e_staticType)); } public function IsDynamic():Boolean{ return ((this.m_type == e_dynamicType)); } public function IsFrozen():Boolean{ return (((this.m_flags & e_frozenFlag) == e_frozenFlag)); } public function IsSleeping():Boolean{ return (((this.m_flags & e_sleepFlag) == e_sleepFlag)); } public function AllowSleeping(_arg1:Boolean):void{ if (_arg1){ this.m_flags = (this.m_flags | e_allowSleepFlag); } else { this.m_flags = (this.m_flags & ~(e_allowSleepFlag)); this.WakeUp(); }; } public function WakeUp():void{ this.m_flags = (this.m_flags & ~(e_sleepFlag)); this.m_sleepTime = 0; } public function PutToSleep():void{ this.m_flags = (this.m_flags | e_sleepFlag); this.m_sleepTime = 0; this.m_linearVelocity.SetZero(); this.m_angularVelocity = 0; this.m_force.SetZero(); this.m_torque = 0; } public function GetShapeList():b2Shape{ return (this.m_shapeList); } public function GetJointList():b2JointEdge{ return (this.m_jointList); } public function GetNext():b2Body{ return (this.m_next); } public function GetUserData(){ return (this.m_userData); } public function SetUserData(_arg1):void{ this.m_userData = _arg1; } public function GetWorld():b2World{ return (this.m_world); } public function SynchronizeShapes():Boolean{ var _local4:b2Shape; var _local1:b2XForm = s_xf1; _local1.R.Set(this.m_sweep.a0); var _local2:b2Mat22 = _local1.R; var _local3:b2Vec2 = this.m_sweep.localCenter; _local1.position.x = (this.m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y))); _local1.position.y = (this.m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y))); var _local5:Boolean; _local4 = this.m_shapeList; while (_local4) { _local5 = _local4.Synchronize(this.m_world.m_broadPhase, _local1, this.m_xf); if (_local5 == false){ break; }; _local4 = _local4.m_next; }; if (_local5 == false){ this.m_flags = (this.m_flags | e_frozenFlag); this.m_linearVelocity.SetZero(); this.m_angularVelocity = 0; _local4 = this.m_shapeList; while (_local4) { _local4.DestroyProxy(this.m_world.m_broadPhase); _local4 = _local4.m_next; }; return (false); }; return (true); } public function SynchronizeTransform():void{ this.m_xf.R.Set(this.m_sweep.a); var _local1:b2Mat22 = this.m_xf.R; var _local2:b2Vec2 = this.m_sweep.localCenter; this.m_xf.position.x = (this.m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y))); this.m_xf.position.y = (this.m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y))); } public function IsConnected(_arg1:b2Body):Boolean{ var _local2:b2JointEdge = this.m_jointList; while (_local2) { if (_local2.other == _arg1){ return ((_local2.joint.m_collideConnected == false)); }; _local2 = _local2.next; }; return (false); } public function Advance(_arg1:Number):void{ this.m_sweep.Advance(_arg1); this.m_sweep.c.SetV(this.m_sweep.c0); this.m_sweep.a = this.m_sweep.a0; this.SynchronizeTransform(); } } }//package Box2D.Dynamics
Section 68
//b2BodyDef (Box2D.Dynamics.b2BodyDef) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2BodyDef { public var massData:b2MassData; public var userData; public var position:b2Vec2; public var angle:Number; public var linearDamping:Number; public var angularDamping:Number; public var allowSleep:Boolean; public var isSleeping:Boolean; public var fixedRotation:Boolean; public var isBullet:Boolean; public function b2BodyDef(){ this.massData = new b2MassData(); this.position = new b2Vec2(); super(); this.massData.center.SetZero(); this.massData.mass = 0; this.massData.I = 0; this.userData = null; this.position.Set(0, 0); this.angle = 0; this.linearDamping = 0; this.angularDamping = 0; this.allowSleep = true; this.isSleeping = false; this.fixedRotation = false; this.isBullet = false; } } }//package Box2D.Dynamics
Section 69
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener) package Box2D.Dynamics { public class b2BoundaryListener { public function Violation(_arg1:b2Body):void{ } } }//package Box2D.Dynamics
Section 70
//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 71
//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 Persist(_arg1:b2ContactPoint):void{ } public function Remove(_arg1:b2ContactPoint):void{ } public function Result(_arg1:b2ContactResult):void{ } } }//package Box2D.Dynamics
Section 72
//b2ContactManager (Box2D.Dynamics.b2ContactManager) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; import Box2D.Common.*; public class b2ContactManager extends b2PairCallback { public var m_world:b2World; public var m_nullContact:b2NullContact; public var m_destroyImmediate:Boolean; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2ContactManager(){ this.m_nullContact = new b2NullContact(); super(); this.m_world = null; this.m_destroyImmediate = false; } 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 (this.m_nullContact); }; if (_local3.m_body == _local4.m_body){ return (this.m_nullContact); }; if (_local6.IsConnected(_local5)){ return (this.m_nullContact); }; if (((!((this.m_world.m_contactFilter == null))) && ((this.m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){ return (this.m_nullContact); }; var _local7:b2Contact = b2Contact.Create(_local3, _local4, this.m_world.m_blockAllocator); if (_local7 == null){ return (this.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 = this.m_world.m_contactList; if (this.m_world.m_contactList != null){ this.m_world.m_contactList.m_prev = _local7; }; this.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; this.m_world.m_contactCount++; return (_local7); } override public function PairRemoved(_arg1, _arg2, _arg3):void{ if (_arg3 == null){ return; }; var _local4:b2Contact = (_arg3 as b2Contact); if (_local4 == this.m_nullContact){ return; }; this.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)) && (this.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; this.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 == this.m_world.m_contactList){ this.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, this.m_world.m_blockAllocator); this.m_world.m_contactCount--; } public function Collide():void{ var _local2:b2Body; var _local3:b2Body; var _local1:b2Contact = this.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(this.m_world.m_contactListener); }; _local1 = _local1.m_next; }; } } }//package Box2D.Dynamics
Section 73
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw) package Box2D.Dynamics { import flash.display.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; import Box2D.Common.*; public class b2DebugDraw { public var m_drawFlags:uint; public var m_sprite:Sprite; public var m_drawScale:Number;// = 1 public var m_lineThickness:Number;// = 1 public var m_alpha:Number;// = 1 public var m_fillAlpha:Number;// = 1 public var m_xformScale:Number;// = 1 public static var e_shapeBit:uint = 1; public static var e_jointBit:uint = 2; public static var e_coreShapeBit:uint = 4; 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_centerOfMassBit:uint = 64; public function b2DebugDraw(){ this.m_drawFlags = 0; } public function SetFlags(_arg1:uint):void{ this.m_drawFlags = _arg1; } public function GetFlags():uint{ return (this.m_drawFlags); } public function AppendFlags(_arg1:uint):void{ this.m_drawFlags = (this.m_drawFlags | _arg1); } public function ClearFlags(_arg1:uint):void{ this.m_drawFlags = (this.m_drawFlags & ~(_arg1)); } public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ this.m_sprite.graphics.lineStyle(this.m_lineThickness, _arg3.color, this.m_alpha); this.m_sprite.graphics.moveTo((_arg1[0].x * this.m_drawScale), (_arg1[0].y * this.m_drawScale)); var _local4 = 1; while (_local4 < _arg2) { this.m_sprite.graphics.lineTo((_arg1[_local4].x * this.m_drawScale), (_arg1[_local4].y * this.m_drawScale)); _local4++; }; this.m_sprite.graphics.lineTo((_arg1[0].x * this.m_drawScale), (_arg1[0].y * this.m_drawScale)); } public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ this.m_sprite.graphics.lineStyle(this.m_lineThickness, _arg3.color, this.m_alpha); this.m_sprite.graphics.moveTo((_arg1[0].x * this.m_drawScale), (_arg1[0].y * this.m_drawScale)); this.m_sprite.graphics.beginFill(_arg3.color, this.m_fillAlpha); var _local4 = 1; while (_local4 < _arg2) { this.m_sprite.graphics.lineTo((_arg1[_local4].x * this.m_drawScale), (_arg1[_local4].y * this.m_drawScale)); _local4++; }; this.m_sprite.graphics.lineTo((_arg1[0].x * this.m_drawScale), (_arg1[0].y * this.m_drawScale)); this.m_sprite.graphics.endFill(); } public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{ this.m_sprite.graphics.lineStyle(this.m_lineThickness, _arg3.color, this.m_alpha); this.m_sprite.graphics.drawCircle((_arg1.x * this.m_drawScale), (_arg1.y * this.m_drawScale), (_arg2 * this.m_drawScale)); } public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{ this.m_sprite.graphics.lineStyle(this.m_lineThickness, _arg4.color, this.m_alpha); this.m_sprite.graphics.moveTo(0, 0); this.m_sprite.graphics.beginFill(_arg4.color, this.m_fillAlpha); this.m_sprite.graphics.drawCircle((_arg1.x * this.m_drawScale), (_arg1.y * this.m_drawScale), (_arg2 * this.m_drawScale)); this.m_sprite.graphics.endFill(); this.m_sprite.graphics.moveTo((_arg1.x * this.m_drawScale), (_arg1.y * this.m_drawScale)); this.m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * this.m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * this.m_drawScale)); } public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{ this.m_sprite.graphics.lineStyle(this.m_lineThickness, _arg3.color, this.m_alpha); this.m_sprite.graphics.moveTo((_arg1.x * this.m_drawScale), (_arg1.y * this.m_drawScale)); this.m_sprite.graphics.lineTo((_arg2.x * this.m_drawScale), (_arg2.y * this.m_drawScale)); } public function DrawXForm(_arg1:b2XForm):void{ this.m_sprite.graphics.lineStyle(this.m_lineThickness, 0xFF0000, this.m_alpha); this.m_sprite.graphics.moveTo((_arg1.position.x * this.m_drawScale), (_arg1.position.y * this.m_drawScale)); this.m_sprite.graphics.lineTo(((_arg1.position.x + (this.m_xformScale * _arg1.R.col1.x)) * this.m_drawScale), ((_arg1.position.y + (this.m_xformScale * _arg1.R.col1.y)) * this.m_drawScale)); this.m_sprite.graphics.lineStyle(this.m_lineThickness, 0xFF00, this.m_alpha); this.m_sprite.graphics.moveTo((_arg1.position.x * this.m_drawScale), (_arg1.position.y * this.m_drawScale)); this.m_sprite.graphics.lineTo(((_arg1.position.x + (this.m_xformScale * _arg1.R.col2.x)) * this.m_drawScale), ((_arg1.position.y + (this.m_xformScale * _arg1.R.col2.y)) * this.m_drawScale)); } } }//package Box2D.Dynamics
Section 74
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Joints.*; public class b2DestructionListener { public function SayGoodbyeJoint(_arg1:b2Joint):void{ } public function SayGoodbyeShape(_arg1:b2Shape):void{ } } }//package Box2D.Dynamics
Section 75
//b2Island (Box2D.Dynamics.b2Island) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; import Box2D.Common.*; public class b2Island { public var m_allocator; public var m_listener:b2ContactListener; public var m_bodies:Array; public var m_contacts:Array; public var m_joints:Array; public var m_bodyCount:int; public var m_jointCount:int; public var m_contactCount:int; public var m_bodyCapacity:int; public var m_contactCapacity:int; public var m_jointCapacity:int; public var m_positionIterationCount: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(); this.m_bodyCapacity = _arg1; this.m_contactCapacity = _arg2; this.m_jointCapacity = _arg3; this.m_bodyCount = 0; this.m_contactCount = 0; this.m_jointCount = 0; this.m_allocator = _arg4; this.m_listener = _arg5; this.m_bodies = new Array(_arg1); _local6 = 0; while (_local6 < _arg1) { this.m_bodies[_local6] = null; _local6++; }; this.m_contacts = new Array(_arg2); _local6 = 0; while (_local6 < _arg2) { this.m_contacts[_local6] = null; _local6++; }; this.m_joints = new Array(_arg3); _local6 = 0; while (_local6 < _arg3) { this.m_joints[_local6] = null; _local6++; }; this.m_positionIterationCount = 0; } public function Clear():void{ this.m_bodyCount = 0; this.m_contactCount = 0; this.m_jointCount = 0; } 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 < this.m_bodyCount) { _local6 = this.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, this.m_contacts, this.m_contactCount, this.m_allocator); _local8.InitVelocityConstraints(_arg1); _local5 = 0; while (_local5 < this.m_jointCount) { _local7 = this.m_joints[_local5]; _local7.InitVelocityConstraints(_arg1); _local5++; }; _local5 = 0; while (_local5 < _arg1.maxIterations) { _local8.SolveVelocityConstraints(); _local9 = 0; while (_local9 < this.m_jointCount) { _local7 = this.m_joints[_local9]; _local7.SolveVelocityConstraints(_arg1); _local9++; }; _local5++; }; _local8.FinalizeVelocityConstraints(); _local5 = 0; while (_local5 < this.m_bodyCount) { _local6 = this.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 < this.m_jointCount) { _local7 = this.m_joints[_local5]; _local7.InitPositionConstraints(); _local5++; }; this.m_positionIterationCount = 0; while (this.m_positionIterationCount < _arg1.maxIterations) { _local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte); _local11 = true; _local5 = 0; while (_local5 < this.m_jointCount) { _local7 = this.m_joints[_local5]; _local12 = _local7.SolvePositionConstraints(); _local11 = ((_local11) && (_local12)); _local5++; }; if (((_local10) && (_local11))){ break; }; this.m_positionIterationCount++; }; }; this.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 < this.m_bodyCount) { _local6 = this.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 < this.m_bodyCount) { _local6 = this.m_bodies[_local5]; this.m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag); _local6.m_linearVelocity.SetZero(); _local6.m_angularVelocity = 0; _local5++; }; }; }; } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:int; var _local5:b2Body; var _local6:Boolean; var _local3:b2ContactSolver = new b2ContactSolver(_arg1, this.m_contacts, this.m_contactCount, this.m_allocator); _local2 = 0; while (_local2 < _arg1.maxIterations) { _local3.SolveVelocityConstraints(); _local2++; }; _local2 = 0; while (_local2 < this.m_bodyCount) { _local5 = this.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++; }; this.Report(_local3.m_constraints); } 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 (this.m_listener == null){ return; }; var _local4:int; while (_local4 < this.m_contactCount) { _local5 = this.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; this.m_listener.Result(_local7); _local13++; }; _local11++; }; _local4++; }; } public function AddBody(_arg1:b2Body):void{ var _local2 = this.m_bodyCount++; this.m_bodies[_local2] = _arg1; } public function AddContact(_arg1:b2Contact):void{ var _local2 = this.m_contactCount++; this.m_contacts[_local2] = _arg1; } public function AddJoint(_arg1:b2Joint):void{ var _local2 = this.m_jointCount++; this.m_joints[_local2] = _arg1; } } }//package Box2D.Dynamics
Section 76
//b2TimeStep (Box2D.Dynamics.b2TimeStep) package Box2D.Dynamics { public class b2TimeStep { public var dt:Number; public var inv_dt:Number; public var dtRatio:Number; public var maxIterations:int; public var warmStarting:Boolean; public var positionCorrection:Boolean; } }//package Box2D.Dynamics
Section 77
//b2World (Box2D.Dynamics.b2World) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; import Box2D.Common.*; public class b2World { public var m_blockAllocator; public var m_stackAllocator; public var m_lock:Boolean; public var m_broadPhase:b2BroadPhase; public var m_contactManager:b2ContactManager; public var m_bodyList:b2Body; public var m_jointList:b2Joint; public var m_contactList:b2Contact; public var m_bodyCount:int; public var m_contactCount:int; public var m_jointCount:int; public var m_gravity:b2Vec2; public var m_allowSleep:Boolean; public var m_groundBody:b2Body; public var m_destructionListener:b2DestructionListener; public var m_boundaryListener:b2BoundaryListener; public var m_contactFilter:b2ContactFilter; public var m_contactListener:b2ContactListener; public var m_debugDraw:b2DebugDraw; public var m_inv_dt0:Number; public var m_positionIterationCount:int; private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8); private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6); private static var s_xf:b2XForm = new b2XForm(); public static var m_positionCorrection:Boolean; public static var m_warmStarting:Boolean; public static var m_continuousPhysics:Boolean; public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){ this.m_contactManager = new b2ContactManager(); super(); this.m_destructionListener = null; this.m_boundaryListener = null; this.m_contactFilter = b2ContactFilter.b2_defaultFilter; this.m_contactListener = null; this.m_debugDraw = null; this.m_bodyList = null; this.m_contactList = null; this.m_jointList = null; this.m_bodyCount = 0; this.m_contactCount = 0; this.m_jointCount = 0; m_positionCorrection = true; m_warmStarting = true; m_continuousPhysics = true; this.m_allowSleep = _arg3; this.m_gravity = _arg2; this.m_lock = false; this.m_inv_dt0 = 0; this.m_contactManager.m_world = this; this.m_broadPhase = new b2BroadPhase(_arg1, this.m_contactManager); var _local4:b2BodyDef = new b2BodyDef(); this.m_groundBody = this.CreateBody(_local4); } public function SetDestructionListener(_arg1:b2DestructionListener):void{ this.m_destructionListener = _arg1; } public function SetBoundaryListener(_arg1:b2BoundaryListener):void{ this.m_boundaryListener = _arg1; } public function SetContactFilter(_arg1:b2ContactFilter):void{ this.m_contactFilter = _arg1; } public function SetContactListener(_arg1:b2ContactListener):void{ this.m_contactListener = _arg1; } public function SetDebugDraw(_arg1:b2DebugDraw):void{ this.m_debugDraw = _arg1; } public function Validate():void{ this.m_broadPhase.Validate(); } public function GetProxyCount():int{ return (this.m_broadPhase.m_proxyCount); } public function GetPairCount():int{ return (this.m_broadPhase.m_pairManager.m_pairCount); } public function CreateBody(_arg1:b2BodyDef):b2Body{ if (this.m_lock == true){ return (null); }; var _local2:b2Body = new b2Body(_arg1, this); _local2.m_prev = null; _local2.m_next = this.m_bodyList; if (this.m_bodyList){ this.m_bodyList.m_prev = _local2; }; this.m_bodyList = _local2; this.m_bodyCount++; return (_local2); } public function DestroyBody(_arg1:b2Body):void{ var _local4:b2JointEdge; var _local5:b2Shape; if (this.m_lock == true){ return; }; var _local2:b2JointEdge = _arg1.m_jointList; while (_local2) { _local4 = _local2; _local2 = _local2.next; if (this.m_destructionListener){ this.m_destructionListener.SayGoodbyeJoint(_local4.joint); }; this.DestroyJoint(_local4.joint); }; var _local3:b2Shape = _arg1.m_shapeList; while (_local3) { _local5 = _local3; _local3 = _local3.m_next; if (this.m_destructionListener){ this.m_destructionListener.SayGoodbyeShape(_local5); }; _local5.DestroyProxy(this.m_broadPhase); b2Shape.Destroy(_local5, this.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 == this.m_bodyList){ this.m_bodyList = _arg1.m_next; }; this.m_bodyCount--; } public function CreateJoint(_arg1:b2JointDef):b2Joint{ var _local3:b2Body; var _local4:b2Shape; var _local2:b2Joint = b2Joint.Create(_arg1, this.m_blockAllocator); _local2.m_prev = null; _local2.m_next = this.m_jointList; if (this.m_jointList){ this.m_jointList.m_prev = _local2; }; this.m_jointList = _local2; this.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(this.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 == this.m_jointList){ this.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, this.m_blockAllocator); this.m_jointCount--; if (_local2 == false){ _local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4; _local6 = _local5.m_shapeList; while (_local6) { _local6.RefilterProxy(this.m_broadPhase, _local5.m_xf); _local6 = _local6.m_next; }; }; } public function Refilter(_arg1:b2Shape):void{ _arg1.RefilterProxy(this.m_broadPhase, _arg1.m_body.m_xf); } public function SetWarmStarting(_arg1:Boolean):void{ m_warmStarting = _arg1; } public function SetPositionCorrection(_arg1:Boolean):void{ m_positionCorrection = _arg1; } public function SetContinuousPhysics(_arg1:Boolean):void{ m_continuousPhysics = _arg1; } public function GetBodyCount():int{ return (this.m_bodyCount); } public function GetJointCount():int{ return (this.m_jointCount); } public function GetContactCount():int{ return (this.m_contactCount); } public function SetGravity(_arg1:b2Vec2):void{ this.m_gravity = _arg1; } public function GetGravity():b2Vec2{ return (this.m_gravity); } public function GetGroundBody():b2Body{ return (this.m_groundBody); } public function Step(_arg1:Number, _arg2:int):void{ this.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 = (this.m_inv_dt0 * _arg1); _local3.positionCorrection = m_positionCorrection; _local3.warmStarting = m_warmStarting; this.m_contactManager.Collide(); if (_local3.dt > 0){ this.Solve(_local3); }; if (((m_continuousPhysics) && ((_local3.dt > 0)))){ this.SolveTOI(_local3); }; this.DrawDebugData(); this.m_inv_dt0 = _local3.inv_dt; this.m_lock = false; } public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{ var _local4:Array = new Array(_arg3); var _local5:int = this.m_broadPhase.QueryAABB(_arg1, _local4, _arg3); var _local6:int; while (_local6 < _local5) { _arg2[_local6] = _local4[_local6]; _local6++; }; return (_local5); } public function GetBodyList():b2Body{ return (this.m_bodyList); } public function GetJointList():b2Joint{ return (this.m_jointList); } 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; this.m_positionIterationCount = 0; var _local3:b2Island = new b2Island(this.m_bodyCount, this.m_contactCount, this.m_jointCount, this.m_stackAllocator, this.m_contactListener); _local2 = this.m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2 = _local2.m_next; }; var _local4:b2Contact = this.m_contactList; while (_local4) { _local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag)); _local4 = _local4.m_next; }; var _local5:b2Joint = this.m_jointList; while (_local5) { _local5.m_islandFlag = false; _local5 = _local5.m_next; }; var _local6:int = this.m_bodyCount; var _local7:Array = new Array(_local6); var _local8:b2Body = this.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, this.m_gravity, m_positionCorrection, this.m_allowSleep); if (_local3.m_positionIterationCount > this.m_positionIterationCount){ this.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 = this.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)) && (!((this.m_boundaryListener == null))))){ this.m_boundaryListener.Violation(_local2); }; }; }; _local2 = _local2.m_next; }; this.m_broadPhase.Commit(); } 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(this.m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, this.m_stackAllocator, this.m_contactListener); var _local9:int = this.m_bodyCount; var _local10:Array = new Array(_local9); _local2 = this.m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2.m_sweep.t0 = 0; _local2 = _local2.m_next; }; _local11 = this.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 = this.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(this.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)) && (!((this.m_boundaryListener == null))))){ this.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++; }; this.m_broadPhase.Commit(); }; }; } 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: this.m_debugDraw.DrawSegment(_local8, _local9, _local10); break; case b2Joint.e_pulleyJoint: _local11 = (_arg1 as b2PulleyJoint); _local12 = _local11.GetGroundAnchor1(); _local13 = _local11.GetGroundAnchor2(); this.m_debugDraw.DrawSegment(_local12, _local8, _local10); this.m_debugDraw.DrawSegment(_local13, _local9, _local10); this.m_debugDraw.DrawSegment(_local12, _local13, _local10); break; case b2Joint.e_mouseJoint: this.m_debugDraw.DrawSegment(_local8, _local9, _local10); break; default: if (_local2 != this.m_groundBody){ this.m_debugDraw.DrawSegment(_local6, _local8, _local10); }; this.m_debugDraw.DrawSegment(_local8, _local9, _local10); if (_local3 != this.m_groundBody){ this.m_debugDraw.DrawSegment(_local7, _local9, _local10); }; }; } 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; this.m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3); if (_arg4){ this.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++; }; this.m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3); if (_arg4){ _local15 = _local11.GetCoreVertices(); _local10 = 0; while (_local10 < _local12) { _local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]); _local10++; }; this.m_debugDraw.DrawPolygon(_local14, _local12, _local5); }; break; }; } 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 (this.m_debugDraw == null){ return; }; this.m_debugDraw.m_sprite.graphics.clear(); var _local1:uint = this.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 = this.m_bodyList; while (_local3) { _local11 = _local3.m_xf; _local4 = _local3.GetShapeList(); while (_local4) { if (_local3.IsStatic()){ this.DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15); } else { if (_local3.IsSleeping()){ this.DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15); } else { this.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 = this.m_jointList; while (_local5) { this.DrawJoint(_local5); _local5 = _local5.m_next; }; }; if ((_local1 & b2DebugDraw.e_pairBit)){ _local6 = this.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)); this.m_debugDraw.DrawSegment(_local8, _local9, _local10); _local16 = _local17.next; }; _local2++; }; }; if ((_local1 & b2DebugDraw.e_aabbBit)){ _local6 = this.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); this.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); this.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 = this.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++; }; this.m_debugDraw.DrawPolygon(_local14, 4, _local10); }; _local4 = _local4.m_next; }; _local3 = _local3.m_next; }; }; if ((_local1 & b2DebugDraw.e_centerOfMassBit)){ _local3 = this.m_bodyList; while (_local3) { _local11 = s_xf; _local11.R = _local3.m_xf.R; _local11.position = _local3.GetWorldCenter(); this.m_debugDraw.DrawXForm(_local11); _local3 = _local3.m_next; }; }; } } }//package Box2D.Dynamics
Section 78
//b2BuoyancyController (com.boristhebrave.Box2D.Controllers.b2BuoyancyController) package com.boristhebrave.Box2D.Controllers { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2BuoyancyController extends b2MultiController { public var normal:b2Vec2; public var offset:Number;// = 0 public var density:Number;// = 0 public var velocity:b2Vec2; public var linearDrag:Number;// = 2 public var angularDrag:Number;// = 1 public var useDensity:Boolean;// = false public var useWorldGravity:Boolean;// = true public var gravity:b2Vec2;// = null public function b2BuoyancyController(){ this.normal = new b2Vec2(0, -1); this.velocity = new b2Vec2(0, 0); super(); } 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 (this.useWorldGravity){ this.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(this.normal, this.offset, _local3.GetXForm(), _local11); _local6 = (_local6 + _local12); _local4.x = (_local4.x + (_local12 * _local11.x)); _local4.y = (_local4.y + (_local12 * _local11.y)); if (this.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 = this.gravity.Negative(); _local9.Multiply((this.density * _local6)); _local3.ApplyForce(_local9, _local5); _local10 = _local3.GetLinearVelocityFromWorldPoint(_local4); _local10.Subtract(this.velocity); _local10.Multiply((-(this.linearDrag) * _local6)); _local3.ApplyForce(_local10, _local4); _local3.ApplyTorque(((((-(_local3.GetInertia()) / _local3.GetMass()) * _local6) * _local3.GetAngularVelocity()) * this.angularDrag)); }; }; _local2++; }; } override public function Draw(_arg1:b2DebugDraw):void{ var _local2:Number = 1000; var _local3:b2Vec2 = new b2Vec2(); var _local4:b2Vec2 = new b2Vec2(); _local3.x = ((this.normal.x * this.offset) + (this.normal.y * _local2)); _local3.y = ((this.normal.y * this.offset) - (this.normal.x * _local2)); _local4.x = ((this.normal.x * this.offset) - (this.normal.y * _local2)); _local4.y = ((this.normal.y * this.offset) + (this.normal.x * _local2)); var _local5:b2Color = new b2Color(0, 0, 1); _arg1.DrawSegment(_local3, _local4, _local5); } 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 79
//b2Controller (com.boristhebrave.Box2D.Controllers.b2Controller) package com.boristhebrave.Box2D.Controllers { import Box2D.Dynamics.*; public class b2Controller { public var m_next:b2Controller; public var m_prev:b2Controller; public function GetNext():b2Controller{ return (this.m_next); } public function GetPrev():b2Controller{ return (this.m_prev); } public function Step(_arg1:Number):void{ } public function Draw(_arg1:b2DebugDraw):void{ } } }//package com.boristhebrave.Box2D.Controllers
Section 80
//b2GravityController (com.boristhebrave.Box2D.Controllers.b2GravityController) package com.boristhebrave.Box2D.Controllers { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import core.shape.shapeProps.*; import Box2D.Common.*; 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(((((this.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(((((this.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 81
//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(){ this.m_bodies = []; super(); } public function WakeBodies():void{ var _local1:int; while (_local1 < this.m_bodies.length) { this.m_bodies[_local1].WakeUp(); _local1++; }; } public function AddBodies(_arg1:Array):void{ var _local2:* = 0; while (_local2 < _arg1.length) { this.AddBody(_arg1[_local2]); _local2++; }; } public function AddBody(_arg1:b2Body):void{ this.m_bodies.push(_arg1); } public function RemoveBody(_arg1:b2Body):void{ var body = _arg1; this.m_bodies = this.m_bodies.filter(function (_arg1){ return (!((_arg1 == body))); }); } public function GetBodies():Array{ return (this.m_bodies); } public function removeAllBodies():void{ this.m_bodies = new Array(); } 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 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{ this.dispatcher = new EventDispatcher(); } override public function Add(_arg1:b2ContactPoint):void{ this.dispatcher.dispatchEvent(new CoreEvent(COLLIDE_ADD, _arg1)); } override public function Persist(_arg1:b2ContactPoint):void{ this.dispatcher.dispatchEvent(new CoreEvent(COLLIDE_PERSIST, _arg1)); } override public function Remove(_arg1:b2ContactPoint):void{ this.dispatcher.dispatchEvent(new CoreEvent(COLLIDE_REMOVE, _arg1)); } override public function Result(_arg1:b2ContactResult):void{ this.dispatcher.dispatchEvent(new CoreEvent(COLLIDE_RESULT, _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); } } }//package core.engine
Section 83
//CoreEngine (core.engine.CoreEngine) package core.engine { import flash.events.*; import flash.display.*; import core.renderer.*; import Box2D.Dynamics.*; import Box2D.Common.Math.*; import com.boristhebrave.Box2D.Controllers.*; import Box2D.Collision.*; public class CoreEngine extends Sprite { public var gravity:b2Vec2; public var world:b2World; private var _renderers:Array; public var controller:b2MultiController; public var contactListener:BContactListener; public var debugDrawContainer:Sprite; private static var _instance:CoreEngine; public function CoreEngine(_arg1:SingletonEnforcer){ this.gravity = new b2Vec2(0, 10); this._renderers = new Array(); this.contactListener = new BContactListener(); super(); this.createWorld(); } public function createWorld():void{ var _local2:b2DebugDraw; var _local3:Sprite; if (this.controller){ this.controller.removeAllBodies(); }; this._renderers = new Array(); var _local1:b2AABB = new b2AABB(); _local1.lowerBound.Set(-10000, -10000); _local1.upperBound.Set(10000, 10000); this.world = new b2World(_local1, this.gravity, true); if (this.debugDrawContainer){ _local2 = new b2DebugDraw(); _local3 = this.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); this.world.SetDebugDraw(_local2); }; this.world.SetContactListener(this.contactListener); removeEventListener(Event.ENTER_FRAME, this.onEnterFrame); addEventListener(Event.ENTER_FRAME, this.onEnterFrame); } private function onEnterFrame(_arg1:Event):void{ var _local2:BaseRenderer; this.world.Step(0.0333, 5); if (this.controller){ this.controller.Step(0.0333); }; for each (_local2 in this._renderers) { _local2.render(); }; } public function addRenderer(_arg1:BaseRenderer):void{ this._renderers.push(_arg1); } public function removeRenderer(_arg1:BaseRenderer):void{ var _local2:BaseRenderer; for each (_local2 in this._renderers) { if (_local2 == _arg1){ _arg1.destroy(); this._renderers = this._renderers.filter(this.filterValidRenderers); }; }; } private function filterValidRenderers(_arg1:BaseRenderer, _arg2:int, _arg3:Array):Boolean{ return (_arg1.isValid()); } 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 = this.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 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 _bodies:Array; protected var _skins: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")); }; this._bodies = _arg1; this._skins = _arg2; this.addSkins(); } public function addSkins():void{ var _local2:Sprite; var _local1:Sprite = Scene2DReference.getInstance().scene; for each (_local2 in this._skins) { _local1.addChild(_local2); }; } public function render():void{ var i:uint; var body:b2Body; var skin:Sprite; if (!this._bodies){ return; }; i = 0; while (i < this._bodies.length) { body = this._bodies[i]; skin = this._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 destroy():void{ this.removeSkins(); this.removeBodies(); } protected function removeSkins():void{ var _local2:Sprite; var _local1:Sprite = Scene2DReference.getInstance().scene; for each (_local2 in this._skins) { _local1.removeChild(_local2); }; } protected function removeBodies():void{ var _local2:b2Body; var _local1:b2World = CoreEngine.getInstance().world; for each (_local2 in this._bodies) { _local1.DestroyBody(_local2); _local2 = null; }; this._bodies = null; } public function isValid():Boolean{ return ((this._bodies) ? true : false); } } }//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 friction:Number; public var restitution:Number; public var density:Number; public var categoryBits:uint; public var maskBits:uint; public var groupIndex:int; public var angularDamping:uint; public var linearDamping:uint; public var isBullet:Boolean;// = false } }//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 type:String;// = "none" public var subtype:String;// = "" public var w:Number;// = 0 public var h:Number;// = 0 public var renderer; 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(){ this._body = this.createBody(); } protected function createBody():b2Body{ return (null); } public function get body():b2Body{ return (this._body); } } }//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 _x:Number; private var _y:Number; private var _height:Number; private var _width:Number; private var _isStatic:Boolean; private var _customShapeProps:DefaultShapeProps; public function BoxShape(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean, _arg6:DefaultShapeProps=null){ this._x = _arg1; this._y = _arg2; this._width = _arg3; this._height = _arg4; this._isStatic = _arg5; this._customShapeProps = _arg6; super(); } override protected function createBody():b2Body{ var _local1:b2BodyDef; var _local3:DefaultShapeProps; _local1 = new b2BodyDef(); _local1.position.x = (this._x / _physScale); _local1.position.y = (this._y / _physScale); var _local2:b2PolygonDef = new b2PolygonDef(); _local2.SetAsBox((this._width / 60), (this._height / 60)); if (this._customShapeProps){ _local3 = this._customShapeProps; } else { _local3 = (this._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 = this._width; _local5.h = this._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 _x:Number; private var _y:Number; private var _radius:Number; private var _isStatic:Boolean; private var _customShapeProps:DefaultShapeProps; public function CircleShape(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:DefaultShapeProps=null){ this._x = _arg1; this._y = _arg2; this._radius = _arg3; this._isStatic = _arg4; this._customShapeProps = _arg5; super(); } override protected function createBody():b2Body{ var _local3:DefaultShapeProps; var _local1:b2BodyDef = new b2BodyDef(); _local1.position.x = (this._x / _physScale); _local1.position.y = (this._y / _physScale); var _local2:b2CircleDef = new b2CircleDef(); _local2.radius = (this._radius / _physScale); if (this._customShapeProps){ _local3 = this._customShapeProps; } else { _local3 = (this._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 right:Boolean;// = false public var up:Boolean;// = false private static var _instance:KeyboardListener; public function KeyboardListener(_arg1:SingletonEnforcer){ } public function listen(_arg1:Stage):void{ _arg1.addEventListener(KeyboardEvent.KEY_DOWN, this.onKeyDown); _arg1.addEventListener(KeyboardEvent.KEY_UP, this.onKeyUp); } public function onKeyDown(_arg1:KeyboardEvent):void{ switch (_arg1.keyCode){ case 37: this.left = true; break; case 38: this.up = true; break; case 39: this.right = true; break; case 65: this.left = true; break; case 87: this.up = true; break; case 68: this.right = true; break; case 32: this.up = true; break; }; } public function onKeyUp(_arg1:KeyboardEvent):void{ switch (_arg1.keyCode){ case 37: this.left = false; break; case 38: this.up = false; break; case 39: this.right = false; break; case 65: this.left = false; break; case 87: this.up = false; break; case 68: this.right = false; break; case 32: this.up = false; break; }; } 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.twoD.zones.*; import idv.cjcat.stardust.common.clocks.*; 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.twoD.zones.*; import idv.cjcat.stardust.common.actions.*; import idv.cjcat.stardust.common.initializers.*; import idv.cjcat.stardust.common.clocks.*; import idv.cjcat.stardust.twoD.initializers.*; import idv.cjcat.stardust.common.math.*; 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
//ActionTrigger (idv.cjcat.stardust.common.actions.triggers.ActionTrigger) package idv.cjcat.stardust.common.actions.triggers { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.actions.*; public class ActionTrigger extends CompositeAction { public var inverted:Boolean; public function ActionTrigger(_arg1:Boolean=false){ this.inverted = _arg1; } public function testTrigger(_arg1:Emitter, _arg2:Particle, _arg3:Number):Boolean{ return (false); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local6:Action; var _local4:Array = actionCollection.actions; var _local5:Boolean = testTrigger(_arg1, _arg2, _arg3); if (inverted){ _local5 = !(_local5); }; if (_local5){ for each (_local6 in _local4) { _local6.update(_arg1, _arg2, _arg3); }; }; } override public function getXMLTagName():String{ return ("ActionTrigger"); } override public function getElementTypeXMLTag():XML{ return (<triggers/> ); } override public function toXML():XML{ var _local1:XML = super.toXML(); if (_local1.@inverted.length()){ _local1.@inverted = inverted; }; return (_local1); } 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 99
//DeathTrigger (idv.cjcat.stardust.common.actions.triggers.DeathTrigger) package idv.cjcat.stardust.common.actions.triggers { import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; public class DeathTrigger extends ActionTrigger { override public function testTrigger(_arg1:Emitter, _arg2:Particle, _arg3:Number):Boolean{ return (_arg2.isDead); } override public function getXMLTagName():String{ return ("DeathTrigger"); } } }//package idv.cjcat.stardust.common.actions.triggers
Section 100
//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.emitters.*; import idv.cjcat.stardust.common.particles.*; public class LifeTrigger extends ActionTrigger { public var triggerWithinBounds:Boolean; public var triggerEvery:Number; private var _lowerBound:Number; private var _upperBound:Number; 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 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); } public function get lowerBound():Number{ return (_lowerBound); } public function set lowerBound(_arg1:Number):void{ if (_arg1 > _upperBound){ _upperBound = _arg1; }; _lowerBound = _arg1; } public function get upperBound():Number{ return (_upperBound); } public function set upperBound(_arg1:Number):void{ if (_arg1 < _lowerBound){ _lowerBound = _arg1; }; _upperBound = _arg1; } override public function getXMLTagName():String{ return ("LifeTrigger"); } override public function toXML():XML{ var _local1:XML = 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 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); } } }//package idv.cjcat.stardust.common.actions.triggers
Section 101
//Action (idv.cjcat.stardust.common.actions.Action) package idv.cjcat.stardust.common.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.events.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.*; public class Action extends StardustElement { public var active:Boolean; public var skipThisAction:Boolean; private var _mask:int; 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; } public function get supports2D():Boolean{ return (_supports2D); } public function get supports3D():Boolean{ return (_supports3D); } 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(); }; }; } 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(); }; }; } public function preUpdate(_arg1:Emitter, _arg2:Number):void{ } public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ } public function postUpdate(_arg1:Emitter, _arg2:Number):void{ } public function get priority():int{ return (_priority); } public function set priority(_arg1:int):void{ _priority = _arg1; dispatchEvent(new ActionEvent(ActionEvent.PRIORITY_CHANGE, this)); } public function get needsSortedParticles():Boolean{ return (false); } public function get mask():int{ return (_mask); } public function set mask(_arg1:int):void{ _mask = _arg1; } override public function getXMLTagName():String{ return ("Action"); } override public function getElementTypeXMLTag():XML{ return (<actions/> ); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@active = active; _local1.@mask = mask; return (_local1); } 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); }; } } }//package idv.cjcat.stardust.common.actions
Section 102
//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 addAction(_arg1:Action):void{ actions.push(_arg1); _arg1.addEventListener(ActionEvent.PRIORITY_CHANGE, sortActions); sortActions(); } 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 sortActions(_arg1:Event=null):void{ actions.sortOn("priority", (Array.NUMERIC | Array.DESCENDING)); } } }//package idv.cjcat.stardust.common.actions
Section 103
//ActionCollector (idv.cjcat.stardust.common.actions.ActionCollector) package idv.cjcat.stardust.common.actions { public interface ActionCollector { function addAction(_arg1:Action):void; function removeAction(_arg1:Action):void; function clearActions():void; } }//package idv.cjcat.stardust.common.actions
Section 104
//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 105
//Age (idv.cjcat.stardust.common.actions.Age) package idv.cjcat.stardust.common.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 getXMLTagName():String{ return ("Age"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@multiplier = multiplier; return (_local1); } 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 106
//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 107
//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.events.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 preUpdate(_arg1:Emitter, _arg2:Number):void{ var _local3:Action; for each (_local3 in actionCollection.actions) { _local3.preUpdate(_arg1, _arg2); }; } 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); }; }; }; } public function addAction(_arg1:Action):void{ actionCollection.actions.push(_arg1); _arg1.addEventListener(ActionEvent.PRIORITY_CHANGE, sortActions); sortActions(); } 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); }; } 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)); } 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 getRelatedObjects():Array{ return (actionCollection.actions.concat()); } override public function getXMLTagName():String{ return ("CompositeAction"); } override public function toXML():XML{ var _local2:Action; var _local1:XML = 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 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)); }; } } }//package idv.cjcat.stardust.common.actions
Section 108
//DeathLife (idv.cjcat.stardust.common.actions.DeathLife) package idv.cjcat.stardust.common.actions { import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 109
//ScaleCurve (idv.cjcat.stardust.common.actions.ScaleCurve) package idv.cjcat.stardust.common.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.easing.*; public class ScaleCurve extends Action { public var inScale:Number; public var outScale:Number; public var inLifespan:Number; public var outLifespan:Number; private var _inFunction:Function; private var _outFunction:Function; private var _inFunctionExtraParams:Array; private var _outFunctionExtraParams: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 = []; } 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); } public function set inFunctionExtraParams(_arg1:Array):void{ if (!_arg1){ _arg1 = []; }; _inFunctionExtraParams = _arg1; } public function get outFunctionExtraParams():Array{ return (_outFunctionExtraParams); } public function set outFunctionExtraParams(_arg1:Array):void{ if (!_arg1){ _arg1 = []; }; _outFunctionExtraParams = _arg1; } public function get inFunction():Function{ return (_inFunction); } public function set inFunction(_arg1:Function):void{ if (_arg1 == null){ _arg1 = Linear.easeIn; }; _inFunction = _arg1; } public function get outFunction():Function{ return (_outFunction); } public function set outFunction(_arg1:Function):void{ if (_arg1 == null){ _arg1 = Linear.easeOut; }; _outFunction = _arg1; } override public function getXMLTagName():String{ return ("ScaleCurve"); } override public function toXML():XML{ var _local1:XML = 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 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 110
//Clock (idv.cjcat.stardust.common.clocks.Clock) package idv.cjcat.stardust.common.clocks { import idv.cjcat.stardust.common.*; public class Clock extends StardustElement { public function getTicks(_arg1:Number):int{ return (0); } override public function getElementTypeXMLTag():XML{ return (<clocks/> ); } } }//package idv.cjcat.stardust.common.clocks
Section 111
//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 getXMLTagName():String{ return ("SteadyClock"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@ticksPerCall = ticksPerCall; return (_local1); } 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 112
//Back (idv.cjcat.stardust.common.easing.Back) package idv.cjcat.stardust.common.easing { public class Back { 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 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 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 113
//Circ (idv.cjcat.stardust.common.easing.Circ) package idv.cjcat.stardust.common.easing { public class Circ { 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 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 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 114
//Cubic (idv.cjcat.stardust.common.easing.Cubic) package idv.cjcat.stardust.common.easing { public class Cubic { 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 easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = ((_arg1 / _arg4) - 1); return (((_arg3 * (((_arg1 * _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) * _arg1) * _arg1) * _arg1) + _arg2)); }; _arg1 = (_arg1 - 2); return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2)); } } }//package idv.cjcat.stardust.common.easing
Section 115
//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 116
//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 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)); } 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)); } } }//package idv.cjcat.stardust.common.easing
Section 117
//Expo (idv.cjcat.stardust.common.easing.Expo) package idv.cjcat.stardust.common.easing { public class Expo { 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 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 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 118
//Linear (idv.cjcat.stardust.common.easing.Linear) package idv.cjcat.stardust.common.easing { public class Linear { public static function easeNone(_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 easeOut(_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)); } } }//package idv.cjcat.stardust.common.easing
Section 119
//Quad (idv.cjcat.stardust.common.easing.Quad) package idv.cjcat.stardust.common.easing { public class Quad { public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / _arg4); return ((((_arg3 * _arg1) * _arg1) + _arg2)); } 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 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 120
//Quart (idv.cjcat.stardust.common.easing.Quart) package idv.cjcat.stardust.common.easing { public class Quart { 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 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 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 121
//Quint (idv.cjcat.stardust.common.easing.Quint) package idv.cjcat.stardust.common.easing { public class Quint { 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 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 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 122
//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 easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * _HALF_PI))) + _arg3) + _arg2)); } 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 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 123
//Emitter (idv.cjcat.stardust.common.emitters.Emitter) package idv.cjcat.stardust.common.emitters { import flash.events.*; import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.events.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.actions.*; import idv.cjcat.stardust.common.initializers.*; import idv.cjcat.stardust.common.clocks.*; import idv.cjcat.stardust.common.*; import idv.cjcat.stardust.*; public class Emitter extends StardustElement implements ActionCollector, InitializerCollector { private var _clock:Clock; public var active:Boolean; public var needsSort:Boolean; sd var particles:ParticleList; protected var factory:PooledParticleFactory; private var _actionCollection:ActionCollection; public var stepTimeInterval:Number;// = 1 public function Emitter(_arg1:Clock=null){ needsSort = false; this.clock = _arg1; this.active = true; _actionCollection = new ActionCollection(); particles = new PooledParticleList(); } public function get clock():Clock{ return (_clock); } public function set clock(_arg1:Clock):void{ if (!_arg1){ _arg1 = new SteadyClock(0); }; _clock = _arg1; } final public function step(_arg1:Event=null):void{ var _local3:Particle; var _local4:ParticleIterator; var _local5:Action; var _local6:int; var _local7:ParticleCollection; var _local2:Boolean; 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 sd function get actions():Array{ return (_actionCollection.actions); } public function addAction(_arg1:Action):void{ _actionCollection.addAction(_arg1); } final public function removeAction(_arg1:Action):void{ _actionCollection.removeAction(_arg1); } final public function clearActions():void{ _actionCollection.clearActions(); } final sd function get initializers():Array{ return (factory.initializerCollection.initializers); } public function addInitializer(_arg1:Initializer):void{ factory.addInitializer(_arg1); } final public function removeInitializer(_arg1:Initializer):void{ factory.removeInitializer(_arg1); } final public function clearInitializers():void{ factory.clearInitializers(); } final public function get numParticles():int{ return (particles.size); } final public function addParticles(_arg1:ParticleCollection):void{ var _local2:Particle; var _local3:ParticleIterator = _arg1.getIterator(); while ((_local2 = _local3.particle)) { this.particles.add(_local2); _local3.next(); }; if (_arg1.size){ dispatchEvent(new EmitterEvent(EmitterEvent.PARTICLES_ADDED, _arg1)); }; } final public function clearParticles():void{ var _local2:Particle; var _local1:ParticleCollection = particles; particles = new ParticleList(); if (_local1.size){ dispatchEvent(new EmitterEvent(EmitterEvent.PARTICLES_REMOVED, _local1)); }; var _local3:ParticleIterator = particles.getIterator(); while ((_local2 = _local3.particle)) { _local2.destroy(); factory.recycle(_local2); _local3.remove(); }; } final public function removeDeadParticles():void{ var _local1:Particle; var _local4:*; var _local5:InfoRecycler; var _local2:ParticleCollection = new ParticleList(); var _local3:ParticleIterator = 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 getParticles():ParticleCollection{ return (particles); } override public function getRelatedObjects():Array{ return ([_clock].concat(initializers).concat(actions)); } override public function getXMLTagName():String{ return ("Emitter"); } override public function getElementTypeXMLTag():XML{ return (<emitters/> ); } override public function toXML():XML{ var _local2:Action; var _local3:Initializer; var _local1:XML = 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 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)); }; } } }//package idv.cjcat.stardust.common.emitters
Section 124
//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 _element1:StardustElement; private var _element2:StardustElement; private var _name:String; public function DuplicateElementNameError(_arg1, _arg2:String, _arg3:StardustElement, _arg4:StardustElement){ super(_arg1); _element1 = _arg3; _element2 = _arg4; _name = _arg2; } public function get element1():StardustElement{ return (_element1); } public function get element2():StardustElement{ return (_element2); } public function get elementName():String{ return (_name); } } }//package idv.cjcat.stardust.common.errors
Section 125
//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 126
//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 PARTICLES_REMOVED:String = "stardustEmitterParticleRemoved"; public static const STEPPED:String = "stardustEmitterStepped"; 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 127
//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 128
//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 129
//Initializer (idv.cjcat.stardust.common.initializers.Initializer) package idv.cjcat.stardust.common.initializers { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.events.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.*; public class Initializer extends StardustElement implements InfoRecycler { public var active:Boolean; private var _priority:int; protected var _supports2D:Boolean; protected var _supports3D:Boolean; public function Initializer(){ _supports2D = (_supports3D = true); priority = CommonInitializerPriority.getInstance().getPriority((Object(this).constructor as Class)); active = true; } public function get supports2D():Boolean{ return (_supports2D); } public function get supports3D():Boolean{ return (_supports3D); } 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(); }; }; } public function initialize(_arg1:Particle):void{ } public function get priority():int{ return (_priority); } public function set priority(_arg1:int):void{ _priority = _arg1; dispatchEvent(new InitializerEvent(InitializerEvent.PRIORITY_CHANGE, this)); } public function recycleInfo(_arg1:Particle):void{ } public function needsRecycle():Boolean{ return (false); } override public function getXMLTagName():String{ return ("Initializer"); } override public function getElementTypeXMLTag():XML{ return (<initializers/> ); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@active = active; return (_local1); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@active.length()){ active = (_arg1.@active == "true"); }; } } }//package idv.cjcat.stardust.common.initializers
Section 130
//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 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)); } final public function clearInitializers():void{ var _local1:Initializer; for each (_local1 in initializers) { removeInitializer(_local1); }; } } }//package idv.cjcat.stardust.common.initializers
Section 131
//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 132
//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 133
//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); } public function set random(_arg1:Random):void{ if (!_arg1){ _arg1 = new UniformRandom(0, 0); }; _random = _arg1; } override public function getRelatedObjects():Array{ return ([_random]); } override public function getXMLTagName():String{ return ("Life"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@random = _random.name; return (_local1); } 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); }; } } }//package idv.cjcat.stardust.common.initializers
Section 134
//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 get mask():int{ return (_mask); } public function set mask(_arg1:int):void{ if (_arg1 < 0){ _arg1 = 0; }; _mask = _arg1; } override public function getXMLTagName():String{ return ("Mask"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@mask = mask; return (_local1); } 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 135
//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 random():Number{ return (0.5); } public function setRange(_arg1:Number, _arg2:Number):void{ } public function getRange():Array{ return ([0.5, 0.5]); } override public function getXMLTagName():String{ return ("Random"); } override public function getElementTypeXMLTag():XML{ return (<randoms/> ); } } }//package idv.cjcat.stardust.common.math
Section 136
//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 DEGREE_TO_RADIAN:Number = 0.0174532925199433; public static const RADIAN_TO_DEGREE:Number = 57.2957795130823; public static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{ if (_arg1 < _arg2){ return (_arg2); }; if (_arg1 > _arg3){ return (_arg3); }; return (_arg1); } 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 = (_arg1 % _arg2); return (((_local3)<0) ? (_local3 + _arg2) : _local3); } public static function randomFloor(_arg1:Number):int{ var _local2 = (_arg1 | 0); return ((_local2 + int((((_arg1 - _local2))>Math.random()) ? 1 : 0))); } } }//package idv.cjcat.stardust.common.math
Section 137
//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 center:Number; public var radius:Number; public function UniformRandom(_arg1:Number=0.5, _arg2:Number=0){ this.center = _arg1; this.radius = _arg2; } override public function random():Number{ if (radius){ return ((((radius * 2) * (Math.random() - 0.5)) + center)); }; return (center); } override public function setRange(_arg1:Number, _arg2:Number):void{ var _local3:Number = (_arg2 - _arg1); radius = (0.5 * _local3); center = (_arg1 + radius); } override public function getRange():Array{ return ([(center - radius), (center + radius)]); } override public function getXMLTagName():String{ return ("UniformRandom"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@center = center; _local1.@radius = radius; return (_local1); } 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); }; } } }//package idv.cjcat.stardust.common.math
Section 138
//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 139
//Particle (idv.cjcat.stardust.common.particles.Particle) package idv.cjcat.stardust.common.particles { import flash.utils.*; public class Particle { public var initLife:Number; public var initScale:Number; public var initAlpha:Number; public var life:Number; public var scale:Number; public var alpha:Number; public var mass:Number; public var mask:int; public var isDead:Boolean; public var collisionRadius:Number; public var target; public var color:uint; public var sortedIndexIterator:ParticleIterator; public var dictionary:Dictionary; public var recyclers:Dictionary; public function Particle(){ dictionary = new Dictionary(); recyclers = new Dictionary(); } 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; } public function destroy():void{ var _local1:*; target = null; for (_local1 in dictionary) { delete dictionary[_local1]; }; for (_local1 in recyclers) { delete recyclers[_local1]; }; } } }//package idv.cjcat.stardust.common.particles
Section 140
//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; override public function sort(_arg1:ParticleList):void{ _arg1.head = mergeSort(_arg1.head); } private function mergeSort(_arg1:ParticleNode):ParticleNode{ var _local3:ParticleNode; var _local4:ParticleNode; var _local5:ParticleNode; var _local6:ParticleNode; var _local8:int; var _local9:int; var _local10:int; var _local11:int; if (!_arg1){ return (null); }; var _local2:ParticleNode = _arg1; var _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); } public static function getInstance():Particle2DListSorter{ if (!_instance){ _instance = new (Particle2DListSorter); }; return (_instance); } } }//package idv.cjcat.stardust.common.particles
Section 141
//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; override public function sort(_arg1:ParticleList):void{ _arg1.head = mergeSort(_arg1.head); } private function mergeSort(_arg1:ParticleNode):ParticleNode{ var _local3:ParticleNode; var _local4:ParticleNode; var _local5:ParticleNode; var _local6:ParticleNode; var _local8:int; var _local9:int; var _local10:int; var _local11:int; if (!_arg1){ return (null); }; var _local2:ParticleNode = _arg1; var _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); } public static function getInstance():Particle3DListSorter{ if (!_instance){ _instance = new (Particle3DListSorter); }; return (_instance); } } }//package idv.cjcat.stardust.common.particles
Section 142
//ParticleCollection (idv.cjcat.stardust.common.particles.ParticleCollection) package idv.cjcat.stardust.common.particles { public interface ParticleCollection { function add(_arg1:Particle):void; function getIterator():ParticleIterator; function sort():void; function get size():int; } }//package idv.cjcat.stardust.common.particles
Section 143
//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 createParticles(_arg1:int):ParticleList{ var _local4:Initializer; var _local5:Particle; var _local2:ParticleList = new ParticleList(); var _local3:int; while (_local3 < _arg1) { _local5 = createNewParticle(); _local5.init(); _local2.add(_local5); _local3++; }; for each (_local4 in initializerCollection.initializers) { _local4.doInitialize(_local2); }; return (_local2); } protected function createNewParticle():Particle{ return (new Particle()); } public function addInitializer(_arg1:Initializer):void{ initializerCollection.addInitializer(_arg1); } final public function removeInitializer(_arg1:Initializer):void{ initializerCollection.removeInitializer(_arg1); } final public function clearInitializers():void{ initializerCollection.clearInitializers(); } } }//package idv.cjcat.stardust.common.particles
Section 144
//ParticleIterator (idv.cjcat.stardust.common.particles.ParticleIterator) package idv.cjcat.stardust.common.particles { public interface ParticleIterator { function get particle():Particle; function reset():void; function next():void; function clone():ParticleIterator; function dump(_arg1:ParticleIterator):ParticleIterator; function remove():void; } }//package idv.cjcat.stardust.common.particles
Section 145
//ParticleList (idv.cjcat.stardust.common.particles.ParticleList) package idv.cjcat.stardust.common.particles { import idv.cjcat.stardust.*; public class ParticleList implements ParticleCollection { sd var sorter:ParticleListSorter; var count:int; var head:ParticleNode; var tail:ParticleNode; private var node:ParticleNode; 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 add(_arg1:Particle):void{ node = createNode(_arg1); if (head){ tail.next = node; node.prev = tail; tail = node; } else { head = (tail = node); }; count++; } protected function createNode(_arg1:Particle):ParticleNode{ return (new ParticleNode(_arg1)); } public function clear():void{ var _local1:ParticleNode; var _local2:ParticleListIterator = (getIterator() as ParticleListIterator); while ((_local1 = _local2.node)) { ParticleNodePool.recycle(_local1); _local2.next(); }; head = (tail = null); count = 0; } public function getIterator():ParticleIterator{ return (new ParticleListIterator(this)); } public function get size():int{ return (count); } public function isEmpty():Boolean{ return ((count == 0)); } public function sort():void{ sorter.sort(this); } } }//package idv.cjcat.stardust.common.particles
Section 146
//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 reset():void{ if (list){ node = list.head; }; } public function next():void{ if (node){ node = node.next; }; } public function get particle():Particle{ if (node){ return (node.particle); }; return (null); } 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--; }; } public function clone():ParticleIterator{ var _local1:ParticleListIterator = new ParticleListIterator(list); _local1.node = node; return (_local1); } public function dump(_arg1:ParticleIterator):ParticleIterator{ var _local2:ParticleListIterator = (_arg1 as ParticleListIterator); if (_local2){ _local2.list = list; _local2.node = node; }; return (_arg1); } } }//package idv.cjcat.stardust.common.particles
Section 147
//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 get(_arg1:ParticleList):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++; var _local2:ParticleListIterator = (_vec[(_position - 1)] as ParticleListIterator); _local2.list = _arg1; return (_local2); } public static function recycle(_arg1:ParticleListIterator):void{ if (_position == 0){ return; }; _arg1.list = null; _arg1.node = null; _vec[(_position - 1)] = _arg1; if (_position){ _position--; }; } } }//package idv.cjcat.stardust.common.particles
Section 148
//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 149
//ParticleNode (idv.cjcat.stardust.common.particles.ParticleNode) package idv.cjcat.stardust.common.particles { import idv.cjcat.stardust.common.particles.*; class ParticleNode { var next:ParticleNode; var prev:ParticleNode; var particle:Particle; function ParticleNode(_arg1:Particle=null){ this.particle = _arg1; } } }//package idv.cjcat.stardust.common.particles
Section 150
//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 get(_arg1:Particle):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++; var _local2:ParticleNode = (_vec[(_position - 1)] as ParticleNode); _local2.particle = _arg1; return (_local2); } public static function recycle(_arg1:ParticleNode):void{ if (_position == 0){ return; }; _arg1.particle = null; _arg1.next = null; _vec[(_position - 1)] = _arg1; if (_position){ _position--; }; } } }//package idv.cjcat.stardust.common.particles
Section 151
//ParticlePool (idv.cjcat.stardust.common.particles.ParticlePool) package idv.cjcat.stardust.common.particles { import idv.cjcat.stardust.*; public class ParticlePool { sd var particleClass:Class; private var _array:Array; private var _position:int; private static var _instance:ParticlePool; public function ParticlePool(){ _array = [createNewParticle()]; _position = 0; } 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)); } final public function recycle(_arg1:Particle):void{ if (_position == 0){ return; }; _array[(_position - 1)] = _arg1; if (_position){ _position--; }; } public static function getInstance():ParticlePool{ if (!_instance){ _instance = new (ParticlePool); }; return (_instance); } } }//package idv.cjcat.stardust.common.particles
Section 152
//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 153
//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 154
//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 particlesAdded(_arg1:EmitterEvent):void{ } protected function particlesRemoved(_arg1:EmitterEvent):void{ } protected function render(_arg1:EmitterEvent):void{ } 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 removeEmitter(_arg1:Emitter):void{ var _local2:int = _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); }; } final public function clearEmitters():void{ var _local1:Emitter; for each (_local1 in _emitters) { removeEmitter(_local1); }; } final public function get numParticles():int{ var _local2:Emitter; var _local1:int; for each (_local2 in _emitters) { _local1 = (_local1 + _local2.numParticles); }; return (_local1); } override public function getRelatedObjects():Array{ return (_emitters); } override public function getXMLTagName():String{ return ("Renderer"); } override public function getElementTypeXMLTag():XML{ return (<renderers/> ); } override public function toXML():XML{ var _local2:Emitter; var _local1:XML = super.toXML(); if (_emitters.length > 0){ _local1.appendChild(<emitters/> ); for each (_local2 in _emitters) { _local1.emitters.appendChild(_local2.getXMLTag()); }; }; return (_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 155
//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 156
//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 157
//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.common.errors.*; import idv.cjcat.stardust.*; 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 registerClass(_arg1:Class):void{ var _local2:StardustElement = (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 registerClasses(_arg1:Array):void{ var _local2:Class; for each (_local2 in _arg1) { registerClass(_local2); }; } public function registerClassesFromClassPackage(_arg1:ClassPackage):void{ registerClasses(_arg1.getClasses()); } public function unregisterClass(_arg1:String):void{ delete elementClasses[_arg1]; } public function getElementByName(_arg1:String):StardustElement{ if (elements[_arg1] == undefined){ throw (new IllegalOperationError(("Element not found: " + _arg1))); }; return (elements[_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); }; } public static function buildXML(_arg1:StardustElement):XML{ var _local6:XML; var _local7:XML; var _local2:Dictionary = new Dictionary(); var _local3:XML = <StardustParticleSystem/> ; _local3.@version = Stardust.VERSION; var _local4:Dictionary = new Dictionary(); traverseRelatedObjects(_arg1, _local4); var _local5:Array = []; 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 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); } 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 158
//XMLConvertible (idv.cjcat.stardust.common.xml.XMLConvertible) package idv.cjcat.stardust.common.xml { public interface XMLConvertible { function toXML():XML; function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void; } }//package idv.cjcat.stardust.common.xml
Section 159
//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 = 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 getRelatedObjects():Array{ return ([]); } public function getXMLTagName():String{ return ("StardustElement"); } final public function getXMLTag():XML{ var _local1:XML = XML((("<" + getXMLTagName()) + "/>")); _local1.@name = name; return (_local1); } public function getElementTypeXMLTag():XML{ return (<elements/> ); } public function toXML():XML{ var _local1:XML = getXMLTag(); return (_local1); } public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ name = _arg1.@name; } } }//package idv.cjcat.stardust.common
Section 160
//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 x:Number; public var y:Number; public var z:Number; public var screenX:Number; public var screenY:Number; public var vx:Number; public var vy:Number; public var vz:Number; public var screenVX:Number; public var screenVY:Number; public var rotationX:Number; public var rotationY:Number; public var rotationZ:Number; public var omegaX:Number; public var omegaY:Number; public var omegaZ: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 161
//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 162
//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.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 testTrigger(_arg1:Emitter, _arg2:Particle, _arg3:Number):Boolean{ return (Boolean(_arg2.dictionary[deflector])); } override public function getRelatedObjects():Array{ return ([deflector]); } override public function getXMLTagName():String{ return ("DeflectorTrigger"); } override public function toXML():XML{ var _local1:XML = super.toXML(); if (deflector){ _local1.@deflector = deflector.name; }; return (_local1); } 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 163
//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.emitters.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.twoD.zones.*; import idv.cjcat.stardust.twoD.particles.*; public class ZoneTrigger extends ActionTrigger2D { private var _zone:Zone; public function ZoneTrigger(_arg1:Zone=null){ this.zone = _arg1; } public function get zone():Zone{ return (_zone); } public function set zone(_arg1:Zone):void{ if (!_arg1){ _arg1 = new SinglePoint(0, 0); }; _zone = _arg1; } override public function testTrigger(_arg1:Emitter, _arg2:Particle, _arg3:Number):Boolean{ var _local4:Particle2D = (_arg2 as Particle2D); return (_zone.contains(_local4.x, _local4.y)); } override public function getRelatedObjects():Array{ return ([_zone]); } override public function getXMLTagName():String{ return ("ZoneTrigger"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@zone = _zone.name; return (_local1); } 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 164
//Accelerate (idv.cjcat.stardust.twoD.actions.Accelerate) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 _local5:Vec2D; var _local4:Particle2D = (_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 getXMLTagName():String{ return ("Accelerate"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@acceleration = acceleration; return (_local1); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@acceleration.length()){ acceleration = parseFloat(_arg1.@acceleration); }; } } }//package idv.cjcat.stardust.twoD.actions
Section 165
//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 166
//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 167
//Collide (idv.cjcat.stardust.twoD.actions.Collide) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 _local6:Number; var _local7:Particle; var _local3:ParticleCollection = _arg1.sd::particles; if (_local3.size <= 1){ return; }; var _local4:Number = 0; var _local5:Number = 0; var _local8:ParticleIterator = _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 protected function doMutualAction(_arg1:Particle2D, _arg2:Particle2D, _arg3:Number):void{ var _local4:Number = (_arg1.x - _arg2.x); var _local5:Number = (_arg1.y - _arg2.y); var _local6:Number = (_arg1.collisionRadius * _arg1.scale); var _local7:Number = (_arg2.collisionRadius * _arg2.scale); var _local8:Number = (_local6 + _local7); if (((_local4 * _local4) + (_local5 * _local5)) > (_local8 * _local8)){ return; }; var _local9:Vec2D = Vec2DPool.get(_local4, _local5); var _local10:Number = (1 / _local8); var _local11:Number = (((_arg1.x * _local7) + (_arg2.x * _local6)) * _local10); var _local12:Number = (((_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); var _local13:Number = (_arg1.mass * _arg1.scale); var _local14:Number = (_arg2.mass * _arg2.scale); var _local15:Number = (1 / (_local13 + _local14)); var _local16:Vec2D = Vec2DPool.get(_arg1.vx, _arg1.vy); var _local17:Vec2D = Vec2DPool.get(_arg2.vx, _arg2.vy); _local16.projectThis(_local9); _local17.projectThis(_local9); var _local18:Vec2D = Vec2DPool.get((_arg1.vx - _local16.x), (_arg1.vy - _local16.y)); var _local19:Vec2D = Vec2DPool.get((_arg2.vx - _local17.x), (_arg2.vy - _local17.y)); var _local20:Vec2D = Vec2DPool.get((_local16.x - _local17.x), (_local16.y - _local17.y)); var _local21:Number = (_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); } override public function getXMLTagName():String{ return ("Collide"); } } }//package idv.cjcat.stardust.twoD.actions
Section 168
//Damping (idv.cjcat.stardust.twoD.actions.Damping) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 preUpdate(_arg1:Emitter, _arg2:Number):void{ damp = 1; if (damping){ damp = Math.pow((1 - damping), _arg2); }; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D = (_arg2 as Particle2D); (_arg2 as Particle2D).vx = (_local4.vx * damp); _local4.vy = (_local4.vy * damp); } override public function getXMLTagName():String{ return ("Damping"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@damping = damping; return (_local1); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@damping.length()){ damping = parseFloat(_arg1.@damping); }; } } }//package idv.cjcat.stardust.twoD.actions
Section 169
//DeathZone (idv.cjcat.stardust.twoD.actions.DeathZone) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.twoD.zones.*; 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{ if (!zone){ return; }; var _local4:Particle2D = (_arg2 as Particle2D); var _local5:Boolean = zone.contains(_local4.x, _local4.y); if (inverted){ _local5 = !(_local5); }; if (_local5){ _arg2.isDead = true; }; } override public function getRelatedObjects():Array{ if (!zone){ return ([]); }; return ([zone]); } override public function getXMLTagName():String{ return ("DeathZone"); } override public function toXML():XML{ var _local1:XML = super.toXML(); if (!zone){ _local1.@zone = "null"; } else { _local1.@zone = zone.name; }; _local1.@inverted = inverted; return (_local1); } 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"); }; } } }//package idv.cjcat.stardust.twoD.actions
Section 170
//Deflect (idv.cjcat.stardust.twoD.actions.Deflect) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 { sd var deflectors:Array; private var p2D:Particle2D; private var md4D:MotionData4D; private var deflector:Deflector; public function Deflect(){ deflectors = []; } public function addDeflector(_arg1:Deflector):void{ if (deflectors.indexOf(_arg1) < 0){ deflectors.push(_arg1); }; } public function removeDeflector(_arg1:Deflector):void{ var _local2:int = deflectors.indexOf(_arg1); if (_local2 >= 0){ deflectors.splice(_local2, 1); }; } public function clearDeflectors():void{ deflectors = []; } 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 getXMLTagName():String{ return ("Deflect"); } override public function toXML():XML{ var _local2:Deflector; var _local1:XML = super.toXML(); if (deflectors.length > 0){ _local1.appendChild(<deflectors/> ); for each (_local2 in deflectors) { _local1.deflectors.appendChild(_local2.getXMLTag()); }; }; return (_local1); } 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 171
//Gravity (idv.cjcat.stardust.twoD.actions.Gravity) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 { sd var fields:Array; private var p2D:Particle2D; private var md2D:MotionData2D; private var field:Field; public function Gravity(){ fields = []; } public function addField(_arg1:Field):void{ if (fields.indexOf(_arg1) < 0){ fields.push(_arg1); }; } public function removeField(_arg1:Field):void{ var _local2:int = fields.indexOf(_arg1); if (_local2 >= 0){ fields.splice(_local2, 1); }; } public function clearFields():void{ fields = []; } 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); }; }; } override public function getRelatedObjects():Array{ return (fields); } override public function getXMLTagName():String{ return ("Gravity"); } override public function toXML():XML{ var _local2:Field; var _local1:XML = super.toXML(); if (fields.length > 0){ _local1.appendChild(<fields/> ); for each (_local2 in fields) { _local1.fields.appendChild(_local2.getXMLTag()); }; }; return (_local1); } 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)); }; } } }//package idv.cjcat.stardust.twoD.actions
Section 172
//Move (idv.cjcat.stardust.twoD.actions.Move) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 preUpdate(_arg1:Emitter, _arg2:Number):void{ factor = (_arg2 * multiplier); } 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 getXMLTagName():String{ return ("Move"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@multiplier = multiplier; return (_local1); } 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 173
//MutualAction (idv.cjcat.stardust.twoD.actions.MutualAction) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.twoD.particles.*; public class MutualAction extends Action2D { public var maxDistance:Number; private var j:ParticleListIterator; public function MutualAction(){ j = new ParticleListIterator(); super(); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local5:Particle2D; var _local4:Particle2D = (_arg2 as Particle2D); var _local6:ParticleIterator = _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(); }; } protected function doMutualAction(_arg1:Particle2D, _arg2:Particle2D, _arg3:Number):void{ } final override public function get needsSortedParticles():Boolean{ return (active); } override public function getXMLTagName():String{ return ("MutualAction"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@maxDistance = maxDistance; return (_local1); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@maxDistance.length()){ maxDistance = parseFloat(_arg1.@maxDistance); }; } } }//package idv.cjcat.stardust.twoD.actions
Section 174
//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 strength:Number; public var epsilon:Number; public var attenuationPower:Number; public var massless:Boolean; 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 protected function doMutualAction(_arg1:Particle2D, _arg2:Particle2D, _arg3:Number):void{ var _local8:Number; var _local4:Number = (_arg1.x - _arg2.x); var _local5:Number = (_arg1.y - _arg2.y); var _local6:Number = Math.sqrt(((_local4 * _local4) + (_local5 * _local5))); if (_local6 < epsilon){ _local6 = epsilon; }; var _local7:Vec2D = 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 getXMLTagName():String{ return ("MutualGravity"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@strength = strength; _local1.@epsilon = epsilon; _local1.@attenuationPower = attenuationPower; _local1.@massless = massless; return (_local1); } 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 175
//Oriented (idv.cjcat.stardust.twoD.actions.Oriented) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.math.*; import idv.cjcat.stardust.twoD.particles.*; public class Oriented extends Action2D { public var factor:Number; public var offset:Number; private var f:Number; private var os:Number; public function Oriented(_arg1:Number=1, _arg2:Number=0){ this.factor = _arg1; this.offset = _arg2; } override public function preUpdate(_arg1:Emitter, _arg2:Number):void{ f = Math.pow(factor, (1 / _arg2)); os = (offset + 90); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D = (_arg2 as Particle2D); var _local5:Number = (((Math.atan2(_local4.vy, _local4.vx) * StardustMath.RADIAN_TO_DEGREE) + os) - _local4.rotation); _local4.rotation = (_local4.rotation + (f * _local5)); } override public function getXMLTagName():String{ return ("Oriented"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@factor = factor; _local1.@offset = offset; return (_local1); } 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 176
//Snapshot (idv.cjcat.stardust.twoD.actions.Snapshot) package idv.cjcat.stardust.twoD.actions { import flash.events.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.twoD.particles.*; public class Snapshot extends Action2D { private var _snapshotTaken:Boolean;// = true public function takeSnapshot(_arg1:Event=null):void{ _snapshotTaken = false; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D = (_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"); } } }//package idv.cjcat.stardust.twoD.actions
Section 177
//SnapshotData (idv.cjcat.stardust.twoD.actions.SnapshotData) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.twoD.particles.*; class SnapshotData { public var x:Number; public var y:Number; public var rotation:Number; public var scale: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 178
//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.emitters.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.math.*; import idv.cjcat.stardust.twoD.particles.*; import idv.cjcat.stardust.common.easing.*; import idv.cjcat.stardust.twoD.events.*; public class SnapshotRestore extends Action2D { public var flags:int; private var _duration:Random; private var _curve:Function; private var _started:Boolean;// = false private var _started2:Boolean;// = false private var _counter:Number; private var _maxDuration:Number; private var _durationKey:Object; public function SnapshotRestore(_arg1:Random=null, _arg2:int=1, _arg3:Function=null){ _durationKey = {}; super(); this.duration = _arg1; this.flags = _arg2; this.curve = _arg3; } public function start(_arg1:Event=null):void{ _started = true; _started2 = true; _counter = 0; _maxDuration = _duration.getRange()[1]; } public function get duration():Random{ return (_duration); } public function set duration(_arg1:Random):void{ if (!_arg1){ _arg1 = new UniformRandom(0, 0); }; _duration = _arg1; } override public function preUpdate(_arg1:Emitter, _arg2:Number):void{ _counter = (_counter + _arg2); _counter = StardustMath.clamp(_counter, 0, _maxDuration); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ if (!_started){ skipThisAction = true; return; }; var _local4:Particle2D = (_arg2 as Particle2D); if (!_local4.dictionary[Snapshot]){ return; }; if (_started2){ _local4.dictionary[SnapshotRestore] = new SnapshotData(_local4); _local4.dictionary[_durationKey] = _duration.random(); }; var _local5:SnapshotData = (_local4.dictionary[SnapshotRestore] as SnapshotData); var _local6:SnapshotData = (_local4.dictionary[Snapshot] as SnapshotData); var _local7:Number = _local4.dictionary[_durationKey]; var _local8:Number = 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 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 curve():Function{ return (_curve); } public function set curve(_arg1:Function):void{ if (_arg1 == null){ _arg1 = Linear.easeOut; }; _curve = _arg1; } override public function getRelatedObjects():Array{ return ([_duration]); } override public function getXMLTagName():String{ return ("SnapshotRestore"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@duration = duration.name; _local1.@flags = flags; _local1.@curve = EasingFunctionType.functions[curve]; return (_local1); } 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()]; }; } } }//package idv.cjcat.stardust.twoD.actions
Section 179
//SnapshotRestoreFlag (idv.cjcat.stardust.twoD.actions.SnapshotRestoreFlag) package idv.cjcat.stardust.twoD.actions { public class SnapshotRestoreFlag { public static const POSITION:int = 1; public static const ROTATION:int = (1 << 2); public static const SCALE:int = (1 << 3); public static const ALL:int = ((POSITION | ROTATION) | SCALE); } }//package idv.cjcat.stardust.twoD.actions
Section 180
//Spin (idv.cjcat.stardust.twoD.actions.Spin) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 preUpdate(_arg1:Emitter, _arg2:Number):void{ factor = (_arg2 * multiplier); } 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 getXMLTagName():String{ return ("Spin"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@multiplier = multiplier; return (_local1); } 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 181
//VelocityField (idv.cjcat.stardust.twoD.actions.VelocityField) package idv.cjcat.stardust.twoD.actions { import idv.cjcat.stardust.common.xml.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; 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 _local5:MotionData2D; if (!field){ return; }; var _local4:Particle2D = (_arg2 as Particle2D); _local5 = field.getMotionData2D(_local4); _local4.vx = _local5.x; _local4.vy = _local5.y; MotionData2DPool.recycle(_local5); } override public function getRelatedObjects():Array{ if (field != null){ return ([field]); }; return ([]); } override public function getXMLTagName():String{ return ("VelocityField"); } override public function toXML():XML{ var _local1:XML = super.toXML(); if (!field){ _local1.@field = "null"; } else { _local1.@field = field.name; }; return (_local1); } 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); }; }; } } }//package idv.cjcat.stardust.twoD.actions
Section 182
//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 active:Boolean; public var bounce:Number; public function Deflector(){ active = true; bounce = 0.8; } final public function getMotionData4D(_arg1:Particle2D):MotionData4D{ if (active){ return (calculateMotionData4D(_arg1)); }; return (null); } protected function calculateMotionData4D(_arg1:Particle2D):MotionData4D{ return (null); } override public function getXMLTagName():String{ return ("Deflector"); } override public function getElementTypeXMLTag():XML{ return (<deflectors/> ); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@active = active; _local1.@bounce = bounce; return (_local1); } 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 183
//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 184
//IStardustSprite (idv.cjcat.stardust.twoD.display.IStardustSprite) package idv.cjcat.stardust.twoD.display { import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; public interface IStardustSprite { function init(_arg1:Particle):void; function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void; function disable():void; } }//package idv.cjcat.stardust.twoD.display
Section 185
//Emitter2D (idv.cjcat.stardust.twoD.emitters.Emitter2D) package idv.cjcat.stardust.twoD.emitters { import flash.utils.*; import idv.cjcat.stardust.common.emitters.*; import idv.cjcat.stardust.common.particles.*; import idv.cjcat.stardust.common.actions.*; import idv.cjcat.stardust.common.initializers.*; import idv.cjcat.stardust.common.clocks.*; 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 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); } 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"); } } }//package idv.cjcat.stardust.twoD.emitters
Section 186
//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 187
//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 188
//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 md2D:MotionData2D; private var mass_inv:Number; public function Field(){ active = true; massless = true; } 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 getXMLTagName():String{ return ("Field"); } override public function getElementTypeXMLTag():XML{ return (<fields/> ); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@active = active; _local1.@massless = massless; return (_local1); } 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 189
//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 190
//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 get(_arg1:Number=0, _arg2:Number=0):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++; var _local3:MotionData2D = (_vec[(_position - 1)] as MotionData2D); _local3.x = _arg1; _local3.y = _arg2; return (_local3); } public static function recycle(_arg1:MotionData2D):void{ if (_position == 0){ return; }; if (!_arg1){ return; }; _vec[(_position - 1)] = _arg1; if (_position){ _position--; }; } } }//package idv.cjcat.stardust.twoD.geom
Section 191
//MotionData4D (idv.cjcat.stardust.twoD.geom.MotionData4D) package idv.cjcat.stardust.twoD.geom { public class MotionData4D { public var x:Number; public var y:Number; public var vx:Number; public var vy: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 192
//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 get x():Number{ return (_x); } public function set x(_arg1:Number):void{ _x = _arg1; dispatchEvent(new Vec2DEvent(Vec2DEvent.CHANGE, this)); } public function get y():Number{ return (_y); } public function set y(_arg1:Number):void{ _y = _arg1; dispatchEvent(new Vec2DEvent(Vec2DEvent.CHANGE, this)); } public function clone():Vec2D{ return (new Vec2D(_x, _y)); } public function dot(_arg1:Vec2D):Number{ return (((_x * _arg1._x) + (_y * _arg1._y))); } public function project(_arg1:Vec2D):Vec2D{ var _local2:Vec2D = clone(); _local2.projectThis(_arg1); return (_local2); } public function projectThis(_arg1:Vec2D):void{ var _local2:Vec2D = Vec2DPool.get(_arg1._x, _arg1._y); _local2.length = 1; _local2.length = dot(_local2); _x = _local2._x; _y = _local2._y; Vec2DPool.recycle(_local2); } public function rotate(_arg1:Number, _arg2:Boolean=false):Vec2D{ var _local3:Vec2D = new Vec2D(_x, _y); _local3.rotateThis(_arg1, _arg2); return (_local3); } public function rotateThis(_arg1:Number, _arg2:Boolean=false):void{ if (!_arg2){ _arg1 = (_arg1 * StardustMath.DEGREE_TO_RADIAN); }; var _local3:Number = _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 unitVec():Vec2D{ if (length == 0){ return (new Vec2D()); }; var _local1:Number = (1 / length); return (new Vec2D((_x * _local1), (_y * _local1))); } public function get length():Number{ return (Math.sqrt(((_x * _x) + (_y * _y)))); } public function set length(_arg1:Number):void{ if ((((_x == 0)) && ((_y == 0)))){ return; }; var _local2:Number = (_arg1 / length); _x = (_x * _local2); _y = (_y * _local2); 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 angle():Number{ return ((Math.atan2(_y, _x) * StardustMath.RADIAN_TO_DEGREE)); } public function set angle(_arg1:Number):void{ var _local2:Number = length; var _local3:Number = (_arg1 * StardustMath.DEGREE_TO_RADIAN); _x = (_local2 * Math.cos(_local3)); _y = (_local2 * Math.sin(_local3)); dispatchEvent(new Vec2DEvent(Vec2DEvent.CHANGE, this)); } override public function toString():String{ return (((((("[Vec2D" + " x=") + _x) + " y=") + _y) + "]")); } } }//package idv.cjcat.stardust.twoD.geom
Section 193
//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 get(_arg1:Number=0, _arg2:Number=0):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++; var _local3:Vec2D = (_vec[(_position - 1)] as Vec2D); _local3.x = _arg1; _local3.y = _arg2; return (_local3); } public static function recycle(_arg1:Vec2D):void{ if (_position == 0){ return; }; if (!_arg1){ return; }; _vec[(_position - 1)] = _arg1; if (_position){ _position--; }; } } }//package idv.cjcat.stardust.twoD.geom
Section 194
//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 195
//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{ if (!container){ return; }; var _local2:Particle2D = (_arg1 as Particle2D); var _local3:DisplayObject = (_local2.target as DisplayObject); if (!_local3){ return; }; container.addChild(_local3); } override public function getXMLTagName():String{ return ("DisplayObjectParent"); } } }//package idv.cjcat.stardust.twoD.initializers
Section 196
//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 197
//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 198
//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 _constructorParams:Array; private var _pool:DisplayObjectPool; 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 displayObjectClass():Class{ return (_displayObjectClass); } public function set displayObjectClass(_arg1:Class):void{ _displayObjectClass = _arg1; _pool.reset(_displayObjectClass, _constructorParams); } public function get constructorParams():Array{ return (_constructorParams); } public function set constructorParams(_arg1:Array):void{ _constructorParams = _arg1; _pool.reset(_displayObjectClass, _constructorParams); } override public function recycleInfo(_arg1:Particle):void{ var _local2:DisplayObject = (_arg1.target as DisplayObject); if (_local2){ if ((_local2 is IStardustSprite)){ IStardustSprite(_local2).disable(); }; if ((_local2 is _displayObjectClass)){ _pool.recycle(_local2); }; }; } override public function needsRecycle():Boolean{ return (true); } override public function getXMLTagName():String{ return ("PooledDisplayObjectClass"); } } }//package idv.cjcat.stardust.twoD.initializers
Section 199
//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; } override public function initialize(_arg1:Particle):void{ var _local2:Particle2D = (_arg1 as Particle2D); var _local3:MotionData2D = zone.getPoint(); _local2.x = _local3.x; _local2.y = _local3.y; MotionData2DPool.recycle(_local3); } public function get zone():Zone{ return (_zone); } 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 getXMLTagName():String{ return ("Position"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@zone = zone.name; return (_local1); } 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 200
//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; } override public function initialize(_arg1:Particle):void{ var _local3:MotionData2D; var _local2:Particle2D = (_arg1 as Particle2D); _local3 = zone.getPoint(); _local2.vx = _local3.x; _local2.vy = _local3.y; MotionData2DPool.recycle(_local3); } public function get zone():Zone{ return (_zone); } 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 getXMLTagName():String{ return ("Velocity"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@zone = zone.name; return (_local1); } 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 201
//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 x:Number; public var y:Number; public var vx:Number; public var vy:Number; public var rotation:Number; public var omega: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 202
//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 203
//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 204
//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.events.*; import idv.cjcat.stardust.common.particles.*; 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 addChildMode:int; public var container:DisplayObjectContainer; public var forceParentChange:Boolean; 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 _local4:DisplayObject; if (!container){ return; }; var _local3:ParticleIterator = _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 protected function particlesRemoved(_arg1:EmitterEvent):void{ var _local2:Particle; var _local4:DisplayObject; var _local3:ParticleIterator = _arg1.particles.getIterator(); while ((_local2 = _local3.particle)) { _local4 = (_local2.target as DisplayObject); if (_local4.parent){ DisplayObjectContainer(_local4.parent).removeChild(_local4); }; _local3.next(); }; } override protected function render(_arg1:EmitterEvent):void{ var _local2:Particle2D; var _local4:DisplayObject; var _local3:ParticleIterator = _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 public function getXMLTagName():String{ return ("DisplayObjectRenderer"); } override public function toXML():XML{ var _local1:XML = 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 205
//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 _class:Class; private var _params:Array; private var _vec:Array; private var _position:int;// = 0 private var i:int;// = 0 private static var DEFAULT_SIZE:int = 32; public function DisplayObjectPool(){ _vec = []; super(); } public function reset(_arg1:Class, _arg2:Array):void{ _vec = new Array(DEFAULT_SIZE); _class = _arg1; _params = _arg2; var _local3:int; while (_local3 < DEFAULT_SIZE) { _vec[_local3] = construct(_class, _params); _local3++; }; } 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)); } 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); }; }; } } }//package idv.cjcat.stardust.twoD.utils
Section 206
//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 get virtualThickness():Number{ return (_virtualThickness); } final public function set virtualThickness(_arg1:Number):void{ _virtualThickness = _arg1; updateArea(); } override public function getXMLTagName():String{ return ("Contour"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@virtualThickness = virtualThickness; return (_local1); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); if (_arg1.@virtualThickness.length()){ virtualThickness = parseFloat(_arg1.@virtualThickness); }; } } }//package idv.cjcat.stardust.twoD.zones
Section 207
//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 _radius:Number; private var _radiusVar:Number; private var _direction:Vec2D; private var _directionVar: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); } public function set radius(_arg1:Number):void{ _radius = _arg1; updateSector(); } public function get radiusVar():Number{ return (_radiusVar); } public function set radiusVar(_arg1:Number):void{ _radiusVar = _arg1; updateSector(); } public function get direction():Vec2D{ return (_direction); } public function get directionVar():Number{ return (_directionVar); } public function set directionVar(_arg1:Number):void{ _directionVar = _arg1; updateSector(); } public function updateSector(_arg1:Event=null):void{ minRadius = (_radius - _radiusVar); maxRadius = (_radius + _radiusVar); minAngle = (_direction.angle - _directionVar); maxAngle = (_direction.angle + _directionVar); updateArea(); } override public function getXMLTagName():String{ return ("LazySectorZone"); } override public function toXML():XML{ var _local1:XML = getXMLTag(); _local1.@radius = radius; _local1.@radiusVar = radiusVar; _local1.@directionX = direction.x; _local1.@directionY = direction.y; _local1.@directionVar = directionVar; return (_local1); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ 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); }; var _local3:Number = 0; var _local4:Number = 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); } } }//package idv.cjcat.stardust.twoD.zones
Section 208
//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 { public var x:Number; public var y:Number; private var _randomT:Random; private var _minRadius:Number; private var _maxRadius:Number; private var _minAngle:Number; private var _maxAngle:Number; private var _minAngleRad:Number; private var _maxAngleRad:Number; private var _r1SQ:Number; private var _r2SQ: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 minRadius(_arg1:Number):void{ _minRadius = _arg1; updateArea(); } public function get maxRadius():Number{ return (_maxRadius); } public function set maxRadius(_arg1:Number):void{ _maxRadius = _arg1; updateArea(); } public function get minAngle():Number{ return (_minAngle); } public function set minAngle(_arg1:Number):void{ _minAngle = _arg1; updateArea(); } public function get maxAngle():Number{ return (_maxAngle); } public function set maxAngle(_arg1:Number):void{ _maxAngle = _arg1; updateArea(); } override public function calculateMotionData2D():MotionData2D{ if (_maxRadius == 0){ return (new MotionData2D(x, y)); }; _randomT.setRange(_minAngleRad, _maxAngleRad); var _local1:Number = _randomT.random(); var _local2:Number = StardustMath.interpolate(0, _minRadius, 1, _maxRadius, Math.sqrt(Math.random())); return (new MotionData2D(((_local2 * Math.cos(_local1)) + x), ((_local2 * Math.sin(_local1)) + y))); } override protected function updateArea():void{ _minAngleRad = (_minAngle * StardustMath.DEGREE_TO_RADIAN); _maxAngleRad = (_maxAngle * StardustMath.DEGREE_TO_RADIAN); var _local1:Number = (_maxAngleRad - _minAngleRad); _r1SQ = (_minRadius * _minRadius); _r2SQ = (_maxRadius * _maxRadius); var _local2:Number = (_r2SQ - _r1SQ); area = Math.abs((_local2 * _local1)); } override public function contains(_arg1:Number, _arg2:Number):Boolean{ return (false); } override public function getRelatedObjects():Array{ return ([]); } override public function getXMLTagName():String{ return ("SectorZone"); } override public function toXML():XML{ var _local1:XML = 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 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); }; } } }//package idv.cjcat.stardust.twoD.zones
Section 209
//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 x:Number; public var y:Number; public function SinglePoint(_arg1:Number=0, _arg2:Number=0){ this.x = _arg1; this.y = _arg2; } override public function contains(_arg1:Number, _arg2:Number):Boolean{ if ((((this.x == _arg1)) && ((this.y == _arg2)))){ return (true); }; return (false); } override public function calculateMotionData2D():MotionData2D{ return (MotionData2DPool.get(x, y)); } override protected function updateArea():void{ area = ((virtualThickness * virtualThickness) * Math.PI); } override public function getXMLTagName():String{ return ("SinglePoint"); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@x = x; _local1.@y = y; return (_local1); } 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); }; } } }//package idv.cjcat.stardust.twoD.zones
Section 210
//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 { public var rotation:Number; protected var area:Number; public function Zone(){ rotation = 0; } protected function updateArea():void{ } public function contains(_arg1:Number, _arg2:Number):Boolean{ return (false); } final public function getPoint():MotionData2D{ var _local2:Vec2D; var _local1:MotionData2D = 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); } public function calculateMotionData2D():MotionData2D{ return (null); } final public function getArea():Number{ return (area); } override public function getXMLTagName():String{ return ("Zone"); } override public function getElementTypeXMLTag():XML{ return (<zones/> ); } override public function toXML():XML{ var _local1:XML = super.toXML(); _local1.@rotation = rotation; return (_local1); } override public function parseXML(_arg1:XML, _arg2:XMLBuilder=null):void{ super.parseXML(_arg1, _arg2); rotation = parseFloat(_arg1.@rotation); } } }//package idv.cjcat.stardust.twoD.zones
Section 211
//sd (idv.cjcat.stardust.sd) package idv.cjcat.stardust { public namespace sd = "http://cjcat.idv/stardust"; }//package idv.cjcat.stardust
Section 212
//Stardust (idv.cjcat.stardust.Stardust) package idv.cjcat.stardust { public class Stardust { public static const AUTHOR:String = "CJ Cat (Allen Chou)"; public static const BLOG:String = "http://cjcat.blogspot.com"; public static const EMAIL:String = "cjcat2266@gmail.com"; 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 PROJECT_NAME:String = "Stardust Particle Engine"; public static const VERSION:String = "1.1.132 Beta"; } }//package idv.cjcat.stardust
Section 213
//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 214
//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"; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); public static var _inventory:MochiInventory; 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); } 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.setContainer(); MochiServices.bringToTop(); MochiServices.send("coins_showStore", {options:_arg1}, null, null); } public static function requestFunding(_arg1:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_requestFunding", _arg1); } 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.setContainer(); 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.setContainer(); MochiServices.bringToTop(); MochiServices.send("coins_showVideo", {options:_arg1}, null, null); } addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{ _inventory = new MochiInventory(); }); addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{ _inventory = null; }); } }//package mochi.as3
Section 215
//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 216
//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 217
//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 218
//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) && (_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 + KEY_SALT)].value); }; 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 219
//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 220
//MochiServices (mochi.as3.MochiServices) package mochi.as3 { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import flash.net.*; import flash.system.*; public class MochiServices { public static const CONNECTED:String = "onConnected"; 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; private static var _nextCallbackID:Number; private static var _clip:MovieClip; private static var _loader:Loader; 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 _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); 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); }; } 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); } private static function detach(_arg1:Event):void{ var _local2:LoaderInfo = LoaderInfo(_arg1.target); _local2.removeEventListener(Event.COMPLETE, detach); _local2.removeEventListener(IOErrorEvent.IO_ERROR, detach); _local2.removeEventListener(Event.COMPLETE, loadLCBridgeComplete); _local2.removeEventListener(IOErrorEvent.IO_ERROR, loadError); } public static function stayOnTop():void{ _container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true); if (_clip != null){ _clip.visible = true; }; } private static function loadLCBridgeComplete(_arg1:Event):void{ var _local2:Loader = LoaderInfo(_arg1.target).loader; _mochiLocalConnection = MovieClip(_local2.content); listen(); } 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(); _timer.removeEventListener(TimerEvent.TIMER, connectWait); _timer = null; } 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.9.2 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 "services": MochiServices.triggerEvent(_arg1.event, _arg1.args); break; case "events": MochiEvents.triggerEvent(_arg1.event, _arg1.args); break; case "coins": MochiCoins.triggerEvent(_arg1.event, _arg1.args); break; case "social": MochiSocial.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 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://link.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 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"); } public static function get childClip():Object{ return (_clip); } 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()); }; }; } 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); } 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 addEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.addEventListener(_arg1, _arg2); } private static function loadLCBridge(_arg1:Object):void{ var _local2:Loader = new Loader(); var _local3:String = (_servURL + _mochiLC); var _local4:URLRequest = new URLRequest(_local3); _local2.contentLoaderInfo.addEventListener(Event.COMPLETE, detach); _local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach); _local2.contentLoaderInfo.addEventListener(Event.COMPLETE, loadLCBridgeComplete); _local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError); _local2.load(_local4); _arg1.addChild(_local2); } 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(Event.COMPLETE, detach); _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach); _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 get clip():Object{ return (_container); } 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 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"); } else { _timer.stop(); _timer.removeEventListener(TimerEvent.TIMER, connectWait); _timer = null; }; } } }//package mochi.as3
Section 221
//MochiSocial (mochi.as3.MochiSocial) package mochi.as3 { public class MochiSocial { public static const LOGGED_IN:String = "LoggedIn"; public static const ACTION_CANCELED:String = "onCancel"; public static const PROPERTIES_SIZE:String = "PropertiesSize"; public static const IO_ERROR:String = "IOError"; public static const NO_USER:String = "NoUser"; public static const FRIEND_LIST:String = "FriendsList"; public static const PROFILE_DATA:String = "ProfileData"; public static const GAMEPLAY_DATA:String = "GameplayData"; public static const ACTION_COMPLETE:String = "onComplete"; public static const LOGIN_SHOW:String = "LoginShow"; public static const PROFILE_HIDE:String = "ProfileHide"; public static const USER_INFO:String = "UserInfo"; public static const PROPERTIES_SAVED:String = "PropertySaved"; public static const WIDGET_LOADED:String = "WidgetLoaded"; public static const ERROR:String = "Error"; public static const LOGGED_OUT:String = "LoggedOut"; public static const PROFILE_SHOW:String = "ProfileShow"; public static const LOGIN_HIDE:String = "LoginHide"; public static const LOGIN_SHOWN:String = "LoginShown"; public static var _user_info:Object = null; private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher(); public static function requestFan(_arg1:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_requestFan", _arg1); } public static function postToStream(_arg1:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_postToStream", _arg1); } public static function getFriendsList(_arg1:Object=null):void{ MochiServices.send("social_getFriendsList", _arg1); } public static function requestLogin(_arg1:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_requestLogin", _arg1); } public static function getVersion():String{ return (MochiServices.getVersion()); } public static function saveUserProperties(_arg1:Object):void{ MochiServices.send("social_saveUserProperties", _arg1); } 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 inviteFriends(_arg1:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_inviteFriends", _arg1); } public static function get loggedIn():Boolean{ return (!((_user_info == null))); } public static function addEventListener(_arg1:String, _arg2:Function):void{ _dispatcher.addEventListener(_arg1, _arg2); } public static function showLoginWidget(_arg1:Object=null):void{ MochiServices.setContainer(); MochiServices.bringToTop(); MochiServices.send("social_showLoginWidget", {options:_arg1}); } public static function getAPIURL():String{ if (!_user_info){ return (null); }; return (_user_info.api_url); } public static function hideLoginWidget():void{ MochiServices.send("social_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 222
//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 223
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 224
//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 225
//SoundAsset (mx.core.SoundAsset) package mx.core { import flash.media.*; public class SoundAsset extends Sound implements IFlexAsset { mx_internal static const VERSION:String = "3.5.0.12683"; } }//package mx.core
Section 226
//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 227
//IDestroyable (org.casalib.core.IDestroyable) package org.casalib.core { public interface IDestroyable { function destroy():void; function get destroyed():Boolean; } }//package org.casalib.core
Section 228
//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 229
//IRemovableEventDispatcher (org.casalib.events.IRemovableEventDispatcher) package org.casalib.events { import flash.events.*; public interface IRemovableEventDispatcher extends IEventDispatcher { function removeEventsForType(_arg1:String):void; function removeEventsForListener(_arg1:Function):void; function removeEventListeners():void; } }//package org.casalib.events
Section 230
//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 DOWN:String = "down"; public static const RELEASE:String = "release"; public static const SEQUENCE:String = "sequence"; public function KeyComboEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){ super(_arg1, _arg2, _arg3); } public function get keyCombo():KeyCombo{ return (this._keyCombo); } public function set keyCombo(_arg1:KeyCombo):void{ this._keyCombo = _arg1; } 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); } } }//package org.casalib.events
Section 231
//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 _eventDispatcher:IEventDispatcher; protected var _events:Array; protected var _blockRequest:Boolean; protected static var _proxyMap:Dictionary; public function ListenerManager(_arg1:EventInfo, _arg2:IEventDispatcher){ this._eventDispatcher = _arg2; this._events = new Array(); } 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 dispatchEvent(_arg1:Event):Boolean{ return (this._eventDispatcher.dispatchEvent(_arg1)); } public function hasEventListener(_arg1:String):Boolean{ return (this._eventDispatcher.hasEventListener(_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 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 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 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; } override public function destroy():void{ this.removeEventListeners(); delete ListenerManager._proxyMap[this._eventDispatcher]; this._eventDispatcher = null; super.destroy(); } 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 type:String; public var listener:Function; 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 232
//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 _listenerManager:ListenerManager; protected var _isDestroyed:Boolean; 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); } 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); } 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 removeEventsForType(_arg1:String):void{ this._listenerManager.removeEventsForType(_arg1); } public function removeEventsForListener(_arg1:Function):void{ this._listenerManager.removeEventsForListener(_arg1); } public function removeEventListeners():void{ this._listenerManager.removeEventListeners(); } public function get destroyed():Boolean{ return (this._isDestroyed); } public function destroy():void{ this.removeEventListeners(); this._listenerManager.destroy(); this._isDestroyed = true; } } }//package org.casalib.events
Section 233
//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 get percentage():Number{ return ((100 * this._percent)); } public function set percentage(_arg1:Number):void{ this._percent = (_arg1 * 0.01); } public function get decimalPercentage():Number{ return (this._percent); } public function set decimalPercentage(_arg1:Number):void{ this._percent = _arg1; } public function equals(_arg1:Percent):Boolean{ return ((this.decimalPercentage == _arg1.decimalPercentage)); } public function clone():Percent{ return (new Percent(this.decimalPercentage)); } public function toString():String{ return (this.decimalPercentage.toString()); } } }//package org.casalib.math
Section 234
//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 _keysDown:Dictionary; protected var _keysTyped:Array; protected var _combosDown:Array; protected var _combinations:Array; protected var _longestCombo:uint; 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; } 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); } 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; }; } override public function destroy():void{ throw (new Error("Cannot destroy a singleton.")); } 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 _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 _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(); } 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 _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 235
//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 get keyCodes():Array{ return (this._keyCodes.concat()); } public function equals(_arg1:KeyCombo):Boolean{ if (_arg1 == this){ return (true); }; return (ArrayUtil.equals(this.keyCodes, _arg1.keyCodes)); } } }//package org.casalib.ui
Section 236
//ArrayUtil (org.casalib.util.ArrayUtil) package org.casalib.util { public class ArrayUtil { 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 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 removeDuplicates(_arg1:Array):Array{ return (_arg1.filter(ArrayUtil._removeDuplicatesFilter)); } protected static function _removeDuplicatesFilter(_arg1, _arg2:int, _arg3:Array):Boolean{ return (((_arg2)==0) ? true : (_arg3.lastIndexOf(_arg1, (_arg2 - 1)) == -1)); } 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 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 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 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); } 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); } 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); } protected static function _sortRandom(_arg1, _arg2):int{ return ((NumberUtil.randomIntegerWithinRange(0, 1)) ? 1 : -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 average(_arg1:Array):Number{ if (_arg1.length == 0){ return (0); }; return ((ArrayUtil.sum(_arg1) / _arg1.length)); } public static function getLowestValue(_arg1:Array):Number{ return (_arg1[_arg1.sort((16 | 8))[0]]); } public static function getHighestValue(_arg1:Array):Number{ return (_arg1[_arg1.sort((16 | 8))[(_arg1.length - 1)]]); } } }//package org.casalib.util
Section 237
//NumberUtil (org.casalib.util.NumberUtil) package org.casalib.util { import org.casalib.math.*; public class NumberUtil { public static function isEqual(_arg1:Number, _arg2:Number, _arg3:Number=0):Boolean{ return ((Math.abs((_arg1 - _arg2)) <= Math.abs(_arg3))); } 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 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 randomWithinRange(_arg1:Number, _arg2:Number):Number{ return ((_arg1 + (Math.random() * (_arg2 - _arg1)))); } public static function randomIntegerWithinRange(_arg1:int, _arg2:int):int{ return (Math.round(NumberUtil.randomWithinRange(_arg1, _arg2))); } public static function isEven(_arg1:Number):Boolean{ return (((_arg1 & 1) == 0)); } public static function isOdd(_arg1:Number):Boolean{ return (!(NumberUtil.isEven(_arg1))); } 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 roundDecimalToPlace(_arg1:Number, _arg2:uint):Number{ var _local3:Number = Math.pow(10, _arg2); return ((Math.round((_arg1 * _local3)) / _local3)); } 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 isBetween(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{ return (!((((_arg1 < Math.min(_arg2, _arg3))) || ((_arg1 > Math.max(_arg2, _arg3)))))); } 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 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 interpolate(_arg1:Percent, _arg2:Number, _arg3:Number):Number{ return ((_arg2 + ((_arg3 - _arg2) * _arg1.decimalPercentage))); } public static function normalize(_arg1:Number, _arg2:Number, _arg3:Number):Percent{ return (new Percent(((_arg1 - _arg2) / (_arg3 - _arg2)))); } 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 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 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 addLeadingZero(_arg1:Number):String{ return (((_arg1)<10) ? ("0" + _arg1) : _arg1.toString()); } } }//package org.casalib.util
Section 238
//ObjectUtil (org.casalib.util.ObjectUtil) package org.casalib.util { import flash.utils.*; public class ObjectUtil { public static function contains(_arg1:Object, _arg2:Object):Boolean{ var _local3:String; for (_local3 in _arg1) { if (_arg1[_local3] == _arg2){ return (true); }; }; return (false); } public static function clone(_arg1:Object):Object{ var _local2:ByteArray = new ByteArray(); _local2.writeObject(_arg1); _local2.position = 0; return (_local2.readObject()); } 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 isUndefined(_arg1:Object):Boolean{ return ((_arg1 is undefined)); } 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); } } }//package org.casalib.util
Section 239
//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 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 setStage(_arg1:Stage, _arg2:String="stageDefault"):void{ StageReference._getMap()[_arg2] = _arg1; } public static function removeStage(_arg1:String="stageDefault"):Boolean{ if (!(_arg1 in StageReference._getMap())){ return (false); }; StageReference.setStage(null, _arg1); return (true); } public static function getIds():Array{ return (ObjectUtil.getKeys(StageReference._getMap())); } 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); } } }//package org.casalib.util
Section 240
//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 getDefaultPriority():Number; function addedToEmitter(_arg1:Emitter):void; function removedFromEmitter(_arg1:Emitter):void; function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void; } }//package org.flintparticles.common.actions
Section 241
//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 getDefaultPriority():Number{ return (0); } public function addedToEmitter(_arg1:Emitter):void{ } public function removedFromEmitter(_arg1:Emitter):void{ } public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ } } }//package org.flintparticles.common.actions
Section 242
//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; }; } public function get easing():Function{ return (_easing); } public function set easing(_arg1:Function):void{ _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); }; } } }//package org.flintparticles.common.actions
Section 243
//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 _diffAlpha:Number; private var _endAlpha: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 startAlpha(_arg1:Number):void{ _diffAlpha = (_arg1 - _endAlpha); } public function get endAlpha():Number{ return (_endAlpha); } public function set endAlpha(_arg1:Number):void{ _diffAlpha = ((_endAlpha + _diffAlpha) - _arg1); _endAlpha = _arg1; } override public function getDefaultPriority():Number{ return (-5); } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Number = (_endAlpha + (_diffAlpha * _arg2.energy)); _arg2.color = ((_arg2.color & 0xFFFFFF) | (Math.round((_local4 * 0xFF)) << 24)); } } }//package org.flintparticles.common.actions
Section 244
//Activity (org.flintparticles.common.activities.Activity) package org.flintparticles.common.activities { import org.flintparticles.common.emitters.*; public interface Activity { function getDefaultPriority():Number; function addedToEmitter(_arg1:Emitter):void; function removedFromEmitter(_arg1:Emitter):void; function initialize(_arg1:Emitter):void; function update(_arg1:Emitter, _arg2:Number):void; } }//package org.flintparticles.common.activities
Section 245
//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 get startCount():Number{ return (_startCount); } public function set startCount(_arg1:Number):void{ _startCount = _arg1; } public function stop():void{ } public function resume():void{ } public function startEmitter(_arg1:Emitter):uint{ return (_startCount); } public function updateEmitter(_arg1:Emitter, _arg2:Number):uint{ return (0); } } }//package org.flintparticles.common.counters
Section 246
//Counter (org.flintparticles.common.counters.Counter) package org.flintparticles.common.counters { import org.flintparticles.common.emitters.*; public interface Counter { function startEmitter(_arg1:Emitter):uint; function updateEmitter(_arg1:Emitter, _arg2:Number):uint; function stop():void; function resume():void; } }//package org.flintparticles.common.counters
Section 247
//ZeroCounter (org.flintparticles.common.counters.ZeroCounter) package org.flintparticles.common.counters { import org.flintparticles.common.emitters.*; public class ZeroCounter implements Counter { public function startEmitter(_arg1:Emitter):uint{ return (0); } public function updateEmitter(_arg1:Emitter, _arg2:Number):uint{ return (0); } public function stop():void{ } public function resume():void{ } } }//package org.flintparticles.common.counters
Section 248
//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 249
//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 _particleFactory:ParticleFactory; protected var _initializers:PriorityArray; protected var _actions:PriorityArray; protected var _activities:PriorityArray; protected var _particles:Array; protected var _counter:Counter; protected var _useInternalTick:Boolean;// = true protected var _fixedFrameTime:Number;// = 0 protected var _running:Boolean;// = false protected var _started:Boolean;// = false protected var _maximumFrameTime:Number;// = 0.1 public function Emitter(){ _particles = new Array(); _actions = new PriorityArray(); _initializers = new PriorityArray(); _activities = new PriorityArray(); _counter = new ZeroCounter(); } public function get maximumFrameTime():Number{ return (_maximumFrameTime); } public function set maximumFrameTime(_arg1:Number):void{ _maximumFrameTime = _arg1; } public function addInitializer(_arg1:Initializer, _arg2:Number=NaN):void{ if (isNaN(_arg2)){ _arg2 = _arg1.getDefaultPriority(); }; _initializers.add(_arg1, _arg2); _arg1.addedToEmitter(this); } public function removeInitializer(_arg1:Initializer):void{ if (_initializers.remove(_arg1)){ _arg1.removedFromEmitter(this); }; } public function hasInitializer(_arg1:Initializer):Boolean{ return (_initializers.contains(_arg1)); } public function hasInitializerOfType(_arg1:Class):Boolean{ var _local2:uint = _initializers.length; var _local3:uint; while (_local3 < _local2) { if ((_initializers[_local3] is _arg1)){ return (true); }; _local3++; }; return (false); } public function addAction(_arg1:Action, _arg2:Number=NaN):void{ if (isNaN(_arg2)){ _arg2 = _arg1.getDefaultPriority(); }; _actions.add(_arg1, _arg2); _arg1.addedToEmitter(this); } public function removeAction(_arg1:Action):void{ if (_actions.remove(_arg1)){ _arg1.removedFromEmitter(this); }; } public function hasAction(_arg1:Action):Boolean{ return (_actions.contains(_arg1)); } public function hasActionOfType(_arg1:Class):Boolean{ var _local2:uint = _actions.length; var _local3:uint; while (_local3 < _local2) { if ((_actions[_local3] is _arg1)){ return (true); }; _local3++; }; return (false); } public function addActivity(_arg1:Activity, _arg2:Number=NaN):void{ if (isNaN(_arg2)){ _arg2 = _arg1.getDefaultPriority(); }; _activities.add(_arg1, _arg2); _arg1.addedToEmitter(this); } public function removeActivity(_arg1:Activity):void{ if (_activities.remove(_arg1)){ _arg1.removedFromEmitter(this); }; } public function hasActivity(_arg1:Activity):Boolean{ return (_activities.contains(_arg1)); } public function hasActivityOfType(_arg1:Class):Boolean{ var _local2:uint = _activities.length; var _local3:uint; while (_local3 < _local2) { if ((_activities[_local3] is _arg1)){ return (true); }; _local3++; }; return (false); } public function get counter():Counter{ return (_counter); } public function set counter(_arg1:Counter):void{ _counter = _arg1; if (running){ _counter.startEmitter(this); }; } public function get useInternalTick():Boolean{ return (_useInternalTick); } 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 get fixedFrameTime():Number{ return (_fixedFrameTime); } public function set fixedFrameTime(_arg1:Number):void{ _fixedFrameTime = _arg1; } public function get running():Boolean{ return (_running); } public function get particleFactory():ParticleFactory{ return (_particleFactory); } public function set particleFactory(_arg1:ParticleFactory):void{ _particleFactory = _arg1; } public function get particles():Array{ return (_particles); } protected function createParticle():Particle{ var _local1:Particle = _particleFactory.createParticle(); var _local2:int = _initializers.length; initParticle(_local1); var _local3:int; while (_local3 < _local2) { _initializers[_local3].initialize(this, _local1); _local3++; }; _particles.push(_local1); dispatchEvent(new ParticleEvent(ParticleEvent.PARTICLE_CREATED, _local1)); return (_local1); } protected function initParticle(_arg1:Particle):void{ } public function addExistingParticles(_arg1:Array, _arg2:Boolean=false):void{ var _local4:int; var _local5:int; var _local6:int; var _local3:int = _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 killAllParticles():void{ var _local1:int = _particles.length; var _local2:int; while (_local2 < _local1) { dispatchEvent(new ParticleEvent(ParticleEvent.PARTICLE_DEAD, _particles[_local2])); _particleFactory.disposeParticle(_particles[_local2]); _local2++; }; _particles.length = 0; } public function start():void{ if (_useInternalTick){ FrameUpdater.instance.addEventListener(UpdateEvent.UPDATE, updateEventListener, false, 0, true); }; _started = true; _running = true; var _local1:int = _activities.length; var _local2:int; while (_local2 < _local1) { _activities[_local2].initialize(this); _local2++; }; _local1 = _counter.startEmitter(this); _local2 = 0; while (_local2 < _local1) { createParticle(); _local2++; }; } private function updateEventListener(_arg1:UpdateEvent):void{ if (_fixedFrameTime){ update(_fixedFrameTime); } else { update(_arg1.time); }; } public function update(_arg1:Number):void{ var _local2:int; var _local3:Particle; var _local5:Action; var _local6:int; var _local7:int; if (!_running){ return; }; if (_arg1 > _maximumFrameTime){ _arg1 = _maximumFrameTime; }; var _local4:int = _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)); } protected function sortParticles():void{ } public function pause():void{ _running = false; } public function resume():void{ _running = true; } public function stop():void{ if (_useInternalTick){ FrameUpdater.instance.removeEventListener(UpdateEvent.UPDATE, updateEventListener); }; _started = false; killAllParticles(); } public function runAhead(_arg1:Number, _arg2:Number=10):void{ var _local3:Number = _maximumFrameTime; var _local4:Number = (1 / _arg2); _maximumFrameTime = _local4; while (_arg1 > 0) { _arg1 = (_arg1 - _local4); update(_local4); }; _maximumFrameTime = _local3; } } }//package org.flintparticles.common.emitters
Section 250
//Linear (org.flintparticles.common.energyEasing.Linear) package org.flintparticles.common.energyEasing { public class Linear { public static function easeNone(_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 easeOut(_arg1:Number, _arg2:Number):Number{ return ((1 - (_arg1 / _arg2))); } public static function easeInOut(_arg1:Number, _arg2:Number):Number{ return ((1 - (_arg1 / _arg2))); } } }//package org.flintparticles.common.energyEasing
Section 251
//Quadratic (org.flintparticles.common.energyEasing.Quadratic) package org.flintparticles.common.energyEasing { public class Quadratic { public static function easeIn(_arg1:Number, _arg2:Number):Number{ _arg1 = (_arg1 / _arg2); return ((1 - (_arg1 * _arg1))); } public static function easeOut(_arg1:Number, _arg2:Number):Number{ _arg1 = (1 - (_arg1 / _arg2)); return ((_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 252
//EmitterEvent (org.flintparticles.common.events.EmitterEvent) package org.flintparticles.common.events { import flash.events.*; public class EmitterEvent extends Event { public static var EMITTER_EMPTY:String = "emitterEmpty"; public static var EMITTER_UPDATED:String = "emitterUpdated"; public function EmitterEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){ super(_arg1, _arg2, _arg3); } } }//package org.flintparticles.common.events
Section 253
//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 PARTICLE_CREATED:String = "particleCreated"; public static var PARTICLE_DEAD:String = "particleDead"; public static var PARTICLE_ADDED:String = "particleAdded"; public static var PARTICLES_COLLISION:String = "particlesCollision"; 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 254
//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 255
//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 _min:uint; private var _max:uint; public function ColorInit(_arg1:uint, _arg2:uint){ _min = _arg1; _max = _arg2; } public function get minColor():uint{ return (_min); } public function set minColor(_arg1:uint):void{ _min = _arg1; } public function get maxColor():uint{ return (_max); } public function set maxColor(_arg1:uint):void{ _max = _arg1; } public function get color():uint{ return (((_min == _max)) ? _min : interpolateColors(_max, _min, 0.5)); } public function set color(_arg1:uint):void{ _max = (_min = _arg1); } override public function initialize(_arg1:Emitter, _arg2:Particle):void{ if (_max == _min){ _arg2.color = _min; } else { _arg2.color = interpolateColors(_min, _max, Math.random()); }; } } }//package org.flintparticles.common.initializers
Section 256
//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 getDefaultPriority():Number; function addedToEmitter(_arg1:Emitter):void; function removedFromEmitter(_arg1:Emitter):void; function initialize(_arg1:Emitter, _arg2:Particle):void; } }//package org.flintparticles.common.initializers
Section 257
//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 getDefaultPriority():Number{ return (0); } public function addedToEmitter(_arg1:Emitter):void{ } public function removedFromEmitter(_arg1:Emitter):void{ } public function initialize(_arg1:Emitter, _arg2:Particle):void{ } } }//package org.flintparticles.common.initializers
Section 258
//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 _max:Number; private var _min:Number; public function Lifetime(_arg1:Number, _arg2:Number=NaN){ _max = _arg2; _min = _arg1; } public function get minLifetime():Number{ return (_min); } public function set minLifetime(_arg1:Number):void{ _min = _arg1; } public function get maxLifetime():Number{ return (_max); } public function set maxLifetime(_arg1:Number):void{ _max = _arg1; } public function get lifetime():Number{ return (((_min == _max)) ? _min : ((_max + _min) * 0.5)); } public function set lifetime(_arg1:Number):void{ _max = (_min = _arg1); } override public function initialize(_arg1:Emitter, _arg2:Particle):void{ if (isNaN(_max)){ _arg2.lifetime = _min; } else { _arg2.lifetime = (_min + (Math.random() * (_max - _min))); }; } } }//package org.flintparticles.common.initializers
Section 259
//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; } public function get image():DisplayObject{ return (_image); } public function set image(_arg1:DisplayObject):void{ _image = _arg1; } override public function initialize(_arg1:Emitter, _arg2:Particle):void{ _arg2.image = _image; } } }//package org.flintparticles.common.initializers
Section 260
//Particle (org.flintparticles.common.particles.Particle) package org.flintparticles.common.particles { import flash.utils.*; import flash.geom.*; public class Particle { public var color:uint;// = 4294967295 private var _colorTransform:ColorTransform;// = null private var _previousColor:uint; public var scale:Number;// = 1 public var mass:Number;// = 1 public var collisionRadius:Number;// = 1 public var image;// = null public var lifetime:Number;// = 0 public var age:Number;// = 0 public var energy:Number;// = 1 public var isDead:Boolean;// = false private var _dictionary:Dictionary;// = null public function get dictionary():Dictionary{ if (_dictionary == null){ _dictionary = new Dictionary(true); }; return (_dictionary); } 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; } 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); } public function get alpha():Number{ return ((((color & 4278190080) >>> 24) / 0xFF)); } 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 clone(_arg1:ParticleFactory=null):Particle{ var _local2:Particle; if (_arg1){ _local2 = _arg1.createParticle(); } else { _local2 = new Particle(); }; return (cloneInto(_local2)); } } }//package org.flintparticles.common.particles
Section 261
//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 262
//Renderer (org.flintparticles.common.renderers.Renderer) package org.flintparticles.common.renderers { import org.flintparticles.common.emitters.*; public interface Renderer { function addEmitter(_arg1:Emitter):void; function removeEmitter(_arg1:Emitter):void; } }//package org.flintparticles.common.renderers
Section 263
//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); } 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); }; } public function removeEmitter(_arg1:Emitter):void{ var _local3:Particle; var _local2:int; 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 addedToStage(_arg1:Event):void{ if (stage){ stage.invalidate(); }; } private function particleAdded(_arg1:ParticleEvent):void{ addParticle(_arg1.particle); if (stage){ stage.invalidate(); }; } private function particleRemoved(_arg1:ParticleEvent):void{ removeParticle(_arg1.particle); if (stage){ stage.invalidate(); }; } private function emitterUpdated(_arg1:EmitterEvent):void{ if (stage){ stage.invalidate(); }; } private function updateParticles(_arg1:Event):void{ var _local2:Array = new Array(); var _local3:int; while (_local3 < _emitters.length) { _local2 = _local2.concat(_emitters[_local3].particles); _local3++; }; renderParticles(_local2); } protected function addParticle(_arg1:Particle):void{ } protected function removeParticle(_arg1:Particle):void{ } protected function renderParticles(_arg1:Array):void{ } public function get emitters():Array{ return (_emitters); } } }//package org.flintparticles.common.renderers
Section 264
//FrameUpdater (org.flintparticles.common.utils.FrameUpdater) package org.flintparticles.common.utils { import flash.events.*; import flash.display.*; import flash.utils.*; import org.flintparticles.common.events.*; 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 = _time; _time = getTimer(); var _local3:Number = ((_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 265
//interpolateColors (org.flintparticles.common.utils.interpolateColors) package org.flintparticles.common.utils { public function interpolateColors(_arg1:uint, _arg2:uint, _arg3:Number):uint{ var _local4:Number = (1 - _arg3); var _local5:uint = Math.round(((((_arg1 >>> 16) & 0xFF) * _arg3) + (((_arg2 >>> 16) & 0xFF) * _local4))); var _local6:uint = Math.round(((((_arg1 >>> 8) & 0xFF) * _arg3) + (((_arg2 >>> 8) & 0xFF) * _local4))); var _local7:uint = Math.round((((_arg1 & 0xFF) * _arg3) + ((_arg2 & 0xFF) * _local4))); var _local8:uint = Math.round(((((_arg1 >>> 24) & 0xFF) * _arg3) + (((_arg2 >>> 24) & 0xFF) * _local4))); return (((((_local8 << 24) | (_local5 << 16)) | (_local6 << 8)) | _local7)); } }//package org.flintparticles.common.utils
Section 266
//Maths (org.flintparticles.common.utils.Maths) package org.flintparticles.common.utils { public class Maths { private static const RADTODEG:Number = 57.2957795130823; private static const DEGTORAD:Number = 0.0174532925199433; public static function asDegrees(_arg1:Number):Number{ return ((_arg1 * RADTODEG)); } public static function asRadians(_arg1:Number):Number{ return ((_arg1 * DEGTORAD)); } } }//package org.flintparticles.common.utils
Section 267
//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(); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){ var _local2:int = int(_arg1); if ((((((_local2 == _arg1)) && ((_local2 < _values.length)))) && (_values[_local2]))){ return (_values[_local2].value); }; return (undefined); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{ var _local3:uint = uint(_arg1); if ((((_local3 == _arg1)) && ((_local3 < _values.length)))){ _values[_local3].value = _arg2; }; } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{ if (_arg1 < _values.length){ return ((_arg1 + 1)); }; return (0); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{ return ((_arg1 - 1).toString()); } override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextValue(_arg1:int){ return (_values[(_arg1 - 1)].value); } public function add(_arg1, _arg2:Number):uint{ var _local3:uint = _values.length; var _local4:uint; while (_local4 < _local3) { if (_values[_local4].priority < _arg2){ break; }; _local4++; }; _values.splice(_local4, 0, new Pair(_arg2, _arg1)); return (_values.length); } public function remove(_arg1):Boolean{ var _local2:uint = _values.length; while (_local2--) { if (_values[_local2].value == _arg1){ _values.splice(_local2, 1); return (true); }; }; return (false); } public function contains(_arg1):Boolean{ var _local2:uint = _values.length; while (_local2--) { if (_values[_local2].value == _arg1){ return (true); }; }; return (false); } public function removeAt(_arg1:uint){ var _local2:* = _values[_arg1].value; _values.splice(_arg1, 1); return (_local2); } public function clear():void{ _values.length = 0; } public function get length():uint{ return (_values.length); } } }//package org.flintparticles.common.utils class Pair { private var priority:Number; private var value; private function Pair(_arg1:Number, _arg2){ this.priority = _arg1; this.value = _arg2; } }
Section 268
//Accelerate (org.flintparticles.twoD.actions.Accelerate) package org.flintparticles.twoD.actions { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; import org.flintparticles.common.actions.*; import org.flintparticles.twoD.particles.*; 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 x():Number{ return (_x); } public function set x(_arg1:Number):void{ _x = _arg1; } public function get y():Number{ return (_y); } public function set y(_arg1:Number):void{ _y = _arg1; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D = Particle2D(_arg2); Particle2D(_arg2).velX = (_local4.velX + (_x * _arg3)); _local4.velY = (_local4.velY + (_y * _arg3)); } } }//package org.flintparticles.twoD.actions
Section 269
//LinearDrag (org.flintparticles.twoD.actions.LinearDrag) package org.flintparticles.twoD.actions { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; import org.flintparticles.common.actions.*; import org.flintparticles.twoD.particles.*; public class LinearDrag extends ActionBase { private var _drag:Number; public function LinearDrag(_arg1:Number){ _drag = _arg1; } public function get drag():Number{ return (_drag); } public function set drag(_arg1:Number):void{ _drag = _arg1; } override public function update(_arg1:Emitter, _arg2:Particle, _arg3:Number):void{ var _local4:Particle2D; _local4 = Particle2D(_arg2); var _local5:Number = (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); }; } } }//package org.flintparticles.twoD.actions
Section 270
//Move (org.flintparticles.twoD.actions.Move) package org.flintparticles.twoD.actions { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; import org.flintparticles.common.actions.*; import org.flintparticles.twoD.particles.*; public class Move extends ActionBase { private var p:Particle2D; override public function getDefaultPriority():Number{ return (-10); } 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)); } } }//package org.flintparticles.twoD.actions
Section 271
//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 _x:Number;// = 0 protected var _y:Number;// = 0 protected var _rotation:Number;// = 0 public var spaceSortedX:Array; public var spaceSort:Boolean;// = false protected static var _creator:ParticleCreator2D = new ParticleCreator2D(); public function Emitter2D(){ _particleFactory = _creator; } public function get x():Number{ return (_x); } public function set x(_arg1:Number):void{ _x = _arg1; } public function get y():Number{ return (_y); } public function set y(_arg1:Number):void{ _y = _arg1; } public function get rotation():Number{ return (Maths.asDegrees(_rotation)); } public function set rotation(_arg1:Number):void{ _rotation = Maths.asRadians(_arg1); } public function get rotRadians():Number{ return (_rotation); } public function set rotRadians(_arg1:Number):void{ _rotation = _arg1; } override protected function initParticle(_arg1:Particle):void{ var _local2:Particle2D; _local2 = Particle2D(_arg1); _local2.x = _x; _local2.y = _y; _local2.rotation = _rotation; } 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++; }; }; } public static function get defaultParticleFactory():ParticleFactory{ return (_creator); } } }//package org.flintparticles.twoD.emitters
Section 272
//Velocity (org.flintparticles.twoD.initializers.Velocity) package org.flintparticles.twoD.initializers { import org.flintparticles.common.emitters.*; import org.flintparticles.common.particles.*; import org.flintparticles.common.initializers.*; import org.flintparticles.twoD.zones.*; import flash.geom.*; import org.flintparticles.twoD.particles.*; public class Velocity extends InitializerBase { private var _zone:Zone2D; public function Velocity(_arg1:Zone2D){ _zone = _arg1; } public function get zone():Zone2D{ return (_zone); } public function set zone(_arg1:Zone2D):void{ _zone = _arg1; } override public function initialize(_arg1:Emitter, _arg2:Particle):void{ var _local3:Particle2D; var _local5:Number; var _local6:Number; _local3 = Particle2D(_arg2); var _local4:Point = _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)); }; } } }//package org.flintparticles.twoD.initializers
Section 273
//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 x:Number;// = 0 public var y:Number;// = 0 public var velX:Number;// = 0 public var velY:Number;// = 0 public var rotation:Number;// = 0 public var angVelocity:Number;// = 0 private var _previousMass:Number; private var _previousRadius:Number; private var _inertia:Number; public var sortID:int;// = -1 public function get inertia():Number{ if (((!((mass == _previousMass))) || (!((collisionRadius == _previousRadius))))){ _inertia = (((mass * collisionRadius) * collisionRadius) * 0.5); _previousMass = mass; _previousRadius = collisionRadius; }; return (_inertia); } override public function initialize():void{ super.initialize(); x = 0; y = 0; velX = 0; velY = 0; rotation = 0; angVelocity = 0; sortID = -1; } public function get matrixTransform():Matrix{ var _local1:Number = (scale * Math.cos(rotation)); var _local2:Number = (scale * Math.sin(rotation)); return (new Matrix(_local1, _local2, -(_local2), _local1, x, y)); } 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); } } }//package org.flintparticles.twoD.particles
Section 274
//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 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); }; } public function clearAllParticles():void{ _particles = new Array(); } } }//package org.flintparticles.twoD.particles
Section 275
//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 _bitmap:Bitmap; protected var _bitmapData:BitmapData; protected var _preFilters:Array; protected var _postFilters:Array; protected var _colorMap:Array; protected var _smoothing:Boolean; 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 addFilter(_arg1:BitmapFilter, _arg2:Boolean=false):void{ if (_arg2){ _postFilters.push(_arg1); } else { _preFilters.push(_arg1); }; } public function removeFilter(_arg1:BitmapFilter):void{ var _local2:int; 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++; }; } 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; } 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 set canvas(_arg1:Rectangle):void{ _canvas = _arg1; createBitmap(); } 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(); } 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); } public function get bitmapData():BitmapData{ return (_bitmapData); } } }//package org.flintparticles.twoD.renderers
Section 276
//DiscZone (org.flintparticles.twoD.zones.DiscZone) package org.flintparticles.twoD.zones { import flash.geom.*; public class DiscZone implements Zone2D { private var _center:Point; private var _innerRadius:Number; private var _outerRadius:Number; private var _innerSq:Number; 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 get center():Point{ return (_center); } public function set center(_arg1:Point):void{ _center = _arg1; } public function get innerRadius():Number{ return (_innerRadius); } public function set innerRadius(_arg1:Number):void{ _innerRadius = _arg1; _innerSq = (_innerRadius * _innerRadius); } public function get outerRadius():Number{ return (_outerRadius); } public function set outerRadius(_arg1:Number):void{ _outerRadius = _arg1; _outerSq = (_outerRadius * _outerRadius); } public function contains(_arg1:Number, _arg2:Number):Boolean{ _arg1 = (_arg1 - _center.x); _arg2 = (_arg2 - _center.y); var _local3:Number = ((_arg1 * _arg1) + (_arg2 * _arg2)); return ((((_local3 <= _outerSq)) && ((_local3 >= _innerSq)))); } public function getLocation():Point{ var _local1:Number = Math.random(); var _local2:Point = 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); } public function getArea():Number{ return ((Math.PI * (_outerSq - _innerSq))); } } }//package org.flintparticles.twoD.zones
Section 277
//Zone2D (org.flintparticles.twoD.zones.Zone2D) package org.flintparticles.twoD.zones { import flash.geom.*; public interface Zone2D { function contains(_arg1:Number, _arg2:Number):Boolean; function getLocation():Point; function getArea():Number; } }//package org.flintparticles.twoD.zones
Section 278
//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 279
//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 280
//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 281
//BaseSpaceship (sceneElements.spaceships.BaseSpaceship) package sceneElements.spaceships { import flash.display.*; import core.engine.*; import Box2D.Dynamics.*; import Box2D.Common.Math.*; 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 282
//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 283
//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 284
//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 285
//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 286
//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 287
//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 FanfarClass: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; FanfarClass = Samples_FanfarClass; 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 288
//Samples_ExplosionSndClass (sound.Samples_ExplosionSndClass) package sound { import mx.core.*; public class Samples_ExplosionSndClass extends SoundAsset { } }//package sound
Section 289
//Samples_FanfarClass (sound.Samples_FanfarClass) package sound { import mx.core.*; public class Samples_FanfarClass extends SoundAsset { } }//package sound
Section 290
//Samples_FireSndClass (sound.Samples_FireSndClass) package sound { import mx.core.*; public class Samples_FireSndClass extends SoundAsset { } }//package sound
Section 291
//Samples_LevelLoopClass (sound.Samples_LevelLoopClass) package sound { import mx.core.*; public class Samples_LevelLoopClass extends SoundAsset { } }//package sound
Section 292
//Samples_MenuLoopSndClass (sound.Samples_MenuLoopSndClass) package sound { import mx.core.*; public class Samples_MenuLoopSndClass extends SoundAsset { } }//package sound
Section 293
//Samples_StarCollectedClass1 (sound.Samples_StarCollectedClass1) package sound { import mx.core.*; public class Samples_StarCollectedClass1 extends SoundAsset { } }//package sound
Section 294
//Samples_StarCollectedClass2 (sound.Samples_StarCollectedClass2) package sound { import mx.core.*; public class Samples_StarCollectedClass2 extends SoundAsset { } }//package sound
Section 295
//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 _fanfarSndInstr:BaseInstrument; private var _fireSndInstr:BaseInstrument; private var _explosionSndInstr:BaseInstrument; private var _resetSndInstr:BaseInstrument; private static var _instance:SoundPlayer; public function SoundPlayer(_arg1:SingletonEnforcer){ } 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 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 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(); }; if (_fanfarSndInstr){ _fanfarSndInstr.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(); }; if (_fanfarSndInstr){ _fanfarSndInstr.unmute(); }; }; _isMuted = !(_isMuted); } public function playFanfarSound():void{ if (!_fanfarSndInstr){ _fanfarSndInstr = new BaseInstrument(Samples.getInstance().FanfarClass, 1, false, _isMuted); }; _fanfarSndInstr.play(); } public function playLevelSound():void{ stopLevelSound(); _levelSndInstr = new BaseInstrument(Samples.getInstance().LevelLoopClass, 0.9, 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 296
//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 297
//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 298
//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_WIDTH:Number = 100; private const GRAPHIC_HEIGHT:Number = 25; private const MEGABYTE:uint = 1048576; private var _fpsStack:Array; private var _memoryStack:Array; private var _back:Shape; private var _graph:Shape; private var _fpsLabel:TextField; private var _maxMemoryLabel:TextField; private var _minMemoryLabel:TextField; private var _fpsCount:uint; private var _memoryTimerCount:uint; private var _color:uint; private var _totalMemory:String; private var _timer:Timer; public function Performance(_arg1:uint=0){ this._color = _arg1; this._fpsStack = [0, 0, 0, 0]; this._memoryStack = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; this._memoryTimerCount = 0; this._fpsCount = 0; this._timer = new Timer(250); this._fpsLabel = new TextField(); this._minMemoryLabel = new TextField(); this._maxMemoryLabel = new TextField(); this._back = new Shape(); this._graph = new Shape(); addEventListener(Event.ADDED_TO_STAGE, this.onAdded); } private function onAdded(_arg1:Event):void{ var i:uint; var evt = _arg1; removeEventListener(Event.ADDED_TO_STAGE, this.onAdded); var _local3 = this._fpsLabel; with (_local3) { defaultTextFormat = new TextFormat("Lucida", 10); selectable = false; autoSize = TextFieldAutoSize.LEFT; textColor = _color; antiAliasType = AntiAliasType.NORMAL; text = "Fps: Null\nMem: Null"; }; _local3 = this._minMemoryLabel; with (_local3) { defaultTextFormat = new TextFormat("Lucida", 8); selectable = false; autoSize = TextFieldAutoSize.LEFT; textColor = _color; antiAliasType = AntiAliasType.NORMAL; text = "Null"; }; _local3 = this._maxMemoryLabel; with (_local3) { defaultTextFormat = new TextFormat("Lucida", 8); selectable = false; autoSize = TextFieldAutoSize.LEFT; textColor = _color; antiAliasType = AntiAliasType.NORMAL; text = "Null"; }; this._fpsLabel.mouseEnabled = false; this._maxMemoryLabel.mouseEnabled = false; this._minMemoryLabel.mouseEnabled = false; var widthStep:Number = (this.GRAPHIC_WIDTH / 10); var heightStep:Number = (this.GRAPHIC_HEIGHT / 5); this._back.graphics.lineStyle(0, this._color, 0.2); i = 0; while (i < 10) { this._back.graphics.moveTo((widthStep * i), 0); this._back.graphics.lineTo((widthStep * i), this.GRAPHIC_HEIGHT); i = (i + 1); }; i = 0; while (i <= 5) { this._back.graphics.moveTo(0, (heightStep * i)); this._back.graphics.lineTo((this.GRAPHIC_WIDTH - widthStep), (heightStep * i)); i = (i + 1); }; this._fpsLabel.x = 0; this._fpsLabel.y = 0; this._back.x = 0; this._back.y = ((this._fpsLabel.y + this._fpsLabel.textHeight) + 2); this._graph.x = this._back.x; this._graph.y = this._back.y; this._maxMemoryLabel.x = ((this._back.x + this._back.width) + 2); this._maxMemoryLabel.y = (this._back.y - 2); this._minMemoryLabel.x = ((this._back.x + this._back.width) + 2); this._minMemoryLabel.y = ((this._back.y + this._back.height) - this._minMemoryLabel.textHeight); addChild(this._back); addChild(this._graph); addChild(this._fpsLabel); addChild(this._maxMemoryLabel); addChild(this._minMemoryLabel); this._timer.start(); this._timer.addEventListener(TimerEvent.TIMER, this.onTimer); addEventListener(Event.ENTER_FRAME, this.onEnter); addEventListener(Event.REMOVED_FROM_STAGE, this.onRemoved); } private function onEnter(_arg1:Event):void{ this._fpsCount++; } 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 (this._memoryTimerCount == 4){ this._memoryTimerCount = 0; _local4 = System.totalMemory; this._totalMemory = ((Math.floor(((_local4 / this.MEGABYTE) * 100)) / 100).toString() + "Mb"); _local2 = 0; while (_local2 < 9) { this._memoryStack[_local2] = this._memoryStack[(_local2 + 1)]; _local2++; }; this._memoryStack[9] = _local4; _local5 = 100000000000; _local6 = 0; _local7 = 0; _local2 = 0; while (_local2 < 10) { if (this._memoryStack[_local2] > _local6){ _local6 = this._memoryStack[_local2]; }; if (this._memoryStack[_local2] < _local5){ _local5 = this._memoryStack[_local2]; }; _local2++; }; _local7 = (_local6 - _local5); this._maxMemoryLabel.text = ((Math.floor(((_local6 / this.MEGABYTE) * 1000)) / 1000).toString() + "Mb"); this._minMemoryLabel.text = ((Math.floor(((_local5 / this.MEGABYTE) * 1000)) / 1000).toString() + "Mb"); _local8 = uint((this.GRAPHIC_WIDTH / 10)); this._graph.graphics.clear(); this._graph.graphics.lineStyle(0, this._color); this._graph.graphics.moveTo(0, ((this.GRAPHIC_HEIGHT * (_local6 - this._memoryStack[0])) / _local7)); _local2 = 1; while (_local2 < 10) { this._graph.graphics.lineTo((_local8 * _local2), ((this.GRAPHIC_HEIGHT * (_local6 - this._memoryStack[_local2])) / _local7)); _local2++; }; } else { this._memoryTimerCount++; }; while (_local2 < 3) { this._fpsStack[_local2] = this._fpsStack[(_local2 + 1)]; _local2++; }; this._fpsStack[3] = this._fpsCount; this._fpsCount = 0; var _local3:uint = (((this._fpsStack[0] + this._fpsStack[1]) + this._fpsStack[2]) + this._fpsStack[3]); this._fpsLabel.text = ((("Fps: " + _local3) + "\nMem: ") + this._totalMemory); } private function onRemoved(_arg1:Event):void{ removeEventListener(Event.REMOVED_FROM_STAGE, this.onRemoved); removeEventListener(Event.ENTER_FRAME, this.onEnter); this._timer.removeEventListener(TimerEvent.TIMER, this.onTimer); this._timer.stop(); removeChild(this._back); removeChild(this._graph); removeChild(this._maxMemoryLabel); removeChild(this._minMemoryLabel); removeChild(this._fpsLabel); this._back = null; this._graph = null; this._maxMemoryLabel = null; this._minMemoryLabel = null; this._fpsLabel = null; this._fpsStack = null; this._memoryStack = null; } } }//package utils
Section 299
//BGElement (BGElement) package { import flash.display.*; public dynamic class BGElement extends MovieClip { } }//package
Section 300
//BonusScoreSplash (BonusScoreSplash) package { import flash.display.*; public dynamic class BonusScoreSplash extends MovieClip { public function BonusScoreSplash(){ addFrameScript(44, frame45); } function frame45(){ stop(); } } }//package
Section 301
//BouncerSkin (BouncerSkin) package { import flash.display.*; public dynamic class BouncerSkin extends MovieClip { } }//package
Section 302
//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); } public function onMenu(_arg1:MouseEvent):void{ var _local2:Event = new Event("menu", true); dispatchEvent(_local2); } public function onNext(_arg1:MouseEvent):void{ var _local2:Event = new Event("next", true); dispatchEvent(_local2); } function frame1(){ btnMenu.addEventListener(MouseEvent.CLICK, onMenu); btnNext.addEventListener(MouseEvent.CLICK, onNext); } } }//package
Section 303
//ContactsManager (ContactsManager) package { import flash.events.*; import events.*; import core.engine.*; import core.renderer.*; import Box2D.Dynamics.*; import flash.utils.*; import Box2D.Collision.Shapes.*; import core.shape.shapeProps.*; import Box2D.Collision.*; 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 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 removeRenderer(_arg1:BaseRenderer):void{ CoreEngine.getInstance().removeRenderer(_arg1); } 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 == "hero")))){ onFinishShoot(_local4.m_body); return; }; if ((((_local5 == "hero")) && ((_local6 == "remover")))){ onFinishShoot(_local3.m_body); return; }; } } }//package
Section 304
//Controls (Controls) package { import flash.events.*; import flash.display.*; import flash.text.*; public dynamic class Controls extends MovieClip { public var btnHelp:SimpleButton; public var tfShootsDone:TextField; public var tfCollected:TextField; public var btnReset:SimpleButton; public var tfTotal:TextField; public var tfShootsTotal:TextField; public var btnMenu:SimpleButton; public function Controls(){ addFrameScript(0, frame1); } public function onClickMenu(_arg1:MouseEvent):void{ var _local2:Event = new Event("menu", true); dispatchEvent(_local2); } public function onClickReset(_arg1:MouseEvent):void{ var _local2:Event = new Event("reset", true); dispatchEvent(_local2); } public function onClickHelp(_arg1:MouseEvent):void{ var _local2:Event = new Event("Help", true); dispatchEvent(_local2); } public function disableReset():void{ btnReset.enabled = false; } public function enableReset():void{ btnReset.enabled = true; } 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); } function frame1(){ btnMenu.addEventListener(MouseEvent.CLICK, onClickMenu); btnReset.addEventListener(MouseEvent.CLICK, onClickReset); btnHelp.addEventListener(MouseEvent.CLICK, onClickHelp); } } }//package
Section 305
//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); } public function onMenu(_arg1:MouseEvent):void{ var _local2:Event = new Event("menu", true); dispatchEvent(_local2); } public function onReplay(_arg1:MouseEvent):void{ var _local2:Event = new Event("replay", true); dispatchEvent(_local2); } function frame1(){ btnMenu.addEventListener(MouseEvent.CLICK, onMenu); btnReplay.addEventListener(MouseEvent.CLICK, onReplay); } } }//package
Section 306
//Dust (Dust) package { import flash.display.*; public dynamic class Dust extends MovieClip { } }//package
Section 307
//ExtraShotSplash (ExtraShotSplash) package { import flash.display.*; public dynamic class ExtraShotSplash extends MovieClip { public function ExtraShotSplash(){ addFrameScript(59, frame60); } function frame60(){ stop(); } } }//package
Section 308
//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.profiler.*; import flash.sampler.*; import flash.ui.*; import flash.xml.*; public dynamic class HelpMenu extends MovieClip { public var btnClose:SimpleButton; public var _content:MovieClip; public var btnDownload:SimpleButton; public var btnCredits:SimpleButton; public var btnControls:SimpleButton; public function HelpMenu(){ addFrameScript(0, frame1); } 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"); } public function onDownload(_arg1:MouseEvent=null):void{ _content.gotoAndStop("download"); } 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); } } }//package
Section 309
//LauncherBar (LauncherBar) package { import flash.display.*; public dynamic class LauncherBar extends MovieClip { } }//package
Section 310
//LauncherSkin (LauncherSkin) package { import flash.display.*; public dynamic class LauncherSkin extends MovieClip { } }//package
Section 311
//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.profiler.*; import flash.sampler.*; import flash.ui.*; import flash.xml.*; public dynamic class LevelMenu extends MovieClip { public var lock8:MovieClip; public var btn19:SimpleButton; public var lock9:MovieClip; public var mcPreview:MovieClip; public var mcAreYouSure:MovieClip; public var lock10:MovieClip; public var lock20:MovieClip; public var lock11:MovieClip; public var lock12:MovieClip; public var btnYes:SimpleButton; public var btn10:SimpleButton; public var btn1:SimpleButton; public var lock13:MovieClip; public var btn20:SimpleButton; public var btn11:SimpleButton; public var btn2:SimpleButton; public var lock14:MovieClip; public var lock1:MovieClip; public var btnReset:SimpleButton; public var btn12:SimpleButton; public var btn3:SimpleButton; public var lock15:MovieClip; public var lock2:MovieClip; public var btn13:SimpleButton; public var btn4:SimpleButton; public var lock16:MovieClip; public var lock3:MovieClip; public var btn14:SimpleButton; public var btn5:SimpleButton; public var lock17:MovieClip; public var lock4:MovieClip; public var btn15:SimpleButton; public var btn6:SimpleButton; public var lock18:MovieClip; public var lock5:MovieClip; public var btnNo:SimpleButton; public var btn16:SimpleButton; public var btn7:SimpleButton; public var lock19:MovieClip; public var lock6:MovieClip; public var btn17:SimpleButton; public var btn8:SimpleButton; public var tfBestTime:TextField; public var lock7:MovieClip; public var btn18:SimpleButton; public var btn9:SimpleButton; public var arrRecords:Array; public var arrBtns:Array; public var b:SimpleButton; public var arrLevels:Array; public var arrLocks:Array; public var l:MovieClip; public function LevelMenu(){ addFrameScript(0, frame1); } public function onClick(_arg1:MouseEvent):void{ var _local3:OpenLevelEvent; if (_arg1.target.enabled == false){ return; }; var _local2:uint; while (_local2 < 20) { if (arrBtns[_local2] == _arg1.target){ _local3 = new OpenLevelEvent(OpenLevelEvent.TYPE); _local3.levelNo = (_local2 + 1); dispatchEvent(_local3); return; }; _local2++; }; } public function onRollover(_arg1:MouseEvent):void{ var _local2:uint; 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"); } public function onRollout(_arg1:MouseEvent):void{ mcPreview.gotoAndStop("default"); tfBestTime.visible = false; } 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 showDialog():void{ hideResetConfirmation(); visible = true; } public function hideResetConfirmation():void{ mcAreYouSure.visible = false; btnYes.visible = false; btnNo.visible = false; } public function onReset(_arg1:MouseEvent):void{ mcAreYouSure.visible = true; btnYes.visible = true; btnNo.visible = true; } public function onYes(_arg1:MouseEvent):void{ var _local2:Event = new Event("resetProgress"); dispatchEvent(_local2); hideResetConfirmation(); } public function onNo(_arg1:MouseEvent):void{ hideResetConfirmation(); } 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); } } }//package
Section 312
//Main (Main) package { import flash.events.*; import ui.events.*; import events.*; import flash.display.*; import sound.*; import core.engine.*; import core.renderer.*; import com.boristhebrave.Box2D.Controllers.*; import org.casalib.ui.*; import core.*; import memory.*; import flash.utils.*; import mochi.as3.*; import sceneElements.*; import effects.*; import utils.*; import sceneElements.sensors.*; import org.casalib.util.*; import com.pixelfumes.reflect.*; public class Main extends MovieClip { 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 _mochiads_game_id:String;// = "290f66f13316032d" public var winMenu:WinMenu; private var _dustEffect:DustEffect; private var _highscoresID:String;// = "" private var _levels:Array; private var _startedShootsCount:uint; private var _collectedItemsCount: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, 5, 4, 12, 3, 10, 14, 7, 13, 19, 8, 2, 17, 6, 15, 16, 18, 20, 9, 11]; super(); MochiBot.track(this, "08b4d417"); MochiServices.connect(_mochiads_game_id, this); addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); } private function generateLevel1():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (32 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:113, y:190}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:561, y:76, w:20, h:139, isStatic:true})); push(new VoluntaryBox({x:561, y:234, w:20, h:89, isStatic:true})); push(new Bouncer({x:238, y:348, r:15})); push(new Bouncer({x:518, y:339, r:33})); push(new Trash({x:369, y:99})); push(new Trash({x:400, y:89})); push(new Trash({x:431, y:90})); push(new Trash({x:506, y:188})); push(new Trash({x:324, y:210})); push(new Trash({x:339, y:239})); push(new Trash({x:497, y:223})); push(new Trash({x:398, y:274})); push(new Trash({x:480, y:247})); push(new Trash({x:363, y:261})); push(new Trash({x:460, y:101})); push(new Trash({x:485, y:122})); push(new Trash({x:502, y:152})); push(new Trash({x:344, y:119})); push(new Trash({x:326, y:146})); push(new Trash({x:320, y:177})); push(new Trash({x:291, y:98})); push(new Trash({x:291, y:119})); push(new Trash({x:267, y:119})); push(new Trash({x:267, y:97})); push(new Trash({x:244, y:98})); push(new Trash({x:244, y:119})); push(new Trash({x:218, y:119})); push(new Trash({x:218, y:242})); push(new Trash({x:454, y:266})); push(new Trash({x:426, y:274})); push(new Trash({x:291, y:263})); push(new Trash({x:291, y:241})); push(new Trash({x:268, y:242})); push(new Trash({x:268, y:263})); push(new Trash({x:244, y:263})); push(new Trash({x:244, y:241})); }; } private function createProfiler():void{ profiler = new Performance(15661567); profiler.x = 500; profiler.name = "profilerName"; } private function generateLevel6():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (36 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:362, y:216}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:17, y:200, w:19, h:82, isStatic:true})); push(new VoluntaryBox({x:630, y:91, w:19, h:202, isStatic:true})); push(new VoluntaryBox({x:306, y:162, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:404, y:161, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:334, y:139, w:15, h:15, isStatic:true})); push(new VoluntaryBox({x:626, y:380, w:28, h:28, isStatic:true})); push(new VoluntaryBox({x:213, y:29, w:28, h:28, isStatic:true})); push(new VoluntaryBox({x:525, y:301, w:28, h:28, isStatic:true})); push(new VoluntaryBox({x:65, y:353, w:28, h:28, isStatic:true})); push(new VoluntaryBox({x:585, y:329, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:351, y:114, w:15, h:15, isStatic:true})); push(new VoluntaryBox({x:17, y:94, w:19, h:82, isStatic:true})); push(new VoluntaryBox({x:17, y:-7, w:19, h:82, isStatic:true})); push(new VoluntaryBox({x:378, y:139, w:15, h:15, isStatic:true})); push(new Bouncer({x:246, y:355, r:35})); push(new Bouncer({x:145, y:315, r:23})); push(new Bouncer({x:81, y:259, r:16})); push(new Bouncer({x:389, y:375, r:48})); push(new Trash({x:208, y:151})); push(new Trash({x:478, y:154})); push(new Trash({x:150, y:43})); push(new Trash({x:122, y:75})); push(new Trash({x:73, y:122})); push(new Trash({x:251, y:152})); push(new Trash({x:431, y:154})); push(new Trash({x:376, y:85})); push(new Trash({x:404, y:116})); push(new Trash({x:310, y:85})); push(new Trash({x:281, y:117})); push(new Trash({x:344, y:59})); push(new Trash({x:450, y:116})); push(new Trash({x:419, y:75})); push(new Trash({x:387, y:43})); push(new Trash({x:344, y:18})); push(new Trash({x:79, y:40})); push(new Trash({x:113, y:43})); push(new Trash({x:581, y:56})); push(new Trash({x:581, y:20})); 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:308, y:43})); push(new Trash({x:278, y:79})); push(new Trash({x:241, y:111})); push(new Trash({x:581, y:87})); push(new Trash({x:581, y:127})); push(new Trash({x:547, y:20})); push(new Trash({x:511, y:20})); push(new Trash({x:470, y:20})); push(new Trash({x:500, y:53})); push(new Trash({x:547, y:103})); push(new Trash({x:524, y:79})); push(new Trash({x:95, y:100})); }; } private function createMask():void{ var _local1:MainMask = new MainMask(); addChild(_local1); } private function generateLevel8():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (44 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:110, y:358}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:250, y:345, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:250, y:297, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:250, y:243, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:250, y:186, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:250, y:125, w:20, h:20, isStatic:true})); push(new Bouncer({x:406, y:338, r:34})); push(new Trash({x:417, y:65})); push(new Trash({x:394, y:90})); push(new Trash({x:376, y:122})); push(new Trash({x:376, y:160})); push(new Trash({x:408, y:196})); push(new Trash({x:445, y:217})); push(new Trash({x:489, y:217})); push(new Trash({x:529, y:196})); push(new Trash({x:555, y:160})); push(new Trash({x:555, y:117})); push(new Trash({x:537, y:85})); push(new Trash({x:508, y:62})); push(new Trash({x:464, y:56})); push(new Trash({x:464, y:99})); push(new Trash({x:458, y:330})); push(new Trash({x:464, y:168})); push(new Trash({x:36, y:40})); push(new Trash({x:499, y:133})); push(new Trash({x:59, y:18})); push(new Trash({x:90, y:18})); push(new Trash({x:107, y:40})); push(new Trash({x:90, y:69})); push(new Trash({x:55, y:69})); push(new Trash({x:272, y:149})); push(new Trash({x:295, y:168})); push(new Trash({x:272, y:212})); push(new Trash({x:295, y:237})); push(new Trash({x:272, y:288})); push(new Trash({x:295, y:307})); push(new Trash({x:272, y:355})); push(new Trash({x:295, y:372})); push(new Trash({x:429, y:133})); push(new Trash({x:491, y:330})); push(new Trash({x:526, y:330})); push(new Trash({x:559, y:330})); push(new Trash({x:595, y:330})); push(new Trash({x:207, y:210})); push(new Trash({x:182, y:237})); push(new Trash({x:207, y:281})); push(new Trash({x:182, y:304})); push(new Trash({x:207, y:355})); push(new Trash({x:182, y:372})); push(new Trash({x:207, y:147})); push(new Trash({x:182, y:168})); }; } private function generateLevel3():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (58 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:575, 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:368, y:209, 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:122, y:209})); push(new Bouncer({x:151, y:344, r:15})); push(new Bouncer({x:22, y:132, r:15})); push(new Trash({x:178, y:55})); push(new Trash({x:107, y:55})); push(new Trash({x:172, y:87})); push(new Trash({x:107, y:87})); push(new Trash({x:515, y:39})); push(new Trash({x:485, y:39})); push(new Trash({x:456, y:39})); push(new Trash({x:426, y:39})); push(new Trash({x:426, y:220})); push(new Trash({x:544, y:39})); push(new Trash({x:597, y:93})); push(new Trash({x:474, y:93})); push(new Trash({x:474, y:175})); push(new Trash({x:547, y:175})); push(new Trash({x:547, y:134})); push(new Trash({x:516, y:134})); push(new Trash({x:511, y:175})); push(new Trash({x:474, y:134})); push(new Trash({x:505, y:93})); push(new Trash({x:536, y:93})); push(new Trash({x:567, y:93})); push(new Trash({x:597, y:125})); push(new Trash({x:597, y:157})); push(new Trash({x:597, y:188})); push(new Trash({x:228, y:87})); push(new Trash({x:228, y:51})); push(new Trash({x:166, y:284})); push(new Trash({x:461, y:220})); push(new Trash({x:426, y:184})); push(new Trash({x:426, y:148})); push(new Trash({x:426, y:111})); push(new Trash({x:426, y:75})); push(new Trash({x:76, y:119})); push(new Trash({x:228, y:119})); push(new Trash({x:198, y:119})); push(new Trash({x:168, y:119})); push(new Trash({x:137, y:119})); push(new Trash({x:107, y:119})); push(new Trash({x:228, y:151})); push(new Trash({x:228, y:183})); push(new Trash({x:228, y:215})); push(new Trash({x:228, y:247})); push(new Trash({x:199, y:247})); push(new Trash({x:169, y:247})); push(new Trash({x:139, y:247})); push(new Trash({x:109, y:247})); push(new Trash({x:79, y:247})); push(new Trash({x:79, y:220})); push(new Trash({x:79, y:193})); push(new Trash({x:79, y:166})); push(new Trash({x:103, y:166})); push(new Trash({x:129, y:166})); push(new Trash({x:154, y:166})); push(new Trash({x:178, y:166})); push(new Trash({x:178, y:189})); push(new Trash({x:178, y:211})); push(new Trash({x:152, y:211})); }; } private function generateLevel4():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (36 - 10); 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:247, y:104, w:18, h:160, isStatic:true})); push(new VoluntaryBox({x:425, y:230, w:36, h:77, isStatic:true})); push(new VoluntaryBox({x:633, y:285, w:14, h:142, isStatic:true})); push(new VoluntaryBox({x:145, y:19, w:188, h:48, isStatic:true})); push(new VoluntaryBox({x:633, y:103, w:14, h:142, isStatic:true})); push(new VoluntaryBox({x:633, y:-53, w:14, h:142, isStatic:true})); push(new Bouncer({x:240, y:366, r:27})); push(new Trash({x:344, y:191})); push(new Bouncer({x:338, y:363, r:61})); push(new Trash({x:527, y:57})); push(new Trash({x:295, y:147})); push(new Trash({x:488, y:90})); push(new Trash({x:450, y:116})); push(new Trash({x:416, y:138})); push(new Trash({x:380, y:163})); push(new Trash({x:566, y:23})); push(new Trash({x:527, y:276})); push(new Trash({x:501, y:243})); push(new Trash({x:483, y:32})); push(new Trash({x:431, y:57})); push(new Trash({x:388, y:90})); push(new Trash({x:552, y:243})); 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:337, y:122})); push(new Trash({x:180, y:90})); push(new Trash({x:277, y:243})); push(new Trash({x:309, y:220})); push(new Trash({x:501, y:302})); push(new Trash({x:556, y:309})); push(new Trash({x:413, y:293})); push(new Trash({x:431, y:334})); push(new Trash({x:443, y:377})); push(new Trash({x:580, y:101})); push(new Trash({x:580, y:135})); push(new Trash({x:580, y:170})); push(new Trash({x:283, y:24})); push(new Trash({x:556, y:133})); push(new Trash({x:283, y:54})); push(new Trash({x:283, y:90})); push(new Trash({x:314, y:54})); push(new Trash({x:314, y:25})); push(new Trash({x:349, y:25})); }; } 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{ if (_arg1){ showSponsorsIntro(); }; } private function generateLevel9():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (34 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:526, y:221}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:313, y:159, w:77, h:24, isStatic:true})); push(new VoluntaryBox({x:416, y:159, w:77, h:24, isStatic:true})); push(new VoluntaryBox({x:520, y:159, w:77, h:24, isStatic:true})); push(new VoluntaryBox({x:389, y:279, w:77, h:24, isStatic:true})); push(new Trash({x:250, y:39})); push(new Bouncer({x:315, y:133, r:12})); push(new Bouncer({x:103, y:94, r:42})); push(new Trash({x:290, y:13})); push(new Trash({x:320, y:43})); push(new Trash({x:359, y:13})); push(new Trash({x:388, y:43})); push(new Trash({x:422, y:13})); push(new Trash({x:458, y:43})); push(new Trash({x:493, y:13})); push(new Trash({x:525, y:43})); push(new Trash({x:558, y:13})); push(new Trash({x:580, y:43})); push(new Trash({x:271, y:316})); push(new Trash({x:301, y:346})); push(new Trash({x:337, y:316})); push(new Trash({x:369, y:346})); push(new Trash({x:403, y:316})); push(new Trash({x:439, y:344})); push(new Trash({x:474, y:316})); push(new Trash({x:507, y:348})); push(new Trash({x:539, y:316})); push(new Trash({x:568, y:346})); push(new Trash({x:93, y:164})); push(new Trash({x:93, y:225})); push(new Trash({x:61, y:194})); push(new Trash({x:23, y:194})); push(new Trash({x:123, y:194})); push(new Trash({x:166, y:194})); push(new Bouncer({x:416, y:133, r:12})); push(new Bouncer({x:521, y:133, r:12})); push(new Bouncer({x:103, y:318, r:52})); push(new Trash({x:231, y:316})); push(new Trash({x:192, y:316})); push(new Trash({x:231, y:348})); push(new Trash({x:192, y:348})); push(new Trash({x:303, y:93})); push(new Trash({x:405, y:93})); push(new Trash({x:511, y:93})); }; } private function generateLevel2():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (49 - 10); 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:121, y:320})); push(new Trash({x:374, y:335})); push(new Trash({x:285, y:53})); push(new Trash({x:413, y:50})); push(new Trash({x:160, y:84})); push(new Trash({x:361, y:166})); push(new Trash({x:481, y:97})); push(new Trash({x:329, y:185})); push(new Trash({x:510, y:81})); push(new Trash({x:118, y:60})); push(new Trash({x:243, y:50})); push(new Trash({x:451, y:50})); push(new Trash({x:491, y:50})); push(new Trash({x:152, y:44})); push(new Trash({x:419, y:84})); push(new Trash({x:242, y:84})); push(new Trash({x:553, y:320})); push(new Trash({x:518, y:325})); push(new Trash({x:481, y:328})); push(new Trash({x:445, y:331})); push(new Trash({x:409, y:333})); push(new Trash({x:195, y:329})); push(new Trash({x:232, y:331})); push(new Trash({x:267, y:333})); push(new Trash({x:301, y:335})); push(new Trash({x:158, y:325})); push(new Trash({x:285, y:110})); push(new Trash({x:338, y:335})); push(new Trash({x:419, y:133})); push(new Trash({x:451, y:115})); push(new Trash({x:200, y:44})); push(new Trash({x:329, y:133})); push(new Trash({x:51, y:157})); push(new Trash({x:392, y:149})); push(new Trash({x:561, y:117})); push(new Trash({x:58, y:113})); push(new Trash({x:194, y:105})); push(new Trash({x:298, y:167})); push(new Trash({x:371, y:53})); push(new Trash({x:579, y:195})); push(new Trash({x:51, y:248})); push(new Trash({x:374, y:105})); push(new Trash({x:45, y:201})); push(new Trash({x:262, y:145})); push(new Trash({x:223, y:123})); push(new Trash({x:329, y:53})); push(new Trash({x:329, y:94})); push(new Trash({x:571, y:155})); push(new Trash({x:579, y:238})); push(new Bouncer({x:62, y:61, r:33})); }; } private function generateLevel5():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (45 - 10); 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:32, h:66, isStatic:true})); push(new VoluntaryBox({x:618, y:280, w:32, h:66, isStatic:true})); push(new VoluntaryBox({x:618, y:52, w:32, h:66, isStatic:true})); push(new Bouncer({x:350, y:126, r:37})); push(new Trash({x:423, y:27})); push(new Bouncer({x:343, y:266, r:48})); push(new Trash({x:448, y:55})); push(new Trash({x:430, y:90})); push(new Trash({x:400, y:121})); push(new Trash({x:538, y:150})); push(new Trash({x:504, y:144})); push(new Trash({x:463, y:160})); push(new Trash({x:395, y:207})); push(new Trash({x:430, y:183})); push(new Trash({x:494, y:269})); push(new Trash({x:563, y:179})); push(new Trash({x:482, y:195})); push(new Trash({x:520, y:183})); push(new Trash({x:561, y:214})); push(new Trash({x:533, y:241})); push(new Trash({x:450, y:284})); push(new Trash({x:405, y:301})); push(new Trash({x:454, y:227})); push(new Trash({x:242, y:58})); push(new Trash({x:418, y:247})); push(new Trash({x:501, y:230})); push(new Trash({x:200, y:24})); push(new Trash({x:179, y:49})); push(new Trash({x:188, y:84})); push(new Trash({x:218, y:100})); push(new Trash({x:0xFF, y:106})); push(new Trash({x:276, y:197})); push(new Trash({x:242, y:179})); push(new Trash({x:206, y:175})); push(new Trash({x:169, y:203})); push(new Trash({x:160, y:247})); push(new Trash({x:169, y:285})); push(new Trash({x:206, y:295})); push(new Trash({x:242, y:295})); push(new Trash({x:274, y:285})); push(new Trash({x:242, y:9})); push(new Trash({x:284, y:20})); push(new Trash({x:395, y:13})); push(new Trash({x:362, y:29})); push(new Trash({x:343, y:58})); push(new Trash({x:218, y:243})); push(new Trash({x:340, y:182})); push(new Trash({x:333, y:321})); push(new Trash({x:333, y:346})); push(new Trash({x:309, y:49})); }; } private function checkForBonus():void{ var _local1:uint = uint(randRange(1, 100)); if (_local1 == 50){ giveExtraShot(); } else { if ((((_local1 == 60)) || ((_local1 == 70)))){ giveBonusScore(); }; }; } private function generateLevel7():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (38 - 10); 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:272, w:15, h:117, isStatic:true})); push(new VoluntaryBox({x:279, y:262, w:16, h:97, isStatic:true})); push(new Bouncer({x:324, y:31, r:68})); push(new Trash({x:406, y:60})); push(new Trash({x:129, y:6})); push(new Trash({x:206, y:18})); push(new Bouncer({x:53, y:332, r:35})); push(new Bouncer({x:100, y:386, r:18})); push(new Bouncer({x:533, y:349, r:18})); push(new Bouncer({x:474, y:399, r:18})); push(new Trash({x:216, y:57})); push(new Trash({x:238, y:99})); push(new Trash({x:282, y:124})); push(new Trash({x:330, y:124})); push(new Trash({x:374, y:102})); push(new Trash({x:415, y:18})); push(new Trash({x:139, y:57})); push(new Trash({x:161, y:108})); push(new Trash({x:192, y:152})); push(new Trash({x:238, y:184})); push(new Trash({x:287, y:194})); push(new Trash({x:338, y:194})); push(new Trash({x:396, y:174})); push(new Trash({x:438, y:136})); push(new Trash({x:465, y:86})); push(new Trash({x:488, y:33})); push(new Trash({x:76, y:41})); push(new Trash({x:94, y:86})); push(new Trash({x:139, y:152})); push(new Trash({x:180, y:194})); push(new Trash({x:438, y:190})); push(new Trash({x:474, y:152})); push(new Trash({x:521, y:83})); push(new Trash({x:544, y:33})); push(new Trash({x:316, y:242})); push(new Trash({x:488, y:206})); push(new Trash({x:573, y:76})); push(new Trash({x:129, y:200})); push(new Trash({x:48, y:76})); push(new Trash({x:536, y:178})); push(new Trash({x:559, y:129})); push(new Trash({x:588, y:171})); push(new Trash({x:56, y:133})); push(new Trash({x:74, y:178})); push(new Trash({x:28, y:168})); }; } public function randRange(_arg1:Number, _arg2:Number):Number{ return ((_arg1 + (Math.random() * (_arg2 - _arg1)))); } private function giveExtraShot():void{ var _local1:ExtraShotSplash = new ExtraShotSplash(); _local1.x = 320; _local1.y = 200; Scene2DReference.getInstance().scene.addChild(_local1); _totalAllowedShoots++; SoundPlayer.getInstance().playStarCollectedSound(); } 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().playFanfarSound(); } 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 = (33 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:113, y:333}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:563, y:197, w:29, h:111, isStatic:true})); push(new VoluntaryBox({x:337, y:310, w:29, h:111, isStatic:true})); push(new VoluntaryBox({x:622, y:349, w:29, h:77, isStatic:true})); push(new Bouncer({x:339, y:213, r:24})); push(new Trash({x:517, y:185})); push(new Bouncer({x:510, y:125, r:37})); push(new Bouncer({x:626, y:14, r:14})); push(new Trash({x:517, y:210})); push(new Trash({x:517, y:235})); push(new Trash({x:465, y:210})); push(new Trash({x:465, y:235})); push(new Trash({x:465, y:260})); push(new Trash({x:419, y:241})); push(new Trash({x:419, y:266})); push(new Trash({x:419, y:291})); push(new Trash({x:373, y:275})); push(new Trash({x:373, y:300})); push(new Trash({x:373, y:325})); push(new Trash({x:566, y:54})); push(new Trash({x:566, y:79})); push(new Trash({x:566, y:104})); push(new Trash({x:594, y:205})); push(new Trash({x:594, y:230})); push(new Trash({x:594, y:0xFF})); push(new Trash({x:498, y:300})); push(new Trash({x:498, y:325})); push(new Trash({x:498, y:350})); push(new Bouncer({x:41, y:73, r:56})); push(new Trash({x:281, y:260})); push(new Trash({x:281, y:285})); push(new Trash({x:281, y:310})); push(new Trash({x:243, y:285})); push(new Trash({x:243, y:310})); push(new Trash({x:243, y:335})); push(new Trash({x:203, y:310})); push(new Trash({x:203, y:335})); push(new Trash({x:203, y:360})); push(new Trash({x:18, y:162})); push(new Trash({x:18, y:187})); push(new Trash({x:18, y:212})); }; } private function generateLevel12():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (54 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:112, y:325}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new Bouncer({x:502, y:150, r:22})); push(new Trash({x:466, y:66})); push(new Bouncer({x:288, y:162, r:28})); push(new Trash({x:496, y:75})); push(new Trash({x:524, y:88})); push(new Trash({x:550, y:104})); push(new Trash({x:571, y:123})); push(new Trash({x:588, y:146})); push(new Trash({x:601, y:175})); push(new Trash({x:604, y:205})); push(new Trash({x:601, y:233})); push(new Trash({x:590, y:260})); push(new Trash({x:573, y:283})); push(new Trash({x:552, y:304})); push(new Trash({x:527, y:321})); push(new Trash({x:500, y:334})); push(new Trash({x:472, y:344})); push(new Trash({x:441, y:350})); push(new Trash({x:411, y:353})); push(new Trash({x:379, y:354})); push(new Trash({x:347, y:352})); push(new Trash({x:315, y:347})); push(new Trash({x:285, y:339})); push(new Trash({x:0x0100, y:327})); push(new Trash({x:230, y:311})); push(new Trash({x:206, y:292})); push(new Trash({x:185, y:269})); push(new Trash({x:171, y:242})); push(new Trash({x:166, y:214})); push(new Trash({x:168, y:183})); push(new Trash({x:179, y:154})); push(new Trash({x:196, y:129})); push(new Trash({x:219, y:108})); push(new Trash({x:243, y:92})); push(new Trash({x:270, y:79})); push(new Trash({x:298, y:70})); push(new Trash({x:329, y:63})); push(new Trash({x:360, y:60})); push(new Trash({x:395, y:59})); push(new Trash({x:431, y:61})); push(new Trash({x:178, y:108})); push(new Trash({x:166, y:87})); push(new Trash({x:177, y:61})); push(new Trash({x:208, y:51})); push(new Trash({x:233, y:64})); push(new Trash({x:530, y:60})); push(new Trash({x:556, y:45})); push(new Trash({x:584, y:55})); push(new Trash({x:595, y:81})); push(new Trash({x:582, y:101})); push(new Trash({x:316, y:275})); push(new Trash({x:344, y:275})); push(new Trash({x:374, y:275})); push(new Trash({x:403, y:275})); push(new Trash({x:432, y:275})); push(new Trash({x:462, y:275})); }; } private function generateLevel13():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (68 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:85, y:334}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:113, y:57, w:141, h:25, isStatic:true})); push(new Bouncer({x:200, y:254, r:27})); push(new Trash({x:383, y:163})); push(new Trash({x:403, y:135})); push(new Trash({x:433, y:117})); push(new Trash({x:466, y:112})); push(new Trash({x:498, y:119})); push(new Trash({x:522, y:135})); push(new Trash({x:540, y:158})); push(new Trash({x:550, y:187})); push(new Trash({x:548, y:221})); push(new Trash({x:534, y:250})); push(new Trash({x:513, y:271})); push(new Trash({x:483, y:285})); push(new Trash({x:451, y:286})); push(new Trash({x:420, y:276})); push(new Trash({x:396, y:0x0100})); push(new Trash({x:380, y:227})); push(new Trash({x:376, y:194})); push(new Trash({x:328, y:162})); push(new Trash({x:341, y:131})); push(new Trash({x:363, y:103})); push(new Trash({x:392, y:82})); push(new Trash({x:427, y:70})); push(new Trash({x:465, y:68})); push(new Trash({x:502, y:78})); push(new Trash({x:532, y:97})); push(new Trash({x:556, y:122})); push(new Trash({x:573, y:156})); push(new Trash({x:579, y:193})); push(new Trash({x:575, y:226})); push(new Trash({x:563, y:258})); push(new Trash({x:541, y:285})); push(new Trash({x:0x0202, y:306})); push(new Trash({x:481, y:319})); push(new Trash({x:445, y:322})); push(new Trash({x:410, y:316})); push(new Trash({x:379, y:300})); push(new Trash({x:355, y:278})); push(new Trash({x:336, y:250})); push(new Trash({x:325, y:205})); push(new Trash({x:277, y:176})); push(new Trash({x:282, y:141})); push(new Trash({x:297, y:106})); push(new Trash({x:316, y:78})); push(new Trash({x:342, y:54})); push(new Trash({x:370, y:37})); push(new Trash({x:402, y:26})); push(new Trash({x:438, y:21})); push(new Trash({x:475, y:24})); push(new Trash({x:509, y:35})); push(new Trash({x:540, y:54})); push(new Trash({x:564, y:75})); push(new Trash({x:585, y:104})); push(new Trash({x:600, y:139})); push(new Trash({x:606, y:175})); push(new Trash({x:605, y:209})); push(new Trash({x:597, y:244})); push(new Trash({x:579, y:277})); push(new Trash({x:557, y:304})); push(new Trash({x:532, y:324})); push(new Trash({x:501, y:341})); push(new Trash({x:465, y:350})); push(new Trash({x:427, y:351})); push(new Trash({x:392, y:344})); push(new Trash({x:362, y:331})); push(new Trash({x:332, y:310})); push(new Trash({x:309, y:285})); push(new Trash({x:292, y:0x0101})); push(new Trash({x:279, y:219})); }; } private function generateLevel14():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (53 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:558, y:113}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new Bouncer({x:432, y:327, r:56})); push(new Trash({x:172, y:141})); push(new Trash({x:209, y:160})); push(new Trash({x:213, y:206})); push(new Trash({x:132, y:164})); push(new Trash({x:133, y:211})); push(new Trash({x:176, y:231})); push(new Trash({x:252, y:183})); push(new Trash({x:216, y:254})); push(new Trash({x:135, y:0x0100})); push(new Trash({x:93, y:189})); push(new Trash({x:130, y:119})); push(new Trash({x:210, y:116})); push(new Trash({x:291, y:205})); push(new Trash({x:293, y:251})); push(new Trash({x:0x0101, y:274})); push(new Trash({x:179, y:322})); push(new Trash({x:215, y:300})); push(new Trash({x:138, y:302})); push(new Trash({x:56, y:258})); push(new Trash({x:97, y:280})); push(new Trash({x:55, y:213})); push(new Trash({x:92, y:98})); push(new Trash({x:51, y:123})); push(new Trash({x:52, y:167})); push(new Trash({x:169, y:50})); push(new Trash({x:207, y:70})); push(new Trash({x:129, y:74})); push(new Trash({x:287, y:110})); push(new Trash({x:250, y:92})); push(new Trash({x:292, y:157})); push(new Bouncer({x:99, y:151, r:14})); push(new Bouncer({x:102, y:243, r:14})); push(new Bouncer({x:177, y:102, r:14})); push(new Bouncer({x:259, y:144, r:14})); push(new Bouncer({x:261, y:235, r:14})); push(new Bouncer({x:184, y:285, r:14})); push(new VoluntaryBox({x:428, y:105, w:27, h:118, isStatic:true})); push(new VoluntaryBox({x:553, y:9, w:169, h:25, isStatic:true})); push(new Trash({x:603, y:263})); push(new Trash({x:590, y:296})); push(new Trash({x:358, y:59})); push(new Trash({x:538, y:345})); push(new Trash({x:500, y:359})); push(new Trash({x:384, y:83})); push(new Trash({x:354, y:103})); push(new Trash({x:384, y:125})); push(new Trash({x:354, y:148})); push(new Trash({x:388, y:169})); push(new Trash({x:23, y:22})); push(new Trash({x:55, y:22})); push(new Trash({x:23, y:55})); push(new Trash({x:92, y:22})); push(new Trash({x:23, y:90})); push(new Trash({x:58, y:71})); push(new Trash({x:18, y:359})); push(new Trash({x:18, y:325})); push(new Trash({x:51, y:359})); push(new Trash({x:78, y:55})); push(new Trash({x:339, y:331})); push(new Trash({x:319, y:361})); push(new Trash({x:355, y:361})); }; } private function generateLevel15():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (52 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:174, y:249}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:247, y:222, w:20, h:140, isStatic:true})); push(new VoluntaryBox({x:157, y:9, w:125, h:21, isStatic:true})); push(new VoluntaryBox({x:358, y:9, w:125, h:21, isStatic:true})); push(new Bouncer({x:27, y:144, r:75})); 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 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:265, y:179})); push(new Trash({x:265, y:149})); push(new Trash({x:265, y:120})); 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})); push(new Trash({x:433, y:324})); push(new Trash({x:457, y:300})); push(new Trash({x:482, y:275})); push(new Trash({x:506, y:251})); push(new Trash({x:531, y:226})); push(new Trash({x:555, y:202})); push(new Trash({x:580, y:177})); push(new Trash({x:116, y:159})); push(new Trash({x:140, y:135})); push(new Trash({x:165, y:110})); push(new Trash({x:189, y:86})); push(new Trash({x:214, y:61})); push(new Trash({x:238, y:37})); push(new Trash({x:263, y:12})); }; } private function generateLevel16():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (30 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:565, y:231}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:395, y:131, w:20, h:64, isStatic:true})); push(new VoluntaryBox({x:337, y:216, w:20, h:64, isStatic:true})); push(new VoluntaryBox({x:279, y:300, w:20, h:64, isStatic:true})); push(new VoluntaryBox({x:155, y:339, w:20, h:64, isStatic:true})); push(new VoluntaryBox({x:94, y:236, w:20, h:64, isStatic:true})); push(new VoluntaryBox({x:196, y:171, w:20, h:64, isStatic:true})); push(new VoluntaryBox({x:141, y:90, w:20, h:64, isStatic:true})); push(new VoluntaryBox({x:283, y:60, w:20, h:64, isStatic:true})); push(new Bouncer({x:52, y:357, r:25})); push(new Trash({x:186, y:12})); push(new Bouncer({x:36, y:124, r:25})); push(new Bouncer({x:416, y:349, r:25})); push(new Trash({x:226, y:58})); push(new Trash({x:176, y:92})); push(new Trash({x:315, y:18})); push(new Trash({x:373, y:38})); push(new Trash({x:327, y:108})); push(new Trash({x:327, y:60})); push(new Trash({x:260, y:133})); push(new Trash({x:289, y:184})); push(new Trash({x:235, y:214})); push(new Trash({x:131, y:163})); push(new Trash({x:172, y:238})); push(new Trash({x:216, y:291})); push(new Trash({x:187, y:350})); push(new Trash({x:315, y:291})); push(new Trash({x:446, y:139})); push(new Trash({x:391, y:222})); push(new Trash({x:446, y:76})); push(new Trash({x:507, y:28})); push(new Trash({x:77, y:92})); push(new Trash({x:85, y:28})); push(new Trash({x:11, y:42})); push(new Trash({x:43, y:179})); push(new Trash({x:11, y:254})); push(new Trash({x:65, y:287})); push(new Trash({x:104, y:332})); push(new Trash({x:333, y:350})); push(new Trash({x:260, y:366})); push(new Trash({x:437, y:275})); push(new Trash({x:507, y:316})); }; } private function generateLevel10():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (49 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:350, y:192}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:304, y:191, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:304, y:158, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:304, y:226, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:351, y:273, w:63, h:20, isStatic:true})); push(new Bouncer({x:594, y:26, r:15})); push(new Trash({x:115, y:41})); push(new Bouncer({x:594, y:68, r:15})); push(new Bouncer({x:594, y:110, r:15})); push(new Bouncer({x:594, y:152, r:15})); push(new Bouncer({x:594, y:194, r:15})); push(new Bouncer({x:594, y:236, r:15})); push(new Bouncer({x:594, y:278, r:15})); push(new Bouncer({x:594, y:320, r:15})); push(new Bouncer({x:594, y:362, r:15})); push(new Trash({x:141, y:41})); push(new Trash({x:169, y:41})); push(new Trash({x:197, y:41})); push(new Trash({x:141, y:62})); push(new Trash({x:197, y:62})); push(new Trash({x:115, y:86})); push(new Trash({x:115, y:107})); push(new Trash({x:141, y:86})); push(new Trash({x:169, y:86})); push(new Trash({x:197, y:86})); push(new Trash({x:141, y:107})); push(new Trash({x:168, y:107})); push(new Trash({x:197, y:107})); push(new Trash({x:115, y:131})); push(new Trash({x:115, y:152})); push(new Trash({x:141, y:131})); push(new Trash({x:169, y:131})); push(new Trash({x:168, y:152})); push(new Trash({x:87, y:41})); push(new Trash({x:87, y:62})); push(new Trash({x:87, y:86})); push(new Trash({x:87, y:107})); push(new Trash({x:72, y:164})); push(new Trash({x:97, y:184})); push(new Trash({x:122, y:204})); push(new Trash({x:147, y:224})); push(new Trash({x:172, y:244})); push(new Trash({x:320, y:305})); push(new Trash({x:122, y:251})); push(new Trash({x:97, y:271})); push(new Trash({x:170, y:204})); push(new Trash({x:195, y:184})); push(new Trash({x:223, y:164})); push(new Trash({x:343, y:324})); push(new Trash({x:369, y:347})); push(new Trash({x:363, y:305})); push(new Trash({x:317, y:347})); push(new Trash({x:195, y:271})); push(new Trash({x:375, y:15})); push(new Trash({x:401, y:37})); push(new Trash({x:424, y:58})); push(new Trash({x:424, y:16})); push(new Trash({x:377, y:56})); push(new Trash({x:7, y:308})); push(new Trash({x:30, y:326})); push(new Trash({x:50, y:344})); push(new Trash({x:50, y:307})); push(new Trash({x:10, y:342})); }; } private function generateLevel18():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (39 - 10); 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:203, isStatic:true})); push(new VoluntaryBox({x:520, y:286, w:20, h:203, isStatic:true})); push(new VoluntaryBox({x:430, y:286, w:20, h:203, isStatic:true})); push(new VoluntaryBox({x:340, y:286, w:20, h:203, isStatic:true})); push(new VoluntaryBox({x:250, y:286, w:20, h:203, isStatic:true})); push(new Bouncer({x:341, y:174, r:11})); push(new Trash({x:574, y:176})); 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:60})); push(new Trash({x:11, y:137})); push(new Trash({x:30, y:162})); push(new Trash({x:53, y:197})); push(new Trash({x:76, y:226})); push(new Trash({x:95, y:254})); push(new Trash({x:115, y:285})); push(new Trash({x:138, y:317})); push(new Trash({x:485, y:176})); push(new Trash({x:485, y:233})); push(new Trash({x:485, y:290})); push(new Trash({x:485, y:347})); push(new Trash({x:449, y:203})); push(new Trash({x:449, y:260})); push(new Trash({x:449, y:317})); push(new Trash({x:449, y:374})); push(new Bouncer({x:201, y:340, r:34})); }; } private function generateLevel19():void{ _totalAllowedShoots = 5; _finishedShootsCount = (_startedShootsCount = 0); _totalItemsToCollect = (30 - 10); updateStatistic(); var bg:Sprite = new SpaceBG(); bg.cacheAsBitmap = true; Scene2DReference.getInstance().scene.addChild(bg); initLauncher({x:571, y:362}); var _local2 = _sceneElements; with (_local2) { push(new Remover({x:-80, y:-400})); push(new VoluntaryBox({x:508, y:339, w:16, h:71, isStatic:true})); push(new VoluntaryBox({x:508, y:258, w:16, h:71, isStatic:true})); push(new VoluntaryBox({x:508, y:171, w:16, h:71, isStatic:true})); push(new VoluntaryBox({x:621, y:339, w:16, h:71, isStatic:true})); push(new VoluntaryBox({x:621, y:232, w:16, h:71, isStatic:true})); push(new VoluntaryBox({x:621, y:123, w:16, h:71, isStatic:true})); push(new VoluntaryBox({x:46, y:71, w:16, h:71, isStatic:true})); push(new VoluntaryBox({x:98, y:171, w:16, h:71, isStatic:true})); push(new VoluntaryBox({x:148, y:269, w:16, h:71, isStatic:true})); push(new VoluntaryBox({x:209, y:358, w:16, h:71, isStatic:true})); push(new Bouncer({x:390, y:336, r:39})); push(new Trash({x:50, y:143})); push(new Bouncer({x:254, y:323, r:22})); push(new Bouncer({x:597, y:5, r:50})); push(new Bouncer({x:472, y:208, r:10})); push(new Bouncer({x:129, y:382, r:10})); push(new Bouncer({x:472, y:279, r:10})); push(new Bouncer({x:305, y:377, r:10})); push(new Trash({x:18, y:166})); push(new Trash({x:55, y:191})); push(new Trash({x:18, y:218})); push(new Trash({x:73, y:234})); push(new Trash({x:18, y:294})); push(new Trash({x:50, y:252})); push(new Trash({x:63, y:301})); push(new Trash({x:36, y:345})); push(new Trash({x:100, y:288})); push(new Trash({x:88, y:329})); push(new Trash({x:163, y:363})); push(new Trash({x:145, y:36})); push(new Trash({x:183, y:55})); push(new Trash({x:138, y:84})); push(new Trash({x:188, y:112})); push(new Trash({x:232, y:72})); push(new Trash({x:232, y:22})); push(new Trash({x:288, y:52})); push(new Trash({x:140, y:159})); push(new Trash({x:392, y:175})); push(new Trash({x:346, y:191})); push(new Trash({x:410, y:219})); push(new Trash({x:365, y:236})); push(new Trash({x:442, y:31})); push(new Trash({x:470, y:55})); push(new Trash({x:429, y:72})); push(new Trash({x:452, y:323})); push(new Trash({x:464, y:366})); push(new Trash({x:247, y:366})); }; } 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.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 = (36 - 10); 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:229, y:275, w:20, h:27, isStatic:true})); push(new VoluntaryBox({x:316, y:212, w:20, h:27, isStatic:true})); push(new VoluntaryBox({x:243, y:125, w:20, h:27, isStatic:true})); push(new VoluntaryBox({x:450, y:75, w:20, h:27, isStatic:true})); push(new VoluntaryBox({x:494, y:190, w:20, h:57, isStatic:true})); push(new VoluntaryBox({x:413, y:282, w:20, h:27, isStatic:true})); push(new VoluntaryBox({x:560, y:330, w:20, h:27, isStatic:true})); push(new VoluntaryBox({x:588, y:148, w:20, h:27, isStatic:true})); push(new VoluntaryBox({x:356, y:35, w:20, h:27, isStatic:true})); push(new Bouncer({x:310, y:347, r:17})); push(new Trash({x:431, y:344})); push(new Bouncer({x:383, y:152, r:17})); push(new Bouncer({x:575, y:55, r:17})); push(new Bouncer({x:153, y:44, r:17})); push(new Bouncer({x:34, y:118, r:17})); push(new Trash({x:486, y:296})); push(new Trash({x:558, y:253})); push(new Trash({x:603, y:289})); push(new Trash({x:603, y:356})); push(new Trash({x:501, y:356})); push(new Trash({x:550, y:192})); push(new Trash({x:598, y:95})); push(new Trash({x:526, y:123})); push(new Trash({x:483, y:61})); push(new Trash({x:526, y:12})); push(new Trash({x:395, y:33})); push(new Trash({x:423, y:119})); push(new Trash({x:423, y:195})); push(new Trash({x:366, y:226})); push(new Trash({x:301, y:269})); push(new Trash({x:362, y:312})); push(new Trash({x:233, y:198})); push(new Trash({x:293, y:153})); push(new Trash({x:283, y:95})); push(new Trash({x:344, y:80})); push(new Trash({x:293, y:38})); push(new Trash({x:210, y:38})); push(new Trash({x:180, y:95})); push(new Trash({x:180, y:151})); push(new Trash({x:148, y:214})); push(new Trash({x:170, y:253})); push(new Trash({x:123, y:301})); push(new Trash({x:180, y:328})); push(new Trash({x:230, y:328})); push(new Trash({x:41, y:304})); push(new Trash({x:105, y:111})); push(new Trash({x:67, y:45})); push(new Trash({x:450, y:230})); push(new Trash({x:491, y:245})); push(new Trash({x:526, y:226})); }; } 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:[0, 5, 6, 1, 10, 3, 2, 12, 7, 7, 2, 11, 7, 12, 5, 2], 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 = (44 - 10); 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:132, y:116, w:20, h:20, isStatic:true})); push(new VoluntaryBox({x:152, y:120, w:20, h:20, isStatic:true})); push(new Trash({x:378, y:75})); push(new Bouncer({x:559, y:133, r:50})); push(new Bouncer({x:479, y:228, r:35})); 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 Bouncer({x:102, y:110, r:15})); push(new Bouncer({x:176, y:128, r:15})); push(new Trash({x:545, y:226})); push(new Trash({x:572, y:249})); push(new Trash({x:537, y:263})); push(new Trash({x:572, y:284})); push(new Trash({x:603, y:13})); push(new Trash({x:564, y:13})); push(new Trash({x:591, y:42})); push(new Trash({x:537, y:300})); push(new Trash({x:441, y:300})); push(new Trash({x:478, y:300})); push(new Trash({x:460, y:335})); push(new Trash({x:441, y:33})); push(new Trash({x:478, y:20})); push(new Trash({x:478, y:60})); }; } 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 onAddedToStage(_arg1:Event):void{ removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); startGame(); } private function onCollectTrash(_arg1:GameEvent):void{ _collectedItemsCount++; checkForBonus(); 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 giveBonusScore():void{ var _local1:BonusScoreSplash = new BonusScoreSplash(); _local1.x = 320; _local1.y = 380; Scene2DReference.getInstance().scene.addChild(_local1); _collectedItemsCount++; SoundPlayer.getInstance().playStarCollectedSound(); } 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 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:[0, 5, 6, 1, 10, 3, 2, 12, 7, 7, 2, 11, 7, 12, 5, 2], 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 313
//MainMask (MainMask) package { import flash.display.*; public dynamic class MainMask extends MovieClip { } }//package
Section 314
//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 315
//SpaceBG (SpaceBG) package { import flash.display.*; public dynamic class SpaceBG extends MovieClip { } }//package
Section 316
//SpaceshipSkin (SpaceshipSkin) package { import flash.display.*; public dynamic class SpaceshipSkin extends MovieClip { } }//package
Section 317
//StartMenu (StartMenu) package { import flash.events.*; import flash.display.*; import effects.*; public dynamic class StartMenu extends MovieClip { public var btnHelp:SimpleButton; public var btnPlayMoreGames:SimpleButton; public var btnDownload:SimpleButton; public var dustTarget:MovieClip; public var btnHighscores:SimpleButton; public var btnPlay:SimpleButton; public var dustEffect:DustEffect; public function StartMenu(){ addFrameScript(0, frame1); } public function onPlay(_arg1:MouseEvent):void{ var _local2:Event = new Event("Play"); dispatchEvent(_local2); } public function onHelp(_arg1:MouseEvent):void{ var _local2:Event = new Event("Help"); dispatchEvent(_local2); } public function onHighscores(_arg1:MouseEvent):void{ var _local2:Event = new Event("Highscores"); dispatchEvent(_local2); } public function onDownload(_arg1:MouseEvent):void{ var _local2:Event = new Event("Download"); dispatchEvent(_local2); } public function onPlayMoreGames(_arg1:MouseEvent):void{ } public function moveDustTarget(_arg1:Event):void{ dustTarget.x = (dustTarget.x + ((mouseX - dustTarget.x) / 10)); dustTarget.y = (dustTarget.y + ((mouseY - dustTarget.y) / 10)); } public function destroyEffects():void{ dustEffect.stop(); removeChild(dustEffect); } 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); } } }//package
Section 318
//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 319
//WinMenu (WinMenu) package { import flash.events.*; import ui.events.*; import flash.display.*; import org.flintparticles.common.events.*; import org.flintparticles.common.initializers.*; import org.flintparticles.common.actions.*; import org.flintparticles.common.counters.*; import org.flintparticles.twoD.zones.*; import flash.geom.*; import flash.filters.*; import flash.text.*; import org.flintparticles.twoD.emitters.*; import org.flintparticles.twoD.renderers.*; import org.flintparticles.common.displayObjects.*; import org.flintparticles.twoD.actions.*; 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 btnSubmitScore:SimpleButton; public var _score:uint; public var emitter:Emitter2D; public var renderer:BitmapRenderer; public function WinMenu(){ addFrameScript(0, frame1); } public function setText(_arg1:uint, _arg2:uint):void{ tfScore.text = ("Final score: " + _arg2); _score = _arg2; } public function onFocusName(_arg1:FocusEvent):void{ tfName.text = ""; } public function onKeyDowmName(_arg1:KeyboardEvent):void{ if (_arg1.keyCode == Keyboard.ENTER){ submitScore(); }; } 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 restart(_arg1:EmitterEvent):void{ Emitter2D(_arg1.target).start(); } 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(50); emitter.addInitializer(new SharedImage(new Dot(2))); emitter.addInitializer(new ColorInit(4294967295, 4294958990)); 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(); } } }//package
Section 320
//VoluntaryBoxSkin (VoluntaryBoxSkin) package { import flash.display.*; public dynamic class VoluntaryBoxSkin extends MovieClip { } }//package

Library Items

Symbol 1 FontUsed by:2 6 7 8 9 10 11 25 26 27 29 30 32 35 46 49 50 53 54 56 58 61 65 66 68 69 70 72 73 74 76 77 78 85 86 87 89 94 95 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 184 185 190 193 200 201 204 205 208 209 212 213 216 217 218
Symbol 2 TextUses:1Used by:3
Symbol 3 MovieClipUses:2Used by:4
Symbol 4 MovieClip {BonusScoreSplash} [BonusScoreSplash]Uses:3
Symbol 5 GraphicUsed by:34
Symbol 6 TextUses:1Used by:34
Symbol 7 EditableTextUses:1Used by:34
Symbol 8 TextUses:1Used by:34
Symbol 9 EditableTextUses:1Used by:34
Symbol 10 TextUses:1Used by:34
Symbol 11 EditableTextUses:1Used by:34
Symbol 12 GraphicUsed by:13
Symbol 13 MovieClipUses:12Used by:15
Symbol 14 GraphicUsed by:15 67
Symbol 15 ButtonUses:13 14Used by:34
Symbol 16 GraphicUsed by:17
Symbol 17 MovieClipUses:16Used by:34 41 83
Symbol 18 GraphicUsed by:19
Symbol 19 MovieClipUses:18Used by:24
Symbol 20 GraphicUsed by:23
Symbol 21 GraphicUsed by:23
Symbol 22 GraphicUsed by:23
Symbol 23 ButtonUses:20 21 22Used by:24
Symbol 24 MovieClip {assetsNewDesign_fla.MuteControl_5} [assetsNewDesign_fla.MuteControl_5]Uses:19 23Used by:34
Symbol 25 TextUses:1Used by:28
Symbol 26 TextUses:1Used by:28
Symbol 27 TextUses:1Used by:28
Symbol 28 ButtonUses:25 26 27Used by:34 93 195
Symbol 29 TextUses:1Used by:33
Symbol 30 TextUses:1Used by:33
Symbol 31 GraphicUsed by:33
Symbol 32 TextUses:1Used by:33
Symbol 33 ButtonUses:29 30 31 32Used by:34 195
Symbol 34 MovieClip {Controls} [Controls]Uses:5 6 7 8 9 10 11 15 17 24 28 33
Symbol 35 TextUses:1Used by:36
Symbol 36 MovieClipUses:35Used by:37
Symbol 37 MovieClip {ExtraShotSplash} [ExtraShotSplash]Uses:36
Symbol 38 GraphicUsed by:39
Symbol 39 MovieClip {MainMask} [MainMask]Uses:38
Symbol 40 GraphicUsed by:41
Symbol 41 MovieClipUses:40 17Used by:80 183 191 220
Symbol 42 GraphicUsed by:80
Symbol 43 GraphicUsed by:44
Symbol 44 MovieClipUses:43Used by:62
Symbol 45 GraphicUsed by:62
Symbol 46 TextUses:1Used by:62
Symbol 47 GraphicUsed by:48
Symbol 48 MovieClipUses:47Used by:62 249
Symbol 49 TextUses:1Used by:52
Symbol 50 TextUses:1Used by:52
Symbol 51 GraphicUsed by:52
Symbol 52 ButtonUses:49 50 51Used by:62
Symbol 53 TextUses:1Used by:62
Symbol 54 TextUses:1Used by:62
Symbol 55 GraphicUsed by:60
Symbol 56 TextUses:1Used by:60
Symbol 57 GraphicUsed by:60
Symbol 58 TextUses:1Used by:60
Symbol 59 GraphicUsed by:60
Symbol 60 ButtonUses:55 56 57 58 59Used by:62
Symbol 61 TextUses:1Used by:62
Symbol 62 MovieClip {assetsNewDesign_fla.HelpContent_12} [assetsNewDesign_fla.HelpContent_12]Uses:44 45 46 48 52 53 54 60 61Used by:80
Symbol 63 GraphicUsed by:64
Symbol 64 MovieClipUses:63Used by:67
Symbol 65 TextUses:1Used by:67
Symbol 66 TextUses:1Used by:67
Symbol 67 ButtonUses:64 65 66 14Used by:80
Symbol 68 TextUses:1Used by:71
Symbol 69 TextUses:1Used by:71
Symbol 70 TextUses:1Used by:71
Symbol 71 ButtonUses:68 69 70Used by:80
Symbol 72 TextUses:1Used by:75
Symbol 73 TextUses:1Used by:75
Symbol 74 TextUses:1Used by:75
Symbol 75 ButtonUses:72 73 74Used by:80
Symbol 76 TextUses:1Used by:79
Symbol 77 TextUses:1Used by:79
Symbol 78 TextUses:1Used by:79
Symbol 79 ButtonUses:76 77 78Used by:80
Symbol 80 MovieClip {HelpMenu} [HelpMenu]Uses:41 42 62 67 71 75 79
Symbol 81 GraphicUsed by:93
Symbol 82 GraphicUsed by:83
Symbol 83 MovieClipUses:82 17Used by:93 195
Symbol 84 GraphicUsed by:93
Symbol 85 TextUses:1Used by:93
Symbol 86 TextUses:1Used by:90
Symbol 87 TextUses:1Used by:90
Symbol 88 GraphicUsed by:90
Symbol 89 TextUses:1Used by:90
Symbol 90 ButtonUses:86 87 88 89Used by:93
Symbol 91 GraphicUsed by:92
Symbol 92 MovieClipUses:91Used by:93
Symbol 93 MovieClip {CompleteLevelMenu} [CompleteLevelMenu]Uses:81 83 84 85 90 28 92
Symbol 94 TextUses:1Used by:183
Symbol 95 TextUses:1Used by:183
Symbol 96 GraphicUsed by:97
Symbol 97 MovieClipUses:96Used by:183
Symbol 98 GraphicUsed by:100
Symbol 99 GraphicUsed by:100
Symbol 100 ButtonUses:98 99Used by:183
Symbol 101 TextUses:1Used by:183
Symbol 102 TextUses:1Used by:183
Symbol 103 TextUses:1Used by:183
Symbol 104 TextUses:1Used by:183
Symbol 105 TextUses:1Used by:183
Symbol 106 TextUses:1Used by:183
Symbol 107 TextUses:1Used by:183
Symbol 108 TextUses:1Used by:183
Symbol 109 TextUses:1Used by:183
Symbol 110 TextUses:1Used by:183
Symbol 111 TextUses:1Used by:183
Symbol 112 TextUses:1Used by:183
Symbol 113 TextUses:1Used by:183
Symbol 114 TextUses:1Used by:183
Symbol 115 TextUses:1Used by:183
Symbol 116 TextUses:1Used by:183
Symbol 117 TextUses:1Used by:183
Symbol 118 TextUses:1Used by:183
Symbol 119 TextUses:1Used by:183
Symbol 120 TextUses:1Used by:183
Symbol 121 TextUses:1Used by:183
Symbol 122 TextUses:1Used by:183
Symbol 123 FontUsed by:124 126 127 130 131 134
Symbol 124 TextUses:123Used by:125
Symbol 125 MovieClipUses:124Used by:183
Symbol 126 TextUses:123Used by:129
Symbol 127 TextUses:123Used by:129
Symbol 128 GraphicUsed by:129
Symbol 129 ButtonUses:126 127 128Used by:183
Symbol 130 TextUses:123Used by:133
Symbol 131 TextUses:123Used by:133
Symbol 132 GraphicUsed by:133
Symbol 133 ButtonUses:130 131 132Used by:183
Symbol 134 TextUses:123Used by:136
Symbol 135 GraphicUsed by:136
Symbol 136 ButtonUses:134 135Used by:183
Symbol 137 GraphicUsed by:138
Symbol 138 MovieClipUses:137Used by:139
Symbol 139 MovieClipUses:138Used by:183
Symbol 140 BitmapUsed by:141
Symbol 141 GraphicUses:140Used by:180
Symbol 142 BitmapUsed by:143
Symbol 143 GraphicUses:142Used by:180
Symbol 144 BitmapUsed by:145
Symbol 145 GraphicUses:144Used by:180
Symbol 146 BitmapUsed by:147
Symbol 147 GraphicUses:146Used by:180
Symbol 148 BitmapUsed by:149
Symbol 149 GraphicUses:148Used by:180
Symbol 150 BitmapUsed by:151
Symbol 151 GraphicUses:150Used by:180
Symbol 152 BitmapUsed by:153
Symbol 153 GraphicUses:152Used by:180
Symbol 154 BitmapUsed by:155
Symbol 155 GraphicUses:154Used by:180
Symbol 156 BitmapUsed by:157
Symbol 157 GraphicUses:156Used by:180
Symbol 158 BitmapUsed by:159
Symbol 159 GraphicUses:158Used by:180
Symbol 160 BitmapUsed by:161
Symbol 161 GraphicUses:160Used by:180
Symbol 162 BitmapUsed by:163
Symbol 163 GraphicUses:162Used by:180
Symbol 164 BitmapUsed by:165
Symbol 165 GraphicUses:164Used by:180
Symbol 166 BitmapUsed by:167
Symbol 167 GraphicUses:166Used by:180
Symbol 168 BitmapUsed by:169
Symbol 169 GraphicUses:168Used by:180
Symbol 170 BitmapUsed by:171
Symbol 171 GraphicUses:170Used by:180
Symbol 172 BitmapUsed by:173
Symbol 173 GraphicUses:172Used by:180
Symbol 174 BitmapUsed by:175
Symbol 175 GraphicUses:174Used by:180
Symbol 176 BitmapUsed by:177
Symbol 177 GraphicUses:176Used by:180
Symbol 178 BitmapUsed by:179
Symbol 179 GraphicUses:178Used by:180
Symbol 180 MovieClipUses:141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171 173 175 177 179Used by:183
Symbol 181 FontUsed by:182 188 189
Symbol 182 EditableTextUses:181Used by:183
Symbol 183 MovieClip {LevelMenu} [LevelMenu]Uses:41 94 95 97 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 125 129 133 136 139 180 182
Symbol 184 TextUses:1Used by:187
Symbol 185 TextUses:1Used by:187
Symbol 186 GraphicUsed by:187
Symbol 187 ButtonUses:184 185 186Used by:191
Symbol 188 EditableTextUses:181Used by:191
Symbol 189 EditableTextUses:181Used by:191
Symbol 190 TextUses:1Used by:191
Symbol 191 MovieClip {WinMenu} [WinMenu]Uses:41 187 188 189 190
Symbol 192 GraphicUsed by:195
Symbol 193 TextUses:1Used by:195
Symbol 194 GraphicUsed by:195
Symbol 195 MovieClip {DefeatLevelMenu} [DefeatLevelMenu]Uses:192 83 193 28 194 33
Symbol 196 GraphicUsed by:199
Symbol 197 GraphicUsed by:198
Symbol 198 MovieClip {Dust} [Dust]Uses:197Used by:199
Symbol 199 MovieClipUses:196 198Used by:220
Symbol 200 TextUses:1Used by:203
Symbol 201 TextUses:1Used by:203
Symbol 202 GraphicUsed by:203
Symbol 203 ButtonUses:200 201 202Used by:220
Symbol 204 TextUses:1Used by:207
Symbol 205 TextUses:1Used by:207
Symbol 206 GraphicUsed by:207
Symbol 207 ButtonUses:204 205 206Used by:220
Symbol 208 TextUses:1Used by:211
Symbol 209 TextUses:1Used by:211
Symbol 210 GraphicUsed by:211
Symbol 211 ButtonUses:208 209 210Used by:220
Symbol 212 TextUses:1Used by:215
Symbol 213 TextUses:1Used by:215
Symbol 214 GraphicUsed by:215
Symbol 215 ButtonUses:212 213 214Used by:220
Symbol 216 TextUses:1Used by:219
Symbol 217 TextUses:1Used by:219
Symbol 218 TextUses:1Used by:219
Symbol 219 ButtonUses:216 217 218Used by:220
Symbol 220 MovieClip {StartMenu} [StartMenu]Uses:41 199 203 207 211 215 219
Symbol 221 GraphicUsed by:229
Symbol 222 GraphicUsed by:227
Symbol 223 GraphicUsed by:227
Symbol 224 GraphicUsed by:227
Symbol 225 GraphicUsed by:227
Symbol 226 GraphicUsed by:227
Symbol 227 MovieClip {BGElement} [BGElement]Uses:222 223 224 225 226Used by:228
Symbol 228 MovieClip {assetsNewDesign_fla.BGAnimation_64} [assetsNewDesign_fla.BGAnimation_64]Uses:227Used by:229
Symbol 229 MovieClip {SpaceBG} [SpaceBG]Uses:221 228
Symbol 230 GraphicUsed by:231
Symbol 231 MovieClip {VoluntaryBoxSkin} [VoluntaryBoxSkin]Uses:230
Symbol 232 GraphicUsed by:233
Symbol 233 MovieClip {LauncherBar} [LauncherBar]Uses:232
Symbol 234 GraphicUsed by:235
Symbol 235 MovieClip {LauncherSkin} [LauncherSkin]Uses:234
Symbol 236 GraphicUsed by:242
Symbol 237 GraphicUsed by:238
Symbol 238 MovieClipUses:237Used by:242
Symbol 239 GraphicUsed by:240
Symbol 240 MovieClipUses:239Used by:242
Symbol 241 GraphicUsed by:242
Symbol 242 MovieClip {BouncerSkin} [BouncerSkin]Uses:236 238 240 241
Symbol 243 GraphicUsed by:244
Symbol 244 MovieClipUses:243Used by:249
Symbol 245 GraphicUsed by:246
Symbol 246 MovieClipUses:245Used by:249
Symbol 247 GraphicUsed by:248
Symbol 248 MovieClipUses:247Used by:249
Symbol 249 MovieClipUses:48 244 246 248Used by:250
Symbol 250 MovieClip {TrashSkin} [TrashSkin]Uses:249
Symbol 251 Sound {sound.Samples_LevelLoopClass} [sound.Samples_LevelLoopClass]
Symbol 252 Sound {sound.Samples_StarCollectedClass1} [StarCollected1]
Symbol 253 Sound {sound.Samples_MenuLoopSndClass} [sound.Samples_MenuLoopSndClass]
Symbol 254 Sound {sound.Samples_StarCollectedClass2} [StarCollected2]
Symbol 255 Sound {sound.Samples_FanfarClass} [sound.Samples_FanfarClass]
Symbol 256 Sound {sound.Samples_ExplosionSndClass} [sound.Samples_ExplosionSndClass]
Symbol 257 Sound {sound.Samples_FireSndClass} [sound.Samples_FireSndClass]
Symbol 258 GraphicUsed by:259
Symbol 259 MovieClip {SpaceshipSkin} [SpaceshipSkin]Uses:258

Instance Names

"mcWaves"Symbol 24 MovieClip {assetsNewDesign_fla.MuteControl_5} [assetsNewDesign_fla.MuteControl_5] Frame 1Symbol 19 MovieClip
"btnMute"Symbol 24 MovieClip {assetsNewDesign_fla.MuteControl_5} [assetsNewDesign_fla.MuteControl_5] Frame 1Symbol 23 Button
"tfCollected"Symbol 34 MovieClip {Controls} [Controls] Frame 1Symbol 7 EditableText
"tfTotal"Symbol 34 MovieClip {Controls} [Controls] Frame 1Symbol 9 EditableText
"tfShootsDone"Symbol 34 MovieClip {Controls} [Controls] Frame 1Symbol 11 EditableText
"tfShootsTotal"Symbol 34 MovieClip {Controls} [Controls] Frame 1Symbol 9 EditableText
"btnHelp"Symbol 34 MovieClip {Controls} [Controls] Frame 1Symbol 15 Button
"btnMenu"Symbol 34 MovieClip {Controls} [Controls] Frame 1Symbol 28 Button
"btnReset"Symbol 34 MovieClip {Controls} [Controls] Frame 1Symbol 33 Button
"btnGoodLuck"Symbol 62 MovieClip {assetsNewDesign_fla.HelpContent_12} [assetsNewDesign_fla.HelpContent_12] Frame 1Symbol 52 Button
"btnDownload"Symbol 62 MovieClip {assetsNewDesign_fla.HelpContent_12} [assetsNewDesign_fla.HelpContent_12] Frame 20Symbol 60 Button
"_content"Symbol 80 MovieClip {HelpMenu} [HelpMenu] Frame 1Symbol 62 MovieClip {assetsNewDesign_fla.HelpContent_12} [assetsNewDesign_fla.HelpContent_12]
"btnClose"Symbol 80 MovieClip {HelpMenu} [HelpMenu] Frame 1Symbol 67 Button
"btnCredits"Symbol 80 MovieClip {HelpMenu} [HelpMenu] Frame 1Symbol 71 Button
"btnControls"Symbol 80 MovieClip {HelpMenu} [HelpMenu] Frame 1Symbol 75 Button
"btnDownload"Symbol 80 MovieClip {HelpMenu} [HelpMenu] Frame 1Symbol 79 Button
"btnNext"Symbol 93 MovieClip {CompleteLevelMenu} [CompleteLevelMenu] Frame 1Symbol 90 Button
"btnMenu"Symbol 93 MovieClip {CompleteLevelMenu} [CompleteLevelMenu] Frame 1Symbol 28 Button
"btn1"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn2"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn3"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn4"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn5"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn6"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn7"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn8"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn9"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn10"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn11"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn12"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn13"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn14"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn15"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn16"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn17"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn18"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn19"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"btn20"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 100 Button
"mcAreYouSure"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 125 MovieClip
"btnYes"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 129 Button
"btnNo"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 133 Button
"btnReset"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 136 Button
"lock1"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock2"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock3"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock4"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock5"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock10"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock9"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock8"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock7"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock6"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock11"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock12"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock13"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock14"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock15"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock16"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock17"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock18"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock19"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"lock20"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 139 MovieClip
"mcPreview"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 180 MovieClip
"tfBestTime"Symbol 183 MovieClip {LevelMenu} [LevelMenu] Frame 1Symbol 182 EditableText
"btnSubmitScore"Symbol 191 MovieClip {WinMenu} [WinMenu] Frame 1Symbol 187 Button
"tfName"Symbol 191 MovieClip {WinMenu} [WinMenu] Frame 1Symbol 188 EditableText
"tfScore"Symbol 191 MovieClip {WinMenu} [WinMenu] Frame 1Symbol 189 EditableText
"btnMenu"Symbol 195 MovieClip {DefeatLevelMenu} [DefeatLevelMenu] Frame 1Symbol 28 Button
"btnReplay"Symbol 195 MovieClip {DefeatLevelMenu} [DefeatLevelMenu] Frame 1Symbol 33 Button
"dustTarget"Symbol 220 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 199 MovieClip
"btnPlay"Symbol 220 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 203 Button
"btnHelp"Symbol 220 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 207 Button
"btnHighscores"Symbol 220 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 211 Button
"btnDownload"Symbol 220 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 215 Button
"btnPlayMoreGames"Symbol 220 MovieClip {StartMenu} [StartMenu] Frame 1Symbol 219 Button
"particleInst1"Symbol 228 MovieClip {assetsNewDesign_fla.BGAnimation_64} [assetsNewDesign_fla.BGAnimation_64] Frame 1Symbol 227 MovieClip {BGElement} [BGElement]
"particleInst2"Symbol 228 MovieClip {assetsNewDesign_fla.BGAnimation_64} [assetsNewDesign_fla.BGAnimation_64] Frame 1Symbol 227 MovieClip {BGElement} [BGElement]
"skinItem"Symbol 250 MovieClip {TrashSkin} [TrashSkin] Frame 1Symbol 249 MovieClip

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1458 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 4 as "BonusScoreSplash"
ExportAssets (56)Timeline Frame 1Symbol 34 as "Controls"
ExportAssets (56)Timeline Frame 1Symbol 37 as "ExtraShotSplash"
ExportAssets (56)Timeline Frame 1Symbol 39 as "MainMask"
ExportAssets (56)Timeline Frame 1Symbol 80 as "HelpMenu"
ExportAssets (56)Timeline Frame 1Symbol 93 as "CompleteLevelMenu"
ExportAssets (56)Timeline Frame 1Symbol 183 as "LevelMenu"
ExportAssets (56)Timeline Frame 1Symbol 191 as "WinMenu"
ExportAssets (56)Timeline Frame 1Symbol 195 as "DefeatLevelMenu"
ExportAssets (56)Timeline Frame 1Symbol 220 as "StartMenu"
ExportAssets (56)Timeline Frame 1Symbol 229 as "SpaceBG"
ExportAssets (56)Timeline Frame 1Symbol 231 as "VoluntaryBoxSkin"
ExportAssets (56)Timeline Frame 1Symbol 24 as "assetsNewDesign_fla.MuteControl_5"
ExportAssets (56)Timeline Frame 1Symbol 62 as "assetsNewDesign_fla.HelpContent_12"
ExportAssets (56)Timeline Frame 1Symbol 233 as "LauncherBar"
ExportAssets (56)Timeline Frame 1Symbol 235 as "LauncherSkin"
ExportAssets (56)Timeline Frame 1Symbol 242 as "BouncerSkin"
ExportAssets (56)Timeline Frame 1Symbol 228 as "assetsNewDesign_fla.BGAnimation_64"
ExportAssets (56)Timeline Frame 1Symbol 250 as "TrashSkin"
ExportAssets (56)Timeline Frame 1Symbol 198 as "Dust"
ExportAssets (56)Timeline Frame 1Symbol 251 as "sound.Samples_LevelLoopClass"
ExportAssets (56)Timeline Frame 1Symbol 252 as "StarCollected1"
ExportAssets (56)Timeline Frame 1Symbol 253 as "sound.Samples_MenuLoopSndClass"
ExportAssets (56)Timeline Frame 1Symbol 254 as "StarCollected2"
ExportAssets (56)Timeline Frame 1Symbol 255 as "sound.Samples_FanfarClass"
ExportAssets (56)Timeline Frame 1Symbol 256 as "sound.Samples_ExplosionSndClass"
ExportAssets (56)Timeline Frame 1Symbol 257 as "sound.Samples_FireSndClass"
ExportAssets (56)Timeline Frame 1Symbol 259 as "SpaceshipSkin"
ExportAssets (56)Timeline Frame 1Symbol 227 as "BGElement"
SerialNumber (41)Timeline Frame 1

Labels

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




http://swfchan.com/28/136020/info.shtml
Created: 9/2 -2019 08:00:44 Last modified: 9/2 -2019 08:00:44 Server time: 05/11 -2024 04:14:24