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

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

Mutilate-A-Doll.swf

This is the info page for
Flash #101571

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


Text
<p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">If you see this text, nothing interesting is happening, yet. </font></p><p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">You must paste something here to load, or press the save button to save your world.</font></p><p align="left"></p><p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">Might want to press the Help-button for more detailed info.</font></p>

Copy

Save

Load

Done

Local Save

Local Load

Name:

<p align="left"></p>

Share

View

Help

<p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">Toggle help</font></p><p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">about <sbr />saving</font></p>

<p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">Share a <sbr />level</font></p><p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">via Content</font></p><p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">Sharing.</font></p>

<p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">Browse user-<sbr />made levels</font></p>

<p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">These are saved as &quot;flash cookies&quot; locally.</font></p><p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">Enter a name, then save. Load by entering the </font></p><p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">same name and pressing Local Load.</font></p>

<p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">Copies</font></p><p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">text above</font></p>

<p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">Saves</font></p><p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">current</font></p><p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">level</font></p>

<p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">Loads level</font></p><p align="left"><font face="Arial" size="12" color="#000000" letterSpacing="0.000000" kerning="1">from text</font></p>

Skin tone

Fill alpha

Line size

Object

Stage

Shirt

Pants

HELP

Move the sliders to affect graphics.
Line thickness, meaning outlines of
every object plus the lines when you
cut things.
Fill alpha, meaning the visibility of
the inside colour of every object.
Skin tone changes ragdolls'
skin (head) colour

Change colours of various things.
Object colour changes the colour
of every normal object.
Static changes wall colour.
Blood changes blood colour.
Stage changes the background's
colour.
Shirt and pants colour changes
ragdolls' clothes.
These options are saved with the
level when you string save or
share user content.

Static

Blood

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">1</font></p>

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">1</font></p>

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">0.5</font></p>

Density:

Friction:

Restitution:

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">0.2</font></p>

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">0</font></p>

LinearDamp:

Size:

Bleed mod:

Time mod:

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">1</font></p>

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">1</font></p>

Slomo effects

Ragdolls break

Pause on menu

Object limit:

Wind:

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">1000</font></p>

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">0</font></p>

Gravity:

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">10</font></p>

Draw lines on cut

Random spawning

Sounds

Damage:

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

<p align="left"></p>

S

OK

L

Stabilize

Lag:

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">1</font></p>

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">0</font></p>

AngularDamp:

PANIC

Joints break

<p align="left"><font face="Arial Black" size="12" color="#000000" letterSpacing="0.000000" kerning="1">0</font></p>

Angle:

If toggled:
1) Game is autopaused when a menu is opened.
2) Slow motion effects are applied on hard collisions.
3) Ragdolls' limbs can be detached or destroyed.
4) Joints can be broken with enough force.
5) Lines are drawn when you cut (Q,W,E and ctrl)
6) Spawning in random position (not under mouse).
7) Forces are applied to ragdolls to make them stand up better.

These affect whole stage, existing objects too.
Speed of game
Amount of blood *
Maximum amount of objects
Amount of vertical force *
Amount of horizontal force *
Throttle/Overdrive, affects multiple things.
* Can be set to a negative value.

These affect spawned
objects' properties.

Size multiplier
Weight of object
Friction of object
Bounciness of object
Speed damping
Rotation damping
Damping makes it feel
like the air is made of
water or tar.

Drag 'n' drop from here to stage to
spawn an object under mouse.
Click to spawn in a random position.
It's possible to spawn these by
pressing keys.
Press Enter to see list of hotkeys.

Press to
reboot
the physics
engine if
it crashes.

Close Ad

<p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Mouse &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Drag</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Shift+Mouse &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Multiple drag</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Mouse+Del &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Delete</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Shift+Del &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Multiple Delete</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Ctrl+Mouse &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cut</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Up/Down &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Change size (not saveable)</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Left/Right &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rotate</b></font></p>

<p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>SPACE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ragdoll</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>A &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Square</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>S &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Breakable</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>D &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Shuriken</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>F &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Octagon</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>G &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Circle</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>H &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hammer</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>J &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sword</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>K &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Brick &nbsp;wall</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>L &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Chain</b></font></p>

<p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Jointing and Cutting</b></font></p>

<p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Weapons</b></font></p>

<p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Objects</b></font></p>

<p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>System</b></font></p>

<p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Mouse tools</b></font></p>

<p align="left"><font face="Arial" size="10" color="#515151" letterSpacing="0.000000" kerning="1"><b>(To joint:</b></font></p><p align="left"><font face="Arial" size="10" color="#515151" letterSpacing="0.000000" kerning="1"><b>Press a key on top of an object,</b></font></p><p align="left"><font face="Arial" size="10" color="#515151" letterSpacing="0.000000" kerning="1"><b>hold, release on top of another <sbr />object.)</b></font></p>

<p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Y &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Elastic joint</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>U &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rigid joint</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b> I &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hinge joint</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>O &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Motor joint</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>Q &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mousecut</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>W &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Randomcut</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>E &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gridcut</b></font></p>

<p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>C &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quicksave</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>V &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quickload</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>B &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quickshare</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>R &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reset</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>P &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pause</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>ESC &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;save/load menu</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>ENTER &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hide/show hotkeys</b></font></p>

<p align="left"><font face="Arial" size="10" color="#515151" letterSpacing="0.000000" kerning="1"><b>(Shoot with same key)</b></font></p>

<p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pistol</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Shotgun</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>3 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Assault Rifle</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>4 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Grenade Launcher</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>5 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sniper</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>6 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Flamethrower</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>7 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Minigun</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>8 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cannon</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>9 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Harpoon gun</b></font></p><p align="left"><font face="Arial" size="12" color="#515151" letterSpacing="0.000000" kerning="1"><b>0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Rocket</b></font></p>

<p align="left"><font face="Arial" size="12" color="#666666" letterSpacing="0.000000" kerning="1">Press space to summon your first victim after this dull loading screen goes away. </font></p><p align="left"><font face="Arial" size="12" color="#666666" letterSpacing="0.000000" kerning="1">After that, it&apos;s all up to you. Enter for hotkeys, read the instructions and helps.</font></p><p align="left"><font face="Arial" size="12" color="#666666" letterSpacing="0.000000" kerning="1">Feedback is welcome on comments, forums and irc.</font></p>

ActionScript [AS3]

Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2CircleDef extends b2ShapeDef { public var localPosition:b2Vec2; public var radius:Number; public function b2CircleDef(){ localPosition = new b2Vec2(0, 0); super(); type = b2Shape.e_circleShape; radius = 1; } } }//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2CircleShape extends b2Shape { public var m_localPosition:b2Vec2; public var m_radius:Number; public function b2CircleShape(_arg1:b2ShapeDef){ m_localPosition = new b2Vec2(); super(_arg1); var _local2:b2CircleDef = (_arg1 as b2CircleDef); m_type = e_circleShape; m_localPosition.SetV(_local2.localPosition); m_radius = _local2.radius; } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Mat22 = _arg1.R; var _local4:Number = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); var _local5:Number = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _local4 = (_arg2.x - _local4); _local5 = (_arg2.y - _local5); return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius))); } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{ var _local10:Number; var _local6:b2Mat22 = _arg1.R; var _local7:Number = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y))); var _local8:Number = (_arg1.position.y + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y))); var _local9:Number = (_arg4.p1.x - _local7); _local10 = (_arg4.p1.y - _local8); var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius)); if (_local11 < 0){ _arg2[0] = 0; return (e_startsInsideCollide); }; var _local12:Number = (_arg4.p2.x - _arg4.p1.x); var _local13:Number = (_arg4.p2.y - _arg4.p1.y); var _local14:Number = ((_local9 * _local12) + (_local10 * _local13)); var _local15:Number = ((_local12 * _local12) + (_local13 * _local13)); var _local16:Number = ((_local14 * _local14) - (_local15 * _local11)); if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){ return (e_missCollide); }; var _local17:Number = -((_local14 + Math.sqrt(_local16))); if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){ _local17 = (_local17 / _local15); _arg2[0] = _local17; _arg3.x = (_local9 + (_local17 * _local12)); _arg3.y = (_local10 + (_local17 * _local13)); _arg3.Normalize(); return (e_hitCollide); }; return (e_missCollide); } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22 = _arg2.R; var _local4:Number = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); var _local5:Number = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius)); _arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius)); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2Mat22; _local4 = _arg2.R; var _local5:Number = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); var _local6:Number = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _local4 = _arg3.R; var _local7:Number = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); var _local8:Number = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius)); _arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius)); } override public function ComputeMass(_arg1:b2MassData):void{ _arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius); _arg1.center.SetV(m_localPosition); _arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y)))); } public function GetLocalPosition():b2Vec2{ return (m_localPosition); } public function GetRadius():Number{ return (m_radius); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:Number = (m_localPosition.x - _arg1.x); var _local3:Number = (m_localPosition.y - _arg1.y); _local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3))); m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop); } } }//package Box2D.Collision.Shapes
Section 3
//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 = categoryBits; _local1.maskBits = maskBits; _local1.groupIndex = groupIndex; return (_local1); } } }//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2MassData { public var mass:Number;// = 0 public var center:b2Vec2; public var I:Number;// = 0 public function b2MassData(){ center = new b2Vec2(0, 0); super(); } } }//package Box2D.Collision.Shapes
Section 5
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PolygonDef extends b2ShapeDef { public var vertices:Array; public var vertexCount:int; private static var s_mat:b2Mat22 = new b2Mat22(); public function b2PolygonDef(){ vertices = new Array(b2Settings.b2_maxPolygonVertices); super(); type = b2Shape.e_polygonShape; vertexCount = 0; var _local1:int; while (_local1 < b2Settings.b2_maxPolygonVertices) { vertices[_local1] = new b2Vec2(); _local1++; }; } public function SetAsBox(_arg1:Number, _arg2:Number):void{ vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); } public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{ var _local5:b2Vec2; var _local6:b2Mat22; var _local7:int; vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); if (_arg3){ _local5 = _arg3; _local6 = s_mat; _local6.Set(_arg4); _local7 = 0; while (_local7 < vertexCount) { _arg3 = vertices[_local7]; _arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y))); _arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y))); _arg3.x = _arg1; _local7++; }; }; } } }//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PolygonShape extends b2Shape { 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; s_supportVec = new b2Vec2(); m_obb = new b2OBB(); m_vertices = new Array(b2Settings.b2_maxPolygonVertices); m_normals = new Array(b2Settings.b2_maxPolygonVertices); m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices); super(_arg1); m_type = e_polygonShape; var _local2:b2PolygonDef = (_arg1 as b2PolygonDef); m_vertexCount = _local2.vertexCount; var _local4:int = _local3; var _local5:int = _local3; _local3 = 0; while (_local3 < m_vertexCount) { m_vertices[_local3] = _local2.vertices[_local3].Copy(); _local3++; }; _local3 = 0; while (_local3 < m_vertexCount) { _local4 = _local3; _local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0; _local6 = (m_vertices[_local5].x - m_vertices[_local4].x); _local7 = (m_vertices[_local5].y - m_vertices[_local4].y); _local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8)); _local3++; }; m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount); ComputeOBB(m_obb, m_vertices, m_vertexCount); _local3 = 0; while (_local3 < m_vertexCount) { _local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1); _local5 = _local3; _local9 = m_normals[_local4].x; _local10 = m_normals[_local4].y; _local11 = m_normals[_local5].x; _local12 = m_normals[_local5].y; _local13 = (m_vertices[_local3].x - m_centroid.x); _local14 = (m_vertices[_local3].y - m_centroid.y); _local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop); _local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop); _local17 = (1 / ((_local9 * _local12) - (_local10 * _local11))); m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y)); _local3++; }; } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Vec2; var _local10:Number; var _local4:b2Mat22 = _arg1.R; var _local5:Number = (_arg2.x - _arg1.position.x); var _local6:Number = (_arg2.y - _arg1.position.y); var _local7:Number = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y)); var _local8:Number = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y)); var _local9:int; while (_local9 < m_vertexCount) { _local3 = m_vertices[_local9]; _local5 = (_local7 - _local3.x); _local6 = (_local8 - _local3.y); _local3 = m_normals[_local9]; _local10 = ((_local3.x * _local5) + (_local3.y * _local6)); if (_local10 > 0){ return (false); }; _local9++; }; return (true); } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{ var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:b2Vec2; var _local20:Number; var _local21:Number; var _local6:Number = 0; var _local7:Number = _arg5; _local8 = (_arg4.p1.x - _arg1.position.x); _local9 = (_arg4.p1.y - _arg1.position.y); _local10 = _arg1.R; var _local12:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); var _local13:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); _local8 = (_arg4.p2.x - _arg1.position.x); _local9 = (_arg4.p2.y - _arg1.position.y); _local10 = _arg1.R; var _local14:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); var _local15:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); var _local16:Number = (_local14 - _local12); var _local17:Number = (_local15 - _local13); var _local18 = -1; var _local19:int; while (_local19 < m_vertexCount) { _local11 = m_vertices[_local19]; _local8 = (_local11.x - _local12); _local9 = (_local11.y - _local13); _local11 = m_normals[_local19]; _local20 = ((_local11.x * _local8) + (_local11.y * _local9)); _local21 = ((_local11.x * _local16) + (_local11.y * _local17)); if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){ _local6 = (_local20 / _local21); _local18 = _local19; } else { if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){ _local7 = (_local20 / _local21); }; }; if (_local7 < _local6){ return (e_missCollide); }; _local19++; }; if (_local18 >= 0){ _arg2[0] = _local6; _local10 = _arg1.R; _local11 = m_normals[_local18]; _arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); return (e_hitCollide); }; _arg2[0] = 0; return (e_startsInsideCollide); } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22; var _local4:b2Vec2; var _local5:b2Mat22 = s_computeMat; _local3 = _arg2.R; _local4 = m_obb.R.col1; _local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local4 = m_obb.R.col2; _local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local5.Abs(); var _local6:b2Mat22 = _local5; _local4 = m_obb.extents; var _local7:Number = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y)); var _local8:Number = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y)); _local3 = _arg2.R; _local4 = m_obb.center; var _local9:Number = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y))); var _local10:Number = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y))); _arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8)); _arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8)); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2AABB = s_sweptAABB1; var _local5:b2AABB = s_sweptAABB2; ComputeAABB(_local4, _arg2); ComputeAABB(_local5, _arg3); _arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y); _arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y); } override public function ComputeMass(_arg1:b2MassData):void{ var _local10:b2Vec2; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local2:Number = 0; var _local3:Number = 0; var _local4:Number = 0; var _local5:Number = 0; var _local6:Number = 0; var _local7:Number = 0; var _local8:Number = (1 / 3); var _local9:int; while (_local9 < m_vertexCount) { _local10 = m_vertices[_local9]; _local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0]; _local12 = (_local10.x - _local6); _local13 = (_local10.y - _local7); _local14 = (_local11.x - _local6); _local15 = (_local11.y - _local7); _local16 = ((_local12 * _local15) - (_local13 * _local14)); _local17 = (0.5 * _local16); _local4 = (_local4 + _local17); _local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x))); _local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y))); _local18 = _local6; _local19 = _local7; _local20 = _local12; _local21 = _local13; _local22 = _local14; _local23 = _local15; _local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18)); _local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19)); _local5 = (_local5 + (_local16 * (_local24 + _local25))); _local9++; }; _arg1.mass = (m_density * _local4); _local2 = (_local2 * (1 / _local4)); _local3 = (_local3 * (1 / _local4)); _arg1.center.Set(_local2, _local3); _arg1.I = (m_density * _local5); } public function GetOBB():b2OBB{ return (m_obb); } public function GetCentroid():b2Vec2{ return (m_centroid); } public function GetVertexCount():int{ return (m_vertexCount); } public function GetVertices():Array{ return (m_vertices); } public function GetCoreVertices():Array{ return (m_coreVertices); } public function GetNormals():Array{ return (m_normals); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_coreVertices[0])); } public function Centroid(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_centroid)); } public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:b2Vec2; var _local5:b2Mat22; var _local11:Number; _local5 = _arg1.R; var _local6:Number = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y)); var _local7:Number = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y)); var _local8:int; _local4 = m_coreVertices[0]; var _local9:Number = ((_local4.x * _local6) + (_local4.y * _local7)); var _local10 = 1; while (_local10 < m_vertexCount) { _local4 = m_coreVertices[_local10]; _local11 = ((_local4.x * _local6) + (_local4.y * _local7)); if (_local11 > _local9){ _local8 = _local10; _local9 = _local11; }; _local10++; }; _local5 = _arg1.R; _local4 = m_coreVertices[_local8]; s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y))); s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y))); return (s_supportVec); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:b2Vec2; var _local4:Number; var _local5:Number; m_sweepRadius = 0; var _local3:int; while (_local3 < m_vertexCount) { _local2 = m_coreVertices[_local3]; _local4 = (_local2.x - _arg1.x); _local5 = (_local2.y - _arg1.y); _local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5))); if (_local4 > m_sweepRadius){ m_sweepRadius = _local4; }; _local3++; }; } public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{ var _local3:b2Vec2; var _local7:Number; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; _local3 = new b2Vec2(); var _local4:Number = 0; var _local5:Number = 0; var _local6:Number = 0; _local7 = (1 / 3); var _local8:int; while (_local8 < _arg2) { _local9 = _arg1[_local8]; _local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0]; _local11 = (_local9.x - _local5); _local12 = (_local9.y - _local6); _local13 = (_local10.x - _local5); _local14 = (_local10.y - _local6); _local15 = ((_local11 * _local14) - (_local12 * _local13)); _local16 = (0.5 * _local15); _local4 = (_local4 + _local16); _local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x))); _local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y))); _local8++; }; _local3.x = (_local3.x * (1 / _local4)); _local3.y = (_local3.y * (1 / _local4)); return (_local3); } public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{ var _local4:int; var _local7:b2Vec2; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:int; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:b2Mat22; var _local5:Array = new Array((b2Settings.b2_maxPolygonVertices + 1)); _local4 = 0; while (_local4 < _arg3) { _local5[_local4] = _arg2[_local4]; _local4++; }; _local5[_arg3] = _local5[0]; var _local6:Number = Number.MAX_VALUE; _local4 = 1; while (_local4 <= _arg3) { _local7 = _local5[int((_local4 - 1))]; _local8 = (_local5[_local4].x - _local7.x); _local9 = (_local5[_local4].y - _local7.y); _local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); _local8 = (_local8 / _local10); _local9 = (_local9 / _local10); _local11 = -(_local9); _local12 = _local8; _local13 = Number.MAX_VALUE; _local14 = Number.MAX_VALUE; _local15 = -(Number.MAX_VALUE); _local16 = -(Number.MAX_VALUE); _local17 = 0; while (_local17 < _arg3) { _local19 = (_local5[_local17].x - _local7.x); _local20 = (_local5[_local17].y - _local7.y); _local21 = ((_local8 * _local19) + (_local9 * _local20)); _local22 = ((_local11 * _local19) + (_local12 * _local20)); if (_local21 < _local13){ _local13 = _local21; }; if (_local22 < _local14){ _local14 = _local22; }; if (_local21 > _local15){ _local15 = _local21; }; if (_local22 > _local16){ _local16 = _local22; }; _local17++; }; _local18 = ((_local15 - _local13) * (_local16 - _local14)); if (_local18 < (0.95 * _local6)){ _local6 = _local18; _arg1.R.col1.x = _local8; _arg1.R.col1.y = _local9; _arg1.R.col2.x = _local11; _arg1.R.col2.y = _local12; _local23 = (0.5 * (_local13 + _local15)); _local24 = (0.5 * (_local14 + _local16)); _local25 = _arg1.R; _arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24))); _arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24))); _arg1.extents.x = (0.5 * (_local15 - _local13)); _arg1.extents.y = (0.5 * (_local16 - _local14)); }; _local4++; }; } } }//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; public class b2Shape { public var m_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; public static const e_hitCollide:int = 1; public static const e_missCollide:int = 0; public static const e_startsInsideCollide:int = -1; 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){ m_userData = _arg1.userData; m_friction = _arg1.friction; m_restitution = _arg1.restitution; m_density = _arg1.density; m_body = null; m_sweepRadius = 0; m_next = null; m_proxyId = b2Pair.b2_nullProxy; m_filter = _arg1.filter.Copy(); m_isSensor = _arg1.isSensor; } public function GetType():int{ return (m_type); } public function IsSensor():Boolean{ return (m_isSensor); } public function SetFilterData(_arg1:b2FilterData):void{ m_filter = _arg1.Copy(); } public function GetFilterData():b2FilterData{ return (m_filter.Copy()); } public function GetBody():b2Body{ return (m_body); } public function GetNext():b2Shape{ return (m_next); } public function GetUserData(){ return (m_userData); } public function SetUserData(_arg1):void{ 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):int{ return (e_missCollide); } 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 GetSweepRadius():Number{ return (m_sweepRadius); } public function GetFriction():Number{ return (m_friction); } public function GetRestitution():Number{ return (m_restitution); } public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ var _local3:b2AABB = s_proxyAABB; ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function DestroyProxy(_arg1:b2BroadPhase):void{ if (m_proxyId != b2Pair.b2_nullProxy){ _arg1.DestroyProxy(m_proxyId); m_proxyId = b2Pair.b2_nullProxy; }; } public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{ if (m_proxyId == b2Pair.b2_nullProxy){ return (false); }; var _local4:b2AABB = s_syncAABB; ComputeSweptAABB(_local4, _arg2, _arg3); if (_arg1.InRange(_local4)){ _arg1.MoveProxy(m_proxyId, _local4); return (true); }; return (false); } public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ if (m_proxyId == b2Pair.b2_nullProxy){ return; }; _arg1.DestroyProxy(m_proxyId); var _local3:b2AABB = s_resetAABB; ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function 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 8
//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(){ filter = new b2FilterData(); super(); } } }//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2AABB { public var lowerBound:b2Vec2; public var upperBound:b2Vec2; public function b2AABB(){ lowerBound = new b2Vec2(); upperBound = new b2Vec2(); super(); } public function IsValid():Boolean{ var _local1:Number = (upperBound.x - lowerBound.x); var _local2:Number = (upperBound.y - lowerBound.y); var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0))); _local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid())); return (_local3); } } }//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound) package Box2D.Collision { public class b2Bound { public var value:uint; public var proxyId:uint; public var stabbingCount:uint; public function IsLower():Boolean{ return (((value & 1) == 0)); } public function IsUpper():Boolean{ return (((value & 1) == 1)); } public function Swap(_arg1:b2Bound):void{ var _local2:uint = value; var _local3:uint = proxyId; var _local4:uint = stabbingCount; value = _arg1.value; proxyId = _arg1.proxyId; stabbingCount = _arg1.stabbingCount; _arg1.value = _local2; _arg1.proxyId = _local3; _arg1.stabbingCount = _local4; } } }//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues) package Box2D.Collision { public class b2BoundValues { public var lowerValues:Array; public var upperValues:Array; public function b2BoundValues(){ lowerValues = [0, 0]; upperValues = [0, 0]; super(); } } }//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2BroadPhase { public var m_pairManager:b2PairManager; public var m_proxyPool:Array; public var m_freeProxy:uint; public var m_bounds:Array; public var m_querySortKeys: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 = 0xFFFF; public static const b2_nullEdge:uint = 0xFFFF; public static var s_validate:Boolean = false; public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){ var _local3:int; var _local6:b2Proxy; var _local7:int; m_pairManager = new b2PairManager(); m_proxyPool = new Array(b2Settings.b2_maxPairs); m_bounds = new Array((2 * b2Settings.b2_maxProxies)); m_querySortKeys = new Array(b2Settings.b2_maxProxies); m_queryResults = new Array(b2Settings.b2_maxProxies); m_quantizationFactor = new b2Vec2(); super(); m_pairManager.Initialize(this, _arg2); m_worldAABB = _arg1; m_proxyCount = 0; _local3 = 0; while (_local3 < b2Settings.b2_maxProxies) { m_queryResults[_local3] = 0; m_querySortKeys[_local3] = 0; _local3++; }; m_bounds = new Array(2); _local3 = 0; while (_local3 < 2) { m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies)); _local7 = 0; while (_local7 < (2 * b2Settings.b2_maxProxies)) { m_bounds[_local3][_local7] = new b2Bound(); _local7++; }; _local3++; }; var _local4:Number = (_arg1.upperBound.x - _arg1.lowerBound.x); var _local5:Number = (_arg1.upperBound.y - _arg1.lowerBound.y); m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4); m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5); _local3 = 0; while (_local3 < (b2Settings.b2_maxProxies - 1)) { _local6 = new b2Proxy(); m_proxyPool[_local3] = _local6; _local6.SetNext((_local3 + 1)); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; _local3++; }; _local6 = new b2Proxy(); m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6; _local6.SetNext(b2Pair.b2_nullProxy); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; m_freeProxy = 0; m_timeStamp = 1; m_queryResultCount = 0; } public function InRange(_arg1:b2AABB):Boolean{ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local2 = _arg1.lowerBound.x; _local3 = _arg1.lowerBound.y; _local2 = (_local2 - m_worldAABB.upperBound.x); _local3 = (_local3 - m_worldAABB.upperBound.y); _local4 = m_worldAABB.lowerBound.x; _local5 = m_worldAABB.lowerBound.y; _local4 = (_local4 - _arg1.upperBound.x); _local5 = (_local5 - _arg1.upperBound.y); _local2 = b2Math.b2Max(_local2, _local4); _local3 = b2Math.b2Max(_local3, _local5); return ((b2Math.b2Max(_local2, _local3) < 0)); } public function GetProxy(_arg1:int):b2Proxy{ var _local2:b2Proxy = 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 = m_freeProxy; _local4 = m_proxyPool[_local5]; m_freeProxy = _local4.GetNext(); _local4.overlapCount = 0; _local4.userData = _arg2; var _local6:uint = (2 * m_proxyCount); var _local7:Array = new Array(); var _local8:Array = new Array(); ComputeBounds(_local7, _local8, _arg1); var _local9:int; while (_local9 < 2) { _local11 = m_bounds[_local9]; _local14 = [_local12]; _local15 = [_local13]; Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9); _local12 = _local14[0]; _local13 = _local15[0]; _local16 = new Array(); _local18 = (_local6 - _local13); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[int((_local13 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local22 = (_local13 + 2); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[int((_local22 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local16 = new Array(); _local18 = (_local13 - _local12); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[int((_local12 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local22 = (_local12 + 1); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[int((_local22 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local13++; _local19 = _local11[_local12]; _local20 = _local11[_local13]; _local19.value = _local7[_local9]; _local19.proxyId = _local5; _local20.value = _local8[_local9]; _local20.proxyId = _local5; _local21 = _local11[int((_local12 - 1))]; _local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount; _local21 = _local11[int((_local13 - 1))]; _local20.stabbingCount = _local21.stabbingCount; _local3 = _local12; while (_local3 < _local13) { _local21 = _local11[_local3]; _local21.stabbingCount++; _local3++; }; _local3 = _local12; while (_local3 < (_local6 + 2)) { _local19 = _local11[_local3]; _local23 = m_proxyPool[_local19.proxyId]; if (_local19.IsLower()){ _local23.lowerBounds[_local9] = _local3; } else { _local23.upperBounds[_local9] = _local3; }; _local3++; }; _local9++; }; m_proxyCount++; var _local10:int; while (_local10 < m_queryResultCount) { m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]); _local10++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); return (_local5); } public function DestroyProxy(_arg1:uint):void{ var _local2:b2Bound; var _local3:b2Bound; var _local8:Array; var _local9:uint; var _local10:uint; var _local11:uint; var _local12:uint; var _local13:Array; var _local14:int; var _local15:int; var _local16:int; var _local17:uint; var _local18:int; var _local19:b2Proxy; var _local4:b2Proxy = m_proxyPool[_arg1]; var _local5:int = (2 * m_proxyCount); var _local6:int; while (_local6 < 2) { _local8 = m_bounds[_local6]; _local9 = _local4.lowerBounds[_local6]; _local10 = _local4.upperBounds[_local6]; _local2 = _local8[_local9]; _local11 = _local2.value; _local3 = _local8[_local10]; _local12 = _local3.value; _local13 = new Array(); _local15 = ((_local10 - _local9) - 1); _local14 = 0; while (_local14 < _local15) { _local13[_local14] = new b2Bound(); _local2 = _local13[_local14]; _local3 = _local8[int(((_local9 + 1) + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = _local13.length; _local16 = _local9; _local14 = 0; while (_local14 < _local15) { _local3 = _local13[_local14]; _local2 = _local8[int((_local16 + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local13 = new Array(); _local15 = ((_local5 - _local10) - 1); _local14 = 0; while (_local14 < _local15) { _local13[_local14] = new b2Bound(); _local2 = _local13[_local14]; _local3 = _local8[int(((_local10 + 1) + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = _local13.length; _local16 = (_local10 - 1); _local14 = 0; while (_local14 < _local15) { _local3 = _local13[_local14]; _local2 = _local8[int((_local16 + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = (_local5 - 2); _local17 = _local9; while (_local17 < _local15) { _local2 = _local8[_local17]; _local19 = m_proxyPool[_local2.proxyId]; if (_local2.IsLower()){ _local19.lowerBounds[_local6] = _local17; } else { _local19.upperBounds[_local6] = _local17; }; _local17++; }; _local15 = (_local10 - 1); _local18 = _local9; while (_local18 < _local15) { _local2 = _local8[_local18]; _local2.stabbingCount--; _local18++; }; Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6); _local6++; }; var _local7:int; while (_local7 < m_queryResultCount) { m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]); _local7++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); _local4.userData = null; _local4.overlapCount = b2_invalid; _local4.lowerBounds[0] = b2_invalid; _local4.lowerBounds[1] = b2_invalid; _local4.upperBounds[0] = b2_invalid; _local4.upperBounds[1] = b2_invalid; _local4.SetNext(m_freeProxy); m_freeProxy = _arg1; m_proxyCount--; } public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{ var _local3:Array; var _local4:int; var _local5:uint; var _local6:uint; var _local7:b2Bound; var _local8:b2Bound; var _local9:b2Bound; var _local10:uint; var _local11:b2Proxy; var _local16:Array; var _local17:uint; var _local18:uint; var _local19:uint; var _local20:uint; var _local21:int; var _local22:int; var _local23:uint; var _local24:b2Proxy; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){ return; }; if (_arg2.IsValid() == false){ return; }; var _local12:uint = (2 * m_proxyCount); var _local13:b2Proxy = m_proxyPool[_arg1]; var _local14:b2BoundValues = new b2BoundValues(); ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2); var _local15:b2BoundValues = new b2BoundValues(); _local5 = 0; while (_local5 < 2) { _local7 = m_bounds[_local5][_local13.lowerBounds[_local5]]; _local15.lowerValues[_local5] = _local7.value; _local7 = m_bounds[_local5][_local13.upperBounds[_local5]]; _local15.upperValues[_local5] = _local7.value; _local5++; }; _local5 = 0; while (_local5 < 2) { _local16 = m_bounds[_local5]; _local17 = _local13.lowerBounds[_local5]; _local18 = _local13.upperBounds[_local5]; _local19 = _local14.lowerValues[_local5]; _local20 = _local14.upperValues[_local5]; _local7 = _local16[_local17]; _local21 = (_local19 - _local7.value); _local7.value = _local19; _local7 = _local16[_local18]; _local22 = (_local20 - _local7.value); _local7.value = _local20; if (_local21 < 0){ _local6 = _local17; while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) { _local7 = _local16[_local6]; _local8 = _local16[int((_local6 - 1))]; _local23 = _local8.proxyId; _local24 = m_proxyPool[_local8.proxyId]; _local8.stabbingCount++; if (_local8.IsUpper() == true){ if (TestOverlap(_local14, _local24)){ m_pairManager.AddBufferedPair(_arg1, _local23); }; _local3 = _local24.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount++; } else { _local3 = _local24.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount--; }; _local3 = _local13.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.Swap(_local8); _local6--; }; }; if (_local22 > 0){ _local6 = _local18; while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) { _local7 = _local16[_local6]; _local9 = _local16[int((_local6 + 1))]; _local10 = _local9.proxyId; _local11 = m_proxyPool[_local10]; _local9.stabbingCount++; if (_local9.IsLower() == true){ if (TestOverlap(_local14, _local11)){ m_pairManager.AddBufferedPair(_arg1, _local10); }; _local3 = _local11.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount++; } else { _local3 = _local11.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount--; }; _local3 = _local13.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.Swap(_local9); _local6++; }; }; if (_local21 > 0){ _local6 = _local17; while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) { _local7 = _local16[_local6]; _local9 = _local16[int((_local6 + 1))]; _local10 = _local9.proxyId; _local11 = m_proxyPool[_local10]; _local9.stabbingCount--; if (_local9.IsUpper()){ if (TestOverlap(_local15, _local11)){ m_pairManager.RemoveBufferedPair(_arg1, _local10); }; _local3 = _local11.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount--; } else { _local3 = _local11.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount++; }; _local3 = _local13.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.Swap(_local9); _local6++; }; }; if (_local22 < 0){ _local6 = _local18; while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) { _local7 = _local16[_local6]; _local8 = _local16[int((_local6 - 1))]; _local23 = _local8.proxyId; _local24 = m_proxyPool[_local23]; _local8.stabbingCount--; if (_local8.IsLower() == true){ if (TestOverlap(_local15, _local24)){ m_pairManager.RemoveBufferedPair(_arg1, _local23); }; _local3 = _local24.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount--; } else { _local3 = _local24.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount++; }; _local3 = _local13.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.Swap(_local8); _local6--; }; }; _local5++; }; } public function Commit():void{ 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(); ComputeBounds(_local4, _local5, _arg1); var _local8:Array = [_local6]; var _local9:Array = [_local7]; Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0); Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1); var _local10:int; var _local11:int; while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) { _local12 = m_proxyPool[m_queryResults[_local11]]; _arg2[_local11] = _local12.userData; _local11++; _local10++; }; m_queryResultCount = 0; IncrementTimeStamp(); return (_local10); } public function Validate():void{ var _local1:b2Pair; var _local2:b2Proxy; var _local3:b2Proxy; var _local4:Boolean; var _local6:b2Bound; var _local7:uint; var _local8:uint; var _local9:uint; var _local10:b2Bound; var _local5:int; while (_local5 < 2) { _local6 = m_bounds[_local5]; _local7 = (2 * m_proxyCount); _local8 = 0; _local9 = 0; while (_local9 < _local7) { _local10 = _local6[_local9]; if (_local10.IsLower() == true){ _local8++; } else { _local8--; }; _local9++; }; _local5++; }; } public function QuerySegment(_arg1:b2Segment, _arg2, _arg3:int, _arg4:Function):int{ var _local15:int; var _local16:int; var _local17:uint; var _local18:b2Proxy; var _local19:uint; var _local20:uint; var _local24:Number; var _local25:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:uint; var _local5:Number = 1; var _local6:Number = ((_arg1.p2.x - _arg1.p1.x) * m_quantizationFactor.x); var _local7:Number = ((_arg1.p2.y - _arg1.p1.y) * m_quantizationFactor.y); var _local8:int = ((_local6 < -(Number.MIN_VALUE))) ? -1 : ((_local6 > Number.MIN_VALUE)) ? 1 : 0; var _local9:int = ((_local7 < -(Number.MIN_VALUE))) ? -1 : ((_local7 > Number.MIN_VALUE)) ? 1 : 0; var _local10:Number = (m_quantizationFactor.x * (_arg1.p1.x - m_worldAABB.lowerBound.x)); var _local11:Number = (m_quantizationFactor.y * (_arg1.p1.y - m_worldAABB.lowerBound.y)); var _local12:Array = new Array(); var _local13:Array = new Array(); _local12[0] = (uint(_local10) & (b2Settings.USHRT_MAX - 1)); _local12[1] = (uint(_local11) & (b2Settings.USHRT_MAX - 1)); _local13[0] = (_local12[0] + 1); _local13[1] = (_local12[1] + 1); var _local14:Array = new Array(); var _local21:Array = [_local19]; var _local22:Array = [_local20]; Query(_local21, _local22, _local12[0], _local13[0], m_bounds[0], (2 * m_proxyCount), 0); if (_local8 >= 0){ _local15 = (_local22[0] - 1); } else { _local15 = _local21[0]; }; Query(_local21, _local22, _local12[1], _local13[1], m_bounds[1], (2 * m_proxyCount), 1); if (_local9 >= 0){ _local16 = (_local22[0] - 1); } else { _local16 = _local21[0]; }; if (_arg4 != null){ _local27 = 0; while (_local27 < m_queryResultCount) { m_querySortKeys[_local27] = _arg4(m_proxyPool[m_queryResults[_local27]].userData); _local27++; }; _local27 = 0; while (_local27 < (m_queryResultCount - 1)) { _local28 = m_querySortKeys[_local27]; _local29 = m_querySortKeys[(_local27 + 1)]; if (((_local28)<0) ? (_local29 >= 0) : (((_local28 > _local29)) && ((_local29 >= 0)))){ m_querySortKeys[(_local27 + 1)] = _local28; m_querySortKeys[_local27] = _local29; _local30 = m_queryResults[(_local27 + 1)]; m_queryResults[(_local27 + 1)] = m_queryResults[_local27]; m_queryResults[_local27] = _local30; --_local27; if (_local27 == -1){ _local27 = 1; }; } else { _local27++; }; }; while ((((m_queryResultCount > 0)) && ((m_querySortKeys[(m_queryResultCount - 1)] < 0)))) { m_queryResultCount--; }; }; var _local23:Boolean; if ((((_local15 < 0)) || ((_local15 >= (m_proxyCount * 2))))){ _local23 = false; }; if ((((_local16 < 0)) || ((_local16 >= (m_proxyCount * 2))))){ _local23 = false; }; if (_local23){ if (_local8 != 0){ if (_local8 > 0){ _local15++; if (_local15 == (m_proxyCount * 2)){ _local23 = false; }; } else { --_local15; if (_local15 < 0){ _local23 = false; }; }; _local24 = ((m_bounds[0][_local15].value - _local10) / _local6); }; if (_local9 != 0){ if (_local9 > 0){ _local16++; if (_local16 == (m_proxyCount * 2)){ _local23 = false; }; } else { --_local16; if (_local16 < 0){ _local23 = false; }; }; _local25 = ((m_bounds[1][_local16].value - _local11) / _local7); }; }; while (_local23) { if ((((_local9 == 0)) || (((!((_local8 == 0))) && ((_local24 < _local25)))))){ if (_local24 > _local5){ break; }; if (((_local8 > 0)) ? m_bounds[0][_local15].IsLower() : m_bounds[0][_local15].IsUpper()){ _local17 = m_bounds[0][_local15].proxyId; _local18 = m_proxyPool[_local17]; if (_local9 >= 0){ if ((((_local18.lowerBounds[1] <= (_local16 - 1))) && ((_local18.upperBounds[1] >= _local16)))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; } else { if ((((_local18.lowerBounds[1] <= _local16)) && ((_local18.upperBounds[1] >= (_local16 + 1))))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; }; }; if (((((((!((_arg4 == null))) && ((m_queryResultCount == _arg3)))) && ((m_queryResultCount > 0)))) && ((_local24 > m_querySortKeys[(m_queryResultCount - 1)])))){ break; }; if (_local8 > 0){ _local15++; if (_local15 == (m_proxyCount * 2)){ break; }; } else { --_local15; if (_local15 < 0){ break; }; }; _local24 = ((m_bounds[0][_local15].value - _local10) / _local6); } else { if (_local25 > _local5){ break; }; if (((_local9 > 0)) ? m_bounds[1][_local16].IsLower() : m_bounds[1][_local16].IsUpper()){ _local17 = m_bounds[1][_local16].proxyId; _local18 = m_proxyPool[_local17]; if (_local8 >= 0){ if ((((_local18.lowerBounds[0] <= (_local15 - 1))) && ((_local18.upperBounds[0] >= _local15)))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; } else { if ((((_local18.lowerBounds[0] <= _local15)) && ((_local18.upperBounds[0] >= (_local15 + 1))))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; }; }; if (((((((!((_arg4 == null))) && ((m_queryResultCount == _arg3)))) && ((m_queryResultCount > 0)))) && ((_local25 > m_querySortKeys[(m_queryResultCount - 1)])))){ break; }; if (_local9 > 0){ _local16++; if (_local16 == (m_proxyCount * 2)){ break; }; } else { --_local16; if (_local16 < 0){ break; }; }; _local25 = ((m_bounds[1][_local16].value - _local11) / _local7); }; }; var _local26:int; _local27 = 0; while ((((_local27 < m_queryResultCount)) && ((_local26 < _arg3)))) { _local18 = m_proxyPool[m_queryResults[_local27]]; _arg2[_local27] = _local18.userData; _local27++; _local26++; }; m_queryResultCount = 0; IncrementTimeStamp(); return (_local26); } private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{ var _local4:Number = _arg3.lowerBound.x; var _local5:Number = _arg3.lowerBound.y; _local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x); _local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y); _local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x); _local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y); var _local6:Number = _arg3.upperBound.x; var _local7:Number = _arg3.upperBound.y; _local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x); _local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y); _local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x); _local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y); _arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1)); _arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1); _arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1)); _arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1); } private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local5:b2Bound; var _local6:b2Bound; var _local3:int; while (_local3 < 2) { _local4 = m_bounds[_local3]; _local5 = _local4[_arg1.lowerBounds[_local3]]; _local6 = _local4[_arg2.upperBounds[_local3]]; if (_local5.value > _local6.value){ return (false); }; _local5 = _local4[_arg1.upperBounds[_local3]]; _local6 = _local4[_arg2.lowerBounds[_local3]]; if (_local5.value < _local6.value){ return (false); }; _local3++; }; return (true); } public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local5:b2Bound; var _local3:int; while (_local3 < 2) { _local4 = m_bounds[_local3]; _local5 = _local4[_arg2.upperBounds[_local3]]; if (_arg1.lowerValues[_local3] > _local5.value){ return (false); }; _local5 = _local4[_arg2.lowerBounds[_local3]]; if (_arg1.upperValues[_local3] < _local5.value){ return (false); }; _local3++; }; return (true); } private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{ var _local10:b2Bound; var _local12:int; var _local13:int; var _local14:b2Proxy; var _local8:uint = BinarySearch(_arg5, _arg6, _arg3); var _local9:uint = BinarySearch(_arg5, _arg6, _arg4); var _local11:uint = _local8; while (_local11 < _local9) { _local10 = _arg5[_local11]; if (_local10.IsLower()){ IncrementOverlapCount(_local10.proxyId); }; _local11++; }; if (_local8 > 0){ _local12 = (_local8 - 1); _local10 = _arg5[_local12]; _local13 = _local10.stabbingCount; while (_local13) { _local10 = _arg5[_local12]; if (_local10.IsLower()){ _local14 = m_proxyPool[_local10.proxyId]; if (_local8 <= _local14.upperBounds[_arg7]){ IncrementOverlapCount(_local10.proxyId); _local13--; }; }; _local12--; }; }; _arg1[0] = _local8; _arg2[0] = _local9; } private function IncrementOverlapCount(_arg1:uint):void{ var _local2:b2Proxy = m_proxyPool[_arg1]; if (_local2.timeStamp < m_timeStamp){ _local2.timeStamp = m_timeStamp; _local2.overlapCount = 1; } else { _local2.overlapCount = 2; m_queryResults[m_queryResultCount] = _arg1; m_queryResultCount++; }; } private function IncrementTimeStamp():void{ var _local1:uint; if (m_timeStamp == b2Settings.USHRT_MAX){ _local1 = 0; while (_local1 < b2Settings.b2_maxProxies) { (m_proxyPool[_local1] as b2Proxy).timeStamp = 0; _local1++; }; m_timeStamp = 1; } else { m_timeStamp++; }; } private function AddProxyResult(_arg1:uint, _arg2:b2Proxy, _arg3:Number, _arg4:Function):void{ var _local9:Number; var _local10:uint; var _local5:Number = _arg4(_arg2.userData); if (_local5 < 0){ return; }; var _local6:Number = 0; while ((((_local6 < m_queryResultCount)) && ((m_querySortKeys[_local6] < _local5)))) { _local6++; }; var _local7:Number = _local5; var _local8:uint = _arg1; m_queryResultCount = (m_queryResultCount + 1); if (m_queryResultCount > _arg3){ m_queryResultCount = _arg3; }; while (_local6 < m_queryResultCount) { _local9 = m_querySortKeys[_local6]; _local10 = m_queryResults[_local6]; m_querySortKeys[_local6] = _local7; m_queryResults[_local6] = _local8; _local7 = _local9; _local8 = _local10; _local6++; }; } public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{ var _local6:int; var _local7:b2Bound; var _local4:int; var _local5:int = (_arg2 - 1); while (_local4 <= _local5) { _local6 = ((_local4 + _local5) / 2); _local7 = _arg1[_local6]; if (_local7.value > _arg3){ _local5 = (_local6 - 1); } else { if (_local7.value < _arg3){ _local4 = (_local6 + 1); } else { return (uint(_local6)); }; }; }; return (uint(_local4)); } } }//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair) package Box2D.Collision { public class b2BufferedPair { public var proxyId1:uint; public var proxyId2:uint; } }//package Box2D.Collision
Section 14
//b2Collision (Box2D.Collision.b2Collision) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Collision { public static const b2_nullFeature:uint = 0xFF; private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2(); public static function 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 15
//b2ContactID (Box2D.Collision.b2ContactID) package Box2D.Collision { public class b2ContactID { public var features:Features; public var _key:uint; public function b2ContactID(){ features = new Features(); super(); features._m_id = this; } public function Set(_arg1:b2ContactID):void{ key = _arg1._key; } public function Copy():b2ContactID{ var _local1:b2ContactID = new b2ContactID(); _local1.key = key; return (_local1); } public function get key():uint{ return (_key); } public function set key(_arg1:uint):void{ _key = _arg1; features._referenceEdge = (_key & 0xFF); features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF); features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF); features._flip = (((_key & 4278190080) >> 24) & 0xFF); } } }//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint) package Box2D.Collision { import Box2D.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(){ position = new b2Vec2(); velocity = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Distance { private static var s_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 18
//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(){ points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ManifoldPoint(); _local1++; }; normal = new b2Vec2(); } public function Reset():void{ var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { (points[_local1] as b2ManifoldPoint).Reset(); _local1++; }; normal.SetZero(); pointCount = 0; } public function Set(_arg1:b2Manifold):void{ pointCount = _arg1.pointCount; var _local2:int; while (_local2 < b2Settings.b2_maxManifoldPoints) { (points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]); _local2++; }; normal.SetV(_arg1.normal); } } }//package Box2D.Collision
Section 19
//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(){ localPoint1 = new b2Vec2(); localPoint2 = new b2Vec2(); id = new b2ContactID(); super(); } public function Reset():void{ localPoint1.SetZero(); localPoint2.SetZero(); separation = 0; normalImpulse = 0; tangentImpulse = 0; id.key = 0; } public function Set(_arg1:b2ManifoldPoint):void{ localPoint1.SetV(_arg1.localPoint1); localPoint2.SetV(_arg1.localPoint2); separation = _arg1.separation; normalImpulse = _arg1.normalImpulse; tangentImpulse = _arg1.tangentImpulse; id.key = _arg1.id.key; } } }//package Box2D.Collision
Section 20
//b2OBB (Box2D.Collision.b2OBB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2OBB { public var R:b2Mat22; public var center:b2Vec2; public var extents:b2Vec2; public function b2OBB(){ R = new b2Mat22(); center = new b2Vec2(); extents = new b2Vec2(); super(); } } }//package Box2D.Collision
Section 21
//b2Pair (Box2D.Collision.b2Pair) package Box2D.Collision { public class b2Pair { public var userData;// = null public var proxyId1:uint; public var proxyId2:uint; public var next:uint; public var status:uint; public static var b2_nullPair:uint = 0xFFFF; public static var b2_nullProxy:uint = 0xFFFF; public static var b2_tableCapacity:int = 65536; 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{ status = (status | e_pairBuffered); } public function ClearBuffered():void{ status = (status & ~(e_pairBuffered)); } public function IsBuffered():Boolean{ return (((status & e_pairBuffered) == e_pairBuffered)); } public function SetRemoved():void{ status = (status | e_pairRemoved); } public function ClearRemoved():void{ status = (status & ~(e_pairRemoved)); } public function IsRemoved():Boolean{ return (((status & e_pairRemoved) == e_pairRemoved)); } public function SetFinal():void{ status = (status | e_pairFinal); } public function IsFinal():Boolean{ return (((status & e_pairFinal) == e_pairFinal)); } } }//package Box2D.Collision
Section 22
//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 23
//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(); m_hashTable = new Array(b2Pair.b2_tableCapacity); _local1 = 0; while (_local1 < b2Pair.b2_tableCapacity) { m_hashTable[_local1] = b2Pair.b2_nullPair; _local1++; }; m_pairs = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1] = new b2Pair(); _local1++; }; m_pairBuffer = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairBuffer[_local1] = new b2BufferedPair(); _local1++; }; _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy; m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy; m_pairs[_local1].userData = null; m_pairs[_local1].status = 0; m_pairs[_local1].next = (_local1 + 1); _local1++; }; m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair; m_pairCount = 0; m_pairBufferCount = 0; } public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{ m_broadPhase = _arg1; m_callback = _arg2; } public function AddBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair = AddPair(_arg1, _arg2); if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = m_pairBuffer[m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; m_pairBufferCount++; }; _local4.ClearRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } public function RemoveBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair = Find(_arg1, _arg2); if (_local4 == null){ return; }; if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = m_pairBuffer[m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; m_pairBufferCount++; }; _local4.SetRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } public function Commit():void{ var _local1:b2BufferedPair; var _local2:int; var _local5:b2Pair; var _local6:b2Proxy; var _local7:b2Proxy; var _local3:int; var _local4:Array = m_broadPhase.m_proxyPool; _local2 = 0; while (_local2 < m_pairBufferCount) { _local1 = m_pairBuffer[_local2]; _local5 = Find(_local1.proxyId1, _local1.proxyId2); _local5.ClearBuffered(); _local6 = _local4[_local5.proxyId1]; _local7 = _local4[_local5.proxyId2]; if (_local5.IsRemoved()){ if (_local5.IsFinal() == true){ m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData); }; _local1 = m_pairBuffer[_local3]; _local1.proxyId1 = _local5.proxyId1; _local1.proxyId2 = _local5.proxyId2; _local3++; } else { if (_local5.IsFinal() == false){ _local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData); _local5.SetFinal(); }; }; _local2++; }; _local2 = 0; while (_local2 < _local3) { _local1 = m_pairBuffer[_local2]; RemovePair(_local1.proxyId1, _local1.proxyId2); _local2++; }; m_pairBufferCount = 0; if (b2BroadPhase.s_validate){ ValidateTable(); }; } private function AddPair(_arg1:uint, _arg2:uint):b2Pair{ var _local6:uint; if (_arg1 > _arg2){ _local6 = _arg1; _arg1 = _arg2; _arg2 = _local6; }; var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); var _local4 = FindHash(_arg1, _arg2, _local3); if (_local4 != null){ return (_local4); }; var _local5:uint = m_freePair; _local4 = m_pairs[_local5]; m_freePair = _local4.next; _local4.proxyId1 = _arg1; _local4.proxyId2 = _arg2; _local4.status = 0; _local4.userData = null; _local4.next = m_hashTable[_local3]; m_hashTable[_local3] = _local5; m_pairCount++; return (_local4); } private function RemovePair(_arg1:uint, _arg2:uint){ var _local3:b2Pair; var _local7:uint; var _local8:uint; var _local9:*; if (_arg1 > _arg2){ _local7 = _arg1; _arg1 = _arg2; _arg2 = _local7; }; var _local4:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); var _local5:uint = m_hashTable[_local4]; var _local6:b2Pair; while (_local5 != b2Pair.b2_nullPair) { if (Equals(m_pairs[_local5], _arg1, _arg2)){ _local8 = _local5; _local3 = m_pairs[_local5]; if (_local6){ _local6.next = _local3.next; } else { m_hashTable[_local4] = _local3.next; }; _local3 = m_pairs[_local8]; _local9 = _local3.userData; _local3.next = m_freePair; _local3.proxyId1 = b2Pair.b2_nullProxy; _local3.proxyId2 = b2Pair.b2_nullProxy; _local3.userData = null; _local3.status = 0; m_freePair = _local8; m_pairCount--; return (_local9); } else { _local6 = m_pairs[_local5]; _local5 = _local6.next; }; }; return (null); } private function Find(_arg1:uint, _arg2:uint):b2Pair{ var _local4:uint; if (_arg1 > _arg2){ _local4 = _arg1; _arg1 = _arg2; _arg2 = _local4; }; var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); return (FindHash(_arg1, _arg2, _local3)); } private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{ var _local4:b2Pair; var _local5:uint = m_hashTable[_arg3]; _local4 = m_pairs[_local5]; while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) { _local5 = _local4.next; _local4 = m_pairs[_local5]; }; if (_local5 == b2Pair.b2_nullPair){ return (null); }; return (_local4); } private function 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 24
//b2Point (Box2D.Collision.b2Point) package Box2D.Collision { import Box2D.Common.Math.*; public class b2Point { public var p:b2Vec2; public function b2Point(){ p = new b2Vec2(); super(); } public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{ return (p); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (p); } } }//package Box2D.Collision
Section 25
//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(){ lowerBounds = [uint(0), uint(0)]; upperBounds = [uint(0), uint(0)]; super(); } public function GetNext():uint{ return (lowerBounds[0]); } public function SetNext(_arg1:uint):void{ lowerBounds[0] = (_arg1 & 0xFFFF); } public function IsValid():Boolean{ return (!((overlapCount == b2BroadPhase.b2_invalid))); } } }//package Box2D.Collision
Section 26
//b2Segment (Box2D.Collision.b2Segment) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Segment { public var p1:b2Vec2; public var p2:b2Vec2; public function b2Segment(){ p1 = new b2Vec2(); p2 = new b2Vec2(); super(); } public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{ var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local5:b2Vec2 = _arg3.p1; var _local6:Number = (_arg3.p2.x - _local5.x); var _local7:Number = (_arg3.p2.y - _local5.y); var _local8:Number = (p2.x - p1.x); var _local9:Number = (p2.y - p1.y); var _local10:Number = _local9; var _local11:Number = -(_local8); var _local12:Number = (100 * Number.MIN_VALUE); var _local13:Number = -(((_local6 * _local10) + (_local7 * _local11))); if (_local13 > _local12){ _local14 = (_local5.x - p1.x); _local15 = (_local5.y - p1.y); _local16 = ((_local14 * _local10) + (_local15 * _local11)); if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){ _local17 = ((-(_local7) * _local15) + (_local7 * _local14)); if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){ _local16 = (_local16 / _local13); _local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); _local10 = (_local10 / _local18); _local11 = (_local11 / _local18); _arg1[0] = _local16; _arg2.Set(_local10, _local11); return (true); }; }; }; return (false); } public function Extend(_arg1:b2AABB):void{ ExtendForward(_arg1); ExtendBackward(_arg1); } public function ExtendForward(_arg1:b2AABB):void{ var aabb = _arg1; var dX:Number = (p2.x - p1.x); var dY:Number = (p2.y - p1.y); var greaterthan0:* = function (_arg1){ return ((_arg1 > 0)); }; var lambda:Number = Math.min(((dX > 0)) ? ((aabb.upperBound.x - p1.x) / dX) : ((dX < 0)) ? ((aabb.lowerBound.x - p1.x) / dX) : Number.POSITIVE_INFINITY, ((dY > 0)) ? ((aabb.upperBound.y - p1.y) / dY) : ((dY < 0)) ? ((aabb.lowerBound.y - p1.y) / dY) : Number.POSITIVE_INFINITY); p2.x = (p1.x + (dX * lambda)); p2.y = (p1.y + (dY * lambda)); } public function ExtendBackward(_arg1:b2AABB):void{ var dY:Number; var lambda:Number; var aabb = _arg1; var dX:Number = (-(p2.x) + p1.x); dY = (-(p2.y) + p1.y); var greaterthan0:* = function (_arg1){ return ((_arg1 > 0)); }; lambda = Math.min(((dX > 0)) ? ((aabb.upperBound.x - p2.x) / dX) : ((dX < 0)) ? ((aabb.lowerBound.x - p2.x) / dX) : Number.POSITIVE_INFINITY, ((dY > 0)) ? ((aabb.upperBound.y - p2.y) / dY) : ((dY < 0)) ? ((aabb.lowerBound.y - p2.y) / dY) : Number.POSITIVE_INFINITY); p1.x = (p2.x + (dX * lambda)); p1.y = (p2.y + (dY * lambda)); } } }//package Box2D.Collision
Section 27
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2TimeOfImpact { public static var s_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 28
//ClipVertex (Box2D.Collision.ClipVertex) package Box2D.Collision { import Box2D.Common.Math.*; public class ClipVertex { public var v:b2Vec2; public var id:b2ContactID; public function ClipVertex(){ v = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features) package Box2D.Collision { public class Features { public var _referenceEdge:int; public var _incidentEdge:int; public var _incidentVertex:int; public var _flip:int; public var _m_id:b2ContactID; public function set referenceEdge(_arg1:int):void{ _referenceEdge = _arg1; _m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF)); } public function get referenceEdge():int{ return (_referenceEdge); } public function set incidentEdge(_arg1:int):void{ _incidentEdge = _arg1; _m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00)); } public function get incidentEdge():int{ return (_incidentEdge); } public function set incidentVertex(_arg1:int):void{ _incidentVertex = _arg1; _m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000)); } public function get incidentVertex():int{ return (_incidentVertex); } public function set flip(_arg1:int):void{ _flip = _arg1; _m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080)); } public function get flip():int{ return (_flip); } } }//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22) package Box2D.Common.Math { public class b2Mat22 { public var col1:b2Vec2; public var col2:b2Vec2; public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){ var _local4:Number; var _local5:Number; col1 = new b2Vec2(); col2 = new b2Vec2(); super(); if (((!((_arg2 == null))) && (!((_arg3 == null))))){ col1.SetV(_arg2); col2.SetV(_arg3); } else { _local4 = Math.cos(_arg1); _local5 = Math.sin(_arg1); col1.x = _local4; col2.x = -(_local5); col1.y = _local5; col2.y = _local4; }; } public function Set(_arg1:Number):void{ var _local2:Number; _local2 = Math.cos(_arg1); var _local3:Number = Math.sin(_arg1); col1.x = _local2; col2.x = -(_local3); col1.y = _local3; col2.y = _local2; } public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{ col1.SetV(_arg1); col2.SetV(_arg2); } public function Copy():b2Mat22{ return (new b2Mat22(0, col1, col2)); } public function SetM(_arg1:b2Mat22):void{ col1.SetV(_arg1.col1); col2.SetV(_arg1.col2); } public function AddM(_arg1:b2Mat22):void{ col1.x = (col1.x + _arg1.col1.x); col1.y = (col1.y + _arg1.col1.y); col2.x = (col2.x + _arg1.col2.x); col2.y = (col2.y + _arg1.col2.y); } public function SetIdentity():void{ col1.x = 1; col2.x = 0; col1.y = 0; col2.y = 1; } public function SetZero():void{ col1.x = 0; col2.x = 0; col1.y = 0; col2.y = 0; } public function GetAngle():Number{ return (Math.atan2(col1.y, col1.x)); } public function Invert(_arg1:b2Mat22):b2Mat22{ var _local2:Number; var _local4:Number; var _local6:Number; _local2 = col1.x; var _local3:Number = col2.x; _local4 = col1.y; var _local5:Number = col2.y; _local6 = ((_local2 * _local5) - (_local3 * _local4)); _local6 = (1 / _local6); _arg1.col1.x = (_local6 * _local5); _arg1.col2.x = (-(_local6) * _local3); _arg1.col1.y = (-(_local6) * _local4); _arg1.col2.y = (_local6 * _local2); return (_arg1); } public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:Number = col1.x; var _local5:Number = col2.x; var _local6:Number = col1.y; var _local7:Number = col2.y; var _local8:Number = ((_local4 * _local7) - (_local5 * _local6)); _local8 = (1 / _local8); _arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3))); _arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2))); return (_arg1); } public function Abs():void{ col1.Abs(); col2.Abs(); } } }//package Box2D.Common.Math
Section 31
//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 32
//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(){ localCenter = new b2Vec2(); c0 = new b2Vec2(); c = new b2Vec2(); super(); } public function GetXForm(_arg1:b2XForm, _arg2:Number):void{ var _local4:Number; var _local5:Number; if ((1 - t0) > Number.MIN_VALUE){ _local4 = ((_arg2 - t0) / (1 - t0)); _arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x)); _arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y)); _local5 = (((1 - _local4) * a0) + (_local4 * a)); _arg1.R.Set(_local5); } else { _arg1.position.SetV(c); _arg1.R.Set(a); }; var _local3:b2Mat22 = _arg1.R; _arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y))); _arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y))); } public function Advance(_arg1:Number):void{ var _local2:Number; if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){ _local2 = ((_arg1 - t0) / (1 - t0)); c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x)); c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y)); a0 = (((1 - _local2) * a0) + (_local2 * a)); t0 = _arg1; }; } } }//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2) package Box2D.Common.Math { public class b2Vec2 { public var x:Number; public var y:Number; public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function SetZero():void{ x = 0; y = 0; } public function Set(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function SetV(_arg1:b2Vec2):void{ x = _arg1.x; y = _arg1.y; } public function Negative():b2Vec2{ return (new b2Vec2(-(x), -(y))); } public function Copy():b2Vec2{ return (new b2Vec2(x, y)); } public function Add(_arg1:b2Vec2):void{ x = (x + _arg1.x); y = (y + _arg1.y); } public function Subtract(_arg1:b2Vec2):void{ x = (x - _arg1.x); y = (y - _arg1.y); } public function Multiply(_arg1:Number):void{ x = (x * _arg1); y = (y * _arg1); } public function MulM(_arg1:b2Mat22):void{ var _local2:Number = x; x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y)); y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y)); } public function MulTM(_arg1:b2Mat22):void{ var _local2:Number = b2Math.b2Dot(this, _arg1.col1); y = b2Math.b2Dot(this, _arg1.col2); x = _local2; } public function CrossVF(_arg1:Number):void{ var _local2:Number = x; x = (_arg1 * y); y = (-(_arg1) * _local2); } public function CrossFV(_arg1:Number):void{ var _local2:Number = x; x = (-(_arg1) * y); y = (_arg1 * _local2); } public function MinV(_arg1:b2Vec2):void{ x = ((x < _arg1.x)) ? x : _arg1.x; y = ((y < _arg1.y)) ? y : _arg1.y; } public function MaxV(_arg1:b2Vec2):void{ x = ((x > _arg1.x)) ? x : _arg1.x; y = ((y > _arg1.y)) ? y : _arg1.y; } public function Abs():void{ if (x < 0){ x = -(x); }; if (y < 0){ y = -(y); }; } public function Length():Number{ return (Math.sqrt(((x * x) + (y * y)))); } public function LengthSquared():Number{ return (((x * x) + (y * y))); } public function Normalize():Number{ var _local1:Number = Math.sqrt(((x * x) + (y * y))); if (_local1 < Number.MIN_VALUE){ return (0); }; var _local2:Number = (1 / _local1); x = (x * _local2); y = (y * _local2); return (_local1); } public function IsValid():Boolean{ return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y)))); } public static function Make(_arg1:Number, _arg2:Number):b2Vec2{ return (new b2Vec2(_arg1, _arg2)); } } }//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm) package Box2D.Common.Math { public class b2XForm { public var position:b2Vec2; public var R:b2Mat22; public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{ position = new b2Vec2(); R = new b2Mat22(); super(); if (_arg1){ position.SetV(_arg1); R.SetM(_arg2); }; } public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{ position.SetV(_arg1); R.SetM(_arg2); } public function SetIdentity():void{ position.SetZero(); R.SetIdentity(); } public function Set(_arg1:b2XForm):void{ position.SetV(_arg1.position); R.SetM(_arg1.R); } } }//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color) package Box2D.Common { import Box2D.Common.Math.*; public class b2Color { private var _r:uint;// = 0 private var _g:uint;// = 0 private var _b:uint;// = 0 public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function set r(_arg1:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function set g(_arg1:Number):void{ _g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function set b(_arg1:Number):void{ _b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function get color():uint{ return (((_r | (_g << 8)) | (_b << 16))); } } }//package Box2D.Common
Section 36
//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 = 0x2000; public static const b2_maxPairs:int = 65536; 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 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2CircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; var _local3:b2ManifoldPoint = m_manifold.points[0]; _local3.normalImpulse = 0; _local3.tangentImpulse = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2ManifoldPoint; var _local8:b2ManifoldPoint; var _local5:b2Body = m_shape1.m_body; var _local6:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf); var _local7:b2ContactPoint = s_evalCP; _local7.shape1 = m_shape1; _local7.shape2 = m_shape2; _local7.friction = m_friction; _local7.restitution = m_restitution; if (m_manifold.pointCount > 0){ m_manifoldCount = 1; _local8 = m_manifold.points[0]; if (m0.pointCount == 0){ _local8.normalImpulse = 0; _local8.tangentImpulse = 0; if (_arg1){ _local7.position = _local5.GetWorldPoint(_local8.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Add(_local7); }; } else { _local4 = m0.points[0]; _local8.normalImpulse = _local4.normalImpulse; _local8.tangentImpulse = _local4.tangentImpulse; if (_arg1){ _local7.position = _local5.GetWorldPoint(_local8.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Persist(_local7); }; }; } else { m_manifoldCount = 0; if ((((m0.pointCount > 0)) && (_arg1))){ _local4 = m0.points[0]; _local7.position = _local5.GetWorldPoint(_local4.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function 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 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Contact { public var m_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){ m_node1 = new b2ContactEdge(); m_node2 = new b2ContactEdge(); super(); m_flags = 0; if (((!(_arg1)) || (!(_arg2)))){ m_shape1 = null; m_shape2 = null; return; }; if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){ m_flags = (m_flags | e_nonSolidFlag); }; m_shape1 = _arg1; m_shape2 = _arg2; m_manifoldCount = 0; m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction)); m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution); m_prev = null; m_next = null; m_node1.contact = null; m_node1.prev = null; m_node1.next = null; m_node1.other = null; m_node2.contact = null; m_node2.prev = null; m_node2.next = null; m_node2.other = null; } public function GetManifolds():Array{ return (null); } public function GetManifoldCount():int{ return (m_manifoldCount); } public function IsSolid():Boolean{ return (((m_flags & e_nonSolidFlag) == 0)); } public function GetNext():b2Contact{ return (m_next); } public function GetShape1():b2Shape{ return (m_shape1); } public function GetShape2():b2Shape{ return (m_shape2); } public function Update(_arg1:b2ContactListener):void{ var _local2:int = m_manifoldCount; Evaluate(_arg1); var _local3:int = m_manifoldCount; var _local4:b2Body = m_shape1.m_body; var _local5:b2Body = m_shape2.m_body; if ((((_local3 == 0)) && ((_local2 > 0)))){ _local4.WakeUp(); _local5.WakeUp(); }; if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){ m_flags = (m_flags & ~(e_slowFlag)); } else { m_flags = (m_flags | e_slowFlag); }; } public function Evaluate(_arg1:b2ContactListener):void{ } public static function 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 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2ContactConstraint { public var points:Array; public var normal:b2Vec2; public var 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(){ normal = new b2Vec2(); super(); points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ContactConstraintPoint(); _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; public class b2ContactConstraintPoint { public var 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(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); r1 = new b2Vec2(); r2 = new b2Vec2(); super(); } } }//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2ContactEdge { public var other:b2Body; public var contact:b2Contact; public var prev:b2ContactEdge; public var next:b2ContactEdge; } }//package Box2D.Dynamics.Contacts
Section 42
//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 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; public class b2ContactResult { public var 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(){ position = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2ContactSolver { public var m_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; m_step = new b2TimeStep(); m_constraints = new Array(); super(); m_step.dt = _arg1.dt; m_step.inv_dt = _arg1.inv_dt; m_step.maxIterations = _arg1.maxIterations; m_allocator = _arg4; m_constraintCount = 0; _local6 = 0; while (_local6 < _arg3) { _local5 = _arg2[_local6]; m_constraintCount = (m_constraintCount + _local5.m_manifoldCount); _local6++; }; _local6 = 0; while (_local6 < m_constraintCount) { m_constraints[_local6] = new b2ContactConstraint(); _local6++; }; var _local9:int; _local6 = 0; while (_local6 < _arg3) { _local5 = _arg2[_local6]; _local10 = _local5.m_shape1.m_body; _local11 = _local5.m_shape2.m_body; _local12 = _local5.m_manifoldCount; _local13 = _local5.GetManifolds(); _local14 = _local5.m_friction; _local15 = _local5.m_restitution; _local16 = _local10.m_linearVelocity.x; _local17 = _local10.m_linearVelocity.y; _local18 = _local11.m_linearVelocity.x; _local19 = _local11.m_linearVelocity.y; _local20 = _local10.m_angularVelocity; _local21 = _local11.m_angularVelocity; _local22 = 0; while (_local22 < _local12) { _local23 = _local13[_local22]; _local24 = _local23.normal.x; _local25 = _local23.normal.y; _local26 = m_constraints[_local9]; _local26.body1 = _local10; _local26.body2 = _local11; _local26.manifold = _local23; _local26.normal.x = _local24; _local26.normal.y = _local25; _local26.pointCount = _local23.pointCount; _local26.friction = _local14; _local26.restitution = _local15; _local27 = 0; while (_local27 < _local26.pointCount) { _local28 = _local23.points[_local27]; _local29 = _local26.points[_local27]; _local29.normalImpulse = _local28.normalImpulse; _local29.tangentImpulse = _local28.tangentImpulse; _local29.separation = _local28.separation; _local29.positionImpulse = 0; _local29.localAnchor1.SetV(_local28.localPoint1); _local29.localAnchor2.SetV(_local28.localPoint2); _local8 = _local10.m_xf.R; _local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x); _local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y); _local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33)); _local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33)); _local32 = _local30; _local29.r1.Set(_local32, _local33); _local8 = _local11.m_xf.R; _local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x); _local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y); _local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35)); _local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35)); _local34 = _local30; _local29.r2.Set(_local34, _local35); _local36 = ((_local32 * _local32) + (_local33 * _local33)); _local37 = ((_local34 * _local34) + (_local35 * _local35)); _local38 = ((_local32 * _local24) + (_local33 * _local25)); _local39 = ((_local34 * _local24) + (_local35 * _local25)); _local40 = (_local10.m_invMass + _local11.m_invMass); _local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39))))); _local29.normalMass = (1 / _local40); _local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass)); _local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39))))); _local29.equalizedMass = (1 / _local41); _local42 = _local25; _local43 = -(_local24); _local44 = ((_local32 * _local42) + (_local33 * _local43)); _local45 = ((_local34 * _local42) + (_local35 * _local43)); _local46 = (_local10.m_invMass + _local11.m_invMass); _local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45))))); _local29.tangentMass = (1 / _local46); _local29.velocityBias = 0; if (_local29.separation > 0){ _local29.velocityBias = (-60 * _local29.separation); }; _local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33)); _local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32)); _local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31)); if (_local47 < -(b2Settings.b2_velocityThreshold)){ _local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47)); }; _local27++; }; _local9++; _local22++; }; _local6++; }; } public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2Mat22; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:int; var _local19:int; var _local20:b2ContactConstraintPoint; var _local21:Number; var _local22:Number; var _local23:b2ContactConstraintPoint; var _local5:int; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_invMass; _local10 = _local7.m_invI; _local11 = _local8.m_invMass; _local12 = _local8.m_invI; _local13 = _local6.normal.x; _local14 = _local6.normal.y; _local15 = _local14; _local16 = -(_local13); if (_arg1.warmStarting){ _local19 = _local6.pointCount; _local18 = 0; while (_local18 < _local19) { _local20 = _local6.points[_local18]; _local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio); _local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio); _local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15)); _local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16)); _local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21)))); _local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21)); _local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22)); _local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21)))); _local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21)); _local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22)); _local18++; }; } else { _local19 = _local6.pointCount; _local18 = 0; while (_local18 < _local19) { _local23 = _local6.points[_local18]; _local23.normalImpulse = 0; _local23.tangentImpulse = 0; _local18++; }; }; _local5++; }; } public function SolveVelocityConstraints():void{ var _local1:int; var _local2:b2ContactConstraintPoint; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:b2Mat22; var _local18:b2Vec2; var _local20:b2ContactConstraint; var _local21:b2Body; var _local22:b2Body; var _local23:Number; var _local24:Number; var _local25:b2Vec2; var _local26:b2Vec2; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:int; var _local38:Number; var _local19:int; while (_local19 < m_constraintCount) { _local20 = m_constraints[_local19]; _local21 = _local20.body1; _local22 = _local20.body2; _local23 = _local21.m_angularVelocity; _local24 = _local22.m_angularVelocity; _local25 = _local21.m_linearVelocity; _local26 = _local22.m_linearVelocity; _local27 = _local21.m_invMass; _local28 = _local21.m_invI; _local29 = _local22.m_invMass; _local30 = _local22.m_invI; _local31 = _local20.normal.x; _local32 = _local20.normal.y; _local33 = _local32; _local34 = -(_local31); _local35 = _local20.friction; _local37 = _local20.pointCount; _local1 = 0; while (_local1 < _local37) { _local2 = _local20.points[_local1]; _local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y)); _local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x)); _local9 = ((_local7 * _local31) + (_local8 * _local32)); _local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias)); _local10 = ((_local7 * _local33) + (_local8 * _local34)); _local12 = (_local2.tangentMass * -(_local10)); _local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0); _local11 = (_local13 - _local2.normalImpulse); _local38 = (_local35 * _local2.normalImpulse); _local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38); _local12 = (_local14 - _local2.tangentImpulse); _local15 = ((_local11 * _local31) + (_local12 * _local33)); _local16 = ((_local11 * _local32) + (_local12 * _local34)); _local25.x = (_local25.x - (_local27 * _local15)); _local25.y = (_local25.y - (_local27 * _local16)); _local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15)))); _local26.x = (_local26.x + (_local29 * _local15)); _local26.y = (_local26.y + (_local29 * _local16)); _local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15)))); _local2.normalImpulse = _local13; _local2.tangentImpulse = _local14; _local1++; }; _local21.m_angularVelocity = _local23; _local22.m_angularVelocity = _local24; _local19++; }; } public function FinalizeVelocityConstraints():void{ var _local2:b2ContactConstraint; var _local3:b2Manifold; var _local4:int; var _local5:b2ManifoldPoint; var _local6:b2ContactConstraintPoint; var _local1:int; while (_local1 < m_constraintCount) { _local2 = m_constraints[_local1]; _local3 = _local2.manifold; _local4 = 0; while (_local4 < _local2.pointCount) { _local5 = _local3.points[_local4]; _local6 = _local2.points[_local4]; _local5.normalImpulse = _local6.normalImpulse; _local5.tangentImpulse = _local6.tangentImpulse; _local4++; }; _local1++; }; } public function SolvePositionConstraints(_arg1:Number):Boolean{ var _local3:b2Mat22; var _local4:b2Vec2; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:b2Vec2; var _local10:Number; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:int; var _local20:int; var _local21:b2ContactConstraintPoint; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local2:Number = 0; var _local5:int; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_sweep.c; _local10 = _local7.m_sweep.a; _local11 = _local8.m_sweep.c; _local12 = _local8.m_sweep.a; _local13 = (_local7.m_mass * _local7.m_invMass); _local14 = (_local7.m_mass * _local7.m_invI); _local15 = (_local8.m_mass * _local8.m_invMass); _local16 = (_local8.m_mass * _local8.m_invI); _local17 = _local6.normal.x; _local18 = _local6.normal.y; _local19 = _local6.pointCount; _local20 = 0; while (_local20 < _local19) { _local21 = _local6.points[_local20]; _local3 = _local7.m_xf.R; _local4 = _local7.m_sweep.localCenter; _local22 = (_local21.localAnchor1.x - _local4.x); _local23 = (_local21.localAnchor1.y - _local4.y); _local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23)); _local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23)); _local22 = _local26; _local3 = _local8.m_xf.R; _local4 = _local8.m_sweep.localCenter; _local24 = (_local21.localAnchor2.x - _local4.x); _local25 = (_local21.localAnchor2.y - _local4.y); _local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25)); _local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25)); _local24 = _local26; _local27 = (_local9.x + _local22); _local28 = (_local9.y + _local23); _local29 = (_local11.x + _local24); _local30 = (_local11.y + _local25); _local31 = (_local29 - _local27); _local32 = (_local30 - _local28); _local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation); _local2 = b2Math.b2Min(_local2, _local33); _local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0)); _local35 = (-(_local21.equalizedMass) * _local34); _local36 = _local21.positionImpulse; _local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0); _local35 = (_local21.positionImpulse - _local36); _local37 = (_local35 * _local17); _local38 = (_local35 * _local18); _local9.x = (_local9.x - (_local13 * _local37)); _local9.y = (_local9.y - (_local13 * _local38)); _local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37)))); _local7.m_sweep.a = _local10; _local7.SynchronizeTransform(); _local11.x = (_local11.x + (_local15 * _local37)); _local11.y = (_local11.y + (_local15 * _local38)); _local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37)))); _local8.m_sweep.a = _local12; _local8.SynchronizeTransform(); _local20++; }; _local5++; }; return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop))); } } }//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2NullContact extends b2Contact { override public function Evaluate(_arg1:b2ContactListener):void{ } override public function GetManifolds():Array{ return (null); } } }//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2PolyAndCircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape)); b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape)); m_manifold.pointCount = 0; var _local3:b2ManifoldPoint = m_manifold.points[0]; _local3.normalImpulse = 0; _local3.tangentImpulse = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:int; var _local3:b2Vec2; var _local4:b2Vec2; var _local5:b2ManifoldPoint; var _local10:b2ManifoldPoint; var _local11:Boolean; var _local12:uint; var _local13:int; var _local6:b2Body = m_shape1.m_body; var _local7:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf); var _local8:Array = [false, false]; var _local9:b2ContactPoint = s_evalCP; _local9.shape1 = m_shape1; _local9.shape2 = m_shape2; _local9.friction = m_friction; _local9.restitution = m_restitution; if (m_manifold.pointCount > 0){ _local2 = 0; while (_local2 < m_manifold.pointCount) { _local10 = m_manifold.points[_local2]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < m0.pointCount) { if (_local8[_local13] == true){ } else { _local5 = m0.points[_local13]; if (_local5.id._key == _local12){ _local8[_local13] = true; _local10.normalImpulse = _local5.normalImpulse; _local10.tangentImpulse = _local5.tangentImpulse; _local11 = true; if (_arg1 != null){ _local9.position = _local6.GetWorldPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m_manifold.normal); _local9.separation = _local10.separation; _local9.id.key = _local12; _arg1.Persist(_local9); }; break; }; }; _local13++; }; if ((((_local11 == false)) && (!((_arg1 == null))))){ _local9.position = _local6.GetWorldPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m_manifold.normal); _local9.separation = _local10.separation; _local9.id.key = _local12; _arg1.Add(_local9); }; _local2++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (_arg1 == null){ return; }; _local2 = 0; while (_local2 < m0.pointCount) { if (_local8[_local2]){ } else { _local5 = m0.points[_local2]; _local9.position = _local6.GetWorldPoint(_local5.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m0.normal); _local9.separation = _local5.separation; _local9.id.key = _local5.id._key; _arg1.Remove(_local9); }; _local2++; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function 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 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; 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{ m0 = new b2Manifold(); m_manifolds = [new b2Manifold()]; super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2ManifoldPoint; var _local7:b2ContactPoint; var _local8:int; var _local10:b2ManifoldPoint; var _local11:Boolean; var _local12:uint; var _local13:int; var _local5:b2Body = m_shape1.m_body; var _local6:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf); var _local9:Array = [false, false]; _local7 = s_evalCP; _local7.shape1 = m_shape1; _local7.shape2 = m_shape2; _local7.friction = m_friction; _local7.restitution = m_restitution; if (m_manifold.pointCount > 0){ _local8 = 0; while (_local8 < m_manifold.pointCount) { _local10 = m_manifold.points[_local8]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < m0.pointCount) { if (_local9[_local13] == true){ } else { _local4 = m0.points[_local13]; if (_local4.id._key == _local12){ _local9[_local13] = true; _local10.normalImpulse = _local4.normalImpulse; _local10.tangentImpulse = _local4.tangentImpulse; _local11 = true; if (_arg1 != null){ _local7.position = _local5.GetWorldPoint(_local10.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local10.separation; _local7.id.key = _local12; _arg1.Persist(_local7); }; break; }; }; _local13++; }; if ((((_local11 == false)) && (!((_arg1 == null))))){ _local7.position = _local5.GetWorldPoint(_local10.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local10.separation; _local7.id.key = _local12; _arg1.Add(_local7); }; _local8++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (_arg1 == null){ return; }; _local8 = 0; while (_local8 < m0.pointCount) { if (_local9[_local8]){ } else { _local4 = m0.points[_local8]; _local7.position = _local5.GetWorldPoint(_local4.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; _local8++; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function 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 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2DistanceJoint extends b2Joint { public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_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; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u = new b2Vec2(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_length = _arg1.length; m_frequencyHz = _arg1.frequencyHz; m_dampingRatio = _arg1.dampingRatio; m_impulse = 0; m_gamma = 0; m_bias = 0; m_inv_dt = 0; } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; var _local3:Number; var _local4:b2Body; var _local5:b2Body; var _local6:Number; var _local8:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; m_inv_dt = _arg1.inv_dt; _local4 = m_body1; _local5 = m_body2; _local2 = _local4.m_xf.R; _local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local4.m_sweep.localCenter.y); _local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7)); _local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7)); _local6 = _local3; _local2 = _local5.m_xf.R; _local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local5.m_sweep.localCenter.y); _local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local3; m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6); m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7); var _local10:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y))); if (_local10 > b2Settings.b2_linearSlop){ m_u.Multiply((1 / _local10)); } else { m_u.SetZero(); }; var _local11:Number = ((_local6 * m_u.y) - (_local7 * m_u.x)); var _local12:Number = ((_local8 * m_u.y) - (_local9 * m_u.x)); var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12)); m_mass = (1 / _local13); if (m_frequencyHz > 0){ _local14 = (_local10 - m_length); _local15 = ((2 * Math.PI) * m_frequencyHz); _local16 = (((2 * m_mass) * m_dampingRatio) * _local15); _local17 = ((m_mass * _local15) * _local15); m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17)))); m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma); m_mass = (1 / (_local13 + m_gamma)); }; if (_arg1.warmStarting){ m_impulse = (m_impulse * _arg1.dtRatio); _local18 = (m_impulse * m_u.x); _local19 = (m_impulse * m_u.y); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19)); _local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18)))); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19)); _local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18)))); } else { m_impulse = 0; }; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; _local2 = _local3.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6)); _local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6)); _local5 = _local7; _local2 = _local4.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local7; var _local10:Number = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6)); var _local11:Number = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5)); var _local12:Number = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9)); var _local13:Number = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8)); var _local14:Number = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11))); var _local15:Number = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse))); m_impulse = (m_impulse + _local15); var _local16:Number = (_local15 * m_u.x); var _local17:Number = (_local15 * m_u.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16)))); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17)); _local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); } override public function SolvePositionConstraints():Boolean{ var _local1:b2Mat22; if (m_frequencyHz > 0){ return (true); }; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local1 = _local2.m_xf.R; var _local4:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local5:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local6:Number = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5)); _local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5)); _local4 = _local6; _local1 = _local3.m_xf.R; var _local7:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8)); _local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8)); _local7 = _local6; var _local9:Number = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4); var _local10:Number = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5); var _local11:Number = Math.sqrt(((_local9 * _local9) + (_local10 * _local10))); _local9 = (_local9 / _local11); _local10 = (_local10 / _local11); var _local12:Number = (_local11 - m_length); _local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local13:Number = (-(m_mass) * _local12); m_u.Set(_local9, _local10); var _local14:Number = (_local13 * m_u.x); var _local15:Number = (_local13 * m_u.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14)))); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15)); _local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14)))); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop)); } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2(); _local1.SetV(m_u); _local1.Multiply((m_inv_dt * m_impulse)); return (_local1); } override public function GetReactionTorque():Number{ return (0); } } }//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2DistanceJointDef extends b2JointDef { public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var length:Number; public var frequencyHz:Number; public var dampingRatio:Number; public function b2DistanceJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_distanceJoint; length = 1; frequencyHz = 0; dampingRatio = 0; userData; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1.SetV(body1.GetLocalPoint(_arg3)); localAnchor2.SetV(body2.GetLocalPoint(_arg4)); var _local5:Number = (_arg4.x - _arg3.x); var _local6:Number = (_arg4.y - _arg3.y); length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6))); frequencyHz = 0; dampingRatio = 0; } } }//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2GearJoint extends b2Joint { public var m_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; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_J = new b2Jacobian(); super(_arg1); var _local2:int = _arg1.joint1.m_type; var _local3:int = _arg1.joint2.m_type; m_revolute1 = null; m_prismatic1 = null; m_revolute2 = null; m_prismatic2 = null; m_ground1 = _arg1.joint1.m_body1; m_body1 = _arg1.joint1.m_body2; if (_local2 == b2Joint.e_revoluteJoint){ m_revolute1 = (_arg1.joint1 as b2RevoluteJoint); m_groundAnchor1.SetV(m_revolute1.m_localAnchor1); m_localAnchor1.SetV(m_revolute1.m_localAnchor2); _local4 = m_revolute1.GetJointAngle(); } else { m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint); m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1); m_localAnchor1.SetV(m_prismatic1.m_localAnchor2); _local4 = m_prismatic1.GetJointTranslation(); }; m_ground2 = _arg1.joint2.m_body1; m_body2 = _arg1.joint2.m_body2; if (_local3 == b2Joint.e_revoluteJoint){ m_revolute2 = (_arg1.joint2 as b2RevoluteJoint); m_groundAnchor2.SetV(m_revolute2.m_localAnchor1); m_localAnchor2.SetV(m_revolute2.m_localAnchor2); _local5 = m_revolute2.GetJointAngle(); } else { m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint); m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1); m_localAnchor2.SetV(m_prismatic2.m_localAnchor2); _local5 = m_prismatic2.GetJointTranslation(); }; m_ratio = _arg1.ratio; m_constant = (_local4 + (m_ratio * _local5)); m_force = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y)); return (_local1); } override public function GetReactionTorque():Number{ var _local1:b2Mat22 = m_body2.m_xf.R; var _local2:Number = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x); var _local3:Number = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y); var _local4:Number = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3)); _local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3)); _local2 = _local4; _local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x)))); return (_local4); } public function GetRatio():Number{ return (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 = m_ground1; var _local3:b2Body = m_ground2; var _local4:b2Body = m_body1; var _local5:b2Body = m_body2; var _local14:Number = 0; m_J.SetZero(); if (m_revolute1){ m_J.angular1 = -1; _local14 = (_local14 + _local4.m_invI); } else { _local10 = _local2.m_xf.R; _local11 = m_prismatic1.m_localXAxis1; _local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); _local10 = _local4.m_xf.R; _local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y); _local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9)); _local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9)); _local8 = _local13; _local12 = ((_local8 * _local7) - (_local9 * _local6)); m_J.linear1.Set(-(_local6), -(_local7)); m_J.angular1 = -(_local12); _local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12))); }; if (m_revolute2){ m_J.angular2 = -(m_ratio); _local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI)); } else { _local10 = _local3.m_xf.R; _local11 = m_prismatic2.m_localXAxis1; _local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); _local10 = _local5.m_xf.R; _local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y); _local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9)); _local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9)); _local8 = _local13; _local12 = ((_local8 * _local7) - (_local9 * _local6)); m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7)); m_J.angular2 = (-(m_ratio) * _local12); _local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12)))); }; m_mass = (1 / _local14); if (_arg1.warmStarting){ _local15 = (_arg1.dt * m_force); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y)); _local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1)); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y)); _local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2)); } else { m_force = 0; }; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local5:Number = ((-(_arg1.inv_dt) * m_mass) * _local4); m_force = (m_force + _local5); var _local6:Number = (_arg1.dt * _local5); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2)); } override public function SolvePositionConstraints():Boolean{ var _local4:Number; var _local5:Number; var _local1:Number = 0; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; if (m_revolute1){ _local4 = m_revolute1.GetJointAngle(); } else { _local4 = m_prismatic1.GetJointTranslation(); }; if (m_revolute2){ _local5 = m_revolute2.GetJointAngle(); } else { _local5 = m_prismatic2.GetJointTranslation(); }; var _local6:Number = (m_constant - (_local4 + (m_ratio * _local5))); var _local7:Number = (-(m_mass) * _local6); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y)); _local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1)); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2)); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((_local1 < b2Settings.b2_linearSlop)); } } }//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef) package Box2D.Dynamics.Joints { public class b2GearJointDef extends b2JointDef { public var joint1:b2Joint; public var joint2:b2Joint; public var ratio:Number; public function b2GearJointDef(){ type = b2Joint.e_gearJoint; joint1 = null; joint2 = null; ratio = 1; } } }//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2Jacobian { public var linear1:b2Vec2; public var angular1:Number; public var linear2:b2Vec2; public var angular2:Number; public function b2Jacobian(){ linear1 = new b2Vec2(); linear2 = new b2Vec2(); super(); } public function SetZero():void{ linear1.SetZero(); angular1 = 0; linear2.SetZero(); angular2 = 0; } public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{ linear1.SetV(_arg1); angular1 = _arg2; linear2.SetV(_arg3); angular2 = _arg4; } public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{ return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4))); } } }//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2Joint { public var m_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){ m_node1 = new b2JointEdge(); m_node2 = new b2JointEdge(); super(); m_type = _arg1.type; m_prev = null; m_next = null; m_body1 = _arg1.body1; m_body2 = _arg1.body2; m_collideConnected = _arg1.collideConnected; m_islandFlag = false; m_userData = _arg1.userData; } public function GetType():int{ return (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 (m_body1); } public function GetBody2():b2Body{ return (m_body2); } public function GetNext():b2Joint{ return (m_next); } public function GetUserData(){ return (m_userData); } public function SetUserData(_arg1):void{ 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 54
//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(){ type = b2Joint.e_unknownJoint; userData = null; body1 = null; body2 = null; collideConnected = false; } } }//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointEdge { public var other:b2Body; public var joint:b2Joint; public var prev:b2JointEdge; public var next:b2JointEdge; } }//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2MouseJoint extends b2Joint { private var K:b2Mat22; private var K1:b2Mat22; private var K2:b2Mat22; public var m_localAnchor:b2Vec2; public var m_target:b2Vec2; public var m_body:b2Body; 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 _local2:Number; var _local4:b2Mat22; K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); m_localAnchor = new b2Vec2(); m_target = new b2Vec2(); m_body = m_body2; m_impulse = new b2Vec2(); m_mass = new b2Mat22(); m_C = new b2Vec2(); super(_arg1); m_target.SetV(_arg1.target); _local2 = (m_target.x - m_body2.m_xf.position.x); var _local3:Number = (m_target.y - m_body2.m_xf.position.y); _local4 = m_body2.m_xf.R; m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y)); m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y)); m_maxForce = _arg1.maxForce; m_impulse.SetZero(); var _local5:Number = m_body2.m_mass; var _local6:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz); var _local7:Number = (((2 * _local5) * _arg1.dampingRatio) * _local6); var _local8:Number = ((_arg1.timeStep * _local5) * (_local6 * _local6)); m_gamma = (1 / (_local7 + _local8)); m_beta = (_local8 / (_local7 + _local8)); } override public function GetAnchor1():b2Vec2{ return (m_target); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor)); } public function getBody1():b2Body{ return (m_body1); } public function getBody2():b2Body{ return (m_body2); } override public function GetReactionForce():b2Vec2{ return (m_impulse); } override public function GetReactionTorque():Number{ return (0); } public function SetTarget(_arg1:b2Vec2):void{ if (m_body2.IsSleeping()){ m_body2.WakeUp(); }; m_target = _arg1; } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local7:Number; var _local8:Number; _local2 = m_body2; _local3 = _local2.m_xf.R; _local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x); _local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y); var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local7 = _local2.m_invMass; _local8 = _local2.m_invI; K1.col1.x = _local7; K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = _local7; K2.col1.x = ((_local8 * _local5) * _local5); K2.col2.x = ((-(_local8) * _local4) * _local5); K2.col1.y = ((-(_local8) * _local4) * _local5); K2.col2.y = ((_local8 * _local4) * _local4); K.SetM(K1); K.AddM(K2); K.col1.x = (K.col1.x + m_gamma); K.col2.y = (K.col2.y + m_gamma); K.Invert(m_mass); m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x); m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y); _local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98); var _local9:Number = (_arg1.dt * m_impulse.x); var _local10:Number = (_arg1.dt * m_impulse.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9)))); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local2:b2Body = m_body2; _local3 = _local2.m_xf.R; var _local6:Number = (m_localAnchor.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor.y - _local2.m_sweep.localCenter.y); _local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7)); _local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7)); _local6 = _local4; var _local8:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7)); var _local9:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6)); _local3 = m_mass; _local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x)); _local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y)); var _local10:Number = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5))); var _local11:Number = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5))); var _local12:Number = m_impulse.x; var _local13:Number = m_impulse.y; m_impulse.x = (m_impulse.x + _local10); m_impulse.y = (m_impulse.y + _local11); var _local14:Number = m_impulse.Length(); if (_local14 > m_maxForce){ m_impulse.Multiply((m_maxForce / _local14)); }; _local10 = (m_impulse.x - _local12); _local11 = (m_impulse.y - _local13); var _local15:Number = (_arg1.dt * _local10); var _local16:Number = (_arg1.dt * _local11); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); } override public function SolvePositionConstraints():Boolean{ return (true); } } }//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2MouseJointDef extends b2JointDef { public var target:b2Vec2; public var maxForce:Number; public var frequencyHz:Number; public var dampingRatio:Number; public var timeStep:Number; public function b2MouseJointDef(){ target = new b2Vec2(); super(); type = b2Joint.e_mouseJoint; maxForce = 0; frequencyHz = 5; dampingRatio = 0.7; timeStep = (1 / 60); } } }//package Box2D.Dynamics.Joints
Section 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PrismaticJoint extends b2Joint { public var m_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; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_localXAxis1 = new b2Vec2(); m_localYAxis1 = new b2Vec2(); m_linearJacobian = new b2Jacobian(); m_motorJacobian = new b2Jacobian(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_localXAxis1.SetV(_arg1.localAxis1); m_localYAxis1.x = -(m_localXAxis1.y); m_localYAxis1.y = m_localXAxis1.x; m_refAngle = _arg1.referenceAngle; m_linearJacobian.SetZero(); m_linearMass = 0; m_force = 0; m_angularMass = 0; m_torque = 0; m_motorJacobian.SetZero(); m_motorMass = 0; m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerTranslation = _arg1.lowerTranslation; m_upperTranslation = _arg1.upperTranslation; m_maxMotorForce = _arg1.maxMotorForce; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Mat22 = m_body1.m_xf.R; var _local2:Number = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y))); var _local3:Number = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y))); var _local4:Number = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y))); var _local5:Number = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y))); return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5)))); } override public function GetReactionTorque():Number{ return (m_torque); } public function GetJointTranslation():Number{ var _local3:b2Mat22; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; var _local4:b2Vec2 = _local1.GetWorldPoint(m_localAnchor1); var _local5:b2Vec2 = _local2.GetWorldPoint(m_localAnchor2); var _local6:Number = (_local5.x - _local4.x); var _local7:Number = (_local5.y - _local4.y); var _local8:b2Vec2 = _local1.GetWorldVector(m_localXAxis1); var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7)); return (_local9); } public function GetJointSpeed():Number{ var _local3:b2Mat22; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; _local3 = _local1.m_xf.R; var _local4:Number = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); var _local5:Number = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local3 = _local2.m_xf.R; var _local7:Number = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8)); _local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8)); _local7 = _local6; var _local9:Number = (_local1.m_sweep.c.x + _local4); var _local10:Number = (_local1.m_sweep.c.y + _local5); var _local11:Number = (_local2.m_sweep.c.x + _local7); var _local12:Number = (_local2.m_sweep.c.y + _local8); var _local13:Number = (_local11 - _local9); var _local14:Number = (_local12 - _local10); var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1); var _local16:b2Vec2 = _local1.m_linearVelocity; var _local17:b2Vec2 = _local2.m_linearVelocity; var _local18:Number = _local1.m_angularVelocity; var _local19:Number = _local2.m_angularVelocity; var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4))))); return (_local20); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } public function GetLowerLimit():Number{ return (m_lowerTranslation); } public function GetUpperLimit():Number{ return (m_upperTranslation); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerTranslation = _arg1; m_upperTranslation = _arg2; } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function GetMotorSpeed():Number{ return (m_motorSpeed); } public function SetMaxMotorForce(_arg1:Number):void{ m_maxMotorForce = _arg1; } public function GetMotorForce():Number{ return (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 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local10:Number = _local2.m_invMass; var _local11:Number = _local3.m_invMass; var _local12:Number = _local2.m_invI; var _local13:Number = _local3.m_invI; _local4 = _local2.m_xf.R; var _local14:Number = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y)); var _local15:Number = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y)); var _local16:Number = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x); var _local17:Number = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y); m_linearJacobian.linear1.x = -(_local14); m_linearJacobian.linear1.y = -(_local15); m_linearJacobian.linear2.x = _local14; m_linearJacobian.linear2.y = _local15; m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14))); m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14)); m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2)); m_linearMass = (1 / m_linearMass); m_angularMass = (_local12 + _local13); if (m_angularMass > Number.MIN_VALUE){ m_angularMass = (1 / m_angularMass); }; if (((m_enableLimit) || (m_enableMotor))){ _local4 = _local2.m_xf.R; _local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y)); _local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y)); m_motorJacobian.linear1.x = -(_local18); m_motorJacobian.linear1.y = -(_local19); m_motorJacobian.linear2.x = _local18; m_motorJacobian.linear2.y = _local19; m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18))); m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18)); m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2)); m_motorMass = (1 / m_motorMass); if (m_enableLimit){ _local20 = (_local16 - _local6); _local21 = (_local17 - _local7); _local22 = ((_local18 * _local20) + (_local19 * _local21)); if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){ m_limitState = e_equalLimits; } else { if (_local22 <= m_lowerTranslation){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local22 >= m_upperTranslation){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; }; }; if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit == false){ m_limitForce = 0; }; if (_arg1.warmStarting){ _local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x))); _local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y))); _local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x))); _local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y))); _local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1))); _local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2))); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28)); } else { m_force = 0; m_torque = 0; m_limitForce = 0; m_motorForce = 0; }; m_limitPositionImpulse = 0; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local6:Number; 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; _local6 = _local2.m_invI; var _local7:Number = _local3.m_invI; var _local9:Number = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local10:Number = ((-(_arg1.inv_dt) * m_linearMass) * _local9); m_force = (m_force + _local10); var _local11:Number = (_arg1.dt * _local10); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2)); var _local12:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity); var _local13:Number = ((-(_arg1.inv_dt) * m_angularMass) * _local12); m_torque = (m_torque + _local13); var _local14:Number = (_arg1.dt * _local13); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14)); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed); _local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15); _local17 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce); _local16 = (m_motorForce - _local17); _local11 = (_arg1.dt * _local16); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local19); } else { if (m_limitState == e_atLowerLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); } else { if (m_limitState == e_atUpperLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); }; }; }; _local11 = (_arg1.dt * _local19); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local9:b2Mat22; var _local10:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; var _local5:Number = _local3.m_invMass; var _local6:Number = _local4.m_invMass; var _local7:Number = _local3.m_invI; var _local8:Number = _local4.m_invI; _local9 = _local3.m_xf.R; var _local11:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local12:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12)); _local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12)); _local11 = _local10; _local9 = _local4.m_xf.R; var _local13:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local14:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; var _local15:Number = (_local3.m_sweep.c.x + _local11); var _local16:Number = (_local3.m_sweep.c.y + _local12); var _local17:Number = (_local4.m_sweep.c.x + _local13); var _local18:Number = (_local4.m_sweep.c.y + _local14); var _local19:Number = (_local17 - _local15); var _local20:Number = (_local18 - _local16); _local9 = _local3.m_xf.R; var _local21:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y)); var _local22:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y)); var _local23:Number = ((_local21 * _local19) + (_local22 * _local20)); _local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local24:Number = (-(m_linearMass) * _local23); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2)); var _local25:Number = b2Math.b2Abs(_local23); var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle); _local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); var _local27:Number = (-(m_angularMass) * _local26); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); var _local28:Number = b2Math.b2Abs(_local26); if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local9 = _local3.m_xf.R; _local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); _local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12)); _local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12)); _local11 = _local10; _local9 = _local4.m_xf.R; _local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); _local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; _local15 = (_local3.m_sweep.c.x + _local11); _local16 = (_local3.m_sweep.c.y + _local12); _local17 = (_local4.m_sweep.c.x + _local13); _local18 = (_local4.m_sweep.c.y + _local14); _local19 = (_local17 - _local15); _local20 = (_local18 - _local16); _local9 = _local3.m_xf.R; _local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y)); _local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y)); _local31 = ((_local29 * _local19) + (_local30 * _local20)); _local32 = 0; if (m_limitState == e_equalLimits){ _local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26)); } else { if (m_limitState == e_atLowerLimit){ _local1 = (_local31 - m_lowerTranslation); _local25 = b2Math.b2Max(_local25, -(_local1)); _local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); } else { if (m_limitState == e_atUpperLimit){ _local1 = (_local31 - m_upperTranslation); _local25 = b2Math.b2Max(_local25, _local1); _local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); }; }; }; _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop)))); } } }//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2PrismaticJointDef extends b2JointDef { public var 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(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); localAxis1 = new b2Vec2(); super(); type = b2Joint.e_prismaticJoint; localAxis1.Set(1, 0); referenceAngle = 0; enableLimit = false; lowerTranslation = 0; upperTranslation = 0; enableMotor = false; maxMotorForce = 0; motorSpeed = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); localAxis1 = body1.GetLocalVector(_arg4); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PulleyJoint extends b2Joint { public var m_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; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u1 = new b2Vec2(); m_u2 = new b2Vec2(); super(_arg1); m_ground = m_body1.m_world.m_groundBody; m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x); m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y); m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x); m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_ratio = _arg1.ratio; m_constant = (_arg1.length1 + (m_ratio * _arg1.length2)); m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength))); m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio)); m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = m_u2.Copy(); _local1.Multiply(m_force); return (_local1); } override public function GetReactionTorque():Number{ return (0); } public function GetGroundAnchor1():b2Vec2{ var _local1:b2Vec2 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor1); return (_local1); } public function GetGroundAnchor2():b2Vec2{ var _local1:b2Vec2 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor2); return (_local1); } public function GetLength1():Number{ var _local1:b2Vec2 = m_body1.GetWorldPoint(m_localAnchor1); var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local4:Number = (_local1.x - _local2); var _local5:Number = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetLength2():Number{ var _local1:b2Vec2 = m_body2.GetWorldPoint(m_localAnchor2); var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); var _local4:Number = (_local1.x - _local2); var _local5:Number = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetRatio():Number{ return (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 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; var _local10:Number = (_local2.m_sweep.c.x + _local5); var _local11:Number = (_local2.m_sweep.c.y + _local6); var _local12:Number = (_local3.m_sweep.c.x + _local8); var _local13:Number = (_local3.m_sweep.c.y + _local9); var _local14:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local15:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local16:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local17:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); m_u1.Set((_local10 - _local14), (_local11 - _local15)); m_u2.Set((_local12 - _local16), (_local13 - _local17)); var _local18:Number = m_u1.Length(); var _local19:Number = m_u2.Length(); if (_local18 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / _local18)); } else { m_u1.SetZero(); }; if (_local19 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / _local19)); } else { m_u2.SetZero(); }; var _local20:Number = ((m_constant - _local18) - (m_ratio * _local19)); if (_local20 > 0){ m_state = e_inactiveLimit; m_force = 0; } else { m_state = e_atUpperLimit; m_positionImpulse = 0; }; if (_local18 < m_maxLength1){ m_limitState1 = e_inactiveLimit; m_limitForce1 = 0; } else { m_limitState1 = e_atUpperLimit; m_limitPositionImpulse1 = 0; }; if (_local19 < m_maxLength2){ m_limitState2 = e_inactiveLimit; m_limitForce2 = 0; } else { m_limitState2 = e_atUpperLimit; m_limitPositionImpulse2 = 0; }; var _local21:Number = ((_local5 * m_u1.y) - (_local6 * m_u1.x)); var _local22:Number = ((_local8 * m_u2.y) - (_local9 * m_u2.x)); m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21)); m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22)); m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2)); m_limitMass1 = (1 / m_limitMass1); m_limitMass2 = (1 / m_limitMass2); m_pulleyMass = (1 / m_pulleyMass); if (_arg1.warmStarting){ _local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x); _local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y); _local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x); _local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25)))); } else { m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; }; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local8: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 _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; _local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; if (m_state == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13)))); _local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18); _local20 = m_force; m_force = b2Math.b2Max(0, (m_force + _local19)); _local19 = (m_force - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x); _local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; if (m_limitState1 == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11))); _local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18); _local20 = m_limitForce1; m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19)); _local19 = (m_limitForce1 - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); }; if (m_limitState2 == e_atUpperLimit){ _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13))); _local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18); _local20 = m_limitForce2; m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19)); _local19 = (m_limitForce2 - _local20); _local16 = ((-(_arg1.dt) * _local19) * m_u2.x); _local17 = ((-(_arg1.dt) * _local19) * m_u2.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; } override public function SolvePositionConstraints():Boolean{ var _local3:b2Mat22; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; var _local4:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local5:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local6:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local7:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); var _local23:Number = 0; if (m_state == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9)); _local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9)); _local8 = _local22; _local3 = _local2.m_xf.R; _local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11)); _local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11)); _local10 = _local22; _local12 = (_local1.m_sweep.c.x + _local8); _local13 = (_local1.m_sweep.c.y + _local9); _local14 = (_local2.m_sweep.c.x + _local10); _local15 = (_local2.m_sweep.c.y + _local11); m_u1.Set((_local12 - _local4), (_local13 - _local5)); m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local16 = m_u1.Length(); _local17 = m_u2.Length(); if (_local16 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / _local16)); } else { m_u1.SetZero(); }; if (_local17 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / _local17)); } else { m_u2.SetZero(); }; _local18 = ((m_constant - _local16) - (m_ratio * _local17)); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_pulleyMass) * _local18); _local20 = m_positionImpulse; m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19)); _local19 = (m_positionImpulse - _local20); _local12 = (-(_local19) * m_u1.x); _local13 = (-(_local19) * m_u1.y); _local14 = ((-(m_ratio) * _local19) * m_u2.x); _local15 = ((-(m_ratio) * _local19) * m_u2.y); _local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12)); _local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13)); _local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local1.SynchronizeTransform(); _local2.SynchronizeTransform(); }; if (m_limitState1 == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9)); _local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9)); _local8 = _local22; _local12 = (_local1.m_sweep.c.x + _local8); _local13 = (_local1.m_sweep.c.y + _local9); m_u1.Set((_local12 - _local4), (_local13 - _local5)); _local16 = m_u1.Length(); if (_local16 > b2Settings.b2_linearSlop){ m_u1.x = (m_u1.x * (1 / _local16)); m_u1.y = (m_u1.y * (1 / _local16)); } else { m_u1.SetZero(); }; _local18 = (m_maxLength1 - _local16); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass1) * _local18); _local21 = m_limitPositionImpulse1; m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19)); _local19 = (m_limitPositionImpulse1 - _local21); _local12 = (-(_local19) * m_u1.x); _local13 = (-(_local19) * m_u1.y); _local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12)); _local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13)); _local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local1.SynchronizeTransform(); }; if (m_limitState2 == e_atUpperLimit){ _local3 = _local2.m_xf.R; _local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11)); _local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11)); _local10 = _local22; _local14 = (_local2.m_sweep.c.x + _local10); _local15 = (_local2.m_sweep.c.y + _local11); m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local17 = m_u2.Length(); if (_local17 > b2Settings.b2_linearSlop){ m_u2.x = (m_u2.x * (1 / _local17)); m_u2.y = (m_u2.y * (1 / _local17)); } else { m_u2.SetZero(); }; _local18 = (m_maxLength2 - _local17); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass2) * _local18); _local21 = m_limitPositionImpulse2; m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19)); _local19 = (m_limitPositionImpulse2 - _local21); _local14 = (-(_local19) * m_u2.x); _local15 = (-(_local19) * m_u2.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local2.SynchronizeTransform(); }; return ((_local23 < b2Settings.b2_linearSlop)); } } }//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2PulleyJointDef extends b2JointDef { public var 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(){ groundAnchor1 = new b2Vec2(); groundAnchor2 = new b2Vec2(); localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_pulleyJoint; groundAnchor1.Set(-1, 1); groundAnchor2.Set(1, 1); localAnchor1.Set(-1, 0); localAnchor2.Set(1, 0); length1 = 0; maxLength1 = 0; length2 = 0; maxLength2 = 0; ratio = 1; collideConnected = true; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{ body1 = _arg1; body2 = _arg2; groundAnchor1.SetV(_arg3); groundAnchor2.SetV(_arg4); localAnchor1 = body1.GetLocalPoint(_arg5); localAnchor2 = body2.GetLocalPoint(_arg6); var _local8:Number = (_arg5.x - _arg3.x); var _local9:Number = (_arg5.y - _arg3.y); length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); var _local10:Number = (_arg6.x - _arg4.x); var _local11:Number = (_arg6.y - _arg4.y); length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); ratio = _arg7; var _local12:Number = (length1 + (ratio * length2)); maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength)); maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio); } } }//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2RevoluteJoint extends b2Joint { 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){ K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); K3 = new b2Mat22(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_pivotForce = new b2Vec2(); m_pivotMass = new b2Mat22(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_referenceAngle = _arg1.referenceAngle; m_pivotForce.Set(0, 0); m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerAngle = _arg1.lowerAngle; m_upperAngle = _arg1.upperAngle; m_maxMotorTorque = _arg1.maxMotorTorque; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ return (m_pivotForce); } override public function GetReactionTorque():Number{ return (m_limitForce); } public function GetJointAngle():Number{ return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle)); } public function GetJointSpeed():Number{ return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity)); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } public function GetLowerLimit():Number{ return (m_lowerAngle); } public function GetUpperLimit():Number{ return (m_upperAngle); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerAngle = _arg1; m_upperAngle = _arg2; } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function GetMotorSpeed():Number{ return (m_motorSpeed); } public function SetMaxMotorTorque(_arg1:Number):void{ m_maxMotorTorque = _arg1; } public function GetMotorTorque():Number{ return (m_motorForce); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local7:Number; var _local14:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); _local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local10:Number = _local2.m_invMass; var _local11:Number = _local3.m_invMass; var _local12:Number = _local2.m_invI; var _local13:Number = _local3.m_invI; K1.col1.x = (_local10 + _local11); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local10 + _local11); K2.col1.x = ((_local12 * _local7) * _local7); K2.col2.x = ((-(_local12) * _local6) * _local7); K2.col1.y = ((-(_local12) * _local6) * _local7); K2.col2.y = ((_local12 * _local6) * _local6); K3.col1.x = ((_local13 * _local9) * _local9); K3.col2.x = ((-(_local13) * _local8) * _local9); K3.col1.y = ((-(_local13) * _local8) * _local9); K3.col2.y = ((_local13 * _local8) * _local8); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Invert(m_pivotMass); m_motorMass = (1 / (_local12 + _local13)); if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit){ _local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle); if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){ m_limitState = e_equalLimits; } else { if (_local14 <= m_lowerAngle){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local14 >= m_upperAngle){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; } else { m_limitForce = 0; }; if (_arg1.warmStarting){ _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); } else { m_pivotForce.SetZero(); m_motorForce = 0; m_limitForce = 0; }; m_limitPositionImpulse = 0; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local5:Number; var _local10:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local11:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7)); var _local12:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6)); var _local13:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12))); var _local14:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12))); m_pivotForce.x = (m_pivotForce.x + _local13); m_pivotForce.y = (m_pivotForce.y + _local14); var _local15:Number = (_arg1.dt * _local13); _local16 = (_arg1.dt * _local14); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15)))); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed); _local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17); _local19 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque); _local18 = (m_motorForce - _local19); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity); _local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local21); } else { if (m_limitState == e_atLowerLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); } else { if (m_limitState == e_atUpperLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); }; }; }; _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21)); }; } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local6:b2Mat22; var _local25:Number; var _local26:Number; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; var _local5:Number = 0; _local6 = _local3.m_xf.R; var _local7:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); var _local9:Number = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8)); _local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8)); _local7 = _local9; _local6 = _local4.m_xf.R; var _local10:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local11:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11)); _local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11)); _local10 = _local9; var _local12:Number = (_local3.m_sweep.c.x + _local7); var _local13:Number = (_local3.m_sweep.c.y + _local8); var _local14:Number = (_local4.m_sweep.c.x + _local10); var _local15:Number = (_local4.m_sweep.c.y + _local11); var _local16:Number = (_local14 - _local12); var _local17:Number = (_local15 - _local13); _local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17))); var _local18:Number = _local3.m_invMass; var _local19:Number = _local4.m_invMass; var _local20:Number = _local3.m_invI; var _local21:Number = _local4.m_invI; K1.col1.x = (_local18 + _local19); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local18 + _local19); K2.col1.x = ((_local20 * _local8) * _local8); K2.col2.x = ((-(_local20) * _local7) * _local8); K2.col1.y = ((-(_local20) * _local7) * _local8); K2.col2.y = ((_local20 * _local7) * _local7); K3.col1.x = ((_local21 * _local11) * _local11); K3.col2.x = ((-(_local21) * _local10) * _local11); K3.col1.y = ((-(_local21) * _local10) * _local11); K3.col2.y = ((_local21 * _local10) * _local10); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Solve(tImpulse, -(_local16), -(_local17)); var _local22:Number = tImpulse.x; var _local23:Number = tImpulse.y; _local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23)); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22)))); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22)))); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); var _local24:Number = 0; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle); _local26 = 0; if (m_limitState == e_equalLimits){ _local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local24 = b2Math.b2Abs(_local2); } else { if (m_limitState == e_atLowerLimit){ _local2 = (_local25 - m_lowerAngle); _local24 = b2Math.b2Max(0, -(_local2)); _local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); } else { if (m_limitState == e_atUpperLimit){ _local2 = (_local25 - m_upperAngle); _local24 = b2Math.b2Max(0, _local2); _local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); }; }; }; _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop)))); } } }//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2RevoluteJointDef extends b2JointDef { public var 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(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_revoluteJoint; localAnchor1.Set(0, 0); localAnchor2.Set(0, 0); referenceAngle = 0; lowerAngle = 0; upperAngle = 0; maxMotorTorque = 0; motorSpeed = 0; enableLimit = false; enableMotor = false; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Contacts.*; public class b2Body { public var m_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){ m_xf = new b2XForm(); m_sweep = new b2Sweep(); m_linearVelocity = new b2Vec2(); m_force = new b2Vec2(); super(); m_flags = 0; if (_arg1.isBullet){ m_flags = (m_flags | e_bulletFlag); }; if (_arg1.fixedRotation){ m_flags = (m_flags | e_fixedRotationFlag); }; if (_arg1.allowSleep){ m_flags = (m_flags | e_allowSleepFlag); }; if (_arg1.isSleeping){ m_flags = (m_flags | e_sleepFlag); }; m_world = _arg2; m_xf.position.SetV(_arg1.position); m_xf.R.Set(_arg1.angle); m_sweep.localCenter.SetV(_arg1.massData.center); m_sweep.t0 = 1; m_sweep.a0 = (m_sweep.a = _arg1.angle); var _local3:b2Mat22 = m_xf.R; var _local4:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_jointList = null; m_contactList = null; m_prev = null; m_next = null; m_linearDamping = _arg1.linearDamping; m_angularDamping = _arg1.angularDamping; m_force.Set(0, 0); m_torque = 0; m_linearVelocity.SetZero(); m_angularVelocity = 0; m_sleepTime = 0; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = _arg1.massData.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = _arg1.massData.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; m_userData = _arg1.userData; m_shapeList = null; m_shapeCount = 0; } public function CreateShape(_arg1:b2ShapeDef):b2Shape{ if (m_world.m_lock == true){ return (null); }; var _local2:b2Shape = b2Shape.Create(_arg1, m_world.m_blockAllocator); _local2.m_next = m_shapeList; m_shapeList = _local2; m_shapeCount++; _local2.m_body = this; _local2.CreateProxy(m_world.m_broadPhase, m_xf); _local2.UpdateSweepRadius(m_sweep.localCenter); return (_local2); } public function DestroyShape(_arg1:b2Shape):void{ if (m_world.m_lock == true){ return; }; _arg1.DestroyProxy(m_world.m_broadPhase); var _local2:b2Shape = m_shapeList; var _local3:Boolean; while (_local2 != null) { if (_local2 == _arg1){ _local2 = _arg1.m_next; _local3 = true; break; }; _local2 = _local2.m_next; }; _arg1.m_body = null; _arg1.m_next = null; m_shapeCount--; b2Shape.Destroy(_arg1, m_world.m_blockAllocator); } public function SetMass(_arg1:b2MassData):void{ var _local2:b2Shape; var _local4:b2Vec2; if (m_world.m_lock == true){ return; }; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = _arg1.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = _arg1.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; m_sweep.localCenter.SetV(_arg1.center); var _local3:b2Mat22 = m_xf.R; _local4 = m_sweep.localCenter; m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); _local2 = m_shapeList; while (_local2) { _local2.UpdateSweepRadius(m_sweep.localCenter); _local2 = _local2.m_next; }; var _local5:int = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (_local5 != m_type){ _local2 = m_shapeList; while (_local2) { _local2.RefilterProxy(m_world.m_broadPhase, m_xf); _local2 = _local2.m_next; }; }; } public function SetMassFromShapes():void{ var _local1:b2Shape; if (m_world.m_lock == true){ return; }; m_mass = 0; m_invMass = 0; m_I = 0; m_invI = 0; var _local2:Number = 0; var _local3:Number = 0; var _local4:b2MassData = s_massData; _local1 = m_shapeList; while (_local1) { _local1.ComputeMass(_local4); m_mass = (m_mass + _local4.mass); _local2 = (_local2 + (_local4.mass * _local4.center.x)); _local3 = (_local3 + (_local4.mass * _local4.center.y)); m_I = (m_I + _local4.I); _local1 = _local1.m_next; }; if (m_mass > 0){ m_invMass = (1 / m_mass); _local2 = (_local2 * m_invMass); _local3 = (_local3 * m_invMass); }; if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){ m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3)))); m_invI = (1 / m_I); } else { m_I = 0; m_invI = 0; }; m_sweep.localCenter.Set(_local2, _local3); var _local5:b2Mat22 = m_xf.R; var _local6:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)); m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); _local1 = m_shapeList; while (_local1) { _local1.UpdateSweepRadius(m_sweep.localCenter); _local1 = _local1.m_next; }; var _local7:int = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (_local7 != m_type){ _local1 = m_shapeList; while (_local1) { _local1.RefilterProxy(m_world.m_broadPhase, m_xf); _local1 = _local1.m_next; }; }; } public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{ var _local3:b2Shape; var _local7:Boolean; if (m_world.m_lock == true){ return (true); }; if (IsFrozen()){ return (false); }; m_xf.R.Set(_arg2); m_xf.position.SetV(_arg1); var _local4:b2Mat22 = m_xf.R; var _local5:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y)); m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_sweep.a0 = (m_sweep.a = _arg2); var _local6:Boolean; _local3 = m_shapeList; while (_local3) { _local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf); if (_local7 == false){ _local6 = true; break; }; _local3 = _local3.m_next; }; if (_local6 == true){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local3 = m_shapeList; while (_local3) { _local3.DestroyProxy(m_world.m_broadPhase); _local3 = _local3.m_next; }; return (false); }; m_world.m_broadPhase.Commit(); return (true); } public function GetXForm():b2XForm{ return (m_xf); } public function GetPosition():b2Vec2{ return (m_xf.position); } public function GetAngle():Number{ return (m_sweep.a); } public function GetWorldCenter():b2Vec2{ return (m_sweep.c); } public function GetLocalCenter():b2Vec2{ return (m_sweep.localCenter); } public function SetLinearVelocity(_arg1:b2Vec2):void{ m_linearVelocity.SetV(_arg1); } public function GetLinearVelocity():b2Vec2{ return (m_linearVelocity); } public function SetAngularVelocity(_arg1:Number):void{ m_angularVelocity = _arg1; } public function GetAngularVelocity():Number{ return (m_angularVelocity); } public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_force.x = (m_force.x + _arg1.x); m_force.y = (m_force.y + _arg1.y); m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))); } public function ApplyTorque(_arg1:Number):void{ if (IsSleeping()){ WakeUp(); }; m_torque = (m_torque + _arg1); } public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x)); m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y)); m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)))); } public function GetMass():Number{ return (m_mass); } public function GetInertia():Number{ return (m_I); } public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22 = m_xf.R; var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y))); _local3.x = (_local3.x + m_xf.position.x); _local3.y = (_local3.y + m_xf.position.y); return (_local3); } public function GetWorldVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulMV(m_xf.R, _arg1)); } public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulXT(m_xf, _arg1)); } public function GetLocalVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulTMV(m_xf.R, _arg1)); } public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{ return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_arg1.x - m_sweep.c.x))))); } public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22 = m_xf.R; var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y))); _local3.x = (_local3.x + m_xf.position.x); _local3.y = (_local3.y + m_xf.position.y); return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x))))); } public function IsBullet():Boolean{ return (((m_flags & e_bulletFlag) == e_bulletFlag)); } public function SetBullet(_arg1:Boolean):void{ if (_arg1){ m_flags = (m_flags | e_bulletFlag); } else { m_flags = (m_flags & ~(e_bulletFlag)); }; } public function IsStatic():Boolean{ return ((m_type == e_staticType)); } public function IsDynamic():Boolean{ return ((m_type == e_dynamicType)); } public function IsFrozen():Boolean{ return (((m_flags & e_frozenFlag) == e_frozenFlag)); } public function IsSleeping():Boolean{ return (((m_flags & e_sleepFlag) == e_sleepFlag)); } public function AllowSleeping(_arg1:Boolean):void{ if (_arg1){ m_flags = (m_flags | e_allowSleepFlag); } else { m_flags = (m_flags & ~(e_allowSleepFlag)); WakeUp(); }; } public function WakeUp():void{ m_flags = (m_flags & ~(e_sleepFlag)); m_sleepTime = 0; } public function PutToSleep():void{ m_flags = (m_flags | e_sleepFlag); m_sleepTime = 0; m_linearVelocity.SetZero(); m_angularVelocity = 0; m_force.SetZero(); m_torque = 0; } public function GetShapeList():b2Shape{ return (m_shapeList); } public function GetJointList():b2JointEdge{ return (m_jointList); } public function GetNext():b2Body{ return (m_next); } public function GetPrev():b2Body{ return (m_prev); } public function GetUserData(){ return (m_userData); } public function SetUserData(_arg1):void{ m_userData = _arg1; } public function GetWorld():b2World{ return (m_world); } public function SynchronizeShapes():Boolean{ var _local4:b2Shape; var _local1:b2XForm = s_xf1; _local1.R.Set(m_sweep.a0); var _local2:b2Mat22 = _local1.R; var _local3:b2Vec2 = m_sweep.localCenter; _local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y))); _local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y))); var _local5:Boolean; _local4 = m_shapeList; while (_local4) { _local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf); if (_local5 == false){ break; }; _local4 = _local4.m_next; }; if (_local5 == false){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local4 = m_shapeList; while (_local4) { _local4.DestroyProxy(m_world.m_broadPhase); _local4 = _local4.m_next; }; return (false); }; return (true); } public function SynchronizeTransform():void{ m_xf.R.Set(m_sweep.a); var _local1:b2Mat22 = m_xf.R; var _local2:b2Vec2 = m_sweep.localCenter; m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y))); m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y))); } public function IsConnected(_arg1:b2Body):Boolean{ var _local2:b2JointEdge = m_jointList; while (_local2) { if (_local2.other == _arg1){ return ((_local2.joint.m_collideConnected == false)); }; _local2 = _local2.next; }; return (false); } public function Advance(_arg1:Number):void{ m_sweep.Advance(_arg1); m_sweep.c.SetV(m_sweep.c0); m_sweep.a = m_sweep.a0; SynchronizeTransform(); } } }//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2BodyDef { public var 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(){ massData = new b2MassData(); position = new b2Vec2(); super(); massData.center.SetZero(); massData.mass = 0; massData.I = 0; userData = null; position.Set(0, 0); angle = 0; linearDamping = 0; angularDamping = 0; allowSleep = true; isSleeping = false; fixedRotation = false; isBullet = false; } } }//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener) package Box2D.Dynamics { public class b2BoundaryListener { public function Violation(_arg1:b2Body):void{ } } }//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; public class b2ContactFilter { public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter); ; public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{ var _local3:b2FilterData = _arg1.GetFilterData(); var _local4:b2FilterData = _arg2.GetFilterData(); if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){ return ((_local3.groupIndex > 0)); }; var _local5:Boolean = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0)))); return (_local5); } public function RayCollide(_arg1, _arg2:b2Shape):Boolean{ if (!_arg1){ return (true); }; return (ShouldCollide((_arg1 as b2Shape), _arg2)); } } }//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener) package Box2D.Dynamics { import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class b2ContactListener { public function Add(_arg1:b2ContactPoint):void{ } public function Persist(_arg1:b2ContactPoint):void{ } public function Remove(_arg1:b2ContactPoint):void{ } public function Result(_arg1:b2ContactResult):void{ } } }//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2ContactManager extends b2PairCallback { public var m_world:b2World; public var m_nullContact:b2NullContact; public var m_destroyImmediate:Boolean; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2ContactManager(){ m_nullContact = new b2NullContact(); super(); m_world = null; m_destroyImmediate = false; } override public function PairAdded(_arg1, _arg2){ var _local3:b2Shape = (_arg1 as b2Shape); var _local4:b2Shape = (_arg2 as b2Shape); var _local5:b2Body = _local3.m_body; var _local6:b2Body = _local4.m_body; if (((_local5.IsStatic()) && (_local6.IsStatic()))){ return (m_nullContact); }; if (_local3.m_body == _local4.m_body){ return (m_nullContact); }; if (_local6.IsConnected(_local5)){ return (m_nullContact); }; if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){ return (m_nullContact); }; var _local7:b2Contact = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator); if (_local7 == null){ return (m_nullContact); }; _local3 = _local7.m_shape1; _local4 = _local7.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; _local7.m_prev = null; _local7.m_next = m_world.m_contactList; if (m_world.m_contactList != null){ m_world.m_contactList.m_prev = _local7; }; m_world.m_contactList = _local7; _local7.m_node1.contact = _local7; _local7.m_node1.other = _local6; _local7.m_node1.prev = null; _local7.m_node1.next = _local5.m_contactList; if (_local5.m_contactList != null){ _local5.m_contactList.prev = _local7.m_node1; }; _local5.m_contactList = _local7.m_node1; _local7.m_node2.contact = _local7; _local7.m_node2.other = _local5; _local7.m_node2.prev = null; _local7.m_node2.next = _local6.m_contactList; if (_local6.m_contactList != null){ _local6.m_contactList.prev = _local7.m_node2; }; _local6.m_contactList = _local7.m_node2; m_world.m_contactCount++; return (_local7); } override public function PairRemoved(_arg1, _arg2, _arg3):void{ if (_arg3 == null){ return; }; var _local4:b2Contact = (_arg3 as b2Contact); if (_local4 == m_nullContact){ return; }; Destroy(_local4); } public function Destroy(_arg1:b2Contact):void{ var _local7:b2Body; var _local8:b2Body; var _local9:Array; var _local10:b2ContactPoint; var _local11:int; var _local12:b2Manifold; var _local13:int; var _local14:b2ManifoldPoint; var _local15:b2Vec2; var _local16:b2Vec2; var _local2:b2Shape = _arg1.m_shape1; var _local3:b2Shape = _arg1.m_shape2; var _local4:int = _arg1.m_manifoldCount; if ((((_local4 > 0)) && (m_world.m_contactListener))){ _local7 = _local2.m_body; _local8 = _local3.m_body; _local9 = _arg1.GetManifolds(); _local10 = s_evalCP; _local10.shape1 = _arg1.m_shape1; _local10.shape2 = _arg1.m_shape1; _local10.friction = _arg1.m_friction; _local10.restitution = _arg1.m_restitution; _local11 = 0; while (_local11 < _local4) { _local12 = _local9[_local11]; _local10.normal.SetV(_local12.normal); _local13 = 0; while (_local13 < _local12.pointCount) { _local14 = _local12.points[_local13]; _local10.position = _local7.GetWorldPoint(_local14.localPoint1); _local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1); _local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2); _local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y)); _local10.separation = _local14.separation; _local10.id.key = _local14.id._key; m_world.m_contactListener.Remove(_local10); _local13++; }; _local11++; }; }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_world.m_contactList){ m_world.m_contactList = _arg1.m_next; }; var _local5:b2Body = _local2.m_body; var _local6:b2Body = _local3.m_body; if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local5.m_contactList){ _local5.m_contactList = _arg1.m_node1.next; }; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local6.m_contactList){ _local6.m_contactList = _arg1.m_node2.next; }; b2Contact.Destroy(_arg1, m_world.m_blockAllocator); m_world.m_contactCount--; } public function Collide():void{ var _local2:b2Body; var _local3:b2Body; var _local1:b2Contact = m_world.m_contactList; while (_local1) { _local2 = _local1.m_shape1.m_body; _local3 = _local1.m_shape2.m_body; if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){ } else { _local1.Update(m_world.m_contactListener); }; _local1 = _local1.m_next; }; } } }//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw) package Box2D.Dynamics { import flash.display.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2DebugDraw { public var m_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(){ m_drawFlags = 0; } public function SetFlags(_arg1:uint):void{ m_drawFlags = _arg1; } public function GetFlags():uint{ return (m_drawFlags); } public function AppendFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags | _arg1); } public function ClearFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags & ~(_arg1)); } public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); var _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); } public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha); var _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.endFill(); } public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); } public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha); m_sprite.graphics.moveTo(0, 0); m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); m_sprite.graphics.endFill(); } public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale)); m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale)); } public function DrawXForm(_arg1:b2XForm):void{ m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale)); m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale)); } } }//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener) package Box2D.Dynamics { import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; public class b2DestructionListener { public function SayGoodbyeJoint(_arg1:b2Joint):void{ } public function SayGoodbyeShape(_arg1:b2Shape):void{ } } }//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.Joints.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2Island { public var m_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(); m_bodyCapacity = _arg1; m_contactCapacity = _arg2; m_jointCapacity = _arg3; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_allocator = _arg4; m_listener = _arg5; m_bodies = new Array(_arg1); _local6 = 0; while (_local6 < _arg1) { m_bodies[_local6] = null; _local6++; }; m_contacts = new Array(_arg2); _local6 = 0; while (_local6 < _arg2) { m_contacts[_local6] = null; _local6++; }; m_joints = new Array(_arg3); _local6 = 0; while (_local6 < _arg3) { m_joints[_local6] = null; _local6++; }; m_positionIterationCount = 0; } public function Clear():void{ m_bodyCount = 0; m_contactCount = 0; 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 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.IsStatic()){ } else { _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x)))); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y)))); _local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque)); _local6.m_force.SetZero(); _local6.m_torque = 0; _local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1)); _local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1)); if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){ _local6.m_linearVelocity.Normalize(); _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity); }; if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){ if (_local6.m_angularVelocity < 0){ _local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity); } else { _local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity; }; }; }; _local5++; }; var _local8:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local8.InitVelocityConstraints(_arg1); _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local7.InitVelocityConstraints(_arg1); _local5++; }; _local5 = 0; while (_local5 < _arg1.maxIterations) { _local8.SolveVelocityConstraints(); _local9 = 0; while (_local9 < m_jointCount) { _local7 = m_joints[_local9]; _local7.SolveVelocityConstraints(_arg1); _local9++; }; _local5++; }; _local8.FinalizeVelocityConstraints(); _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.IsStatic()){ } else { _local6.m_sweep.c0.SetV(_local6.m_sweep.c); _local6.m_sweep.a0 = _local6.m_sweep.a; _local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x)); _local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y)); _local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity)); _local6.SynchronizeTransform(); }; _local5++; }; if (_arg3){ _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local7.InitPositionConstraints(); _local5++; }; m_positionIterationCount = 0; while (m_positionIterationCount < _arg1.maxIterations) { _local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte); _local11 = true; _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local12 = _local7.SolvePositionConstraints(); _local11 = ((_local11) && (_local12)); _local5++; }; if (((_local10) && (_local11))){ break; }; m_positionIterationCount++; }; }; Report(_local8.m_constraints); if (_arg4){ _local13 = Number.MAX_VALUE; _local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance); _local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance); _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.m_invMass == 0){ } else { if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){ _local6.m_sleepTime = 0; _local13 = 0; }; if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){ _local6.m_sleepTime = 0; _local13 = 0; } else { _local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt); _local13 = b2Math.b2Min(_local13, _local6.m_sleepTime); }; }; _local5++; }; if (_local13 >= b2Settings.b2_timeToSleep){ _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag); _local6.m_linearVelocity.SetZero(); _local6.m_angularVelocity = 0; _local5++; }; }; }; } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:int; var _local5:b2Body; var _local6:Boolean; var _local3:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local2 = 0; while (_local2 < _arg1.maxIterations) { _local3.SolveVelocityConstraints(); _local2++; }; _local2 = 0; while (_local2 < m_bodyCount) { _local5 = m_bodies[_local2]; if (_local5.IsStatic()){ } else { _local5.m_sweep.c0.SetV(_local5.m_sweep.c); _local5.m_sweep.a0 = _local5.m_sweep.a; _local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x)); _local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y)); _local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity)); _local5.SynchronizeTransform(); }; _local2++; }; var _local4:Number = 0.75; _local2 = 0; while (_local2 < _arg1.maxIterations) { _local6 = _local3.SolvePositionConstraints(_local4); if (_local6){ break; }; _local2++; }; Report(_local3.m_constraints); } public function Report(_arg1:Array):void{ var _local2:b2Mat22; var _local3:b2Vec2; var _local5:b2Contact; var _local6:b2ContactConstraint; var _local7:b2ContactResult; var _local8:b2Body; var _local9:int; var _local10:Array; var _local11:int; var _local12:b2Manifold; var _local13:int; var _local14:b2ManifoldPoint; var _local15:b2ContactConstraintPoint; if (m_listener == null){ return; }; var _local4:int; while (_local4 < m_contactCount) { _local5 = m_contacts[_local4]; _local6 = _arg1[_local4]; _local7 = s_reportCR; _local7.shape1 = _local5.m_shape1; _local7.shape2 = _local5.m_shape2; _local8 = _local7.shape1.m_body; _local9 = _local5.m_manifoldCount; _local10 = _local5.GetManifolds(); _local11 = 0; while (_local11 < _local9) { _local12 = _local10[_local11]; _local7.normal.SetV(_local12.normal); _local13 = 0; while (_local13 < _local12.pointCount) { _local14 = _local12.points[_local13]; _local15 = _local6.points[_local13]; _local7.position = _local8.GetWorldPoint(_local14.localPoint1); _local7.normalImpulse = _local15.normalImpulse; _local7.tangentImpulse = _local15.tangentImpulse; _local7.id.key = _local14.id.key; m_listener.Result(_local7); _local13++; }; _local11++; }; _local4++; }; } public function AddBody(_arg1:b2Body):void{ var _local2 = m_bodyCount++; m_bodies[_local2] = _arg1; } public function AddContact(_arg1:b2Contact):void{ var _local2 = m_contactCount++; m_contacts[_local2] = _arg1; } public function AddJoint(_arg1:b2Joint):void{ var _local2 = m_jointCount++; m_joints[_local2] = _arg1; } } }//package Box2D.Dynamics
Section 73
//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 74
//b2World (Box2D.Dynamics.b2World) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2World { public var m_raycastUserData; public var m_raycastSegment:b2Segment; public var m_raycastNormal:b2Vec2; 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; public static var skinsColour = new b2Color(0.22, 0.41, 0.49); public static var pantsColour = new b2Color(0.5, 0.5, 0.5); public static var shirtColour = new b2Color(0.5, 0.5, 0.5); public static var bloodColour = new b2Color(0.5, 0, 0); public static var objctColour = new b2Color(0.5, 0.5, 0.5); public static var statcColour = new b2Color(0.3, 0.3, 0.3); 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){ m_raycastNormal = new b2Vec2(); m_contactManager = new b2ContactManager(); super(); m_destructionListener = null; m_boundaryListener = null; m_contactFilter = b2ContactFilter.b2_defaultFilter; m_contactListener = null; m_debugDraw = null; m_bodyList = null; m_contactList = null; m_jointList = null; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_positionCorrection = true; m_warmStarting = true; m_continuousPhysics = true; m_allowSleep = _arg3; m_gravity = _arg2; m_lock = false; m_inv_dt0 = 0; m_contactManager.m_world = this; m_broadPhase = new b2BroadPhase(_arg1, m_contactManager); var _local4:b2BodyDef = new b2BodyDef(); m_groundBody = CreateBody(_local4); } public function SetDestructionListener(_arg1:b2DestructionListener):void{ m_destructionListener = _arg1; } public function SetBoundaryListener(_arg1:b2BoundaryListener):void{ m_boundaryListener = _arg1; } public function SetContactFilter(_arg1:b2ContactFilter):void{ m_contactFilter = _arg1; } public function SetContactListener(_arg1:b2ContactListener):void{ m_contactListener = _arg1; } public function SetDebugDraw(_arg1:b2DebugDraw):void{ m_debugDraw = _arg1; } public function Validate():void{ m_broadPhase.Validate(); } public function GetProxyCount():int{ return (m_broadPhase.m_proxyCount); } public function GetPairCount():int{ return (m_broadPhase.m_pairManager.m_pairCount); } public function CreateBody(_arg1:b2BodyDef):b2Body{ if (m_lock == true){ return (null); }; var _local2:b2Body = new b2Body(_arg1, this); _local2.m_prev = null; _local2.m_next = m_bodyList; if (m_bodyList){ m_bodyList.m_prev = _local2; }; m_bodyList = _local2; m_bodyCount++; return (_local2); } public function DestroyBody(_arg1:b2Body):void{ var _local4:b2JointEdge; var _local5:b2Shape; if (m_lock == true){ return; }; var _local2:b2JointEdge = _arg1.m_jointList; while (_local2) { _local4 = _local2; _local2 = _local2.next; if (m_destructionListener){ m_destructionListener.SayGoodbyeJoint(_local4.joint); }; DestroyJoint(_local4.joint); }; var _local3:b2Shape = _arg1.m_shapeList; while (_local3) { _local5 = _local3; _local3 = _local3.m_next; if (m_destructionListener){ m_destructionListener.SayGoodbyeShape(_local5); }; _local5.DestroyProxy(m_broadPhase); b2Shape.Destroy(_local5, m_blockAllocator); }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_bodyList){ m_bodyList = _arg1.m_next; }; m_bodyCount--; } public function CreateJoint(_arg1:b2JointDef):b2Joint{ var _local3:b2Body; var _local4:b2Shape; var _local2:b2Joint = b2Joint.Create(_arg1, m_blockAllocator); _local2.m_prev = null; _local2.m_next = m_jointList; if (m_jointList){ m_jointList.m_prev = _local2; }; m_jointList = _local2; m_jointCount++; _local2.m_node1.joint = _local2; _local2.m_node1.other = _local2.m_body2; _local2.m_node1.prev = null; _local2.m_node1.next = _local2.m_body1.m_jointList; if (_local2.m_body1.m_jointList){ _local2.m_body1.m_jointList.prev = _local2.m_node1; }; _local2.m_body1.m_jointList = _local2.m_node1; _local2.m_node2.joint = _local2; _local2.m_node2.other = _local2.m_body1; _local2.m_node2.prev = null; _local2.m_node2.next = _local2.m_body2.m_jointList; if (_local2.m_body2.m_jointList){ _local2.m_body2.m_jointList.prev = _local2.m_node2; }; _local2.m_body2.m_jointList = _local2.m_node2; if (_arg1.collideConnected == false){ _local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2; _local4 = _local3.m_shapeList; while (_local4) { _local4.RefilterProxy(m_broadPhase, _local3.m_xf); _local4 = _local4.m_next; }; }; return (_local2); } public function DestroyJoint(_arg1:b2Joint):void{ var _local5:b2Body; var _local6:b2Shape; var _local2:Boolean = _arg1.m_collideConnected; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_jointList){ m_jointList = _arg1.m_next; }; var _local3:b2Body = _arg1.m_body1; var _local4:b2Body = _arg1.m_body2; _local3.WakeUp(); _local4.WakeUp(); if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local3.m_jointList){ _local3.m_jointList = _arg1.m_node1.next; }; _arg1.m_node1.prev = null; _arg1.m_node1.next = null; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local4.m_jointList){ _local4.m_jointList = _arg1.m_node2.next; }; _arg1.m_node2.prev = null; _arg1.m_node2.next = null; b2Joint.Destroy(_arg1, m_blockAllocator); m_jointCount--; if (_local2 == false){ _local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4; _local6 = _local5.m_shapeList; while (_local6) { _local6.RefilterProxy(m_broadPhase, _local5.m_xf); _local6 = _local6.m_next; }; }; } public function Refilter(_arg1:b2Shape):void{ _arg1.RefilterProxy(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 (m_bodyCount); } public function GetJointCount():int{ return (m_jointCount); } public function GetContactCount():int{ return (m_contactCount); } public function SetGravity(_arg1:b2Vec2):void{ m_gravity = _arg1; } public function GetGroundBody():b2Body{ return (m_groundBody); } public function Step(_arg1:Number, _arg2:int):void{ m_lock = true; var _local3:b2TimeStep = new b2TimeStep(); _local3.dt = _arg1; _local3.maxIterations = _arg2; if (_arg1 > 0){ _local3.inv_dt = (1 / _arg1); } else { _local3.inv_dt = 0; }; _local3.dtRatio = (m_inv_dt0 * _arg1); _local3.positionCorrection = m_positionCorrection; _local3.warmStarting = m_warmStarting; m_contactManager.Collide(); if (_local3.dt > 0){ Solve(_local3); }; if (((m_continuousPhysics) && ((_local3.dt > 0)))){ SolveTOI(_local3); }; DrawDebugData(); m_inv_dt0 = _local3.inv_dt; m_lock = false; } public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{ var _local4:Array = new Array(_arg3); var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3); var _local6:int; while (_local6 < _local5) { _arg2[_local6] = _local4[_local6]; _local6++; }; return (_local5); } public function Raycast(_arg1:b2Segment, _arg2:Array, _arg3:int, _arg4:Boolean, _arg5):int{ var _local7:int; var _local6:Array = new Array(_arg3); m_raycastSegment = _arg1; m_raycastUserData = _arg5; if (_arg4){ _local7 = m_broadPhase.QuerySegment(_arg1, _local6, _arg3, RaycastSortKey); } else { _local7 = m_broadPhase.QuerySegment(_arg1, _local6, _arg3, RaycastSortKey2); }; var _local8:int; while (_local8 < _local7) { _arg2[_local8] = _local6[_local8]; _local8++; }; return (_local7); } public function RaycastOne(_arg1:b2Segment, _arg2:Array, _arg3:b2Vec2, _arg4:Boolean, _arg5):b2Shape{ var _local6:Array = new Array(1); var _local7:Number = Raycast(_arg1, _local6, 1, _arg4, _arg5); if (_local7 == 0){ return (null); }; if (_local7 > 1){ trace(_local7); }; var _local8:b2Shape = _local6[0]; var _local9:b2XForm = _local8.GetBody().GetXForm(); _local8.TestSegment(_local9, _arg2, _arg3, _arg1, 1); return (_local8); } public function GetBodyList():b2Body{ return (m_bodyList); } public function GetJointList():b2Joint{ return (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; m_positionIterationCount = 0; var _local3:b2Island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2 = _local2.m_next; }; var _local4:b2Contact = m_contactList; while (_local4) { _local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag)); _local4 = _local4.m_next; }; var _local5:b2Joint = m_jointList; while (_local5) { _local5.m_islandFlag = false; _local5 = _local5.m_next; }; var _local6:int = m_bodyCount; var _local7:Array = new Array(_local6); var _local8:b2Body = m_bodyList; while (_local8) { if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){ } else { if (_local8.IsStatic()){ } else { _local3.Clear(); _local9 = 0; var _temp1 = _local9; _local9 = (_local9 + 1); var _local15 = _temp1; _local7[_local15] = _local8; _local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag); while (_local9 > 0) { --_local9; _local2 = _local7[_local9]; _local3.AddBody(_local2); _local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag)); if (_local2.IsStatic()){ } else { _local12 = _local2.m_contactList; while (_local12) { if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){ } else { if (_local12.contact.m_manifoldCount == 0){ } else { _local3.AddContact(_local12.contact); _local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag); _local11 = _local12.other; if ((_local11.m_flags & b2Body.e_islandFlag)){ } else { var _temp2 = _local9; _local9 = (_local9 + 1); var _local16 = _temp2; _local7[_local16] = _local11; _local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag); }; }; }; _local12 = _local12.next; }; _local13 = _local2.m_jointList; while (_local13) { if (_local13.joint.m_islandFlag == true){ } else { _local3.AddJoint(_local13.joint); _local13.joint.m_islandFlag = true; _local11 = _local13.other; if ((_local11.m_flags & b2Body.e_islandFlag)){ } else { var _temp3 = _local9; _local9 = (_local9 + 1); _local16 = _temp3; _local7[_local16] = _local11; _local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag); }; }; _local13 = _local13.next; }; }; }; _local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep); if (_local3.m_positionIterationCount > m_positionIterationCount){ m_positionIterationCount = _local3.m_positionIterationCount; }; _local10 = 0; while (_local10 < _local3.m_bodyCount) { _local2 = _local3.m_bodies[_local10]; if (_local2.IsStatic()){ _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); }; _local10++; }; }; }; _local8 = _local8.m_next; }; _local2 = m_bodyList; while (_local2) { if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (_local2.IsStatic()){ } else { _local14 = _local2.SynchronizeShapes(); if ((((_local14 == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(_local2); }; }; }; _local2 = _local2.m_next; }; m_broadPhase.Commit(); } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Shape; var _local4:b2Shape; var _local5:b2Body; var _local6:b2Body; var _local7:b2ContactEdge; var _local11:b2Contact; var _local12:b2Contact; var _local13:Number; var _local14:b2Body; var _local15:int; var _local16:b2TimeStep; var _local17:int; var _local18:Number; var _local19:Number; var _local20:b2Body; var _local21:Boolean; var _local8:b2Island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener); var _local9:int = m_bodyCount; var _local10:Array = new Array(_local9); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2.m_sweep.t0 = 0; _local2 = _local2.m_next; }; _local11 = m_contactList; while (_local11) { _local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local11 = _local11.m_next; }; while (true) { _local12 = null; _local13 = 1; _local11 = m_contactList; for (;_local11;(_local11 = _local11.m_next)) { if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){ } else { _local18 = 1; if ((_local11.m_flags & b2Contact.e_toiFlag)){ _local18 = _local11.m_toi; } else { _local3 = _local11.m_shape1; _local4 = _local11.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){ continue; }; _local19 = _local5.m_sweep.t0; if (_local5.m_sweep.t0 < _local6.m_sweep.t0){ _local19 = _local6.m_sweep.t0; _local5.m_sweep.Advance(_local19); } else { if (_local6.m_sweep.t0 < _local5.m_sweep.t0){ _local19 = _local5.m_sweep.t0; _local6.m_sweep.Advance(_local19); }; }; _local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep); if ((((_local18 > 0)) && ((_local18 < 1)))){ _local18 = (((1 - _local18) * _local19) + _local18); if (_local18 > 1){ _local18 = 1; }; }; _local11.m_toi = _local18; _local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag); }; if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){ _local12 = _local11; _local13 = _local18; }; }; }; if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){ break; }; _local3 = _local12.m_shape1; _local4 = _local12.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; _local5.Advance(_local13); _local6.Advance(_local13); _local12.Update(m_contactListener); _local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag)); if (_local12.m_manifoldCount == 0){ } else { _local14 = _local5; if (_local14.IsStatic()){ _local14 = _local6; }; _local8.Clear(); _local15 = 0; var _temp1 = _local15; _local15 = (_local15 + 1); var _local22 = _temp1; _local10[_local22] = _local14; _local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag); while (_local15 > 0) { --_local15; _local2 = _local10[_local15]; _local8.AddBody(_local2); _local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag)); if (_local2.IsStatic()){ } else { _local7 = _local2.m_contactList; while (_local7) { if (_local8.m_contactCount == _local8.m_contactCapacity){ } else { if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){ } else { if (_local7.contact.m_manifoldCount == 0){ } else { _local8.AddContact(_local7.contact); _local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag); _local20 = _local7.other; if ((_local20.m_flags & b2Body.e_islandFlag)){ } else { if (_local20.IsStatic() == false){ _local20.Advance(_local13); _local20.WakeUp(); }; var _temp2 = _local15; _local15 = (_local15 + 1); var _local23 = _temp2; _local10[_local23] = _local20; _local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag); }; }; }; }; _local7 = _local7.next; }; }; }; _local16 = new b2TimeStep(); _local16.dt = ((1 - _local13) * _arg1.dt); _local16.inv_dt = (1 / _local16.dt); _local16.maxIterations = _arg1.maxIterations; _local8.SolveTOI(_local16); _local17 = 0; while (_local17 < _local8.m_bodyCount) { _local2 = _local8.m_bodies[_local17]; _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (_local2.IsStatic()){ } else { _local21 = _local2.SynchronizeShapes(); if ((((_local21 == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(_local2); }; _local7 = _local2.m_contactList; while (_local7) { _local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag)); _local7 = _local7.next; }; }; }; _local17++; }; _local17 = 0; while (_local17 < _local8.m_contactCount) { _local11 = _local8.m_contacts[_local17]; _local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local17++; }; m_broadPhase.Commit(); }; }; } public function DrawJoint(_arg1:b2Joint):void{ var _local11:b2PulleyJoint; var _local12:b2Vec2; var _local13:b2Vec2; var _local2:b2Body = _arg1.m_body1; var _local3:b2Body = _arg1.m_body2; var _local4:b2XForm = _local2.m_xf; var _local5:b2XForm = _local3.m_xf; var _local6:b2Vec2 = _local4.position; var _local7:b2Vec2 = _local5.position; var _local8:b2Vec2 = _arg1.GetAnchor1(); var _local9:b2Vec2 = _arg1.GetAnchor2(); var _local10:b2Color = s_jointColor; switch (_arg1.m_type){ case b2Joint.e_distanceJoint: m_debugDraw.DrawSegment(_local8, _local9, _local10); break; case b2Joint.e_pulleyJoint: _local11 = (_arg1 as b2PulleyJoint); _local12 = _local11.GetGroundAnchor1(); _local13 = _local11.GetGroundAnchor2(); m_debugDraw.DrawSegment(_local12, _local8, _local10); m_debugDraw.DrawSegment(_local13, _local9, _local10); m_debugDraw.DrawSegment(_local12, _local13, _local10); break; case b2Joint.e_mouseJoint: m_debugDraw.DrawSegment(_local8, _local9, _local10); break; default: if (_local2 != m_groundBody){ m_debugDraw.DrawSegment(_local6, _local8, _local10); }; m_debugDraw.DrawSegment(_local8, _local9, _local10); if (_local3 != m_groundBody){ m_debugDraw.DrawSegment(_local7, _local9, _local10); }; }; } public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{ var _local6:b2CircleShape; var _local7:b2Vec2; var _local8:Number; var _local9:b2Vec2; var _local10:int; var _local11:b2PolygonShape; var _local12:int; var _local13:Array; var _local14:Array; var _local15:Array; var _local5:b2Color = s_coreColor; switch (_arg1.m_type){ case b2Shape.e_circleShape: _local6 = (_arg1 as b2CircleShape); _local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition); _local8 = _local6.m_radius; _local9 = _arg2.R.col1; m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3); if (_arg4){ m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5); }; break; case b2Shape.e_polygonShape: _local11 = (_arg1 as b2PolygonShape); _local12 = _local11.GetVertexCount(); _local13 = _local11.GetVertices(); _local14 = new Array(b2Settings.b2_maxPolygonVertices); _local10 = 0; while (_local10 < _local12) { _local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]); _local10++; }; m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3); if (_arg4){ _local15 = _local11.GetCoreVertices(); _local10 = 0; while (_local10 < _local12) { _local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]); _local10++; }; m_debugDraw.DrawPolygon(_local14, _local12, _local5); }; break; }; } public function 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:String; var _local17:*; var _local18:*; var _local19:*; var _local20:*; var _local21:uint; var _local22:b2Pair; var _local23:b2Proxy; var _local24:b2Proxy; var _local25:b2Vec2; var _local26:b2Vec2; var _local27:b2Proxy; var _local28:b2PolygonShape; var _local29:b2OBB; var _local30:b2Vec2; var _local31:b2Mat22; var _local32:b2Vec2; var _local33:Number; if (m_debugDraw == null){ return; }; m_debugDraw.m_sprite.graphics.clear(); var _local1:uint = m_debugDraw.GetFlags(); var _local7:b2Vec2 = new b2Vec2(); var _local8:b2Vec2 = new b2Vec2(); var _local9:b2Vec2 = new b2Vec2(); var _local10:b2Color = new b2Color(0, 0, 0); var _local12:b2AABB = new b2AABB(); var _local13:b2AABB = new b2AABB(); var _local14:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()]; if ((_local1 & b2DebugDraw.e_shapeBit)){ _local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit); _local3 = m_bodyList; while (_local3) { _local16 = _local3.GetUserData(); _local11 = _local3.m_xf; _local4 = _local3.GetShapeList(); while (_local4) { if (_local16 == "blood"){ DrawShape(_local4, _local11, bloodColour, _local15); } else { if ((((_local16.substr(0, 8) == "bodypart")) || ((_local16.substr(0, 6) == "corpse")))){ if ((((_local16.substr(9, 4) == "head")) || ((_local16 == "corpse_hea")))){ DrawShape(_local4, _local11, skinsColour, _local15); } else { if ((((((_local16.substr(10, 3) == "arm")) || ((_local16.substr(9, 4) == "tors")))) || ((_local16 == "corpse_shi")))){ DrawShape(_local4, _local11, shirtColour, _local15); } else { if ((((((_local16.substr(10, 3) == "leg")) || ((_local16.substr(10, 3) == "ulg")))) || ((_local16 == "corpse_pan")))){ DrawShape(_local4, _local11, pantsColour, _local15); }; }; }; } else { if (_local4.GetUserData() == "magnet1"){ DrawShape(_local4, _local11, new b2Color(1, 1, 1), _local15); } else { if (_local4.GetUserData() == "magnet2"){ DrawShape(_local4, _local11, new b2Color(0, 0, 1), _local15); } else { if (_local16 == "bullet_fla"){ _local17 = ((Math.random() * 0.4) + 0.6); _local18 = ((Math.random() * 0.1) + 0.1); DrawShape(_local4, _local11, new b2Color(_local18, _local18, _local17), _local15); } else { if (_local16 == "killme"){ _local19 = Main.instance.bgPicker.hexValue; _local20 = new b2Color(((parseInt(String(_local19).substr(4, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local19).substr(2, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local19).substr(0, 2), 16) + 1) * (1 / 0x0100))); DrawShape(_local4, _local11, _local20, _local15); } else { if (_local3.IsStatic()){ DrawShape(_local4, _local11, statcColour, _local15); } else { if (_local3.IsSleeping()){ DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15); } else { DrawShape(_local4, _local11, objctColour, _local15); }; }; }; }; }; }; }; }; _local4 = _local4.m_next; }; _local3 = _local3.m_next; }; }; if ((_local1 & b2DebugDraw.e_jointBit)){ _local5 = m_jointList; while (_local5) { DrawJoint(_local5); _local5 = _local5.m_next; }; }; if ((_local1 & b2DebugDraw.e_pairBit)){ _local6 = m_broadPhase; _local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y)); _local10.Set(0.9, 0.9, 0.3); _local2 = 0; while (_local2 < b2Pair.b2_tableCapacity) { _local21 = _local6.m_pairManager.m_hashTable[_local2]; while (_local21 != b2Pair.b2_nullPair) { _local22 = _local6.m_pairManager.m_pairs[_local21]; _local23 = _local6.m_proxyPool[_local22.proxyId1]; _local24 = _local6.m_proxyPool[_local22.proxyId2]; _local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local23.lowerBounds[0]].value)); _local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local23.lowerBounds[1]].value)); _local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local23.upperBounds[0]].value)); _local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local23.upperBounds[1]].value)); _local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local24.lowerBounds[0]].value)); _local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local24.lowerBounds[1]].value)); _local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local24.upperBounds[0]].value)); _local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local24.upperBounds[1]].value)); _local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x)); _local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y)); _local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x)); _local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y)); m_debugDraw.DrawSegment(_local8, _local9, _local10); _local21 = _local22.next; }; _local2++; }; }; if ((_local1 & b2DebugDraw.e_aabbBit)){ _local6 = m_broadPhase; _local25 = _local6.m_worldAABB.lowerBound; _local26 = _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) { _local27 = _local6.m_proxyPool[_local2]; if (_local27.IsValid() == false){ } else { _local12.lowerBound.x = (_local25.x + (_local7.x * _local6.m_bounds[0][_local27.lowerBounds[0]].value)); _local12.lowerBound.y = (_local25.y + (_local7.y * _local6.m_bounds[1][_local27.lowerBounds[1]].value)); _local12.upperBound.x = (_local25.x + (_local7.x * _local6.m_bounds[0][_local27.upperBounds[0]].value)); _local12.upperBound.y = (_local25.y + (_local7.y * _local6.m_bounds[1][_local27.upperBounds[1]].value)); _local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y); _local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y); _local14[2].Set(_local12.upperBound.x, _local12.upperBound.y); _local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y); m_debugDraw.DrawPolygon(_local14, 4, _local10); }; _local2++; }; _local14[0].Set(_local25.x, _local25.y); _local14[1].Set(_local26.x, _local25.y); _local14[2].Set(_local26.x, _local26.y); _local14[3].Set(_local25.x, _local26.y); m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9)); }; if ((_local1 & b2DebugDraw.e_obbBit)){ _local10.Set(0.5, 0.3, 0.5); _local3 = m_bodyList; while (_local3) { _local11 = _local3.m_xf; _local4 = _local3.GetShapeList(); while (_local4) { if (_local4.m_type != b2Shape.e_polygonShape){ } else { _local28 = (_local4 as b2PolygonShape); _local29 = _local28.GetOBB(); _local30 = _local29.extents; _local14[0].Set(-(_local30.x), -(_local30.y)); _local14[1].Set(_local30.x, -(_local30.y)); _local14[2].Set(_local30.x, _local30.y); _local14[3].Set(-(_local30.x), _local30.y); _local2 = 0; while (_local2 < 4) { _local31 = _local29.R; _local32 = _local14[_local2]; _local33 = (_local29.center.x + ((_local31.col1.x * _local32.x) + (_local31.col2.x * _local32.y))); _local14[_local2].y = (_local29.center.y + ((_local31.col1.y * _local32.x) + (_local31.col2.y * _local32.y))); _local14[_local2].x = _local33; _local31 = _local11.R; _local33 = (_local11.position.x + ((_local31.col1.x * _local32.x) + (_local31.col2.x * _local32.y))); _local14[_local2].y = (_local11.position.y + ((_local31.col1.y * _local32.x) + (_local31.col2.y * _local32.y))); _local14[_local2].x = _local33; _local2++; }; m_debugDraw.DrawPolygon(_local14, 4, _local10); }; _local4 = _local4.m_next; }; _local3 = _local3.m_next; }; }; if ((_local1 & b2DebugDraw.e_centerOfMassBit)){ _local3 = m_bodyList; while (_local3) { _local11 = s_xf; _local11.R = _local3.m_xf.R; _local11.position = _local3.GetWorldCenter(); m_debugDraw.DrawXForm(_local11); _local3 = _local3.m_next; }; }; } public function RaycastSortKey(_arg1:b2Shape){ if (((m_contactFilter) && (!(m_contactFilter.RayCollide(m_raycastUserData, _arg1))))){ return (-1); }; var _local2:b2Body = _arg1.GetBody(); var _local3:b2XForm = _local2.GetXForm(); var _local4:Array = [0]; if (_arg1.TestSegment(_local3, _local4, m_raycastNormal, m_raycastSegment, 1) == b2Shape.e_missCollide){ return (-1); }; return (_local4[0]); } public function RaycastSortKey2(_arg1:b2Shape){ if (((m_contactFilter) && (!(m_contactFilter.RayCollide(m_raycastUserData, _arg1))))){ return (-1); }; var _local2:b2Body = _arg1.GetBody(); var _local3:b2XForm = _local2.GetXForm(); var _local4:Array = [0]; if (_arg1.TestSegment(_local3, _local4, m_raycastNormal, m_raycastSegment, 1) != b2Shape.e_hitCollide){ return (-1); }; return (_local4[0]); } } }//package Box2D.Dynamics
Section 75
//BaseButton (fl.controls.BaseButton) package fl.controls { import flash.display.*; import flash.events.*; import fl.core.*; import flash.utils.*; import fl.events.*; public class BaseButton extends UIComponent { protected var _selected:Boolean;// = false private var unlockedMouseState:String; protected var pressTimer:Timer; protected var mouseState:String; protected var background:DisplayObject; private var _mouseStateLocked:Boolean;// = false protected var _autoRepeat:Boolean;// = false private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35}; public function BaseButton(){ _selected = false; _autoRepeat = false; _mouseStateLocked = false; super(); buttonMode = true; mouseChildren = false; useHandCursor = false; setupMouseEvents(); setMouseState("up"); pressTimer = new Timer(1, 0); pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true); } protected function endPress():void{ pressTimer.reset(); } public function set mouseStateLocked(_arg1:Boolean):void{ _mouseStateLocked = _arg1; if (_arg1 == false){ setMouseState(unlockedMouseState); } else { unlockedMouseState = mouseState; }; } public function get autoRepeat():Boolean{ return (_autoRepeat); } public function set autoRepeat(_arg1:Boolean):void{ _autoRepeat = _arg1; } override public function set enabled(_arg1:Boolean):void{ super.enabled = _arg1; mouseEnabled = _arg1; } public function get selected():Boolean{ return (_selected); } protected function mouseEventHandler(_arg1:MouseEvent):void{ if (_arg1.type == MouseEvent.MOUSE_DOWN){ setMouseState("down"); startPress(); } else { if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){ setMouseState("over"); endPress(); } else { if (_arg1.type == MouseEvent.ROLL_OUT){ setMouseState("up"); endPress(); }; }; }; } public function setMouseState(_arg1:String):void{ if (_mouseStateLocked){ unlockedMouseState = _arg1; return; }; if (mouseState == _arg1){ return; }; mouseState = _arg1; invalidate(InvalidationType.STATE); } protected function startPress():void{ if (_autoRepeat){ pressTimer.delay = Number(getStyleValue("repeatDelay")); pressTimer.start(); }; dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true)); } protected function buttonDown(_arg1:TimerEvent):void{ if (!_autoRepeat){ endPress(); return; }; if (pressTimer.currentCount == 1){ pressTimer.delay = Number(getStyleValue("repeatInterval")); }; dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true)); } public function set selected(_arg1:Boolean):void{ if (_selected == _arg1){ return; }; _selected = _arg1; invalidate(InvalidationType.STATE); } override public function get enabled():Boolean{ return (super.enabled); } override protected function draw():void{ if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){ drawBackground(); invalidate(InvalidationType.SIZE, false); }; if (isInvalid(InvalidationType.SIZE)){ drawLayout(); }; super.draw(); } protected function setupMouseEvents():void{ addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true); addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true); addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true); addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true); } protected function drawLayout():void{ background.width = width; background.height = height; } protected function drawBackground():void{ var _local1:String; var _local2:DisplayObject; _local1 = (enabled) ? mouseState : "disabled"; if (selected){ _local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1)); }; _local1 = (_local1 + "Skin"); _local2 = background; background = getDisplayObjectInstance(getStyleValue(_local1)); addChildAt(background, 0); if (((!((_local2 == null))) && (!((_local2 == background))))){ removeChild(_local2); }; } public static function getStyleDefinition():Object{ return (defaultStyles); } } }//package fl.controls
Section 76
//Button (fl.controls.Button) package fl.controls { import flash.display.*; import fl.core.*; import fl.managers.*; public class Button extends LabelButton implements IFocusManagerComponent { protected var emphasizedBorder:DisplayObject; protected var _emphasized:Boolean;// = false private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2}; public static var createAccessibilityImplementation:Function; public function Button(){ _emphasized = false; super(); } override public function drawFocus(_arg1:Boolean):void{ var _local2:Number; var _local3:*; super.drawFocus(_arg1); if (_arg1){ _local2 = Number(getStyleValue("emphasizedPadding")); if ((((_local2 < 0)) || (!(_emphasized)))){ _local2 = 0; }; _local3 = getStyleValue("focusRectPadding"); _local3 = ((_local3)==null) ? 2 : _local3; _local3 = (_local3 + _local2); uiFocusRect.x = -(_local3); uiFocusRect.y = -(_local3); uiFocusRect.width = (width + (_local3 * 2)); uiFocusRect.height = (height + (_local3 * 2)); }; } public function set emphasized(_arg1:Boolean):void{ _emphasized = _arg1; invalidate(InvalidationType.STYLES); } override protected function draw():void{ if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){ drawEmphasized(); }; super.draw(); if (emphasizedBorder != null){ setChildIndex(emphasizedBorder, (numChildren - 1)); }; } public function get emphasized():Boolean{ return (_emphasized); } override protected function initializeAccessibility():void{ if (Button.createAccessibilityImplementation != null){ Button.createAccessibilityImplementation(this); }; } protected function drawEmphasized():void{ var _local1:Object; var _local2:Number; if (emphasizedBorder != null){ removeChild(emphasizedBorder); }; emphasizedBorder = null; if (!_emphasized){ return; }; _local1 = getStyleValue("emphasizedSkin"); if (_local1 != null){ emphasizedBorder = getDisplayObjectInstance(_local1); }; if (emphasizedBorder != null){ addChildAt(emphasizedBorder, 0); _local2 = Number(getStyleValue("emphasizedPadding")); emphasizedBorder.x = (emphasizedBorder.y = -(_local2)); emphasizedBorder.width = (width + (_local2 * 2)); emphasizedBorder.height = (height + (_local2 * 2)); }; } public static function getStyleDefinition():Object{ return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles)); } } }//package fl.controls
Section 77
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement) package fl.controls { public class ButtonLabelPlacement { public static const TOP:String = "top"; public static const LEFT:String = "left"; public static const BOTTOM:String = "bottom"; public static const RIGHT:String = "right"; } }//package fl.controls
Section 78
//ColorPicker (fl.controls.ColorPicker) package fl.controls { import flash.display.*; import flash.events.*; import fl.core.*; import fl.managers.*; import flash.geom.*; import flash.text.*; import fl.events.*; import flash.ui.*; public class ColorPicker extends UIComponent implements IFocusManagerComponent { protected var paletteBG:DisplayObject; protected var customColors:Array; protected var palette:Sprite; protected var isOpen:Boolean;// = false protected var swatchButton:BaseButton; protected var selectedSwatch:Sprite; protected var textFieldBG:DisplayObject; protected var colorWell:DisplayObject; protected var rollOverColor:int;// = -1 protected var colorHash:Object; protected var swatchSelectedSkin:DisplayObject; protected var _showTextField:Boolean;// = true protected var currRowIndex:int; protected var doOpen:Boolean;// = false protected var currColIndex:int; protected var swatchMap:Array; protected var _selectedColor:uint; protected var _editable:Boolean;// = true public var textField:TextField; protected var swatches:Sprite; protected static const SWATCH_STYLES:Object = {disabledSkin:"swatchSkin", downSkin:"swatchSkin", overSkin:"swatchSkin", upSkin:"swatchSkin"}; protected static const POPUP_BUTTON_STYLES:Object = {disabledSkin:"disabledSkin", downSkin:"downSkin", overSkin:"overSkin", upSkin:"upSkin"}; public static var defaultColors:Array; private static var defaultStyles:Object = {upSkin:"ColorPicker_upSkin", disabledSkin:"ColorPicker_disabledSkin", overSkin:"ColorPicker_overSkin", downSkin:"ColorPicker_downSkin", colorWell:"ColorPicker_colorWell", swatchSkin:"ColorPicker_swatchSkin", swatchSelectedSkin:"ColorPicker_swatchSelectedSkin", swatchWidth:10, swatchHeight:10, columnCount:18, swatchPadding:1, textFieldSkin:"ColorPicker_textFieldSkin", textFieldWidth:null, textFieldHeight:null, textPadding:3, background:"ColorPicker_backgroundSkin", backgroundPadding:5, textFormat:null, focusRectSkin:null, focusRectPadding:null, embedFonts:false}; public function ColorPicker(){ rollOverColor = -1; _editable = true; _showTextField = true; isOpen = false; doOpen = false; super(); } public function set imeMode(_arg1:String):void{ _imeMode = _arg1; } protected function drawSwatchHighlight():void{ var _local1:Object; var _local2:Number; cleanUpSelected(); _local1 = getStyleValue("swatchSelectedSkin"); _local2 = (getStyleValue("swatchPadding") as Number); if (_local1 != null){ swatchSelectedSkin = getDisplayObjectInstance(_local1); swatchSelectedSkin.x = 0; swatchSelectedSkin.y = 0; swatchSelectedSkin.width = ((getStyleValue("swatchWidth") as Number) + 2); swatchSelectedSkin.height = ((getStyleValue("swatchHeight") as Number) + 2); }; } protected function setColorWellColor(_arg1:ColorTransform):void{ if (!colorWell){ return; }; colorWell.transform.colorTransform = _arg1; } override protected function isOurFocus(_arg1:DisplayObject):Boolean{ return ((((_arg1 == textField)) || (super.isOurFocus(_arg1)))); } public function open():void{ var _local1:IFocusManager; if (!_enabled){ return; }; doOpen = true; _local1 = focusManager; if (_local1){ _local1.defaultButtonEnabled = false; }; invalidate(InvalidationType.STATE); } protected function setTextEditable():void{ if (!showTextField){ return; }; textField.type = (editable) ? TextFieldType.INPUT : TextFieldType.DYNAMIC; textField.selectable = editable; } protected function createSwatch(_arg1:uint):Sprite{ var _local2:Sprite; var _local3:BaseButton; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Graphics; _local2 = new Sprite(); _local3 = new BaseButton(); _local3.focusEnabled = false; _local4 = (getStyleValue("swatchWidth") as Number); _local5 = (getStyleValue("swatchHeight") as Number); _local3.setSize(_local4, _local5); _local3.transform.colorTransform = new ColorTransform(0, 0, 0, 1, (_arg1 >> 16), ((_arg1 >> 8) & 0xFF), (_arg1 & 0xFF), 0); copyStylesToChild(_local3, SWATCH_STYLES); _local3.mouseEnabled = false; _local3.drawNow(); _local3.name = "color"; _local2.addChild(_local3); _local6 = (getStyleValue("swatchPadding") as Number); _local7 = _local2.graphics; _local7.beginFill(0); _local7.drawRect(-(_local6), -(_local6), (_local4 + (_local6 * 2)), (_local5 + (_local6 * 2))); _local7.endFill(); _local2.addEventListener(MouseEvent.CLICK, onSwatchClick, false, 0, true); _local2.addEventListener(MouseEvent.MOUSE_OVER, onSwatchOver, false, 0, true); _local2.addEventListener(MouseEvent.MOUSE_OUT, onSwatchOut, false, 0, true); return (_local2); } protected function onSwatchOut(_arg1:MouseEvent):void{ var _local2:ColorTransform; _local2 = _arg1.target.transform.colorTransform; dispatchEvent(new ColorPickerEvent(ColorPickerEvent.ITEM_ROLL_OUT, _local2.color)); } override protected function keyDownHandler(_arg1:KeyboardEvent):void{ var _local2:ColorTransform; var _local3:Sprite; switch (_arg1.keyCode){ case Keyboard.SHIFT: case Keyboard.CONTROL: return; }; if (_arg1.ctrlKey){ switch (_arg1.keyCode){ case Keyboard.DOWN: open(); break; case Keyboard.UP: close(); break; }; return; }; if (!isOpen){ switch (_arg1.keyCode){ case Keyboard.UP: case Keyboard.DOWN: case Keyboard.LEFT: case Keyboard.RIGHT: case Keyboard.SPACE: open(); return; }; }; textField.maxChars = ((((_arg1.keyCode == "#".charCodeAt(0))) || ((textField.text.indexOf("#") > -1)))) ? 7 : 6; switch (_arg1.keyCode){ case Keyboard.TAB: _local3 = findSwatch(_selectedColor); setSwatchHighlight(_local3); return; case Keyboard.HOME: currColIndex = (currRowIndex = 0); break; case Keyboard.END: currColIndex = (swatchMap[(swatchMap.length - 1)].length - 1); currRowIndex = (swatchMap.length - 1); break; case Keyboard.PAGE_DOWN: currRowIndex = (swatchMap.length - 1); break; case Keyboard.PAGE_UP: currRowIndex = 0; break; case Keyboard.ESCAPE: if (isOpen){ selectedColor = _selectedColor; }; close(); return; case Keyboard.ENTER: return; case Keyboard.UP: currRowIndex = Math.max(-1, (currRowIndex - 1)); if (currRowIndex == -1){ currRowIndex = (swatchMap.length - 1); }; break; case Keyboard.DOWN: currRowIndex = Math.min(swatchMap.length, (currRowIndex + 1)); if (currRowIndex == swatchMap.length){ currRowIndex = 0; }; break; case Keyboard.RIGHT: currColIndex = Math.min(swatchMap[currRowIndex].length, (currColIndex + 1)); if (currColIndex == swatchMap[currRowIndex].length){ currColIndex = 0; currRowIndex = Math.min(swatchMap.length, (currRowIndex + 1)); if (currRowIndex == swatchMap.length){ currRowIndex = 0; }; }; break; case Keyboard.LEFT: currColIndex = Math.max(-1, (currColIndex - 1)); if (currColIndex == -1){ currColIndex = (swatchMap[currRowIndex].length - 1); currRowIndex = Math.max(-1, (currRowIndex - 1)); if (currRowIndex == -1){ currRowIndex = (swatchMap.length - 1); }; }; break; default: return; }; _local2 = swatchMap[currRowIndex][currColIndex].getChildByName("color").transform.colorTransform; rollOverColor = _local2.color; setColorWellColor(_local2); setSwatchHighlight(swatchMap[currRowIndex][currColIndex]); setColorText(_local2.color); } public function get editable():Boolean{ return (_editable); } override protected function focusInHandler(_arg1:FocusEvent):void{ super.focusInHandler(_arg1); setIMEMode(true); } protected function onStageClick(_arg1:MouseEvent):void{ if (((!(contains((_arg1.target as DisplayObject)))) && (!(palette.contains((_arg1.target as DisplayObject)))))){ selectedColor = _selectedColor; close(); }; } protected function onSwatchOver(_arg1:MouseEvent):void{ var _local2:BaseButton; var _local3:ColorTransform; _local2 = (_arg1.target.getChildByName("color") as BaseButton); _local3 = _local2.transform.colorTransform; setColorWellColor(_local3); setSwatchHighlight((_arg1.target as Sprite)); setColorText(_local3.color); dispatchEvent(new ColorPickerEvent(ColorPickerEvent.ITEM_ROLL_OVER, _local3.color)); } override public function set enabled(_arg1:Boolean):void{ super.enabled = _arg1; if (!_arg1){ close(); }; swatchButton.enabled = _arg1; } override protected function keyUpHandler(_arg1:KeyboardEvent):void{ var _local2:uint; var _local3:ColorTransform; var _local4:String; var _local5:Sprite; if (!isOpen){ return; }; _local3 = new ColorTransform(); if (((editable) && (showTextField))){ _local4 = textField.text; if (_local4.indexOf("#") > -1){ _local4 = _local4.replace(/^\s+|\s+$/g, ""); _local4 = _local4.replace(/#/g, ""); }; _local2 = parseInt(_local4, 16); _local5 = findSwatch(_local2); setSwatchHighlight(_local5); _local3.color = _local2; setColorWellColor(_local3); } else { _local2 = rollOverColor; _local3.color = _local2; }; if (_arg1.keyCode != Keyboard.ENTER){ return; }; dispatchEvent(new ColorPickerEvent(ColorPickerEvent.ENTER, _local2)); _selectedColor = rollOverColor; setColorText(_local3.color); rollOverColor = _local3.color; dispatchEvent(new ColorPickerEvent(ColorPickerEvent.CHANGE, selectedColor)); close(); } protected function drawBG():void{ var _local1:Object; var _local2:Number; _local1 = getStyleValue("background"); if (_local1 != null){ paletteBG = (getDisplayObjectInstance(_local1) as Sprite); }; if (paletteBG == null){ return; }; _local2 = Number(getStyleValue("backgroundPadding")); paletteBG.width = (Math.max((showTextField) ? textFieldBG.width : 0, swatches.width) + (_local2 * 2)); paletteBG.height = ((swatches.y + swatches.height) + _local2); palette.addChildAt(paletteBG, 0); } protected function positionTextField():void{ var _local1:Number; var _local2:Number; if (!showTextField){ return; }; _local1 = (getStyleValue("backgroundPadding") as Number); _local2 = (getStyleValue("textPadding") as Number); textFieldBG.x = (paletteBG.x + _local1); textFieldBG.y = (paletteBG.y + _local1); textField.x = (textFieldBG.x + _local2); textField.y = (textFieldBG.y + _local2); } protected function setEmbedFonts():void{ var _local1:Object; _local1 = getStyleValue("embedFonts"); if (_local1 != null){ textField.embedFonts = _local1; }; } public function set showTextField(_arg1:Boolean):void{ invalidate(InvalidationType.STYLES); _showTextField = _arg1; } protected function addStageListener(_arg1:Event=null):void{ stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageClick, false, 0, true); } protected function drawPalette():void{ if (isOpen){ stage.removeChild(palette); }; palette = new Sprite(); drawTextField(); drawSwatches(); drawBG(); } protected function showPalette():void{ var _local1:Sprite; if (isOpen){ positionPalette(); return; }; addEventListener(Event.ENTER_FRAME, addCloseListener, false, 0, true); stage.addChild(palette); isOpen = true; positionPalette(); dispatchEvent(new Event(Event.OPEN)); stage.focus = textField; _local1 = selectedSwatch; if (_local1 == null){ _local1 = findSwatch(_selectedColor); }; setSwatchHighlight(_local1); } public function set editable(_arg1:Boolean):void{ _editable = _arg1; invalidate(InvalidationType.STATE); } public function set colors(_arg1:Array):void{ customColors = _arg1; invalidate(InvalidationType.DATA); } protected function drawTextField():void{ var _local1:Number; var _local2:Number; var _local3:Object; var _local4:TextFormat; var _local5:TextFormat; if (!showTextField){ return; }; _local1 = (getStyleValue("backgroundPadding") as Number); _local2 = (getStyleValue("textPadding") as Number); textFieldBG = getDisplayObjectInstance(getStyleValue("textFieldSkin")); if (textFieldBG != null){ palette.addChild(textFieldBG); textFieldBG.x = (textFieldBG.y = _local1); }; _local3 = UIComponent.getStyleDefinition(); _local4 = (enabled) ? (_local3.defaultTextFormat as TextFormat) : (_local3.defaultDisabledTextFormat as TextFormat); textField.setTextFormat(_local4); _local5 = (getStyleValue("textFormat") as TextFormat); if (_local5 != null){ textField.setTextFormat(_local5); } else { _local5 = _local4; }; textField.defaultTextFormat = _local5; setEmbedFonts(); textField.restrict = "A-Fa-f0-9#"; textField.maxChars = 6; palette.addChild(textField); textField.text = " #888888 "; textField.height = (textField.textHeight + 3); textField.width = (textField.textWidth + 3); textField.text = ""; textField.x = (textField.y = (_local1 + _local2)); textFieldBG.width = (textField.width + (_local2 * 2)); textFieldBG.height = (textField.height + (_local2 * 2)); setTextEditable(); } protected function setColorText(_arg1:uint):void{ if (textField == null){ return; }; textField.text = ("#" + colorToString(_arg1)); } protected function colorToString(_arg1:uint):String{ var _local2:String; _local2 = _arg1.toString(16); while (_local2.length < 6) { _local2 = ("0" + _local2); }; return (_local2); } public function get imeMode():String{ return (_imeMode); } public function set selectedColor(_arg1:uint):void{ var _local2:ColorTransform; if (!_enabled){ return; }; _selectedColor = _arg1; rollOverColor = -1; currColIndex = (currRowIndex = 0); _local2 = new ColorTransform(); _local2.color = _arg1; setColorWellColor(_local2); invalidate(InvalidationType.DATA); } override protected function focusOutHandler(_arg1:FocusEvent):void{ if (_arg1.relatedObject == textField){ setFocus(); return; }; if (isOpen){ close(); }; super.focusOutHandler(_arg1); setIMEMode(false); } protected function onPopupButtonClick(_arg1:MouseEvent):void{ if (isOpen){ close(); } else { open(); }; } protected function positionPalette():void{ var _local1:Point; var _local2:Number; _local1 = swatchButton.localToGlobal(new Point(0, 0)); _local2 = (getStyleValue("backgroundPadding") as Number); if ((_local1.x + palette.width) > stage.stageWidth){ palette.x = ((_local1.x - palette.width) << 0); } else { palette.x = (((_local1.x + swatchButton.width) + _local2) << 0); }; palette.y = (Math.max(0, Math.min(_local1.y, (stage.stageHeight - palette.height))) << 0); } public function get hexValue():String{ if (colorWell == null){ return (colorToString(0)); }; return (colorToString(colorWell.transform.colorTransform.color)); } override public function get enabled():Boolean{ return (super.enabled); } protected function setSwatchHighlight(_arg1:Sprite):void{ var _local2:Number; var _local3:*; if (_arg1 == null){ if (palette.contains(swatchSelectedSkin)){ palette.removeChild(swatchSelectedSkin); }; return; } else { if (((!(palette.contains(swatchSelectedSkin))) && ((colors.length > 0)))){ palette.addChild(swatchSelectedSkin); } else { if (!colors.length){ return; }; }; }; _local2 = (getStyleValue("swatchPadding") as Number); palette.setChildIndex(swatchSelectedSkin, (palette.numChildren - 1)); swatchSelectedSkin.x = ((swatches.x + _arg1.x) - 1); swatchSelectedSkin.y = ((swatches.y + _arg1.y) - 1); _local3 = _arg1.getChildByName("color").transform.colorTransform.color; currColIndex = colorHash[_local3].col; currRowIndex = colorHash[_local3].row; } protected function onSwatchClick(_arg1:MouseEvent):void{ var _local2:ColorTransform; _local2 = _arg1.target.getChildByName("color").transform.colorTransform; _selectedColor = _local2.color; dispatchEvent(new ColorPickerEvent(ColorPickerEvent.CHANGE, selectedColor)); close(); } override protected function draw():void{ if (isInvalid(InvalidationType.STYLES, InvalidationType.DATA)){ setStyles(); drawPalette(); setEmbedFonts(); invalidate(InvalidationType.DATA, false); invalidate(InvalidationType.STYLES, false); }; if (isInvalid(InvalidationType.DATA)){ drawSwatchHighlight(); setColorDisplay(); }; if (isInvalid(InvalidationType.STATE)){ setTextEditable(); if (doOpen){ doOpen = false; showPalette(); }; colorWell.visible = enabled; }; if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){ swatchButton.setSize(width, height); swatchButton.drawNow(); colorWell.width = width; colorWell.height = height; }; super.draw(); } protected function drawSwatches():void{ var _local1:Number; var _local2:Number; var _local3:uint; var _local4:uint; var _local5:Number; var _local6:Number; var _local7:uint; var _local8:int; var _local9:uint; var _local10:Sprite; _local1 = (getStyleValue("backgroundPadding") as Number); _local2 = (showTextField) ? ((textFieldBG.y + textFieldBG.height) + _local1) : _local1; swatches = new Sprite(); palette.addChild(swatches); swatches.x = _local1; swatches.y = _local2; _local3 = (getStyleValue("columnCount") as uint); _local4 = (getStyleValue("swatchPadding") as uint); _local5 = (getStyleValue("swatchWidth") as Number); _local6 = (getStyleValue("swatchHeight") as Number); colorHash = {}; swatchMap = []; _local7 = Math.min(0x0400, colors.length); _local8 = -1; _local9 = 0; while (_local9 < _local7) { _local10 = createSwatch(colors[_local9]); _local10.x = ((_local5 + _local4) * (_local9 % _local3)); if (_local10.x == 0){ swatchMap.push([_local10]); _local8++; } else { swatchMap[_local8].push(_local10); }; colorHash[colors[_local9]] = {swatch:_local10, row:_local8, col:(swatchMap[_local8].length - 1)}; _local10.y = (Math.floor((_local9 / _local3)) * (_local6 + _local4)); swatches.addChild(_local10); _local9++; }; } override protected function configUI():void{ var _local1:uint; super.configUI(); tabChildren = false; if (_slot1.defaultColors == null){ _slot1.defaultColors = []; _local1 = 0; while (_local1 < 216) { _slot1.defaultColors.push(((((((((_local1 / 6) % 3) << 0) + (((_local1 / 108) << 0) * 3)) * 51) << 16) | (((_local1 % 6) * 51) << 8)) | ((((_local1 / 18) << 0) % 6) * 51))); _local1++; }; }; colorHash = {}; swatchMap = []; textField = new TextField(); textField.tabEnabled = false; swatchButton = new BaseButton(); swatchButton.focusEnabled = false; swatchButton.useHandCursor = false; swatchButton.autoRepeat = false; swatchButton.setSize(25, 25); swatchButton.addEventListener(MouseEvent.CLICK, onPopupButtonClick, false, 0, true); addChild(swatchButton); palette = new Sprite(); palette.tabChildren = false; palette.cacheAsBitmap = true; } public function get showTextField():Boolean{ return (_showTextField); } public function get colors():Array{ return (((customColors)!=null) ? customColors : _slot1.defaultColors); } protected function findSwatch(_arg1:uint):Sprite{ var _local2:Object; if (!swatchMap.length){ return (null); }; _local2 = colorHash[_arg1]; if (_local2 != null){ return (_local2.swatch); }; return (null); } protected function setColorDisplay():void{ var _local1:ColorTransform; var _local2:Sprite; if (!swatchMap.length){ return; }; _local1 = new ColorTransform(0, 0, 0, 1, (_selectedColor >> 16), ((_selectedColor >> 8) & 0xFF), (_selectedColor & 0xFF), 0); setColorWellColor(_local1); setColorText(_selectedColor); _local2 = findSwatch(_selectedColor); setSwatchHighlight(_local2); if (((swatchMap.length) && ((colorHash[_selectedColor] == undefined)))){ cleanUpSelected(); }; } protected function cleanUpSelected():void{ if (((swatchSelectedSkin) && (palette.contains(swatchSelectedSkin)))){ palette.removeChild(swatchSelectedSkin); }; } public function get selectedColor():uint{ if (colorWell == null){ return (0); }; return (colorWell.transform.colorTransform.color); } private function addCloseListener(_arg1:Event){ removeEventListener(Event.ENTER_FRAME, addCloseListener); if (!isOpen){ return; }; addStageListener(); } protected function removeStageListener(_arg1:Event=null):void{ stage.removeEventListener(MouseEvent.MOUSE_DOWN, onStageClick, false); } protected function setStyles():void{ var _local1:DisplayObject; var _local2:Object; _local1 = colorWell; _local2 = getStyleValue("colorWell"); if (_local2 != null){ colorWell = (getDisplayObjectInstance(_local2) as DisplayObject); }; addChildAt(colorWell, getChildIndex(swatchButton)); copyStylesToChild(swatchButton, POPUP_BUTTON_STYLES); swatchButton.drawNow(); if (((((!((_local1 == null))) && (contains(_local1)))) && (!((_local1 == colorWell))))){ removeChild(_local1); }; } public function close():void{ var _local1:IFocusManager; if (isOpen){ stage.removeChild(palette); isOpen = false; dispatchEvent(new Event(Event.CLOSE)); }; _local1 = focusManager; if (_local1){ _local1.defaultButtonEnabled = true; }; removeStageListener(); cleanUpSelected(); } public static function getStyleDefinition():Object{ return (defaultStyles); } } }//package fl.controls
Section 79
//LabelButton (fl.controls.LabelButton) package fl.controls { import flash.display.*; import flash.events.*; import fl.core.*; import fl.managers.*; import flash.text.*; import fl.events.*; import flash.ui.*; public class LabelButton extends BaseButton implements IFocusManagerComponent { protected var _labelPlacement:String;// = "right" protected var _toggle:Boolean;// = false protected var icon:DisplayObject; protected var oldMouseState:String; protected var mode:String;// = "center" public var textField:TextField; protected var _label:String;// = "Label" private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false}; public static var createAccessibilityImplementation:Function; public function LabelButton(){ _labelPlacement = ButtonLabelPlacement.RIGHT; _toggle = false; _label = "Label"; mode = "center"; super(); } protected function toggleSelected(_arg1:MouseEvent):void{ selected = !(selected); dispatchEvent(new Event(Event.CHANGE, true)); } public function get labelPlacement():String{ return (_labelPlacement); } override protected function keyDownHandler(_arg1:KeyboardEvent):void{ if (!enabled){ return; }; if (_arg1.keyCode == Keyboard.SPACE){ if (oldMouseState == null){ oldMouseState = mouseState; }; setMouseState("down"); startPress(); }; } protected function setEmbedFont(){ var _local1:Object; _local1 = getStyleValue("embedFonts"); if (_local1 != null){ textField.embedFonts = _local1; }; } override protected function keyUpHandler(_arg1:KeyboardEvent):void{ if (!enabled){ return; }; if (_arg1.keyCode == Keyboard.SPACE){ setMouseState(oldMouseState); oldMouseState = null; endPress(); dispatchEvent(new MouseEvent(MouseEvent.CLICK)); }; } override public function get selected():Boolean{ return ((_toggle) ? _selected : false); } public function set labelPlacement(_arg1:String):void{ _labelPlacement = _arg1; invalidate(InvalidationType.SIZE); } public function set toggle(_arg1:Boolean):void{ if (((!(_arg1)) && (super.selected))){ selected = false; }; _toggle = _arg1; if (_toggle){ addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true); } else { removeEventListener(MouseEvent.CLICK, toggleSelected); }; invalidate(InvalidationType.STATE); } public function get label():String{ return (_label); } override public function set selected(_arg1:Boolean):void{ _selected = _arg1; if (_toggle){ invalidate(InvalidationType.STATE); }; } override protected function draw():void{ if (textField.text != _label){ label = _label; }; if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){ drawBackground(); drawIcon(); drawTextFormat(); invalidate(InvalidationType.SIZE, false); }; if (isInvalid(InvalidationType.SIZE)){ drawLayout(); }; if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){ if (((isFocused) && (focusManager.showFocusIndicator))){ drawFocus(true); }; }; validate(); } public function get toggle():Boolean{ return (_toggle); } override protected function configUI():void{ super.configUI(); textField = new TextField(); textField.type = TextFieldType.DYNAMIC; textField.selectable = false; addChild(textField); } override protected function drawLayout():void{ var _local1:Number; var _local2:String; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; _local1 = Number(getStyleValue("textPadding")); _local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement; textField.height = (textField.textHeight + 4); _local3 = (textField.textWidth + 4); _local4 = (textField.textHeight + 4); _local5 = ((icon)==null) ? 0 : (icon.width + _local1); _local6 = ((icon)==null) ? 0 : (icon.height + _local1); textField.visible = (label.length > 0); if (icon != null){ icon.x = Math.round(((width - icon.width) / 2)); icon.y = Math.round(((height - icon.height) / 2)); }; if (textField.visible == false){ textField.width = 0; textField.height = 0; } else { if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){ _local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1)))); if ((height - 2) > _local4){ _local8 = _local4; } else { _local8 = (height - 2); }; _local3 = _local7; textField.width = _local3; _local4 = _local8; textField.height = _local4; textField.x = Math.round(((width - _local3) / 2)); textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0)); if (icon != null){ icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1)); }; } else { _local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1)))); _local3 = _local7; textField.width = _local3; textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0)); textField.y = Math.round(((height - textField.height) / 2)); if (icon != null){ icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1)); }; }; }; super.drawLayout(); } override protected function initializeAccessibility():void{ if (LabelButton.createAccessibilityImplementation != null){ LabelButton.createAccessibilityImplementation(this); }; } protected function drawIcon():void{ var _local1:DisplayObject; var _local2:String; var _local3:Object; _local1 = icon; _local2 = (enabled) ? mouseState : "disabled"; if (selected){ _local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1)); }; _local2 = (_local2 + "Icon"); _local3 = getStyleValue(_local2); if (_local3 == null){ _local3 = getStyleValue("icon"); }; if (_local3 != null){ icon = getDisplayObjectInstance(_local3); }; if (icon != null){ addChildAt(icon, 1); }; if (((!((_local1 == null))) && (!((_local1 == icon))))){ removeChild(_local1); }; } public function set label(_arg1:String):void{ _label = _arg1; if (textField.text != _label){ textField.text = _label; dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE)); }; invalidate(InvalidationType.SIZE); invalidate(InvalidationType.STYLES); } protected function drawTextFormat():void{ var _local1:Object; var _local2:TextFormat; var _local3:TextFormat; _local1 = UIComponent.getStyleDefinition(); _local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat); textField.setTextFormat(_local2); _local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat); if (_local3 != null){ textField.setTextFormat(_local3); } else { _local3 = _local2; }; textField.defaultTextFormat = _local3; setEmbedFont(); } public static function getStyleDefinition():Object{ return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition())); } } }//package fl.controls
Section 80
//ComponentShim (fl.core.ComponentShim) package fl.core { import flash.display.*; public dynamic class ComponentShim extends MovieClip { } }//package fl.core
Section 81
//InvalidationType (fl.core.InvalidationType) package fl.core { public class InvalidationType { public static const SIZE:String = "size"; public static const ALL:String = "all"; public static const DATA:String = "data"; public static const SCROLL:String = "scroll"; public static const STATE:String = "state"; public static const STYLES:String = "styles"; public static const SELECTED:String = "selected"; public static const RENDERER_STYLES:String = "rendererStyles"; } }//package fl.core
Section 82
//UIComponent (fl.core.UIComponent) package fl.core { import flash.display.*; import flash.events.*; import flash.utils.*; import fl.managers.*; import flash.text.*; import fl.events.*; import flash.system.*; public class UIComponent extends Sprite { protected var _enabled:Boolean;// = true private var _mouseFocusEnabled:Boolean;// = true protected var startHeight:Number; protected var _height:Number; protected var _oldIMEMode:String;// = null protected var startWidth:Number; public var focusTarget:IFocusManagerComponent; protected var errorCaught:Boolean;// = false protected var uiFocusRect:DisplayObject; protected var _width:Number; public var version:String;// = "3.0.0.15" protected var isFocused:Boolean;// = false protected var callLaterMethods:Dictionary; private var _focusEnabled:Boolean;// = true private var tempText:TextField; protected var invalidateFlag:Boolean;// = false protected var _inspector:Boolean;// = false protected var sharedStyles:Object; protected var invalidHash:Object; protected var isLivePreview:Boolean;// = false protected var _imeMode:String;// = null protected var instanceStyles:Object; protected var _x:Number; protected var _y:Number; public static var inCallLaterPhase:Boolean = false; private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)}; public static var createAccessibilityImplementation:Function; private static var focusManagers:Dictionary = new Dictionary(false); public function UIComponent(){ version = "3.0.0.15"; isLivePreview = false; invalidateFlag = false; _enabled = true; isFocused = false; _focusEnabled = true; _mouseFocusEnabled = true; _imeMode = null; _oldIMEMode = null; errorCaught = false; _inspector = false; super(); instanceStyles = {}; sharedStyles = {}; invalidHash = {}; callLaterMethods = new Dictionary(); StyleManager.registerInstance(this); configUI(); invalidate(InvalidationType.ALL); tabEnabled = (this is IFocusManagerComponent); focusRect = false; if (tabEnabled){ addEventListener(FocusEvent.FOCUS_IN, focusInHandler); addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler); addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); addEventListener(KeyboardEvent.KEY_UP, keyUpHandler); }; initializeFocusManager(); addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true); } public function drawFocus(_arg1:Boolean):void{ var _local2:Number; isFocused = _arg1; if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){ removeChild(uiFocusRect); uiFocusRect = null; }; if (_arg1){ uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite); if (uiFocusRect == null){ return; }; _local2 = Number(getStyleValue("focusRectPadding")); uiFocusRect.x = -(_local2); uiFocusRect.y = -(_local2); uiFocusRect.width = (width + (_local2 * 2)); uiFocusRect.height = (height + (_local2 * 2)); addChildAt(uiFocusRect, 0); }; } private function callLaterDispatcher(_arg1:Event):void{ var _local2:Dictionary; var _local3:Object; if (_arg1.type == Event.ADDED_TO_STAGE){ removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher); stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true); stage.invalidate(); return; }; _arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher); if (stage == null){ addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true); return; }; inCallLaterPhase = true; _local2 = callLaterMethods; for (_local3 in _local2) { _local3(); delete _local2[_local3]; }; inCallLaterPhase = false; } private function addedHandler(_arg1:Event):void{ removeEventListener("addedToStage", addedHandler); initializeFocusManager(); } protected function getStyleValue(_arg1:String):Object{ return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]); } protected function isOurFocus(_arg1:DisplayObject):Boolean{ return ((_arg1 == this)); } override public function get scaleX():Number{ return ((width / startWidth)); } override public function get scaleY():Number{ return ((height / startHeight)); } override public function set height(_arg1:Number):void{ if (_height == _arg1){ return; }; setSize(width, _arg1); } protected function keyDownHandler(_arg1:KeyboardEvent):void{ } protected function focusInHandler(_arg1:FocusEvent):void{ var _local2:IFocusManager; if (isOurFocus((_arg1.target as DisplayObject))){ _local2 = focusManager; if (((_local2) && (_local2.showFocusIndicator))){ drawFocus(true); isFocused = true; }; }; } public function setStyle(_arg1:String, _arg2:Object):void{ if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){ return; }; instanceStyles[_arg1] = _arg2; invalidate(InvalidationType.STYLES); } override public function get visible():Boolean{ return (super.visible); } public function get componentInspectorSetting():Boolean{ return (_inspector); } override public function get x():Number{ return ((isNaN(_x)) ? super.x : _x); } override public function get y():Number{ return ((isNaN(_y)) ? super.y : _y); } protected function setIMEMode(_arg1:Boolean){ var enabled = _arg1; if (_imeMode != null){ if (enabled){ IME.enabled = true; _oldIMEMode = IME.conversionMode; try { if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){ IME.conversionMode = _imeMode; }; errorCaught = false; } catch(e:Error) { errorCaught = true; throw (new Error(("IME mode not supported: " + _imeMode))); }; } else { if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){ IME.conversionMode = _oldIMEMode; }; IME.enabled = false; }; }; } public function set enabled(_arg1:Boolean):void{ if (_arg1 == _enabled){ return; }; _enabled = _arg1; invalidate(InvalidationType.STATE); } public function setSharedStyle(_arg1:String, _arg2:Object):void{ if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){ return; }; sharedStyles[_arg1] = _arg2; if (instanceStyles[_arg1] == null){ invalidate(InvalidationType.STYLES); }; } protected function keyUpHandler(_arg1:KeyboardEvent):void{ } public function set focusEnabled(_arg1:Boolean):void{ _focusEnabled = _arg1; } override public function set scaleX(_arg1:Number):void{ setSize((startWidth * _arg1), height); } public function get mouseFocusEnabled():Boolean{ return (_mouseFocusEnabled); } override public function set scaleY(_arg1:Number):void{ setSize(width, (startHeight * _arg1)); } protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{ var classDef:Object; var skin = _arg1; classDef = null; if ((skin is Class)){ return ((new (skin) as DisplayObject)); }; if ((skin is DisplayObject)){ (skin as DisplayObject).x = 0; (skin as DisplayObject).y = 0; return ((skin as DisplayObject)); }; try { classDef = getDefinitionByName(skin.toString()); } catch(e:Error) { try { classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object); } catch(e:Error) { }; }; if (classDef == null){ return (null); }; return ((new (classDef) as DisplayObject)); } protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{ var _local3:String; for (_local3 in _arg2) { _arg1.setStyle(_local3, getStyleValue(_arg2[_local3])); }; } protected function beforeComponentParameters():void{ } protected function callLater(_arg1:Function):void{ if (inCallLaterPhase){ return; }; callLaterMethods[_arg1] = true; if (stage != null){ stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true); stage.invalidate(); } else { addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true); }; } protected function createFocusManager():void{ if (focusManagers[stage] == null){ focusManagers[stage] = new FocusManager(stage); }; } override public function set visible(_arg1:Boolean):void{ var _local2:String; if (super.visible == _arg1){ return; }; super.visible = _arg1; _local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE; dispatchEvent(new ComponentEvent(_local2, true)); } protected function hookAccessibility(_arg1:Event):void{ removeEventListener(Event.ENTER_FRAME, hookAccessibility); initializeAccessibility(); } public function set componentInspectorSetting(_arg1:Boolean):void{ _inspector = _arg1; if (_inspector){ beforeComponentParameters(); } else { afterComponentParameters(); }; } override public function set x(_arg1:Number):void{ move(_arg1, _y); } public function drawNow():void{ draw(); } override public function set y(_arg1:Number):void{ move(_x, _arg1); } protected function checkLivePreview():Boolean{ var className:String; if (parent == null){ return (false); }; try { className = getQualifiedClassName(parent); } catch(e:Error) { }; return ((className == "fl.livepreview::LivePreviewParent")); } protected function focusOutHandler(_arg1:FocusEvent):void{ if (isOurFocus((_arg1.target as DisplayObject))){ drawFocus(false); isFocused = false; }; } public function set mouseFocusEnabled(_arg1:Boolean):void{ _mouseFocusEnabled = _arg1; } public function getFocus():InteractiveObject{ if (stage){ return (stage.focus); }; return (null); } protected function validate():void{ invalidHash = {}; } override public function get height():Number{ return (_height); } public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{ invalidHash[_arg1] = true; if (_arg2){ this.callLater(draw); }; } public function get enabled():Boolean{ return (_enabled); } protected function getScaleX():Number{ return (super.scaleX); } protected function getScaleY():Number{ return (super.scaleY); } public function get focusEnabled():Boolean{ return (_focusEnabled); } protected function afterComponentParameters():void{ } protected function draw():void{ if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){ if (((isFocused) && (focusManager.showFocusIndicator))){ drawFocus(true); }; }; validate(); } protected function configUI():void{ var _local1:Number; var _local2:Number; var _local3:Number; isLivePreview = checkLivePreview(); _local1 = rotation; rotation = 0; _local2 = super.width; _local3 = super.height; var _local4 = 1; super.scaleY = _local4; super.scaleX = _local4; setSize(_local2, _local3); move(super.x, super.y); rotation = _local1; startWidth = _local2; startHeight = _local3; if (numChildren > 0){ removeChildAt(0); }; } protected function setScaleX(_arg1:Number):void{ super.scaleX = _arg1; } protected function setScaleY(_arg1:Number):void{ super.scaleY = _arg1; } private function initializeFocusManager():void{ if (stage == null){ addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true); } else { createFocusManager(); }; } public function set focusManager(_arg1:IFocusManager):void{ UIComponent.focusManagers[this] = _arg1; } public function clearStyle(_arg1:String):void{ setStyle(_arg1, null); } protected function isInvalid(_arg1:String, ... _args):Boolean{ if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){ return (true); }; while (_args.length > 0) { if (invalidHash[_args.pop()]){ return (true); }; }; return (false); } public function setSize(_arg1:Number, _arg2:Number):void{ _width = _arg1; _height = _arg2; invalidate(InvalidationType.SIZE); dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false)); } override public function set width(_arg1:Number):void{ if (_width == _arg1){ return; }; setSize(_arg1, height); } public function setFocus():void{ if (stage){ stage.focus = this; }; } protected function initializeAccessibility():void{ if (UIComponent.createAccessibilityImplementation != null){ UIComponent.createAccessibilityImplementation(this); }; } public function get focusManager():IFocusManager{ var _local1:DisplayObject; _local1 = this; while (_local1) { if (UIComponent.focusManagers[_local1] != null){ return (IFocusManager(UIComponent.focusManagers[_local1])); }; _local1 = _local1.parent; }; return (null); } override public function get width():Number{ return (_width); } public function move(_arg1:Number, _arg2:Number):void{ _x = _arg1; _y = _arg2; super.x = Math.round(_arg1); super.y = Math.round(_arg2); dispatchEvent(new ComponentEvent(ComponentEvent.MOVE)); } public function validateNow():void{ invalidate(InvalidationType.ALL, false); draw(); } public function getStyle(_arg1:String):Object{ return (instanceStyles[_arg1]); } public static function getStyleDefinition():Object{ return (defaultStyles); } public static function mergeStyles(... _args):Object{ var _local2:Object; var _local3:uint; var _local4:uint; var _local5:Object; var _local6:String; _local2 = {}; _local3 = _args.length; _local4 = 0; while (_local4 < _local3) { _local5 = _args[_local4]; for (_local6 in _local5) { if (_local2[_local6] != null){ } else { _local2[_local6] = _args[_local4][_local6]; }; }; _local4++; }; return (_local2); } } }//package fl.core
Section 83
//ColorPickerEvent (fl.events.ColorPickerEvent) package fl.events { import flash.events.*; public class ColorPickerEvent extends Event { protected var _color:uint; public static const ITEM_ROLL_OUT:String = "itemRollOut"; public static const ITEM_ROLL_OVER:String = "itemRollOver"; public static const CHANGE:String = "change"; public static const ENTER:String = "enter"; public function ColorPickerEvent(_arg1:String, _arg2:uint){ super(_arg1, true); _color = _arg2; } override public function toString():String{ return (formatToString("ColorPickerEvent", "type", "bubbles", "cancelable", "color")); } public function get color():uint{ return (_color); } override public function clone():Event{ return (new ColorPickerEvent(type, color)); } } }//package fl.events
Section 84
//ComponentEvent (fl.events.ComponentEvent) package fl.events { import flash.events.*; public class ComponentEvent extends Event { public static const HIDE:String = "hide"; public static const BUTTON_DOWN:String = "buttonDown"; public static const MOVE:String = "move"; public static const RESIZE:String = "resize"; public static const ENTER:String = "enter"; public static const LABEL_CHANGE:String = "labelChange"; public static const SHOW:String = "show"; public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){ super(_arg1, _arg2, _arg3); } override public function toString():String{ return (formatToString("ComponentEvent", "type", "bubbles", "cancelable")); } override public function clone():Event{ return (new ComponentEvent(type, bubbles, cancelable)); } } }//package fl.events
Section 85
//FocusManager (fl.managers.FocusManager) package fl.managers { import fl.controls.*; import flash.display.*; import flash.events.*; import fl.core.*; import flash.utils.*; import flash.text.*; import flash.ui.*; public class FocusManager implements IFocusManager { private var focusableObjects:Dictionary; private var _showFocusIndicator:Boolean;// = true private var defButton:Button; private var focusableCandidates:Array; private var _form:DisplayObjectContainer; private var _defaultButtonEnabled:Boolean;// = true private var activated:Boolean;// = false private var _defaultButton:Button; private var calculateCandidates:Boolean;// = true private var lastFocus:InteractiveObject; private var lastAction:String; public function FocusManager(_arg1:DisplayObjectContainer){ activated = false; calculateCandidates = true; _showFocusIndicator = true; _defaultButtonEnabled = true; super(); focusableObjects = new Dictionary(true); if (_arg1 != null){ _form = _arg1; addFocusables(DisplayObject(_arg1)); _arg1.addEventListener(Event.ADDED, addedHandler); _arg1.addEventListener(Event.REMOVED, removedHandler); activate(); }; } public function get showFocusIndicator():Boolean{ return (_showFocusIndicator); } private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{ var _local5:int; var _local6:int; var _local7:DisplayObject; var _local8:IFocusManagerGroup; var _local9:int; var _local10:DisplayObject; var _local11:IFocusManagerGroup; _local5 = focusableCandidates.length; _local6 = _arg1; while (true) { if (_arg2){ _arg1--; } else { _arg1++; }; if (_arg3){ if (((_arg2) && ((_arg1 < 0)))){ break; }; if (((!(_arg2)) && ((_arg1 == _local5)))){ break; }; } else { _arg1 = ((_arg1 + _local5) % _local5); if (_local6 == _arg1){ break; }; }; if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){ _local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1])); if ((_local7 is IFocusManagerGroup)){ _local8 = IFocusManagerGroup(_local7); _local9 = 0; while (_local9 < focusableCandidates.length) { _local10 = focusableCandidates[_local9]; if ((_local10 is IFocusManagerGroup)){ _local11 = IFocusManagerGroup(_local10); if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){ _arg1 = _local9; break; }; }; _local9++; }; }; return (_arg1); }; }; return (_arg1); } public function set form(_arg1:DisplayObjectContainer):void{ _form = _arg1; } private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{ var focusable:IFocusManagerComponent; var io:InteractiveObject; var doc:DisplayObjectContainer; var i:int; var child:DisplayObject; var o = _arg1; var skipTopLevel = _arg2; if (!skipTopLevel){ if ((o is IFocusManagerComponent)){ focusable = IFocusManagerComponent(o); if (focusable.focusEnabled){ if (((focusable.tabEnabled) && (isTabVisible(o)))){ focusableObjects[o] = true; calculateCandidates = true; }; o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler); o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler); }; } else { if ((o is InteractiveObject)){ io = (o as InteractiveObject); if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){ focusableObjects[io] = true; calculateCandidates = true; }; io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler); io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler); }; }; }; if ((o is DisplayObjectContainer)){ doc = DisplayObjectContainer(o); o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler); if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){ i = 0; while (i < doc.numChildren) { try { child = doc.getChildAt(i); if (child != null){ addFocusables(doc.getChildAt(i)); }; } catch(error:SecurityError) { }; i = (i + 1); }; }; }; } private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{ return (_arg1.getChildIndex(_arg2)); } private function mouseFocusChangeHandler(_arg1:FocusEvent):void{ if ((_arg1.relatedObject is TextField)){ return; }; _arg1.preventDefault(); } private function focusOutHandler(_arg1:FocusEvent):void{ var _local2:InteractiveObject; _local2 = (_arg1.target as InteractiveObject); } private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{ var _local3:IFocusManagerGroup; if (!isEnabledAndVisible(_arg1)){ return (false); }; if ((_arg1 is IFocusManagerGroup)){ _local3 = IFocusManagerGroup(_arg1); if (_arg2 == _local3.groupName){ return (false); }; }; return (true); } public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{ var _local2:InteractiveObject; _local2 = _arg1; while (_arg1) { if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){ return (_arg1); }; _arg1 = _arg1.parent; }; return (_local2); } private function sortFocusableObjectsTabIndex():void{ var _local1:Object; var _local2:InteractiveObject; focusableCandidates = []; for (_local1 in focusableObjects) { _local2 = InteractiveObject(_local1); if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){ focusableCandidates.push(_local2); }; }; focusableCandidates.sort(sortByTabIndex); } private function removeFocusables(_arg1:DisplayObject):void{ var _local2:Object; var _local3:DisplayObject; if ((_arg1 is DisplayObjectContainer)){ _arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler); _arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler); for (_local2 in focusableObjects) { _local3 = DisplayObject(_local2); if (DisplayObjectContainer(_arg1).contains(_local3)){ if (_local3 == lastFocus){ lastFocus = null; }; _local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler); delete focusableObjects[_local2]; calculateCandidates = true; }; }; }; } private function addedHandler(_arg1:Event):void{ var _local2:DisplayObject; _local2 = DisplayObject(_arg1.target); if (_local2.stage){ addFocusables(DisplayObject(_arg1.target)); }; } private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{ while (_arg1 != InteractiveObject(form)) { if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){ return (_arg1); }; _arg1 = _arg1.parent; if (_arg1 == null){ break; }; }; return (null); } private function tabChildrenChangeHandler(_arg1:Event):void{ var _local2:DisplayObjectContainer; if (_arg1.target != _arg1.currentTarget){ return; }; calculateCandidates = true; _local2 = DisplayObjectContainer(_arg1.target); if (_local2.tabChildren){ addFocusables(_local2, true); } else { removeFocusables(_local2); }; } public function sendDefaultButtonEvent():void{ defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK)); } public function getFocus():InteractiveObject{ var _local1:InteractiveObject; _local1 = form.stage.focus; return (findFocusManagerComponent(_local1)); } private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{ var _local2:DisplayObjectContainer; var _local3:TextField; var _local4:SimpleButton; _local2 = DisplayObject(form).parent; while (_arg1 != _local2) { if ((_arg1 is UIComponent)){ if (!UIComponent(_arg1).enabled){ return (false); }; } else { if ((_arg1 is TextField)){ _local3 = TextField(_arg1); if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){ return (false); }; } else { if ((_arg1 is SimpleButton)){ _local4 = SimpleButton(_arg1); if (!_local4.enabled){ return (false); }; }; }; }; if (!_arg1.visible){ return (false); }; _arg1 = _arg1.parent; }; return (true); } public function set defaultButton(_arg1:Button):void{ var _local2:Button; _local2 = (_arg1) ? Button(_arg1) : null; if (_local2 != _defaultButton){ if (_defaultButton){ _defaultButton.emphasized = false; }; if (defButton){ defButton.emphasized = false; }; _defaultButton = _local2; defButton = _local2; if (_local2){ _local2.emphasized = true; }; }; } private function deactivateHandler(_arg1:Event):void{ var _local2:InteractiveObject; _local2 = InteractiveObject(_arg1.target); } public function setFocus(_arg1:InteractiveObject):void{ if ((_arg1 is IFocusManagerComponent)){ IFocusManagerComponent(_arg1).setFocus(); } else { form.stage.focus = _arg1; }; } private function setFocusToNextObject(_arg1:FocusEvent):void{ var _local2:InteractiveObject; if (!hasFocusableObjects()){ return; }; _local2 = getNextFocusManagerComponent(_arg1.shiftKey); if (_local2){ setFocus(_local2); }; } private function hasFocusableObjects():Boolean{ var _local1:Object; for (_local1 in focusableObjects) { return (true); }; return (false); } private function tabIndexChangeHandler(_arg1:Event):void{ calculateCandidates = true; } private function sortFocusableObjects():void{ var _local1:Object; var _local2:InteractiveObject; focusableCandidates = []; for (_local1 in focusableObjects) { _local2 = InteractiveObject(_local1); if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){ sortFocusableObjectsTabIndex(); return; }; focusableCandidates.push(_local2); }; focusableCandidates.sort(sortByDepth); } private function keyFocusChangeHandler(_arg1:FocusEvent):void{ showFocusIndicator = true; if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){ setFocusToNextObject(_arg1); _arg1.preventDefault(); }; } private function getIndexOfFocusedObject(_arg1:DisplayObject):int{ var _local2:int; var _local3:int; _local2 = focusableCandidates.length; _local3 = 0; _local3 = 0; while (_local3 < _local2) { if (focusableCandidates[_local3] == _arg1){ return (_local3); }; _local3++; }; return (-1); } public function hideFocus():void{ } private function removedHandler(_arg1:Event):void{ var _local2:int; var _local3:DisplayObject; var _local4:InteractiveObject; _local3 = DisplayObject(_arg1.target); if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){ if (_local3 == lastFocus){ IFocusManagerComponent(lastFocus).drawFocus(false); lastFocus = null; }; _local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler); delete focusableObjects[_local3]; calculateCandidates = true; } else { if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){ _local4 = (_local3 as InteractiveObject); if (_local4){ if (_local4 == lastFocus){ lastFocus = null; }; delete focusableObjects[_local4]; calculateCandidates = true; }; _local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler); }; }; removeFocusables(_local3); } private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{ var _local3:String; var _local4:String; var _local5:int; var _local6:String; var _local7:String; var _local8:String; var _local9:DisplayObject; var _local10:DisplayObject; _local3 = ""; _local4 = ""; _local8 = "0000"; _local9 = DisplayObject(_arg1); _local10 = DisplayObject(_arg2); while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) { _local5 = getChildIndex(_local9.parent, _local9); _local6 = _local5.toString(16); if (_local6.length < 4){ _local7 = (_local8.substring(0, (4 - _local6.length)) + _local6); }; _local3 = (_local7 + _local3); _local9 = _local9.parent; }; while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) { _local5 = getChildIndex(_local10.parent, _local10); _local6 = _local5.toString(16); if (_local6.length < 4){ _local7 = (_local8.substring(0, (4 - _local6.length)) + _local6); }; _local4 = (_local7 + _local4); _local10 = _local10.parent; }; return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0); } public function get defaultButton():Button{ return (_defaultButton); } private function activateHandler(_arg1:Event):void{ var _local2:InteractiveObject; _local2 = InteractiveObject(_arg1.target); if (lastFocus){ if ((lastFocus is IFocusManagerComponent)){ IFocusManagerComponent(lastFocus).setFocus(); } else { form.stage.focus = lastFocus; }; }; lastAction = "ACTIVATE"; } public function showFocus():void{ } public function set defaultButtonEnabled(_arg1:Boolean):void{ _defaultButtonEnabled = _arg1; } public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{ var _local2:DisplayObject; var _local3:String; var _local4:int; var _local5:Boolean; var _local6:int; var _local7:int; var _local8:IFocusManagerGroup; if (!hasFocusableObjects()){ return (null); }; if (calculateCandidates){ sortFocusableObjects(); calculateCandidates = false; }; _local2 = form.stage.focus; _local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2))); _local3 = ""; if ((_local2 is IFocusManagerGroup)){ _local8 = IFocusManagerGroup(_local2); _local3 = _local8.groupName; }; _local4 = getIndexOfFocusedObject(_local2); _local5 = false; _local6 = _local4; if (_local4 == -1){ if (_arg1){ _local4 = focusableCandidates.length; }; _local5 = true; }; _local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3); return (findFocusManagerComponent(focusableCandidates[_local7])); } private function mouseDownHandler(_arg1:MouseEvent):void{ var _local2:InteractiveObject; if (_arg1.isDefaultPrevented()){ return; }; _local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target)); if (!_local2){ return; }; showFocusIndicator = false; if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){ setFocus(_local2); }; lastAction = "MOUSEDOWN"; } private function isTabVisible(_arg1:DisplayObject):Boolean{ var _local2:DisplayObjectContainer; _local2 = _arg1.parent; while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) { if (!_local2.tabChildren){ return (false); }; _local2 = _local2.parent; }; return (true); } public function get nextTabIndex():int{ return (0); } private function keyDownHandler(_arg1:KeyboardEvent):void{ if (_arg1.keyCode == Keyboard.TAB){ lastAction = "KEY"; if (calculateCandidates){ sortFocusableObjects(); calculateCandidates = false; }; }; if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){ sendDefaultButtonEvent(); }; } private function focusInHandler(_arg1:FocusEvent):void{ var _local2:InteractiveObject; var _local3:Button; _local2 = InteractiveObject(_arg1.target); if (form.contains(_local2)){ lastFocus = findFocusManagerComponent(InteractiveObject(_local2)); if ((lastFocus is Button)){ _local3 = Button(lastFocus); if (defButton){ defButton.emphasized = false; defButton = _local3; _local3.emphasized = true; }; } else { if (((defButton) && (!((defButton == _defaultButton))))){ defButton.emphasized = false; defButton = _defaultButton; _defaultButton.emphasized = true; }; }; }; } private function tabEnabledChangeHandler(_arg1:Event):void{ var _local2:InteractiveObject; var _local3:Boolean; calculateCandidates = true; _local2 = InteractiveObject(_arg1.target); _local3 = (focusableObjects[_local2] == true); if (_local2.tabEnabled){ if (((!(_local3)) && (isTabVisible(_local2)))){ if (!(_local2 is IFocusManagerComponent)){ _local2.focusRect = false; }; focusableObjects[_local2] = true; }; } else { if (_local3){ delete focusableObjects[_local2]; }; }; } public function set showFocusIndicator(_arg1:Boolean):void{ _showFocusIndicator = _arg1; } public function get form():DisplayObjectContainer{ return (_form); } private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{ return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2)); } public function activate():void{ if (activated){ return; }; form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true); form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true); form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true); form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true); form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true); form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true); form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true); activated = true; if (lastFocus){ setFocus(lastFocus); }; } public function deactivate():void{ form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler); form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler); form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true); form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true); form.stage.removeEventListener(Event.ACTIVATE, activateHandler); form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler); form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true); activated = false; } public function get defaultButtonEnabled():Boolean{ return (_defaultButtonEnabled); } } }//package fl.managers
Section 86
//IFocusManager (fl.managers.IFocusManager) package fl.managers { import fl.controls.*; import flash.display.*; public interface IFocusManager { function getFocus():InteractiveObject; function deactivate():void; function set defaultButton(_arg1:Button):void; function set showFocusIndicator(_arg1:Boolean):void; function get defaultButtonEnabled():Boolean; function get nextTabIndex():int; function get defaultButton():Button; function get showFocusIndicator():Boolean; function setFocus(_arg1:InteractiveObject):void; function activate():void; function showFocus():void; function set defaultButtonEnabled(_arg1:Boolean):void; function hideFocus():void; function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject; function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject; } }//package fl.managers
Section 87
//IFocusManagerComponent (fl.managers.IFocusManagerComponent) package fl.managers { public interface IFocusManagerComponent { function set focusEnabled(_arg1:Boolean):void; function drawFocus(_arg1:Boolean):void; function setFocus():void; function get focusEnabled():Boolean; function get tabEnabled():Boolean; function get tabIndex():int; function get mouseFocusEnabled():Boolean; } }//package fl.managers
Section 88
//IFocusManagerGroup (fl.managers.IFocusManagerGroup) package fl.managers { public interface IFocusManagerGroup { function set groupName(_arg1:String):void; function set selected(_arg1:Boolean):void; function get groupName():String; function get selected():Boolean; } }//package fl.managers
Section 89
//StyleManager (fl.managers.StyleManager) package fl.managers { import fl.core.*; import flash.utils.*; import flash.text.*; public class StyleManager { private var globalStyles:Object; private var classToDefaultStylesDict:Dictionary; private var styleToClassesHash:Object; private var classToStylesDict:Dictionary; private var classToInstancesDict:Dictionary; private static var _instance:StyleManager; public function StyleManager(){ styleToClassesHash = {}; classToInstancesDict = new Dictionary(true); classToStylesDict = new Dictionary(true); classToDefaultStylesDict = new Dictionary(true); globalStyles = UIComponent.getStyleDefinition(); } public static function clearComponentStyle(_arg1:Object, _arg2:String):void{ var _local3:Class; var _local4:Object; _local3 = getClassDef(_arg1); _local4 = getInstance().classToStylesDict[_local3]; if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){ delete _local4[_arg2]; invalidateComponentStyle(_local3, _arg2); }; } private static function getClassDef(_arg1:Object):Class{ var component = _arg1; if ((component is Class)){ return ((component as Class)); }; try { return ((getDefinitionByName(getQualifiedClassName(component)) as Class)); } catch(e:Error) { if ((component is UIComponent)){ try { return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class)); } catch(e:Error) { }; }; }; return (null); } public static function clearStyle(_arg1:String):void{ setStyle(_arg1, null); } public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{ var _local4:Class; var _local5:Object; _local4 = getClassDef(_arg1); _local5 = getInstance().classToStylesDict[_local4]; if (_local5 == null){ _local5 = (getInstance().classToStylesDict[_local4] = {}); }; if (_local5 == _arg3){ return; }; _local5[_arg2] = _arg3; invalidateComponentStyle(_local4, _arg2); } private static function setSharedStyles(_arg1:UIComponent):void{ var _local2:StyleManager; var _local3:Class; var _local4:Object; var _local5:String; _local2 = getInstance(); _local3 = getClassDef(_arg1); _local4 = _local2.classToDefaultStylesDict[_local3]; for (_local5 in _local4) { _arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5)); }; } public static function getComponentStyle(_arg1:Object, _arg2:String):Object{ var _local3:Class; var _local4:Object; _local3 = getClassDef(_arg1); _local4 = getInstance().classToStylesDict[_local3]; return (((_local4)==null) ? null : _local4[_arg2]); } private static function getInstance(){ if (_instance == null){ _instance = new (StyleManager); }; return (_instance); } private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{ var _local3:Dictionary; var _local4:Object; var _local5:UIComponent; _local3 = getInstance().classToInstancesDict[_arg1]; if (_local3 == null){ return; }; for (_local4 in _local3) { _local5 = (_local4 as UIComponent); if (_local5 == null){ } else { _local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2)); }; }; } private static function invalidateStyle(_arg1:String):void{ var _local2:Dictionary; var _local3:Object; _local2 = getInstance().styleToClassesHash[_arg1]; if (_local2 == null){ return; }; for (_local3 in _local2) { invalidateComponentStyle(Class(_local3), _arg1); }; } public static function registerInstance(_arg1:UIComponent):void{ var inst:StyleManager; var classDef:Class; var target:Class; var defaultStyles:Object; var styleToClasses:Object; var n:String; var instance = _arg1; inst = getInstance(); classDef = getClassDef(instance); if (classDef == null){ return; }; if (inst.classToInstancesDict[classDef] == null){ inst.classToInstancesDict[classDef] = new Dictionary(true); target = classDef; while (defaultStyles == null) { if (target["getStyleDefinition"] != null){ defaultStyles = target["getStyleDefinition"](); break; }; try { target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class); } catch(err:Error) { try { target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class); } catch(e:Error) { defaultStyles = UIComponent.getStyleDefinition(); break; }; }; }; styleToClasses = inst.styleToClassesHash; for (n in defaultStyles) { if (styleToClasses[n] == null){ styleToClasses[n] = new Dictionary(true); }; styleToClasses[n][classDef] = true; }; inst.classToDefaultStylesDict[classDef] = defaultStyles; inst.classToStylesDict[classDef] = {}; }; inst.classToInstancesDict[classDef][instance] = true; setSharedStyles(instance); } public static function getStyle(_arg1:String):Object{ return (getInstance().globalStyles[_arg1]); } private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{ var _local3:Class; var _local4:StyleManager; var _local5:Object; _local3 = getClassDef(_arg1); _local4 = getInstance(); _local5 = _local4.classToStylesDict[_local3][_arg2]; if (_local5 != null){ return (_local5); }; _local5 = _local4.globalStyles[_arg2]; if (_local5 != null){ return (_local5); }; return (_local4.classToDefaultStylesDict[_local3][_arg2]); } public static function setStyle(_arg1:String, _arg2:Object):void{ var _local3:Object; _local3 = getInstance().globalStyles; if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){ return; }; _local3[_arg1] = _arg2; invalidateStyle(_arg1); } } }//package fl.managers
Section 90
//Input (General.Input) package General { import flash.display.*; import flash.events.*; public class Input { public static var ascii:Array; private static var keyState:Array; private static var keyArr:Array; private static var keyBuffer:Array; private static var bufferSize:int; public static var lastKey:int = 0; public static var timeSinceLastKey = 0; public static var mouseDown:Boolean = false; public static var mouseReleased:Boolean = false; public static var mousePressed:Boolean = false; public static var mouseOver:Boolean = false; public static var mouseX:Number = 0; public static var mouseY:Number = 0; public static var mouseOffsetX:Number = 0; public static var mouseOffsetY:Number = 0; public static var mouseDragX:Number = 0; public static var mouseDragY:Number = 0; public static var mouse:Sprite = new Sprite(); public static var m_stageMc:Sprite; public function Input(_arg1:Sprite){ m_stageMc = _arg1; ascii = new Array(222); fillAscii(); keyState = new Array(222); keyArr = new Array(); var _local2:int; while (_local2 < 222) { keyState[_local2] = new int(0); if (ascii[_local2] != undefined){ keyArr.push(_local2); }; _local2++; }; bufferSize = 5; keyBuffer = new Array(bufferSize); var _local3:int; while (_local3 < bufferSize) { keyBuffer[_local3] = new Array(0, 0); _local3++; }; _arg1.stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPress, false, 0, true); _arg1.stage.addEventListener(KeyboardEvent.KEY_UP, keyRelease, false, 0, true); _arg1.stage.addEventListener(MouseEvent.MOUSE_DOWN, mousePress, false, 0, true); _arg1.stage.addEventListener(MouseEvent.CLICK, mouseRelease, false, 0, true); _arg1.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove, false, 0, true); _arg1.stage.addEventListener(Event.MOUSE_LEAVE, mouseLeave, false, 0, true); mouse.graphics.lineStyle(0.1, 0, 100); mouse.graphics.moveTo(0, 0); mouse.graphics.lineTo(0, 0.1); } public function mousePress(_arg1:MouseEvent){ mousePressed = true; mouseDown = true; mouseDragX = 0; mouseDragY = 0; } public function mouseRelease(_arg1:MouseEvent){ mouseDown = false; mouseReleased = true; } public function mouseLeave(_arg1:Event){ mouseReleased = mouseDown; mouseDown = false; } public function mouseMove(_arg1:MouseEvent){ if (mouseDown != _arg1.buttonDown){ mouseDown = _arg1.buttonDown; mouseReleased = !(_arg1.buttonDown); mousePressed = _arg1.buttonDown; mouseDragX = 0; mouseDragY = 0; }; mouseX = (_arg1.stageX - m_stageMc.x); mouseY = (_arg1.stageY - m_stageMc.y); mouseOffsetX = (mouseX - mouse.x); mouseOffsetY = (mouseY - mouse.y); if (mouseDown){ mouseDragX = (mouseDragX + mouseOffsetX); mouseDragY = (mouseDragY + mouseOffsetY); }; mouse.x = mouseX; mouse.y = mouseY; } public function keyPress(_arg1:KeyboardEvent){ keyState[_arg1.keyCode] = Math.max(keyState[_arg1.keyCode], 1); lastKey = _arg1.keyCode; } public function keyRelease(_arg1:KeyboardEvent){ keyState[_arg1.keyCode] = -1; var _local2:int = (bufferSize - 1); while (_local2 > 0) { keyBuffer[_local2] = keyBuffer[(_local2 - 1)]; _local2--; }; keyBuffer[0] = [_arg1.keyCode, 0]; } private function fillAscii(){ ascii[65] = "A"; ascii[66] = "B"; ascii[67] = "C"; ascii[68] = "D"; ascii[69] = "E"; ascii[70] = "F"; ascii[71] = "G"; ascii[72] = "H"; ascii[73] = "I"; ascii[74] = "J"; ascii[75] = "K"; ascii[76] = "L"; ascii[77] = "M"; ascii[78] = "N"; ascii[79] = "O"; ascii[80] = "P"; ascii[81] = "Q"; ascii[82] = "R"; ascii[83] = "S"; ascii[84] = "T"; ascii[85] = "U"; ascii[86] = "V"; ascii[87] = "W"; ascii[88] = "X"; ascii[89] = "Y"; ascii[90] = "Z"; ascii[48] = "0"; ascii[49] = "1"; ascii[50] = "2"; ascii[51] = "3"; ascii[52] = "4"; ascii[53] = "5"; ascii[54] = "6"; ascii[55] = "7"; ascii[56] = "8"; ascii[57] = "9"; ascii[32] = "Spacebar"; ascii[17] = "Ctrl"; ascii[16] = "Shift"; ascii[192] = "~"; ascii[38] = "up"; ascii[40] = "down"; ascii[37] = "left"; ascii[39] = "right"; ascii[96] = "Numpad 0"; ascii[97] = "Numpad 1"; ascii[98] = "Numpad 2"; ascii[99] = "Numpad 3"; ascii[100] = "Numpad 4"; ascii[101] = "Numpad 5"; ascii[102] = "Numpad 6"; ascii[103] = "Numpad 7"; ascii[104] = "Numpad 8"; ascii[105] = "Numpad 9"; ascii[111] = "Numpad /"; ascii[106] = "Numpad *"; ascii[109] = "Numpad -"; ascii[107] = "Numpad +"; ascii[110] = "Numpad ."; ascii[45] = "Insert"; ascii[46] = "Delete"; ascii[33] = "Page Up"; ascii[34] = "Page Down"; ascii[35] = "End"; ascii[36] = "Home"; ascii[112] = "F1"; ascii[113] = "F2"; ascii[114] = "F3"; ascii[115] = "F4"; ascii[116] = "F5"; ascii[117] = "F6"; ascii[118] = "F7"; ascii[119] = "F8"; ascii[188] = ","; ascii[190] = "."; ascii[186] = ";"; ascii[222] = "'"; ascii[219] = "["; ascii[221] = "]"; ascii[189] = "-"; ascii[187] = "+"; ascii[220] = "\\"; ascii[191] = "/"; ascii[9] = "TAB"; ascii[8] = "Backspace"; } public static function update(){ var _local1:int; while (_local1 < keyArr.length) { if (keyState[keyArr[_local1]] != 0){ var _local3 = keyState; var _local4 = keyArr[_local1]; var _local5 = (_local3[_local4] + 1); _local3[_local4] = _local5; }; _local1++; }; var _local2:int; while (_local2 < bufferSize) { _local3 = keyBuffer[_local2]; _local4 = 1; _local5 = (_local3[_local4] + 1); _local3[_local4] = _local5; _local2++; }; mouseReleased = false; mousePressed = false; mouseOver = false; } public static function getKeyHold(_arg1:int):int{ return (Math.max(0, keyState[_arg1])); } public static function isKeyDown(_arg1:int):Boolean{ return ((keyState[_arg1] > 0)); } public static function isKeyPressed(_arg1:int):Boolean{ timeSinceLastKey = 0; return ((keyState[_arg1] == 1)); } public static function isKeyReleased(_arg1:int):Boolean{ return ((keyState[_arg1] == -1)); } public static function isKeyInBuffer(_arg1:int, _arg2:int, _arg3:int){ return ((((keyBuffer[_arg2][0] == _arg1)) && ((keyBuffer[_arg2][1] <= _arg3)))); } public static function getKeyString(_arg1:uint):String{ return (ascii[_arg1]); } } }//package General
Section 91
//Ball (Ball) package { import flash.events.*; import flash.geom.*; public class Ball extends Particle { public function Ball(_arg1:Point, _arg2:Point, _arg3:int, _arg4:Number){ super(_arg1, _arg2, _arg3, _arg4); x = position.x; y = position.y; scaleX = (scaleY = ((Math.random() * 1) + 0.5)); alpha = ((Math.random() * 1) + 0.5); update_i.addEventListener(TimerEvent.TIMER, setPosition, false, 0, true); } public function setPosition(_arg1:TimerEvent):void{ x = position.x; y = position.y; } } }//package
Section 92
//Base64 (Base64) package { import flash.utils.*; public class Base64 { private static var _b64Chars:Array = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"); private static var _b64Lookup:Object = _buildB64Lookup(); private static var _linebreaks:Boolean; public static function isWhitespace(_arg1:String):Boolean{ switch (_arg1){ case " ": case "\t": case "\r": case "\n": case "\f": return (true); default: return (false); }; } public static function Encode(_arg1:ByteArray, _arg2:Boolean=false):String{ _linebreaks = _arg2; return (_encodeBytes(_arg1)); } public static function Decode(_arg1:String):ByteArray{ return (_decodeSring(_arg1)); } private static function _buildB64Lookup():Object{ var _local1:Object = new Object(); var _local2:Number = 0; while (_local2 < _b64Chars.length) { _local1[_b64Chars[_local2]] = _local2; _local2++; }; return (_local1); } private static function _isBase64(_arg1:String):Boolean{ return (!((_b64Lookup[_arg1] == undefined))); } private static function _encodeBytes(_arg1:ByteArray):String{ var _local3:uint; var _local5:ByteArray; var _local2 = ""; var _local4:uint; _arg1.position = 0; while (_arg1.position < _arg1.length) { _local3 = ((_arg1.bytesAvailable >= 3)) ? 3 : _arg1.bytesAvailable; _local5 = new ByteArray(); _arg1.readBytes(_local5, 0, _local3); _local2 = (_local2 + _b64EncodeBuffer(_local5)); _local4 = (_local4 + 4); if (((_linebreaks) && (((_local4 % 76) == 0)))){ _local2 = (_local2 + "\n"); _local4 = 0; }; }; return (_local2.toString()); } private static function _b64EncodeBuffer(_arg1:ByteArray):String{ var _local2 = ""; _local2 = (_local2 + _b64Chars[(_arg1[0] >> 2)]); switch (_arg1.length){ case 1: _local2 = (_local2 + _b64Chars[((_arg1[0] << 4) & 48)]); _local2 = (_local2 + "=="); break; case 2: _local2 = (_local2 + _b64Chars[(((_arg1[0] << 4) & 48) | (_arg1[1] >> 4))]); _local2 = (_local2 + _b64Chars[((_arg1[1] << 2) & 60)]); _local2 = (_local2 + "="); break; case 3: _local2 = (_local2 + _b64Chars[(((_arg1[0] << 4) & 48) | (_arg1[1] >> 4))]); _local2 = (_local2 + _b64Chars[(((_arg1[1] << 2) & 60) | (_arg1[2] >> 6))]); _local2 = (_local2 + _b64Chars[(_arg1[2] & 63)]); break; default: trace("Base64 byteBuffer outOfRange"); }; return (_local2.toString()); } private static function _decodeSring(_arg1:String):ByteArray{ var _local7:String; var _local2:String = ("" + _arg1); var _local3:ByteArray = new ByteArray(); var _local4 = ""; var _local5:uint = _local2.length; var _local6:uint; while (_local6 < _local5) { _local7 = _local2.charAt(_local6); if (((!(isWhitespace(_local7))) && (((_isBase64(_local7)) || ((_local7 == "=")))))){ _local4 = (_local4 + _local7); if (_local4.length == 4){ _local3.writeBytes(_b64DecodeBuffer(_local4)); _local4 = ""; }; }; _local6++; }; _local3.position = 0; return (_local3); } private static function _b64DecodeBuffer(_arg1:String):ByteArray{ var _local2:ByteArray = new ByteArray(); var _local3:uint = _b64Lookup[_arg1.charAt(0)]; var _local4:uint = _b64Lookup[_arg1.charAt(1)]; var _local5:uint = _b64Lookup[_arg1.charAt(2)]; var _local6:uint = _b64Lookup[_arg1.charAt(3)]; _local2.writeByte(((_local3 << 2) | (_local4 >> 4))); if (_arg1.charAt(2) != "="){ _local2.writeByte(((_local4 << 4) | (_local5 >> 2))); }; if (_arg1.charAt(3) != "="){ _local2.writeByte(((_local5 << 6) | _local6)); }; return (_local2); } } }//package
Section 93
//ColorPicker_backgroundSkin (ColorPicker_backgroundSkin) package { import flash.display.*; public dynamic class ColorPicker_backgroundSkin extends MovieClip { } }//package
Section 94
//ColorPicker_colorWell (ColorPicker_colorWell) package { import flash.display.*; public dynamic class ColorPicker_colorWell extends MovieClip { } }//package
Section 95
//ColorPicker_disabledSkin (ColorPicker_disabledSkin) package { import flash.display.*; public dynamic class ColorPicker_disabledSkin extends MovieClip { } }//package
Section 96
//ColorPicker_downSkin (ColorPicker_downSkin) package { import flash.display.*; public dynamic class ColorPicker_downSkin extends MovieClip { } }//package
Section 97
//ColorPicker_overSkin (ColorPicker_overSkin) package { import flash.display.*; public dynamic class ColorPicker_overSkin extends MovieClip { } }//package
Section 98
//ColorPicker_swatchSelectedSkin (ColorPicker_swatchSelectedSkin) package { import flash.display.*; public dynamic class ColorPicker_swatchSelectedSkin extends MovieClip { } }//package
Section 99
//ColorPicker_swatchSkin (ColorPicker_swatchSkin) package { import flash.display.*; public dynamic class ColorPicker_swatchSkin extends Sprite { } }//package
Section 100
//ColorPicker_textFieldSkin (ColorPicker_textFieldSkin) package { import flash.display.*; public dynamic class ColorPicker_textFieldSkin extends MovieClip { } }//package
Section 101
//ColorPicker_upSkin (ColorPicker_upSkin) package { import flash.display.*; public dynamic class ColorPicker_upSkin extends MovieClip { } }//package
Section 102
//Console (Console) package { import flash.display.*; import flash.events.*; import flash.utils.*; import flash.text.*; import flash.net.*; import flash.ui.*; public class Console extends Sprite { private var _openKey:int; private var _executeKey:int; private var _prevHistoryKey:int; private var _nextHistoryKey:int; private var _commandHistory:Array; private var _historyMax:Number; private var _showing:Boolean; private var _currHistoryIndex:int; private var _numCommandsInHistory:Number; private var _commandDelegates:Dictionary; private var _shared:SharedObject; public static var _inputField:TextField; public function Console(_arg1:int){ addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); _shared = SharedObject.getLocal("history"); _openKey = _arg1; _executeKey = Keyboard.ENTER; _prevHistoryKey = Keyboard.UP; _nextHistoryKey = Keyboard.DOWN; _historyMax = 20; _showing = false; _currHistoryIndex = 0; _numCommandsInHistory = 0; if (_shared.data.history){ _commandHistory = (_shared.data.history as Array); _numCommandsInHistory = _commandHistory.length; } else { _commandHistory = new Array(); _shared.data.history = _commandHistory; }; _commandDelegates = new Dictionary(); _inputField = (addChild(new TextField()) as TextField); _inputField.type = TextFieldType.INPUT; _inputField.addEventListener(FocusEvent.FOCUS_OUT, onConsoleFocusOut); _inputField.defaultTextFormat = new TextFormat("Arial", 14, 0xFFFFFF, false, false, false); makeConsoleInvisible(); } public function clearStoredHistory():void{ _shared.clear(); } public function addCommand(_arg1:String, _arg2:Function):void{ _commandDelegates[_arg1] = _arg2; } public function addCommandToHistory(_arg1:String):void{ var _local2:int = _commandHistory.indexOf(_arg1); if (_local2 != -1){ _commandHistory.splice(_local2, 1); _numCommandsInHistory--; }; _commandHistory.push(_arg1); _numCommandsInHistory++; if (_commandHistory.length > _historyMax){ _commandHistory.shift(); _numCommandsInHistory--; }; _shared.flush(); } public function getPreviousHistoryCommand():String{ if (_currHistoryIndex > 0){ _currHistoryIndex--; }; return (getCurrentCommand()); } public function getNextHistoryCommand():String{ if (_currHistoryIndex < _numCommandsInHistory){ _currHistoryIndex++; }; return (getCurrentCommand()); } public function getCurrentCommand():String{ var _local1:String = _commandHistory[_currHistoryIndex]; if (!_local1){ return (""); }; return (_local1); } public function toggleConsole():void{ if (_showing){ hideConsole(); } else { showConsole(); }; } public function showConsole():void{ if (!_showing){ _showing = true; makeConsoleVisible(); stage.focus = _inputField; stage.addEventListener(KeyboardEvent.KEY_UP, onKeyPressInConsole); _currHistoryIndex = _numCommandsInHistory; }; } public function hideConsole():void{ if (_showing){ _showing = false; makeConsoleInvisible(); stage.removeEventListener(KeyboardEvent.KEY_UP, onKeyPressInConsole); }; } public function clearConsole():void{ _inputField.text = ""; } private function onAddedToStage(_arg1:Event):void{ graphics.beginFill(0x666666, 1); graphics.drawRect(0, 0, stage.stageWidth, 25); graphics.endFill(); _inputField.width = stage.stageWidth; _inputField.y = 4; _inputField.x = 4; _inputField.name = "console"; stage.addEventListener(KeyboardEvent.KEY_UP, onToggleKeyPress); } private function onConsoleFocusOut(_arg1:FocusEvent):void{ } private function onToggleKeyPress(_arg1:KeyboardEvent):void{ if (_arg1.keyCode == _openKey){ toggleConsole(); }; } private function onKeyPressInConsole(_arg1:KeyboardEvent):void{ var args:Array; var command:String; var func:Function; var expected:Number; var event = _arg1; if (event.keyCode == _executeKey){ if ((((_inputField.text == "")) || ((_inputField.text == " ")))){ return; }; addCommandToHistory(_inputField.text); args = _inputField.text.split(" "); command = args.shift(); clearConsole(); func = _commandDelegates[command]; if (_commandDelegates[command] == undefined){ _inputField.text = ("Unknown command: " + command); }; if (func != null){ try { func.apply(this, args); } catch(e:ArgumentError) { expected = Number(e.message.slice((e.message.indexOf("Expected ") + 9), e.message.lastIndexOf(","))); trace(expected); _inputField.text = ((expected + " parameters required for function: ") + command); }; }; } else { if (event.keyCode == _prevHistoryKey){ _inputField.text = getPreviousHistoryCommand(); event.preventDefault(); _inputField.setSelection(_inputField.text.length, _inputField.text.length); } else { if (event.keyCode == _nextHistoryKey){ _inputField.text = getNextHistoryCommand(); event.preventDefault(); _inputField.setSelection(_inputField.text.length, _inputField.text.length); }; }; }; } public function setConsoleText(_arg1:String):void{ _inputField.text = _arg1; } private function makeConsoleVisible():void{ this.visible = true; } private function makeConsoleInvisible():void{ this.visible = false; } } }//package
Section 103
//help (help) package { import flash.display.*; public dynamic class help extends MovieClip { } }//package
Section 104
//horizontalSliderManager (horizontalSliderManager) package { import flash.display.*; import flash.events.*; import flash.geom.*; import flash.text.*; public class horizontalSliderManager extends MovieClip { public var currentValue:Number; private var dragRect:Rectangle; private var holder:MovieClip; private var sliderBar:MovieClip; private var sliderControl:MovieClip; private var snapping:int; private var barSteps:int; private var textBox:TextField; public function horizontalSliderManager(){ dragRect = new Rectangle(); super(); } public function setupSlider(_arg1:MovieClip, _arg2:MovieClip, _arg3:MovieClip, _arg4:int=25, _arg5:int=0, _arg6:TextField=null){ holder = _arg1; sliderBar = _arg2; sliderControl = _arg3; sliderControl.buttonMode = true; textBox = _arg6; snapping = _arg4; barSteps = Math.round((sliderBar.width / snapping)); if ((_arg5 * barSteps) > sliderBar.width){ _arg5 = snapping; }; dragRect.x = sliderBar.x; dragRect.y = sliderBar.y; dragRect.width = sliderBar.width; dragRect.height = 0; sliderControl.y = dragRect.y; sliderControl.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); holder.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); sliderControl.x = ((barSteps * _arg5) + dragRect.x); currentValue = Math.round(((sliderControl.x - sliderBar.x) / barSteps)); updateText(); } private function updateText():void{ var _local1:int; if (textBox != null){ _local1 = Math.round(((sliderControl.x - sliderBar.x) / barSteps)); textBox.text = ("" + _local1); }; } private function mouseDownHandler(_arg1:MouseEvent):void{ sliderControl.startDrag(false, dragRect); holder.addEventListener(MouseEvent.MOUSE_MOVE, sliderMovesHandler); } private function sliderMovesHandler(_arg1:MouseEvent):void{ currentValue = Math.round(((sliderControl.x - sliderBar.x) / barSteps)); holder.dispatchEvent(new SliderEvent(SliderEvent.SLIDER_UPDATED, true)); updateText(); } private function mouseUpHandler(_arg1:MouseEvent):void{ holder.dispatchEvent(new SliderEvent(SliderEvent.SLIDER_UPDATED, true)); var _local2:int = Math.round(((sliderControl.x - sliderBar.x) / barSteps)); sliderControl.x = ((_local2 * barSteps) + dragRect.x); holder.removeEventListener(MouseEvent.MOUSE_MOVE, sliderMovesHandler); holder.removeEventListener(MouseEvent.MOUSE_MOVE, mouseUpHandler); stopDrag(); } } }//package
Section 105
//Main (Main) package { import fl.controls.*; import flash.display.*; import Box2D.Common.Math.*; import flash.events.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import flash.utils.*; import Box2D.Dynamics.Contacts.*; import flash.geom.*; import flash.text.*; import General.*; import fl.events.*; import flash.net.*; import flash.media.*; import flash.ui.*; import flash.system.*; import flash.errors.*; public class Main extends MovieClip { public const b2_maxPolygonVertices:int = 8; public var preloader:MovieClip; public var console:Console; public var m_input:Input; public var m_sprite:Sprite; public var m_world:b2World; public var dbgDraw:b2DebugDraw; public var speed:Number;// = 1 public var timerSpeed:Number;// = 1 public var m_phys_scale:Number;// = 25 public var m_physScale:Number;// = 15 public var m_iterations:int;// = 50 public var m_timeStep:Number;// = 0.0333333333333333 public var slomoOn:Boolean;// = false public var paused:Boolean;// = false public var infoText:TextField; public var drawing:Boolean;// = false public var ctrldown:Boolean;// = false public var drawingWall:Boolean;// = false public var DrawingCustomShape:Boolean;// = false public var customObjArray:Array; public var pixel_dist:int;// = 20 public var pixel_dist2:int;// = 20 public var points_array:Array; public var saved_x:int; public var saved_y:int; public var background:MovieClip; public var canvas:Sprite; public var joints:Sprite; public var blood:Sprite; public var sp:Sprite; public var InterfaceTOP:MovieClip; public var Interface:MovieClip; public var saveMenu:MovieClip; public var keyhelp:MovieClip; public var debugAlpha;// = 0.3 public var debugLine;// = 0.1 public var debugR;// = 130 public var debugG;// = 130 public var debugB;// = 130 public var bgPicker:ColorPicker; public var objPicker:ColorPicker; public var shirtPicker:ColorPicker; public var pantsPicker:ColorPicker; public var bloodPicker:ColorPicker; public var staticPicker:ColorPicker; public var colourPickerOpen:Boolean;// = false public var bgTransform:ColorTransform; public var debugColour:Array; public var grinch;// = 0 public var head:b2Body; public var madeby:String; public var jointbody:b2Body; public var jointpoint:b2Vec2; public var magnetNumber:Number;// = 0 public var explosion:Boolean;// = false public var onlyCutBreakable:Boolean;// = false public var multipleSelected:Boolean;// = false public var pauseMoving;// = false public var pauseMovingPos:b2Vec2; public var pauseMovingBody:b2Body; public var pauseMovingBodies:Array; public var particleGravity:Number;// = 1.05 public var particleFriction:Number;// = 0.99 public var menuJustToggled;// = false public var waterTimer:Timer; public var slomotimer:Timer; public var speedtimer:Timer; public var slowdownfor:Number;// = 0 public var lineTimer:Timer; public var cutArray:Array; public var cutEverythingArray:Array; public var shitArray:Array; public var killArray:Array; public var jointArray:Array; public var magnetArray:Array; public var cannonArray:Array; public var savejointArray:Array; public var keyArray:Array; public var waterArray:Array; var sta:Array; var mag:Array; var squ:Array; var flo:Array; var rag:Array; var oct:Array; var des:Array; var til:Array; var exp:Array; var gea:Array; var ham:Array; var swo:Array; var cha:Array; var wea:Array; var joi:Array; var roc:Array; var tra:Array; var wal:Array; var cir:Array; var rea:Array; var allObjects:Array; public var limitbodies:Boolean; public var GlobalDamping:Number;// = 0 public var spawning:Boolean;// = false public var spawnType:String; public var spawnInit:Point; public var togglePause:int;// = 0 public var toggleSlomo:int;// = 0 public var toggleRagdollBreak:int;// = 1 public var toggleLines:int;// = 1 public var toggleSpawn:int;// = 0 public var toggleStabi:int;// = 0 public var toggleJointBreak:int;// = 1 public var lagMod;// = 1 public var toneSlider:horizontalSliderManager; public var alphaSlider:horizontalSliderManager; public var lineSlider:horizontalSliderManager; public var playingSlice:Boolean;// = false public var playingTouch:Boolean;// = false public var myChannel:SoundChannel; public var sTransform:SoundTransform; public var KeyReset;// = 82 public var KeyDrawWall;// = 78 public var KeyDrawObj;// = 77 public var KeyWall;// = 75 public var KeyCut;// = 17 public var KeyRandomCut;// = 87 public var KeyMouseCut;// = 81 public var KeyGridCut;// = 69 public var KeyExplosion;// = 88 public var KeySquare;// = 65 public var KeyAnnihilator;// = 84 public var KeyBreakable;// = 83 public var KeyStar;// = 68 public var KeyOctagon;// = 70 public var KeyCircle;// = 71 public var KeyRagdoll;// = 32 public var KeyMultipleSelect;// = 16 public var KeyLaser;// = 35 public var KeySword;// = 74 public var KeyHammer;// = 72 public var KeyBGJoint;// = 73 public var KeyObjJoint;// = 85 public var KeyRopeJoint;// = 89 public var KeyMotorJoint;// = 79 public var KeyChain;// = 76 public var KeyPause;// = 80 public var Keypistol;// = 49 public var Keyshotgun;// = 50 public var Keyassault;// = 51 public var Keym79;// = 52 public var Keysniper;// = 53 public var Keyflamer;// = 54 public var Keyminigun;// = 55 public var Keycannon;// = 56 public var Keyharpoon;// = 57 public var Keymissile;// = 48 public var KeyUp;// = 38 public var KeyDown;// = 40 public var KeyLeft;// = 37 public var KeyRight;// = 39 public var KeyDisableHUD;// = 13 public var KeySave;// = 67 public var KeyLoad;// = 86 public var KeyShare;// = 66 public var KeySaveMenu;// = 27 public var KeyDisableHELP;// = 8 public var HUDstatus;// = 1 public var bulletType:String;// = "None" public var laserOnStage:Boolean;// = false public var pistolOnStage:Boolean;// = false public var shotgunOnStage:Boolean;// = false public var assaultOnStage:Boolean;// = false public var m79OnStage:Boolean;// = false public var sniperOnStage:Boolean;// = false public var flamerOnStage:Boolean;// = false public var minigunOnStage:Boolean;// = false public var cannonOnStage:Boolean;// = false public var harpoonOnStage:Boolean;// = false public var pistolBody:b2Body; public var pistolReady:Boolean;// = false public var pistolReloading:Boolean;// = false public var pistolDirection:String;// = "1" public var shotgunBody:b2Body; public var shotgunReady:Boolean;// = false public var shotgunReloading:Boolean;// = false public var shotgunDirection:String;// = "1" public var assaultBody:b2Body; public var assaultReady:Boolean;// = false public var assaultReloading:Boolean;// = false public var assaultDirection:String;// = "1" public var m79Body:b2Body; public var m79Ready:Boolean;// = false public var m79Reloading:Boolean;// = false public var m79Direction:String;// = "1" public var sniperBody:b2Body; public var sniperReady:Boolean;// = false public var sniperReloading:Boolean;// = false public var sniperDirection:String;// = "1" public var flamerBody:b2Body; public var flamerReady:Boolean;// = false public var flamerReloading:Boolean;// = false public var flamerDirection:String;// = "1" public var minigunBody:b2Body; public var minigunReady:Boolean;// = false public var minigunReloading:Boolean;// = false public var minigunDirection:String;// = "1" public var cannonBody:b2Body; public var cannonReady:Boolean;// = false public var cannonReloading:Boolean;// = false public var cannonDirection:String;// = "1" public var harpoonBody:b2Body; public var harpoonReady:Boolean;// = false public var harpoonReloading:Boolean;// = false public var harpoonDirection:String;// = "1" public var kongregate; public var e_hitCollide;// = 1 public var segment:b2Segment; public var laserBody:b2Body; public var segmentLength:Number;// = 30 public var laserStart:b2Vec2; public var laserDir:b2Vec2; public var laserColor:b2Color; public var max_shapes:Number;// = 64 public var firstClic:Boolean;// = false public var depX:Number; public var depY:Number; public var arrX:Number; public var arrY:Number; public var m_cut;// = null public var m_mouseJoint:b2MouseJoint; private var mousePVec:b2Vec2; public static var instance:Main; public static var mouseXWorldPhys:Number; public static var mouseYWorldPhys:Number; public static var mouseXWorld:Number; public static var mouseYWorld:Number; public function Main(){ var _local7:*; customObjArray = []; background = new MovieClip(); canvas = new Sprite(); joints = new Sprite(); blood = new Sprite(); sp = new Sprite(); bgTransform = new ColorTransform(); debugColour = new Array(((debugB + 1) * (1 / 0x0100)), ((debugG + 1) * (1 / 0x0100)), ((debugR + 1) * (1 / 0x0100))); pauseMovingBodies = []; cutArray = []; cutEverythingArray = []; shitArray = []; killArray = []; jointArray = []; magnetArray = []; cannonArray = []; savejointArray = []; keyArray = []; waterArray = []; sta = []; mag = []; squ = []; flo = []; rag = []; oct = []; des = []; til = []; exp = []; gea = []; ham = []; swo = []; cha = []; wea = []; joi = []; roc = []; tra = []; wal = []; cir = []; rea = []; allObjects = ["squ", "flo", "mag", "sta", "rag", "oct", "des", "exp", "ham", "swo", "cha", "til", "roc", "tra", "wal", "wea", "gea", "cir", "rea"]; myChannel = new SoundChannel(); sTransform = new SoundTransform(0, 0); segment = new b2Segment(); mousePVec = new b2Vec2(); super(); preloader.visible = false; instance = this; m_sprite = new Sprite(); addChild(background); addChild(canvas); canvas.graphics.lineStyle(1, 0xFFFFFF); keyhelp = new help(); addChild(keyhelp); keyhelp.visible = false; addChild(m_sprite); addChild(sp); addChild(blood); addChild(joints); SoundMixer.soundTransform = sTransform; m_input = new Input(m_sprite); var _local1:Sprite = new Sprite(); background.addChild(_local1); _local1.graphics.lineStyle(1, 0xFFFFFF); _local1.graphics.beginFill(0xFFFFFF, 1); _local1.graphics.drawRect(0, 0, 800, 600); _local1.graphics.endFill(); _local1.x = (800 - _local1.width); _local1.y = (600 - _local1.height); bgTransform.color = 0; background.transform.colorTransform = bgTransform; stage.addEventListener(Event.ENTER_FRAME, update, false, 0, true); stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKeys); stage.addEventListener(KeyboardEvent.KEY_UP, keyUps); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpEvent); stage.addEventListener(MouseEvent.MOUSE_MOVE, mouse_moved); stage.addEventListener(MouseEvent.MOUSE_DOWN, mouse_pressed); stage.addEventListener(Event.ACTIVATE, setfocus); var _local2:SharedObject = SharedObject.getLocal("mutilate-a-doll"); var _local3:* = "display_the_tutorial"; if (_local2.data.convertedname != null){ if (_local2.data.convertedname > 0){ _local2.data.convertedname = (int(_local2.data.convertedname) - 1); _local2.flush(); }; } else { _local2.data.convertedname = 2; _local2.flush(); }; infoText = new TextField(); infoText.width = 720; infoText.height = 540; infoText.wordWrap = true; infoText.defaultTextFormat = new TextFormat("Arial", 16, 0x666666, true, false, false, "", "", "center"); if (_local2.data.convertedname > 0){ infoText.text = "\n\nThis quick tutorial will be displayed twice on startup, then it will stop pestering you.\nI suggest reading it.\n\nFirst, press enter for a list of hotkeys.\nUse those keys to spawn objects on mouse coordinates. Some of those objects are also on the menu below, you can drag and drop items from there to stage.\n\nThere's also a menu on top, you can use it to change colour settings.\n\nEsc for save menu, where you can save your levels for personal use, \nor share them with other Kongregate users.\n\nRead the instructions and helps for more detailed info.\nClose the tutorial by spawning a ragdoll with Space.\n\nHave fun."; } else { infoText.text = ""; }; addChild(infoText); infoText.selectable = false; infoText.x = 30; infoText.y = 30; _local2.close(); var _local4:b2AABB = new b2AABB(); _local4.lowerBound.Set(-1000, -1000); _local4.upperBound.Set(1000, 1000); var _local5:b2Vec2 = new b2Vec2(0, 0); var _local6:Boolean; m_world = new b2World(_local4, _local5, _local6); m_world.SetContactListener(new SplitContactListener()); dbgDraw = new b2DebugDraw(); dbgDraw.m_sprite = m_sprite; dbgDraw.m_drawScale = 15; dbgDraw.m_fillAlpha = debugAlpha; dbgDraw.m_lineThickness = debugLine; dbgDraw.SetFlags(b2DebugDraw.e_shapeBit); m_world.SetDebugDraw(dbgDraw); BuildInterface(); CutterTest(); waterArray = [new Point(100, 100), new Point(300, 100), new Point(500, 100), new Point(700, 100), new Point(900, 100), new Point(1100, 100), new Point(1250, 100)]; API(); if (grinch == "disabled"){ spawnChristmas(); _local7 = "eNpVjUEKwjAQRS/0kTRNbUNWxYUo2Ip4gSSIRtJUke5yeGcaNzLM+zzmk4znawUaIQQBBGx+U6xaU+RLvx/sAN60xGhUC72FMKGDbinzqd/9FxImyLcJM16c+TgeZoeQSAnakKhIHYJdJUF9mE1knTzqBpMrzccNtWSu5h3fvEXH1t5RK6Zjk4FNPsuj9LtamE0wX6o4QJE="; loadWorld(null, _local7, 0, 0); }; } private function API():void{ var _local1:Object = LoaderInfo(root.loaderInfo).parameters; var _local2:String = ((_local1.api_path) || ("http://api.kongregate.com/flash/API_AS3_Local.swf")); trace(("API path: " + _local2)); var _local3:URLRequest = new URLRequest(_local2); var _local4:Loader = new Loader(); _local4.contentLoaderInfo.addEventListener(Event.COMPLETE, onApiLoaded); _local4.load(_local3); this.addChild(_local4); } public function onApiLoaded(_arg1:Event):void{ kongregate = _arg1.target.content; kongregate.sharedContent.addLoadListener("Level", onLoadLevel); kongregate.services.connect(); trace(("\n" + kongregate.services)); trace(("\n" + kongregate.user)); trace(("\n" + kongregate.scores)); trace(("\n" + kongregate.stats)); } private function saveTutorial(_arg1:Event):void{ if (saveMenu.tutorial.visible == false){ saveMenu.savetext.text = (((((((((((((((((((((((((((("How to save and share:" + "\n") + "1. Make something wonderful.") + "\n") + "2. Press [Save]") + "\n") + "3. Select all of the text in this textfield and copy it OR press [Copy] to do that.") + "\n") + "4a. Paste it somewhere (chat, comments, forums...), and tell them how to use it.") + "\n") + "4b. [Share] it with Kongregate's Content Share") + "\n") + "4c. Store for later use.") + "\n") + "") + "\n") + "How to load:") + "\n") + "1. You receive a very spammy-looking line. It's an encoded save.") + "\n") + "2. Paste it in this box (after erasing all of this tutorial text)") + "\n") + "3. Press [Load]") + "\n") + "4. If you don't see an error-message in this box, the load was successfull.") + "\n") + "5. Press Done") + "\n") + "6. Unpause (press P) to start the simulation, as worlds are loaded in paused mode."); saveMenu.tutorial.visible = true; } else { saveMenu.savetext.text = ""; saveMenu.tutorial.visible = false; }; } private function shareContent(_arg1:Event):void{ saveWorld(_arg1); saveMenu.visible = false; var _local2:* = saveMenu.savetext.text; kongregate.sharedContent.save("Level", _local2, onSavedContent); } private function saveContent(_arg1:Event):void{ saveMenu.visible = false; var _local2:* = saveMenu.savetext.text; kongregate.sharedContent.save("Level", _local2, onSavedContent); } private function loadContent(_arg1:Event):void{ saveMenu.visible = false; kongregate.sharedContent.browse("Level"); } function onLoadLevel(_arg1:Object){ var _local2:Number = _arg1.id; var _local3:String = _arg1.name; var _local4:String = _arg1.permalink; var _local5:String = _arg1.content; var _local6:String = _arg1.label; trace(((((("Contraption " + _local2) + " [") + _local6) + "] loaded: ") + _local5)); loadWorld(null, _local5, 1, 1); saveMenu.savetext.text = "Content loaded successfully."; } function onSavedContent(_arg1:Object){ if (_arg1.success){ saveMenu.savetext.text = "Content shared successfully."; trace(((("Content saved, id:" + _arg1.id) + ", name:") + _arg1.name)); } else { saveMenu.savetext.text = "Invalid user content save."; }; } private function spawnChristmas():void{ var _local4:int; var _local13:*; var _local14:*; var _local1:Array = [[[2.9, 54.65], [2.9, 64.75], [-3.55, 64.75], [-3.55, 48.2]], [[2.9, 15.65], [2.9, 35.65], [-3.55, 29.2], [-3.55, 9.2]], [[2.9, -23.35], [2.9, -4.35], [-3.55, -10.8], [-3.55, -29.8]], [[8.45, -46.95], [2.9, -41.4], [-3.35, -44.75], [3.65, -51.75]], [[22.5, -52.85], [14.35, -52.85], [11.7, -59.75], [22.5, -59.8]], [[30.65, -52.85], [33.35, -59.8], [40.6, -52.55], [35.8, -47.7]], [[48.55, -44.55], [48.55, -32.85], [42.1, -32.85], [42.1, -41.4]]]; var _local2:Array = [[[2.9, 35.65], [2.9, 54.65], [-3.55, 48.2], [-3.55, 29.2]], [[2.9, -4.35], [2.9, 15.65], [-3.55, 9.2], [-3.55, -10.8]], [[2.9, -41.4], [2.9, -23.35], [-3.55, -29.8], [-3.55, -44.55], [-3.35, -44.75]], [[11.7, -59.75], [14.35, -52.85], [8.45, -46.95], [3.65, -51.75], [11.65, -59.75]], [[33.35, -59.8], [30.65, -52.85], [22.5, -52.85], [22.5, -59.8]], [[48.55, -44.55], [42.1, -41.4], [35.8, -47.7], [40.6, -52.55]], [[48.55, -25.1], [42.15, -25.1], [42.1, -32.85], [48.55, -32.85]]]; var _local3:Array = [[[2.9, 54.65], [2.9, 64.75], [-3.55, 64.75], [-3.55, 48.2]], [[2.9, 15.65], [2.9, 35.65], [-3.55, 29.2], [-3.55, 9.2]], [[2.9, -23.35], [2.9, -4.35], [-3.55, -10.8], [-3.55, -29.8]], [[8.45, -46.95], [2.9, -41.4], [-3.35, -44.75], [3.65, -51.75]], [[22.5, -52.85], [14.35, -52.85], [11.7, -59.75], [22.5, -59.8]], [[30.65, -52.85], [33.35, -59.8], [40.6, -52.55], [35.8, -47.7]], [[48.55, -44.55], [48.55, -32.85], [42.1, -32.85], [42.1, -41.4]]]; _local4 = 0; while (_local4 < 2) { spawnShit([_local1, _local2, _local3], [1, 1, 1], 1.2, "cane", ((_local4 * 450) + 150), 220, Math.PI, ["disabled"]); _local4++; }; var _local5:Array = [[[36.3, -34.5], [36.3, 35.3], [-33.45, 35.3], [-33.45, -34.5]], [[7.6, -34.5], [7.6, -5.75], [-4.75, -5.75], [-4.75, -34.5]], [[7.6, 6.55], [7.6, 35.3], [-4.75, 35.3], [-4.75, 6.55]], [[-33.45, -5.75], [-4.75, -5.75], [-4.75, 6.55], [-33.45, 6.55]], [[7.6, -5.75], [36.3, -5.75], [36.3, 6.55], [7.6, 6.55]], [[7.6, -5.75], [7.6, 6.55], [-4.75, 6.55], [-4.75, -5.75]]]; var _local6:Array = [[[7.6, -4.15], [20.95, -4.15], [20.95, 19.3], [7.6, 19.3]], [[-5.85, 19.3], [-5.85, -16.05], [7.6, -16.05], [7.6, 19.3]], [[-19.65, -4.15], [-5.85, -4.15], [-5.85, 19.3], [-19.65, 19.3]], [[-5.85, -4.15], [-23.6, -4.15], [-23.6, -16.05], [-5.85, -16.05]], [[24.9, -4.15], [7.6, -4.15], [7.6, -16.05], [24.9, -16.05]], [[1.95, -16.05], [15.7, -29.75], [15.7, -22.2], [4.85, -16.05]], [[-12.45, -23.2], [-11.7, -28.65], [1.95, -16.05], [-0.9, -16.05], [-9.7, -18.55]], [[-0.55, -22.2], [4.9, -23.85], [1.7, -16.35]]]; _local4 = 0; while (_local4 < 10) { if (Math.floor((Math.random() * 2)) == 1){ spawnShit([_local5], [1], ((Math.random() * 1) + 0.5), "gift1", ((_local4 * 80) + 40), 525, 0, ["disabled"]); } else { spawnShit([_local6], [1], ((Math.random() * 1) + 1), "gift2", ((_local4 * 80) + 40), 525, 0, ["disabled"]); }; _local4++; }; var _local7:Array = [[[17.85, 13.25], [22.7, 23.8], [-20.25, 23.8], [-14.7, 13.25]], [[9.95, -15.05], [13.9, -13], [17.85, -6.4], [17.85, 13.25], [-14.7, 13.25], [-14.7, -6.4], [-11, -12.55], [-5.75, -15.05]], [[6, -20.75], [6, -15.05], [-1.5, -15.05], [-1.5, -20.75]]]; var _local8:Array = [[[-13.95, 12.9], [-2.55, 1.5], [9.2, 12.9], [-2.4, 36.05]], [[32.35, 1.35], [9.2, 12.9], [-2.55, 1.5], [9.2, -10.25]], [[-13.95, -9.6], [-13.95, -10.25], [-2.4, -33.4], [9.2, -10.25], [-2.55, 1.5]], [[-13.95, -10.25], [-13.95, -9.6], [-37.1, 1.35]], [[-37.1, 1.35], [-13.95, -9.6], [-2.55, 1.5], [-13.95, 12.9]]]; var _local9:Array = [[[3.6, -13], [3.6, -19.3], [7.1, -24.3], [12.1, -24.3], [28.65, -10.5], [28.65, -3.9], [25, 0.2], [19.4, 0.9]], [[-11.95, -2.45], [-3.9, -10.95], [3.6, -13], [19.4, 0.9], [4.45, 20.25], [-3.9, 20.25], [-16.05, 11.9], [-17.1, 4.9]], [[-3.9, -10.95], [-11.95, -2.45], [-17.1, -5.95], [-15.75, -10.95]]]; var _local10:Array = [[[13.5, 2], [13.5, 14.3], [8.2, 17.85], [-26.7, 17.85], [-29.6, 14.2], [-29.05, 6.1], [-24.2, 2]], [[-13.2, 2], [-11.45, -0.2], [13.5, -0.2], [13.5, 2]], [[13.5, -14.1], [13.5, -0.2], [-11.45, -0.2], [-11.45, -14.1]], [[16.1, -16.6], [13.5, -14.1], [-12.05, -14.1], [-14.25, -17.05], [-14.65, -24.25], [-11.75, -28.05], [12.9, -28.05], [16.1, -24.5]]]; _local4 = 0; while (_local4 < 5) { _local13 = ((158 * _local4) + 80); _local14 = Math.floor((Math.random() * 4)); trace(_local14); if (_local14 == 0){ spawnShit([_local7], [1], 1.3, "stuffer1", _local13, 100, 0, ["disabled"]); } else { if (_local14 == 1){ spawnShit([_local8], [1], 1.3, "stuffer2", _local13, 100, 0, ["disabled"]); } else { if (_local14 == 2){ spawnShit([_local9], [1], 1.3, "stuffer3", _local13, 100, 0, ["disabled"]); } else { if (_local14 == 3){ spawnShit([_local10], [1], 1.3, "stuffer4", _local13, 100, 0, ["disabled"]); }; }; }; }; _local4++; }; var _local11:Array = [[[-21.5, -93.05], [-67.85, -43.45], [-98.05, -55.2], [-54.9, -99.1]], [[-25.1, -34.65], [-67.85, -43.45], [-21.5, -93.05], [0.7, -93.05]], [[-25.1, -34.65], [0.7, -93.05], [25.95, -34.65]], [[0.7, -93.05], [24.05, -93.05], [69.25, -43.45], [25.95, -34.65]], [[69.25, -43.45], [24.05, -93.05], [56.3, -99.1], [99.45, -55.2]], [[-39.45, -155.1], [-13.6, -148.25], [-54.9, -99.1], [-83.3, -108.4]], [[-54.9, -99.1], [-13.6, -148.25], [0.7, -148.25], [-21.5, -93.05]], [[-21.5, -93.05], [0.7, -148.25], [24.05, -93.05]], [[0.7, -148.25], [16.2, -148.25], [56.3, -99.1], [24.05, -93.05]], [[16.2, -148.25], [40.85, -155.1], [84.7, -108.4], [56.3, -99.1]], [[-20.35, -209.95], [-6.85, -207.1], [-39.45, -155.1], [-60.85, -161.95]], [[-13.6, -148.25], [-39.45, -155.1], [-6.85, -207.1], [0.7, -207.1]], [[-13.6, -148.25], [0.7, -207.1], [16.2, -148.25]], [[0.7, -207.1], [8.25, -207.1], [40.85, -155.1], [16.2, -148.25]], [[8.25, -207.1], [21.75, -209.95], [62.25, -161.95], [40.85, -155.1]], [[0.7, -261.35], [-20.35, -209.95], [-33.95, -212.85]], [[0.7, -261.35], [-6.85, -207.1], [-20.35, -209.95]], [[-6.85, -207.1], [0.7, -261.35], [8.25, -207.1]], [[0.7, -261.35], [21.75, -209.95], [8.25, -207.1]], [[0.7, -261.35], [35.35, -212.85], [21.75, -209.95]]]; var _local12:Array = [[[-25.75, -14.15], [26.65, -14.15], [19.2, 30.7], [-17.8, 30.7]], [[6.7, -34.65], [6.7, -14.15], [-5.3, -14.15], [-5.3, -34.65]]]; spawnShit([_local11, _local12], [1, 100], 1.75, "tree", 400, 535, 0, ["disabled"]); } private function setfocus(_arg1:Event):void{ stage.focus = stage; } private function PANIC(_arg1:Event):void{ magnetNumber = 0; magnetArray = []; var _local2:b2Body = m_world.m_bodyList; while (_local2) { destroyBody(_local2); _local2 = _local2.m_next; }; while (blood.numChildren > 0) { blood.removeChildAt(0); }; var _local3:b2AABB = new b2AABB(); _local3.lowerBound.Set(-1000, -1000); _local3.upperBound.Set(1000, 1000); var _local4:b2Vec2 = new b2Vec2(0, 0); var _local5:Boolean; m_world = new b2World(_local3, _local4, _local5); m_world.SetContactListener(new SplitContactListener()); dbgDraw = new b2DebugDraw(); dbgDraw.m_sprite = m_sprite; dbgDraw.m_drawScale = 15; dbgDraw.m_fillAlpha = debugAlpha; dbgDraw.m_lineThickness = debugLine; dbgDraw.SetFlags(b2DebugDraw.e_shapeBit); m_world.SetDebugDraw(dbgDraw); CutterTest(); } private function BuildInterface():void{ Interface = new userInterface(); saveMenu = new savemenu(); addChild(saveMenu); saveMenu.saveIt.addEventListener(MouseEvent.MOUSE_DOWN, saveWorld); saveMenu.loadIt.addEventListener(MouseEvent.MOUSE_DOWN, loadWorld); saveMenu.copyIt.addEventListener(MouseEvent.MOUSE_DOWN, copyToClipboard); saveMenu.doneIt.addEventListener(MouseEvent.MOUSE_DOWN, closeSaveMenu); saveMenu.saveSharedObj.addEventListener(MouseEvent.MOUSE_DOWN, saveSO); saveMenu.loadSharedObj.addEventListener(MouseEvent.MOUSE_DOWN, loadSO); saveMenu.contentSave.addEventListener(MouseEvent.MOUSE_DOWN, saveContent); saveMenu.contentLoad.addEventListener(MouseEvent.MOUSE_DOWN, loadContent); saveMenu.helpthefuckingidiots.addEventListener(MouseEvent.MOUSE_DOWN, saveTutorial); saveMenu.visible = false; saveMenu.tutorial.visible = false; keyhelp.x = 375; keyhelp.y = 85; saveMenu.x = 400; saveMenu.y = 200; Interface.x = 500; Interface.y = 600; keyArray = [KeyReset, KeyDrawWall, KeyDrawObj, KeyCut, KeyRandomCut, KeyMouseCut, KeyGridCut, KeyExplosion, KeySquare, KeyAnnihilator, KeyBreakable, KeyStar, KeyOctagon, KeyCircle, KeyRagdoll]; Interface.KeyMap.text = keyArray; InterfaceTOP = new userInterfaceTOP(); InterfaceTOP.x = 500; InterfaceTOP.y = 0; addChild(Interface); addChild(InterfaceTOP); InterfaceTOP.toggle.addEventListener(MouseEvent.MOUSE_DOWN, interfaceTOPToggle); InterfaceTOP.help.addEventListener(MouseEvent.MOUSE_DOWN, HELPTOP); console = new Console(Keyboard.HOME); console.name = "console"; Interface.addChild(console); console.addCommand("pause", pause); console.addCommand("unpause", unpause); console.addCommand("spawn", spawnConsoleObject); console.addCommand("stack", spawnStack); console.addCommand("reset", reset); console.addCommand("clear", reset); console.addCommand("r", reset); console.addCommand("change", changeVariable); console.addCommand("var", changeVariable); console.addCommand("variable", changeVariable); console.addCommand("toggle", changeToggle); console.addCommand("debug", debugMode); console.x = -500; console.y = -28; console.width = 710; console.height = 100; Interface.tutorial.visible = false; InterfaceTOP.tutorial.visible = false; ToggleFrames(); Interface.panic.addEventListener(MouseEvent.MOUSE_DOWN, PANIC); Interface.help.addEventListener(MouseEvent.MOUSE_DOWN, HELP); Interface.setkeys.addEventListener(MouseEvent.MOUSE_DOWN, confirmKeys); Interface.loadworld.addEventListener(MouseEvent.MOUSE_DOWN, loadWorld); Interface.saveworld.addEventListener(MouseEvent.MOUSE_DOWN, saveWorld); Interface.toggle.addEventListener(MouseEvent.MOUSE_DOWN, interfaceToggle); Interface.spawnstar.addEventListener(MouseEvent.MOUSE_DOWN, interfaceStar); Interface.spawnsquare.addEventListener(MouseEvent.MOUSE_DOWN, interfaceSquare); Interface.spawncircle.addEventListener(MouseEvent.MOUSE_DOWN, interfaceCircle); Interface.spawnmagnet.addEventListener(MouseEvent.MOUSE_DOWN, interfaceMagnet); Interface.spawnoctagon.addEventListener(MouseEvent.MOUSE_DOWN, interfaceOctagon); Interface.spawnragdoll.addEventListener(MouseEvent.MOUSE_DOWN, interfaceRagdoll); Interface.spawnwall.addEventListener(MouseEvent.MOUSE_DOWN, interfaceWall); Interface.spawnhammer.addEventListener(MouseEvent.MOUSE_DOWN, interfaceHammer); Interface.spawnsword.addEventListener(MouseEvent.MOUSE_DOWN, interfaceSword); Interface.spawnchain.addEventListener(MouseEvent.MOUSE_DOWN, interfaceChain); Interface.spawnexplosive.addEventListener(MouseEvent.MOUSE_DOWN, interfaceExplosive); Interface.spawnbreakable.addEventListener(MouseEvent.MOUSE_DOWN, interfaceBreakable); Interface.spawnbreakable2.addEventListener(MouseEvent.MOUSE_DOWN, interfaceBreakable2); Interface.spawntrash.addEventListener(MouseEvent.MOUSE_DOWN, interfaceTrash); Interface.spawngear.addEventListener(MouseEvent.MOUSE_DOWN, interfaceGear); Interface.GlobalToggle_Pause.addEventListener(MouseEvent.MOUSE_DOWN, interfaceTogglePause); Interface.GlobalToggle_Slomo.addEventListener(MouseEvent.MOUSE_DOWN, interfaceToggleSlomo); Interface.GlobalToggle_RagdollBreak.addEventListener(MouseEvent.MOUSE_DOWN, interfaceToggleRagdollBreak); Interface.GlobalToggle_JointBreak.addEventListener(MouseEvent.MOUSE_DOWN, interfaceToggleJointBreak); Interface.GlobalToggle_Lines.addEventListener(MouseEvent.MOUSE_DOWN, interfaceToggleLines); Interface.GlobalToggle_Sound.addEventListener(MouseEvent.MOUSE_DOWN, interfaceToggleSound); Interface.GlobalToggle_Spawn.addEventListener(MouseEvent.MOUSE_DOWN, interfaceToggleSpawn); Interface.GlobalToggle_Stabi.addEventListener(MouseEvent.MOUSE_DOWN, interfaceToggleStabi); objPicker = new ColorPicker(); objPicker.addEventListener(Event.OPEN, toggleColourPicker); objPicker.addEventListener(Event.CLOSE, toggleColourPicker); objPicker.addEventListener(ColorPickerEvent.CHANGE, changeObjColour); objPicker.move(-420, -90); InterfaceTOP.addChild(objPicker); staticPicker = new ColorPicker(); staticPicker.addEventListener(Event.OPEN, toggleColourPicker); staticPicker.addEventListener(Event.CLOSE, toggleColourPicker); staticPicker.addEventListener(ColorPickerEvent.CHANGE, changeStaticColour); staticPicker.move(-340, -90); InterfaceTOP.addChild(staticPicker); bloodPicker = new ColorPicker(); bloodPicker.addEventListener(Event.OPEN, toggleColourPicker); bloodPicker.addEventListener(Event.CLOSE, toggleColourPicker); bloodPicker.addEventListener(ColorPickerEvent.CHANGE, changeBloodColour); bloodPicker.move(-340, -70); InterfaceTOP.addChild(bloodPicker); bgPicker = new ColorPicker(); bgPicker.addEventListener(Event.OPEN, toggleColourPicker); bgPicker.addEventListener(Event.CLOSE, toggleColourPicker); bgPicker.addEventListener(ColorPickerEvent.CHANGE, changeBgColour); bgPicker.move(-420, -70); InterfaceTOP.addChild(bgPicker); shirtPicker = new ColorPicker(); shirtPicker.addEventListener(Event.OPEN, toggleColourPicker); shirtPicker.addEventListener(Event.CLOSE, toggleColourPicker); shirtPicker.addEventListener(ColorPickerEvent.CHANGE, changeShirtColour); shirtPicker.move(-420, -50); InterfaceTOP.addChild(shirtPicker); pantsPicker = new ColorPicker(); pantsPicker.addEventListener(Event.OPEN, toggleColourPicker); pantsPicker.addEventListener(Event.CLOSE, toggleColourPicker); pantsPicker.addEventListener(ColorPickerEvent.CHANGE, changePantsColour); pantsPicker.move(-420, -30); InterfaceTOP.addChild(pantsPicker); toneSlider = new horizontalSliderManager(); toneSlider.setupSlider(this, InterfaceTOP.sliderTone, InterfaceTOP.knobTone, 100, 50); alphaSlider = new horizontalSliderManager(); alphaSlider.setupSlider(this, InterfaceTOP.sliderAlpha, InterfaceTOP.knobAlpha, 100, 30); lineSlider = new horizontalSliderManager(); lineSlider.setupSlider(this, InterfaceTOP.sliderLine, InterfaceTOP.knobLine, 100, 0); addEventListener(SliderEvent.SLIDER_UPDATED, updateSliders); bgPicker.selectedColor = uint("0x000000"); objPicker.selectedColor = uint("0x777777"); staticPicker.selectedColor = uint("0x444444"); shirtPicker.selectedColor = uint("0x777777"); pantsPicker.selectedColor = uint("0x777777"); bloodPicker.selectedColor = uint("0x660000"); b2World.objctColour = new b2Color(((parseInt("77", 16) + 1) * (1 / 0x0100)), ((parseInt("77", 16) + 1) * (1 / 0x0100)), ((parseInt("77", 16) + 1) * (1 / 0x0100))); b2World.bloodColour = new b2Color(((parseInt("00", 16) + 1) * (1 / 0x0100)), ((parseInt("00", 16) + 1) * (1 / 0x0100)), ((parseInt("66", 16) + 1) * (1 / 0x0100))); b2World.pantsColour = new b2Color(((parseInt("77", 16) + 1) * (1 / 0x0100)), ((parseInt("77", 16) + 1) * (1 / 0x0100)), ((parseInt("77", 16) + 1) * (1 / 0x0100))); b2World.shirtColour = new b2Color(((parseInt("77", 16) + 1) * (1 / 0x0100)), ((parseInt("77", 16) + 1) * (1 / 0x0100)), ((parseInt("77", 16) + 1) * (1 / 0x0100))); b2World.statcColour = new b2Color(((parseInt("44", 16) + 1) * (1 / 0x0100)), ((parseInt("44", 16) + 1) * (1 / 0x0100)), ((parseInt("44", 16) + 1) * (1 / 0x0100))); } private function debugMode():void{ m_world.m_debugDraw.AppendFlags((((b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit) | b2DebugDraw.e_coreShapeBit) | b2DebugDraw.e_centerOfMassBit)); } private function HELPTOP(_arg1:Event):void{ if (InterfaceTOP.tutorial.visible == true){ InterfaceTOP.tutorial.visible = false; } else { InterfaceTOP.tutorial.visible = true; }; } private function HELP(_arg1:Event):void{ if (Interface.tutorial.visible == true){ Interface.tutorial.visible = false; } else { Interface.tutorial.visible = true; }; } private function pause(_arg1:Event=null):void{ if (speed != 0){ if (slomoOn){ if (slomotimer.running){ slomotimer.stop(); }; if (speedtimer.running){ speedtimer.stop(); }; }; speed = 0; slomoOn = false; paused = true; infoText.text = "Press P to unpause."; }; } private function unpause(_arg1:Event=null):void{ if (infoText.text == "Press P to unpause."){ infoText.text = ""; }; paused = false; speed = Interface.GlobalField_Time.text; } private function updateSliders(_arg1:SliderEvent):void{ b2World.skinsColour = new b2Color((0.1 + ((0.6 * toneSlider.currentValue) / 100)), (0.1 + ((0.8 * toneSlider.currentValue) / 100)), (0.1 + ((1 * toneSlider.currentValue) / 100))); debugAlpha = (alphaSlider.currentValue / 100); debugLine = (lineSlider.currentValue / 5); dbgDraw.m_fillAlpha = debugAlpha; dbgDraw.m_lineThickness = debugLine; } private function closeSaveMenu(_arg1:Event):void{ saveMenu.visible = false; if ((((togglePause == 1)) && ((speed == 0)))){ unpause(); }; } private function copyToClipboard(_arg1:Event):void{ System.setClipboard(saveMenu.savetext.text); } public function toggleColourPicker(_arg1:Event):void{ if (colourPickerOpen){ colourPickerOpen = false; } else { colourPickerOpen = true; }; } public function changeObjColour(_arg1:Event):void{ debugR = parseInt(String(_arg1.target.hexValue).substr(0, 2), 16); debugG = parseInt(String(_arg1.target.hexValue).substr(2, 2), 16); debugB = parseInt(String(_arg1.target.hexValue).substr(4, 2), 16); b2World.objctColour = new b2Color(((debugB + 1) * (1 / 0x0100)), ((debugG + 1) * (1 / 0x0100)), ((debugR + 1) * (1 / 0x0100))); } public function changeShirtColour(_arg1:Event):void{ debugR = parseInt(String(_arg1.target.hexValue).substr(0, 2), 16); debugG = parseInt(String(_arg1.target.hexValue).substr(2, 2), 16); debugB = parseInt(String(_arg1.target.hexValue).substr(4, 2), 16); b2World.shirtColour = new b2Color(((debugB + 1) * (1 / 0x0100)), ((debugG + 1) * (1 / 0x0100)), ((debugR + 1) * (1 / 0x0100))); } public function changePantsColour(_arg1:Event):void{ debugR = parseInt(String(_arg1.target.hexValue).substr(0, 2), 16); debugG = parseInt(String(_arg1.target.hexValue).substr(2, 2), 16); debugB = parseInt(String(_arg1.target.hexValue).substr(4, 2), 16); b2World.pantsColour = new b2Color(((debugB + 1) * (1 / 0x0100)), ((debugG + 1) * (1 / 0x0100)), ((debugR + 1) * (1 / 0x0100))); } public function changeStaticColour(_arg1:Event):void{ debugR = parseInt(String(_arg1.target.hexValue).substr(0, 2), 16); debugG = parseInt(String(_arg1.target.hexValue).substr(2, 2), 16); debugB = parseInt(String(_arg1.target.hexValue).substr(4, 2), 16); b2World.statcColour = new b2Color(((debugB + 1) * (1 / 0x0100)), ((debugG + 1) * (1 / 0x0100)), ((debugR + 1) * (1 / 0x0100))); } public function changeBloodColour(_arg1:Event):void{ debugR = parseInt(String(_arg1.target.hexValue).substr(0, 2), 16); debugG = parseInt(String(_arg1.target.hexValue).substr(2, 2), 16); debugB = parseInt(String(_arg1.target.hexValue).substr(4, 2), 16); b2World.bloodColour = new b2Color(((debugB + 1) * (1 / 0x0100)), ((debugG + 1) * (1 / 0x0100)), ((debugR + 1) * (1 / 0x0100))); } public function changeBgColour(_arg1:Event):void{ bgTransform.color = uint(("0x" + _arg1.target.hexValue)); background.transform.colorTransform = bgTransform; } function saveSO(_arg1:Event):void{ var _local3:*; var _local2:SharedObject = SharedObject.getLocal("mutilate-a-doll"); if (saveMenu.nameSO.text == ""){ saveMenu.nameSO.text = "Insert a name."; }; if (saveMenu.savetext.text == ""){ saveWorld(_arg1); }; if (((!((saveMenu.savetext.text == ""))) && (!((saveMenu.nameSO.text == ""))))){ _local3 = String(saveMenu.nameSO.text).split(" ").join("_"); _local2.data.convertedname = saveMenu.savetext.text; _local2.flush(); }; trace(_local3, _local2.data.convertedname); _local2.close(); } function loadSO(_arg1:Event):void{ var _local3:*; var _local2:SharedObject = SharedObject.getLocal("mutilate-a-doll"); if (saveMenu.nameSO.text == ""){ saveMenu.nameSO.text = "Insert a name."; } else { _local3 = String(saveMenu.nameSO.text).split(" ").join("_"); if (_local2.data.convertedname != null){ saveMenu.savetext.text = _local2.data.convertedname; loadWorld(_arg1); } else { saveMenu.savetext.text = "Not found."; }; }; _local2.close(); } private function saveWorld(_arg1:Event):void{ var _local6:int; var _local8:String; var _local9:*; var _local10:*; var _local2 = ""; var _local3:Array = [Interface.GlobalField_Time.text, Interface.GlobalField_Bleed.text, Interface.GlobalField_Object.text, Interface.GlobalField_Gravity.text, Interface.GlobalField_Wind.text, Interface.GlobalField_Lag.text, ".", ".", ".", ".", (Interface.GlobalToggle_Pause.currentFrame - 1), (Interface.GlobalToggle_Slomo.currentFrame - 1), (Interface.GlobalToggle_RagdollBreak.currentFrame - 1), (Interface.GlobalToggle_Lines.currentFrame - 1), (Interface.GlobalToggle_Spawn.currentFrame - 1), (Interface.GlobalToggle_Stabi.currentFrame - 1), (Interface.GlobalToggle_Sound.currentFrame - 1), (Interface.GlobalToggle_JointBreak.currentFrame - 1), ".", ".", toneSlider.currentValue, lineSlider.currentValue, alphaSlider.currentValue, bgPicker.hexValue, objPicker.hexValue, shirtPicker.hexValue, pantsPicker.hexValue, staticPicker.hexValue, bloodPicker.hexValue]; var _local4:b2Body = m_world.m_bodyList; while (_local4) { if (((!((_local4.GetUserData() == "dontcutme"))) && (!((_local4 == m_world.GetGroundBody()))))){ _local8 = _local4.GetUserData(); _local9 = _local4.GetPosition(); if (((((!((_local8 == null))) && (!((_local9.x == NaN))))) && (!((_local9.y == NaN))))){ trace("Type:", _local8); trace("Pos:", (_local9.x * m_phys_scale), (_local9.y * m_phys_scale)); if (((((((((((((((((((((((((((((!((_local8 == "pistol"))) && (!((_local8 == "shotgun"))))) && (!((_local8 == "assault"))))) && (!((_local8 == "m79"))))) && (!((_local8 == "sniper"))))) && (!((_local8 == "flamer"))))) && (!((_local8 == "minigun"))))) && (!((_local8 == "cannon"))))) && (!((_local8 == "harpoon"))))) && (!((_local8 == "tailmace"))))) && (!((_local8 == "destructable"))))) && (!((_local8 == "destructable_tile"))))) && (!((_local8 == "destructable_tile_save"))))) && (!((_local8 == "destructable_realistic"))))) && (!((String(_local4.GetUserData()).substr(0, 8) == "bodypart"))))){ _local10 = _local8.substr(0, 3); if (allObjects.indexOf(_local10) != -1){ this[_local10].push((((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ";")); }; } else { if ((((_local8 == "destructable")) && ((_local4.GetMass() == 70)))){ des.push((((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ";")); } else { if (_local8 == "destructable_tile_save"){ til.push((((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ";")); } else { if (_local8 == "destructable_realistic"){ rea.push((((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ";")); } else { if (_local8 == "pistol"){ wea[0] = (((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ":"); } else { if (_local8 == "shotgun"){ wea[1] = (((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ":"); } else { if (_local8 == "assault"){ wea[2] = (((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ":"); } else { if (_local8 == "m79"){ wea[3] = (((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ":"); } else { if (_local8 == "sniper"){ wea[4] = (((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ":"); } else { if (_local8 == "flamer"){ wea[5] = (((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ":"); } else { if (_local8 == "minigun"){ wea[6] = (((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ":"); } else { if (_local8 == "cannon"){ wea[7] = (((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ":"); } else { if (_local8 == "harpoon"){ wea[8] = ((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)); } else { if (String(_local4.GetUserData()).substr(8, 5) == "mtors"){ rag.push((((((Math.round((_local9.x * m_physScale)).toString(32) + ",") + Math.round((_local9.y * m_physScale)).toString(32)) + ",") + Math.round((_local4.GetAngle() * (180 / Math.PI))).toString(32)) + ";")); }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; _local4 = _local4.m_next; }; var _local5:* = false; _local6 = 0; while (_local6 <= wea.length) { if (wea[_local6] != "undefined"){ _local5 = true; }; _local6++; }; if (_local5){ if (!pistolOnStage){ wea[0] = "blank:"; }; if (!shotgunOnStage){ wea[1] = "blank:"; }; if (!assaultOnStage){ wea[2] = "blank:"; }; if (!m79OnStage){ wea[3] = "blank:"; }; if (!sniperOnStage){ wea[4] = "blank:"; }; if (!flamerOnStage){ wea[5] = "blank:"; }; if (!minigunOnStage){ wea[6] = "blank:"; }; if (!cannonOnStage){ wea[7] = "blank:"; }; if (!harpoonOnStage){ wea[8] = "blank"; }; }; _local2 = (_local2 + "OPT"); _local2 = (_local2 + _local3); _local6 = 0; while (_local6 < allObjects.length) { if (allObjects[_local6].length > 0){ _local2 = (_local2 + ("|" + String(allObjects[_local6]).toUpperCase())); while (this[allObjects[_local6]].length > 0) { _local2 = (_local2 + this[allObjects[_local6]][0]); this[allObjects[_local6]].shift(); }; }; _local6++; }; var _local7:b2Joint = m_world.GetJointList(); while (_local7) { if (_local7.GetUserData() == "bgjoint"){ joi.push((((((((("bg," + Math.round((_local7.GetAnchor1().x * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetAnchor1().y * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetAnchor2().x * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetAnchor2().y * m_physScale)).toString(32)) + ";")); }; if (_local7.GetUserData() == "ropejoint"){ joi.push((((((((("ro," + Math.round((_local7.GetAnchor1().x * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetAnchor1().y * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetAnchor2().x * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetAnchor2().y * m_physScale)).toString(32)) + ";")); }; if (_local7.GetUserData() == "objjoint"){ joi.push((((((((("ob," + Math.round((_local7.GetAnchor1().x * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetAnchor1().y * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetAnchor2().x * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetAnchor2().y * m_physScale)).toString(32)) + ";")); }; if (_local7.GetUserData() == "motjoint"){ joi.push((((((((("mo," + Math.round((_local7.GetAnchor1().x * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetAnchor1().y * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetBody1().GetPosition().x * m_physScale)).toString(32)) + ",") + Math.round((_local7.GetBody1().GetPosition().y * m_physScale)).toString(32)) + ";")); }; _local7 = _local7.GetNext(); }; if (joi.length > 0){ _local2 = (_local2 + "|JOI"); while (joi.length > 0) { _local2 = (_local2 + joi[0]); joi.shift(); }; }; saveMenu.savetext.text = compress(_local2); } private function loadWorld(_arg1:Event, _arg2=null, _arg3=1, _arg4=1):void{ var _local5:b2Body; var _local6:b2Body; var _local7:String; var _local8:Array; var _local9:*; var _local10:String; var _local11:Array; var _local12:*; var _local13:String; var _local14:Array; var _local15:Array; var _local16:*; var _local17:*; var _local18:*; var _local19:Array; var _local20:*; var _local21:Array; var _local22:*; var _local23:*; var _local24:*; var _local25:*; var _local26:b2MouseJointDef; var _local27:*; var _local28:*; var _local29:*; var _local30:b2DistanceJointDef; var _local31:b2RevoluteJointDef; slomoOn = false; magnetNumber = 0; magnetArray = []; if (_arg4 == 1){ pause(); }; if (_arg3 == 1){ _local5 = m_world.GetBodyList(); while (_local5) { _local6 = _local5; trace(_local6.GetUserData()); _local5 = _local5.GetNext(); destroyBody(_local6); }; }; while (blood.numChildren > 0) { blood.removeChildAt(0); Particle.inst.update_i.removeEventListener(TimerEvent.TIMER, update); Particle.inst.update_i.stop(); }; CutterTest(); if (_arg2 == null){ if (saveMenu.savetext.text == "christmas"){ spawnChristmas(); _local7 = ""; } else { if (saveMenu.savetext.text == "tutorial"){ infoText.text = "First, press enter for a list of hotkeys.\nUse those keys to spawn objects on mouse coordinates. Some of those objects are also on the menu below, you can drag and drop items from there to stage.\n\nThere's also a menu on top, you can use it to change colour settings.\n\nEsc for save menu, where you can save your levels for personal use, \nor share them with other Kongregate users.\n\nRead the instructions and helps for more detailed info.\nClose the tutorial by spawning a ragdoll with Space.\n\nHave fun."; _local7 = ""; } else { _local7 = uncompress(saveMenu.savetext.text); trace(_local7); }; }; } else { _local7 = uncompress(_arg2); }; if (_local7 == "error"){ saveMenu.savetext.text = "An error occured while decrypting the save-line.\nIt probably somehow got damaged during copypaste, somehow..."; saveMenu.visible = true; } else { _local8 = _local7.split("|"); _local9 = 0; while (_local9 < _local8.length) { _local10 = String(_local8[_local9]).substr(3, (_local8[_local9].length - 3)); _local11 = _local10.split(";"); trace(magnetNumber); while (_local11.length > 0) { _local12 = _local8[_local9].substr(0, 3); _local13 = _local11[0]; if (_local12 == "OPT"){ _local14 = _local13.split(","); trace(("Options: " + _local14)); Interface.GlobalField_Time.text = _local14[0]; Interface.GlobalField_Bleed.text = _local14[1]; Interface.GlobalField_Object.text = _local14[2]; Interface.GlobalField_Gravity.text = _local14[3]; Interface.GlobalField_Wind.text = _local14[4]; Interface.GlobalField_Lag.text = _local14[5]; if (_local14[10] == undefined){ _local14[10] = 0; }; if (_local14[11] == undefined){ _local14[11] = 0; }; if (_local14[12] == undefined){ _local14[12] = 1; }; if (_local14[13] == undefined){ _local14[13] = 1; }; if (_local14[14] == undefined){ _local14[14] = 0; }; if (_local14[15] == undefined){ _local14[15] = 0; }; if (_local14[17] == undefined){ _local14[17] = 1; }; if (_local14[18] == undefined){ _local14[18] = 1; }; if (_local14[10] == "."){ _local14[10] = 0; }; if (_local14[11] == "."){ _local14[11] = 0; }; if (_local14[12] == "."){ _local14[12] = 1; }; if (_local14[13] == "."){ _local14[13] = 1; }; if (_local14[14] == "."){ _local14[14] = 0; }; if (_local14[15] == "."){ _local14[15] = 0; }; if (_local14[17] == "."){ _local14[17] = 1; }; if (_local14[18] == "."){ _local14[18] = 1; }; togglePause = _local14[10]; toggleSlomo = _local14[11]; toggleRagdollBreak = _local14[12]; toggleLines = _local14[13]; toggleSpawn = _local14[14]; toggleStabi = _local14[15]; toggleJointBreak = _local14[17]; ToggleFrames(); bgTransform.color = uint(("0x" + _local14[23])); background.transform.colorTransform = bgTransform; trace("COLOURS:", _local14[24], _local14[25], _local14[26], _local14[27], _local14[28]); if (_local14[23] == undefined){ _local14[23] = "000000"; }; if (_local14[24] == undefined){ _local14[24] = "777777"; }; if (_local14[25] == undefined){ _local14[25] = "777777"; }; if (_local14[26] == undefined){ _local14[26] = "777777"; }; if (_local14[27] == undefined){ _local14[27] = "444444"; }; if (_local14[28] == undefined){ _local14[28] = "660000"; }; b2World.objctColour = new b2Color(((parseInt(String(_local14[24]).substr(4, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local14[24]).substr(2, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local14[24]).substr(0, 2), 16) + 1) * (1 / 0x0100))); b2World.shirtColour = new b2Color(((parseInt(String(_local14[25]).substr(4, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local14[25]).substr(2, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local14[25]).substr(0, 2), 16) + 1) * (1 / 0x0100))); b2World.pantsColour = new b2Color(((parseInt(String(_local14[26]).substr(4, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local14[26]).substr(2, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local14[26]).substr(0, 2), 16) + 1) * (1 / 0x0100))); b2World.statcColour = new b2Color(((parseInt(String(_local14[27]).substr(4, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local14[27]).substr(2, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local14[27]).substr(0, 2), 16) + 1) * (1 / 0x0100))); b2World.bloodColour = new b2Color(((parseInt(String(_local14[28]).substr(4, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local14[28]).substr(2, 2), 16) + 1) * (1 / 0x0100)), ((parseInt(String(_local14[28]).substr(0, 2), 16) + 1) * (1 / 0x0100))); objPicker.enabled = true; bgPicker.enabled = true; shirtPicker.enabled = true; pantsPicker.enabled = true; bloodPicker.enabled = true; staticPicker.enabled = true; bgPicker.selectedColor = uint(("0x" + _local14[23])); objPicker.selectedColor = uint(("0x" + _local14[24])); shirtPicker.selectedColor = uint(("0x" + _local14[25])); pantsPicker.selectedColor = uint(("0x" + _local14[26])); staticPicker.selectedColor = uint(("0x" + _local14[27])); bloodPicker.selectedColor = uint(("0x" + _local14[28])); if (InterfaceTOP.y == 0){ objPicker.enabled = false; bgPicker.enabled = false; shirtPicker.enabled = false; pantsPicker.enabled = false; bloodPicker.enabled = false; staticPicker.enabled = false; }; }; if (((((!((_local12 == "JOI"))) && (!((_local12 == "WEA"))))) && (!((_local12 == "OPT"))))){ _local15 = _local13.split(","); _local16 = parseInt(_local15[0], 32); _local17 = parseInt(_local15[1], 32); _local18 = (parseInt(_local15[2], 32) / (180 / Math.PI)); if (_local12 == "STA"){ spawnStar(_local16, _local17, _local18); } else { if (_local12 == "MAG"){ spawnMagnet(_local16, _local17, _local18); magnetArray[magnetNumber] = new b2Vec2(_local16, _local17); } else { if (_local12 == "CIR"){ spawnCircle(_local16, _local17, _local18); } else { if (_local12 == "SQU"){ spawnSquare(_local16, _local17, _local18); } else { if (_local12 == "FLO"){ createWall(_local16, _local17, _local18); } else { if (_local12 == "RAG"){ addRagdoll(_local16, (-43 + _local17), Interface.GlobalField_Size.text, _local18); } else { if (_local12 == "OCT"){ spawnOctagon(_local16, _local17, _local18); } else { if (_local12 == "DES"){ spawnBreakable(_local16, _local17, _local18); } else { if (_local12 == "REA"){ spawnBreakable2(_local16, _local17, _local18); } else { if (_local12 == "GEA"){ spawnGear(_local16, _local17, _local18); } else { if (_local12 == "EXP"){ spawnExplosive(_local16, _local17, _local18); } else { if (_local12 == "HAM"){ spawnHammer(_local16, _local17, _local18); } else { if (_local12 == "SWO"){ spawnSword(_local16, _local17, _local18); } else { if (_local12 == "CHA"){ spawnChain((_local16 - 5), _local17, _local18); } else { if (_local12 == "MAC"){ spawnChain((_local16 - 5), _local17, _local18); } else { if (_local12 == "TIL"){ spawnWall((_local16 - 149), (_local17 + 12), _local18); } else { if (_local12 == "ROC"){ spawnShit([[[[17.25, 10.2], [17.25, 106.35], [-16, 106.35], [-16, 10.2], [0.65, -13.95]]], [[[17.25, 94.1], [29.7, 106.35], [17.25, 106.35]], [[-16, 94.1], [-16, 106.35], [-28.45, 106.35]], [[2.45, 99.05], [0.55, 105.65], [-1.4, 99.05], [0.55, 92.4]]]], [1, 0.01], 1, "rocket", _local16, _local17, _local18, ["disabled"]); } else { if (_local12 == "TRA"){ spawnShit([[[[-47.85, -49.5], [47.05, -49.5], [39.2, 75], [-38.85, 75]], [[47.05, -59.65], [47.05, -49.5], [-47.85, -49.5], [-47.85, -59.65]], [[10.15, -59.65], [10.15, -67.35], [15.95, -71.65], [15.95, -59.65]], [[15.95, -71.65], [10.15, -67.35], [-10.15, -67.35], [-15.95, -71.65]], [[-15.95, -59.65], [-15.95, -71.65], [-10.15, -67.35], [-10.15, -59.65]], [[-39.85, -21.8], [-35.9, -20.95], [-30.45, 75], [-33.8, 75]], [[-27.85, -19.45], [-23.3, -18.8], [-19.85, 75], [-23.7, 75]], [[-15.1, -17.9], [-11.2, -17.6], [-9.6, 75], [-12.95, 75]], [[2.05, -17.3], [1.75, 75], [-2.55, 75], [-2.95, -17.3]], [[10.25, -17.6], [14.25, -17.9], [12.35, 75], [8.9, 75]], [[22.5, -18.8], [27.15, -19.45], [23.55, 75], [19.55, 75]], [[35.15, -20.9], [39.2, -21.8], [33.9, 75], [30.45, 75]]]], [9000], 1, "trash", _local16, _local17, _local18, ["disabled"]); } else { if (_local12 == "WAL"){ createWall(_local16, _local17, _local18); }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; if (_local12 == "WEA"){ _local19 = _local13.split(":"); _local20 = 0; while (_local19.length > 0) { if (_local19[0] != "blank"){ _local21 = _local19[0].split(","); _local16 = parseInt(_local21[0], 32); _local17 = parseInt(_local21[1], 32); _local18 = (parseInt(_local21[2], 32) * (Math.PI / 180)); if (_local20 == 0){ spawnPistol(_local16, _local17, _local18); }; if (_local20 == 1){ spawnShotgun(_local16, _local17, _local18); }; if (_local20 == 2){ spawnAssault(_local16, _local17, _local18); }; if (_local20 == 3){ spawnM79(_local16, _local17, _local18); }; if (_local20 == 4){ spawnSniper(_local16, _local17, _local18); }; if (_local20 == 5){ spawnFlamer(_local16, _local17, _local18); }; if (_local20 == 6){ spawnMinigun(_local16, _local17, _local18); }; if (_local20 == 7){ spawnCannon(_local16, _local17, _local18); }; if (_local20 == 8){ spawnHarpoon(_local16, _local17, _local18); }; }; _local20++; _local19.shift(); }; }; if (_local12 == "JOI"){ _local15 = _local13.split(","); _local22 = _local15[0]; if (_local22 == "bg"){ _local23 = (parseInt(_local15[3], 32) / m_physScale); _local24 = (parseInt(_local15[4], 32) / m_physScale); _local25 = GetBodyAt(_local23, _local24); if ((_local25 is b2Body)){ _local26 = new b2MouseJointDef(); _local26.userData = "bgjoint"; _local26.body1 = m_world.GetGroundBody(); _local26.body2 = _local25; _local26.target.Set(_local23, _local24); _local26.maxForce = (900000 * _local25.GetMass()); _local26.timeStep = m_timeStep; m_world.CreateJoint(_local26); }; }; if (_local22 == "ob"){ _local23 = (parseInt(_local15[1], 32) / m_physScale); _local24 = (parseInt(_local15[2], 32) / m_physScale); _local27 = (parseInt(_local15[3], 32) / m_physScale); _local28 = (parseInt(_local15[4], 32) / m_physScale); _local25 = GetBodyAt(_local23, _local24, true); _local29 = GetBodyAt(_local27, _local28, true); if ((((_local25 is b2Body)) && ((_local29 is b2Body)))){ _local30 = new b2DistanceJointDef(); _local30.collideConnected = true; _local30.userData = "objjoint"; _local30.Initialize(_local25, _local29, new b2Vec2(_local23, _local24), new b2Vec2(_local27, _local28)); m_world.CreateJoint(_local30); }; }; if (_local22 == "mo"){ _local23 = (parseInt(_local15[1], 32) / m_physScale); _local24 = (parseInt(_local15[2], 32) / m_physScale); _local27 = (parseInt(_local15[3], 32) / m_physScale); _local28 = (parseInt(_local15[4], 32) / m_physScale); _local25 = GetBodyAt(_local23, _local24, true); _local29 = GetBodyAt(_local27, _local28, true); if ((((_local25 is b2Body)) && ((_local29 is b2Body)))){ _local31 = new b2RevoluteJointDef(); _local31.Initialize(_local29, _local25, new b2Vec2(_local23, _local24)); _local31.motorSpeed = 1; _local31.userData = "motjoint"; _local31.collideConnected = true; _local31.maxMotorTorque = (1000 * _local25.GetMass()); _local31.enableMotor = true; _local31.enableLimit = false; m_world.CreateJoint(_local31); }; }; if (_local22 == "ro"){ _local23 = (parseInt(_local15[1], 32) / m_physScale); _local24 = (parseInt(_local15[2], 32) / m_physScale); _local27 = (parseInt(_local15[3], 32) / m_physScale); _local28 = (parseInt(_local15[4], 32) / m_physScale); _local25 = GetBodyAt(_local23, _local24, true); _local29 = GetBodyAt(_local27, _local28, true); if ((((_local25 is b2Body)) && ((_local29 is b2Body)))){ _local30 = new b2DistanceJointDef(); _local30.collideConnected = true; _local30.userData = "ropejoint"; _local30.Initialize(_local25, _local29, new b2Vec2(_local23, _local24), new b2Vec2(_local27, _local28)); _local30.frequencyHz = 2; _local30.dampingRatio = 0.01; m_world.CreateJoint(_local30); }; }; }; _local11.shift(); }; _local9++; }; }; } function compress(_arg1:String):String{ var _local2:ByteArray = new ByteArray(); _local2.writeUTFBytes(_arg1); _local2.compress(); return (Base64.Encode(_local2)); } function uncompress(_arg1:String):String{ var str = _arg1; var decode:ByteArray = Base64.Decode(str); try { decode.uncompress(); } catch(e:IOError) { return ("error"); }; return (decode.toString()); } private function confirmKeys(_arg1:MouseEvent):void{ setKeys(); } private function ToggleFrames():void{ Interface.GlobalToggle_Pause.gotoAndStop((togglePause + 1)); Interface.GlobalToggle_Slomo.gotoAndStop((toggleSlomo + 1)); Interface.GlobalToggle_RagdollBreak.gotoAndStop((toggleRagdollBreak + 1)); Interface.GlobalToggle_JointBreak.gotoAndStop((toggleJointBreak + 1)); Interface.GlobalToggle_Lines.gotoAndStop((toggleLines + 1)); Interface.GlobalToggle_Spawn.gotoAndStop((toggleSpawn + 1)); Interface.GlobalToggle_Stabi.gotoAndStop((toggleStabi + 1)); if (sTransform.volume == 0){ Interface.GlobalToggle_Sound.gotoAndStop(1); } else { Interface.GlobalToggle_Sound.gotoAndStop(2); }; } private function interfaceTogglePause(_arg1:MouseEvent):void{ if (togglePause == 1){ togglePause = 0; } else { togglePause = 1; }; ToggleFrames(); } private function interfaceToggleSlomo(_arg1:MouseEvent):void{ if (toggleSlomo == 1){ toggleSlomo = 0; } else { toggleSlomo = 1; }; ToggleFrames(); } private function interfaceToggleRagdollBreak(_arg1:MouseEvent):void{ if (toggleRagdollBreak == 1){ toggleRagdollBreak = 0; } else { toggleRagdollBreak = 1; }; ToggleFrames(); } private function interfaceToggleJointBreak(_arg1:MouseEvent):void{ if (toggleJointBreak == 1){ toggleJointBreak = 0; } else { toggleJointBreak = 1; }; ToggleFrames(); } private function interfaceToggleSpawn(_arg1:MouseEvent):void{ if (toggleSpawn == 1){ toggleSpawn = 0; } else { toggleSpawn = 1; }; ToggleFrames(); } private function interfaceToggleLines(_arg1:MouseEvent):void{ if (toggleLines == 1){ toggleLines = 0; } else { toggleLines = 1; }; ToggleFrames(); } private function interfaceToggleStabi(_arg1:MouseEvent):void{ if (toggleStabi == 1){ toggleStabi = 0; } else { toggleStabi = 1; }; ToggleFrames(); } private function interfaceToggleSound(_arg1:MouseEvent):void{ if (sTransform.volume == 0){ sTransform.volume = 1; SoundMixer.soundTransform = sTransform; } else { sTransform.volume = 0; SoundMixer.soundTransform = sTransform; }; ToggleFrames(); } private function setKeys(){ drawingWall = false; ctrldown = false; drawing = false; keyArray = String(Interface.KeyMap.text).split(","); KeyReset = keyArray[0]; KeyDrawWall = keyArray[1]; KeyDrawObj = keyArray[2]; KeyCut = keyArray[3]; KeyRandomCut = keyArray[4]; KeyMouseCut = keyArray[5]; KeyGridCut = keyArray[6]; KeyExplosion = keyArray[7]; KeySquare = keyArray[8]; KeyAnnihilator = keyArray[9]; KeyBreakable = keyArray[10]; KeyStar = keyArray[11]; KeyOctagon = keyArray[12]; KeyCircle = keyArray[13]; KeyRagdoll = keyArray[14]; } public function addDamage(_arg1:Number){ var _local2:* = int(Interface.damagemeter.text); var _local3:* = (_local2 + _arg1); Interface.damagemeter.text = _local3; } public function mouse_pressed(_arg1:MouseEvent):void{ var _local2:*; var _local3:*; drawing = true; canvas.graphics.moveTo(mouseX, mouseY); points_array = new Array(); saved_x = mouseX; saved_y = mouseY; points_array.push(saved_x); points_array.push(saved_y); if (((!(colourPickerOpen)) && (!(menuJustToggled)))){ if (Interface.y == 450){ _local2 = 425; } else { _local2 = 600; }; if (InterfaceTOP.y == 100){ _local3 = 125; } else { _local3 = 0; }; if ((((mouseY < _local2)) && ((mouseY > _local3)))){ if (InterfaceTOP.y == 100){ interfaceTOPToggle(_arg1); }; if (Interface.y == 450){ interfaceToggle(_arg1); }; }; }; menuJustToggled = false; } public function mouse_moved(_arg1:MouseEvent):void{ var _local2:int; var _local3:int; var _local4:int; var _local5:int; var _local6:int; var _local7:int; var _local8:Number; var _local9:Number; var _local10:int; var _local11:int; if (((drawing) && (drawingWall))){ _local2 = (mouseX - saved_x); _local3 = (mouseY - saved_y); if (((_local2 * _local2) + (_local3 * _local3)) > (pixel_dist * pixel_dist)){ saved_x = mouseX; saved_y = mouseY; points_array.push(saved_x); points_array.push(saved_y); _local10 = ((points_array.length / 2) - 1); _local11 = 0; while (_local11 < _local10) { _local4 = points_array[(_local11 * 2)]; _local6 = points_array[((_local11 * 2) + 1)]; _local5 = points_array[((_local11 * 2) + 2)]; _local7 = points_array[((_local11 * 2) + 3)]; _local2 = (_local4 - _local5); _local3 = (_local6 - _local7); _local9 = Math.atan2(_local3, _local2); createWall(_local4, _local6, _local9); points_array.shift(); points_array.shift(); _local11++; }; }; }; if (((drawing) && (DrawingCustomShape))){ _local2 = (mouseX - saved_x); _local3 = (mouseY - saved_y); if (((_local2 * _local2) + (_local3 * _local3)) > (pixel_dist2 * pixel_dist2)){ canvas.graphics.lineTo(mouseX, mouseY); saved_x = mouseX; saved_y = mouseY; points_array.push(saved_x); points_array.push(saved_y); _local10 = ((points_array.length / 2) - 1); _local11 = 0; while (_local11 < _local10) { _local4 = points_array[(_local11 * 2)]; _local6 = points_array[((_local11 * 2) + 1)]; _local5 = points_array[((_local11 * 2) + 2)]; _local7 = points_array[((_local11 * 2) + 3)]; _local2 = (_local4 - _local5); _local3 = (_local6 - _local7); _local8 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3))); _local9 = Math.atan2(_local3, _local2); customObjArray.push(_local4.toPrecision(3), _local6.toPrecision(3), _local9.toPrecision(3)); points_array.shift(); points_array.shift(); _local11++; }; }; }; } public function create_custom_obj():void{ var _local1:b2Body; var _local2:b2BodyDef; var _local3:b2PolygonDef; var _local4:*; var _local5:*; var _local6:*; _local2 = new b2BodyDef(); _local2.userData = "dontcutme"; _local2.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local2.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local1 = m_world.CreateBody(_local2); while (customObjArray.length > 0) { _local4 = (customObjArray[0] / m_physScale); _local5 = (customObjArray[1] / m_physScale); _local6 = customObjArray[2]; _local3 = new b2PolygonDef(); _local2.angle = _local6; _local3.SetAsOrientedBox(0.8, 0.5, new b2Vec2(_local4, _local5), _local6); _local3.density = Interface.GlobalField_Density.text; _local3.restitution = Interface.GlobalField_Restitution.text; _local3.friction = Interface.GlobalField_Friction.text; _local1.CreateShape(_local3); customObjArray = customObjArray.slice(3, customObjArray.length); }; _local1.SetMassFromShapes(); } public function interfaceToggle(_arg1:MouseEvent):void{ menuJustToggled = true; if (((!((stage.focus == null))) && (!((stage.focus.name == "savetext"))))){ stage.focus = stage; }; if (Interface.y == 450){ if ((((((togglePause == 1)) && ((saveMenu.visible == false)))) && ((InterfaceTOP.y == 0)))){ unpause(); }; Interface.y = (Interface.y + 150); if (Interface.tutorial.visible == true){ Interface.tutorial.visible = false; }; } else { if (togglePause == 1){ pause(); }; Interface.y = (Interface.y - 150); }; } public function interfaceTOPToggle(_arg1:Event):void{ menuJustToggled = true; if (InterfaceTOP.y == 100){ if ((((((togglePause == 1)) && ((saveMenu.visible == false)))) && ((Interface.y == 600)))){ unpause(); }; if (InterfaceTOP.tutorial.visible == true){ InterfaceTOP.tutorial.visible = false; }; InterfaceTOP.y = (InterfaceTOP.y - 100); objPicker.enabled = false; bgPicker.enabled = false; shirtPicker.enabled = false; pantsPicker.enabled = false; bloodPicker.enabled = false; staticPicker.enabled = false; InterfaceTOP.tutorial.visible = false; } else { if (togglePause == 1){ pause(); }; InterfaceTOP.y = (InterfaceTOP.y + 100); objPicker.enabled = true; bgPicker.enabled = true; shirtPicker.enabled = true; pantsPicker.enabled = true; bloodPicker.enabled = true; staticPicker.enabled = true; }; } public function interfaceBreakable(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "breakable"; } public function interfaceBreakable2(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "breakable2"; } public function interfaceRagdoll(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "ragdoll"; } public function interfaceOctagon(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "octagon"; } public function interfaceCircle(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "circle"; } public function interfaceMagnet(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "magnet"; } public function interfaceStar(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "star"; } public function interfaceSquare(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "square"; } public function interfaceGear(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "gear"; } public function interfaceWall(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "wall"; } public function interfaceHammer(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "hammer"; } public function interfaceSword(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "sword"; } public function interfaceChain(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "chain"; } public function interfaceExplosive(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "explosive"; } public function interfaceTrash(_arg1:MouseEvent):void{ spawning = true; spawnInit = new Point(mouseX, mouseY); spawnType = "trash"; } private function spawnStack(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number=1, _arg5:Number=0, _arg6:Number=0):void{ var _local7:* = _arg2; var _local8:* = _arg3; var _local9:int; while (_local9 < _arg4) { _local7 = (_local7 + _arg5); _local8 = (_local8 + _arg6); spawnObject(_arg1, true, _local7, _local8, 0); _local9++; }; } private function changeVariable(_arg1:String, _arg2:Number):void{ if ((((_arg1 == "time")) || ((_arg1 == "speed")))){ Interface.GlobalField_Time.text = _arg2; }; if ((((_arg1 == "blood")) || ((_arg1 == "bleed")))){ Interface.GlobalField_Bleed.text = _arg2; }; if ((((((_arg1 == "object")) || ((_arg1 == "limit")))) || ((_arg1 == "obj")))){ Interface.GlobalField_Object.text = _arg2; }; if ((((_arg1 == "gravity")) || ((_arg1 == "grav")))){ Interface.GlobalField_Gravity.text = _arg2; }; if (_arg1 == "wind"){ Interface.GlobalField_Wind.text = _arg2; }; if (_arg1 == "lag"){ Interface.GlobalField_Lag.text = _arg2; }; } private function changeToggle(_arg1:String, _arg2:Number):void{ if ((((_arg2 == 0)) || ((_arg2 == 1)))){ if ((((((_arg1 == "pause")) || ((_arg1 == "menu")))) || ((_arg1 == "pausemenu")))){ togglePause = _arg2; } else { if ((((((_arg1 == "slomo")) || ((_arg1 == "slowmo")))) || ((_arg1 == "slowmotion")))){ toggleSlomo = _arg2; } else { if ((((((_arg1 == "ragdolls")) || ((_arg1 == "ragdoll")))) || ((_arg1 == "ragdollbreak")))){ toggleRagdollBreak = _arg2; } else { if ((((((_arg1 == "lines")) || ((_arg1 == "cut")))) || ((_arg1 == "cutlines")))){ toggleLines = _arg2; } else { if (_arg1 == "spawn"){ toggleSpawn = _arg2; } else { if ((((_arg1 == "stabi")) || ((_arg1 == "stabilize")))){ toggleStabi = _arg2; } else { if ((((((_arg1 == "joints")) || ((_arg1 == "joint")))) || ((_arg1 == "jointbreak")))){ toggleJointBreak = _arg2; } else { console.setConsoleText("Invalid toggle."); }; }; }; }; }; }; }; ToggleFrames(); } else { console.setConsoleText("Toggles require 0 or 1"); }; } private function spawnConsoleObject(_arg1:String, _arg2:Number=30, _arg3:Number=30, _arg4:Number=0):void{ spawnObject(_arg1, true, _arg2, _arg3, _arg4); } public function spawnObject(_arg1:String, _arg2:Boolean=false, _arg3:Number=30, _arg4:Number=30, _arg5:Number=0):void{ var _local6:*; var _local7:*; var _local8:*; var _local9:Array; var _local10:Array; var _local11:Array; if (_arg2){ _local6 = _arg3; _local7 = _arg4; _local8 = (_arg5 / (180 / Math.PI)); } else { if (toggleSpawn == 1){ _local6 = (Math.random() * 800); _local7 = (Math.random() * 600); } else { _local6 = mouseX; _local7 = mouseY; }; _local8 = (Interface.GlobalField_Angle.text / (180 / Math.PI)); }; if (_arg1 == "star"){ spawnStar(_local6, _local7, _local8); }; if (_arg1 == "circle"){ spawnCircle(_local6, _local7, _local8); }; if (_arg1 == "magnet"){ spawnMagnet(_local6, _local7, _local8); }; if (_arg1 == "square"){ spawnSquare(_local6, _local7, _local8); }; if (_arg1 == "ragdoll"){ addRagdoll(_local6, (_local7 - 50), Interface.GlobalField_Size.text, _local8); }; if (_arg1 == "octagon"){ spawnOctagon(_local6, _local7, _local8); }; if (_arg1 == "breakable"){ spawnBreakable(_local6, _local7, _local8); }; if (_arg1 == "breakable2"){ spawnBreakable2(_local6, _local7, _local8); }; if (_arg1 == "gear"){ spawnGear(_local6, _local7, _local8); }; if (_arg1 == "explosive"){ spawnExplosive(_local6, _local7, _local8); }; if (_arg1 == "wall"){ spawnWall(_local6, _local7, _local8); }; if (_arg1 == "hammer"){ spawnHammer(_local6, _local7, _local8); }; if (_arg1 == "sword"){ spawnSword(_local6, _local7, _local8); }; if (_arg1 == "chain"){ spawnChain(_local6, _local7, _local8); }; if (_arg1 == "pistol"){ spawnPistol(_local6, _local7, _local8); }; if (_arg1 == "shotgun"){ spawnShotgun(_local6, _local7, _local8); }; if (_arg1 == "assault"){ spawnAssault(_local6, _local7, _local8); }; if (_arg1 == "m79"){ spawnM79(_local6, _local7, _local8); }; if (_arg1 == "sniper"){ spawnSniper(_local6, _local7, _local8); }; if (_arg1 == "flamer"){ spawnFlamer(_local6, _local7, _local8); }; if (_arg1 == "minigun"){ spawnMinigun(_local6, _local7, _local8); }; if (_arg1 == "cannon"){ spawnCannon(_local6, _local7, _local8); }; if (_arg1 == "harpoon"){ spawnHarpoon(_local6, _local7, _local8); }; if (_arg1 == "static"){ spawnStatic(_local6, _local7, _local8); }; if (_arg1 == "trash"){ _local9 = [[[-47.85, -49.5], [47.05, -49.5], [39.2, 75], [-38.85, 75]], [[47.05, -59.65], [47.05, -49.5], [-47.85, -49.5], [-47.85, -59.65]], [[10.15, -59.65], [10.15, -67.35], [15.95, -71.65], [15.95, -59.65]], [[15.95, -71.65], [10.15, -67.35], [-10.15, -67.35], [-15.95, -71.65]], [[-15.95, -59.65], [-15.95, -71.65], [-10.15, -67.35], [-10.15, -59.65]], [[-39.85, -21.8], [-35.9, -20.95], [-30.45, 75], [-33.8, 75]], [[-27.85, -19.45], [-23.3, -18.8], [-19.85, 75], [-23.7, 75]], [[-15.1, -17.9], [-11.2, -17.6], [-9.6, 75], [-12.95, 75]], [[2.05, -17.3], [1.75, 75], [-2.55, 75], [-2.95, -17.3]], [[10.25, -17.6], [14.25, -17.9], [12.35, 75], [8.9, 75]], [[22.5, -18.8], [27.15, -19.45], [23.55, 75], [19.55, 75]], [[35.15, -20.9], [39.2, -21.8], [33.9, 75], [30.45, 75]]]; spawnShit([_local9], [9000], 1, "trash", _local6, _local7, _local8, ["disabled"]); }; if (_arg1 == "rocket"){ _local10 = [[[17.25, 10.2], [17.25, 106.35], [-16, 106.35], [-16, 10.2], [0.65, -13.95]]]; _local11 = [[[17.25, 94.1], [29.7, 106.35], [17.25, 106.35]], [[-16, 94.1], [-16, 106.35], [-28.45, 106.35]], [[2.45, 99.05], [0.55, 105.65], [-1.4, 99.05], [0.55, 92.4]]]; spawnShit([_local10, _local11], [1, 0.01], 1, "rocket", _local6, _local7, _local8, ["disabled"]); }; } public function create_wall(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6):void{ var _local7:b2Body; var _local8:b2BodyDef; var _local9:b2PolygonDef; _local8 = new b2BodyDef(); _local8.userData = "wall"; _local8.position.Set(_arg1, _arg2); _local8.angle = _arg5; _local9 = new b2PolygonDef(); _local9.SetAsBox(_arg3, _arg4); _local9.friction = 0.3; _local9.density = _arg6; _local7 = m_world.CreateBody(_local8); _local7.CreateShape(_local9); _local7.SetMassFromShapes(); } public function createWall(_arg1, _arg2, _arg3):void{ var _local4:b2Body; var _local5:b2BodyDef; var _local6:b2PolygonDef; _local5 = new b2BodyDef(); _local5.userData = "wall"; _local5.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local5.angle = _arg3; _local6 = new b2PolygonDef(); _local6.SetAsBox(1, 0.3); _local6.friction = 0.3; _local6.density = 0; _local4 = m_world.CreateBody(_local5); _local4.CreateShape(_local6); _local4.SetMassFromShapes(); } private function rotateAroundPoint(_arg1:b2Vec2, _arg2:Number, _arg3:Array){ var _local6:b2Body; var _local7:Number; var _local8:Number; var _local9:*; var _local4:Number = Math.cos(_arg2); var _local5:Number = Math.sin(_arg2); for each (_local6 in _arg3) { _local7 = (_local6.GetPosition().x - _arg1.x); _local8 = (_local6.GetPosition().y - _arg1.y); _local9 = new b2Vec2((((_local4 * _local7) - (_local5 * _local8)) + _arg1.x), (((_local4 * _local8) + (_local5 * _local7)) + _arg1.y)); _local6.SetXForm(_local9, _arg2); }; } public function spawnChain(_arg1, _arg2, _arg3){ var _local5:int; var _local7:b2Body; var _local9:b2BodyDef; var _local12:b2Body; var _local13:*; var _local4:Array = []; var _local6:b2Vec2 = new b2Vec2(); var _local8:b2PolygonDef = new b2PolygonDef(); _local8.SetAsOrientedBox(((Interface.GlobalField_Size.text * 6) / m_physScale), ((Interface.GlobalField_Size.text * 3) / m_physScale), new b2Vec2(0, 0), _arg3); _local8.density = (30 * Interface.GlobalField_Size.text); _local8.friction = (100 * Interface.GlobalField_Friction.text); _local8.restitution = Interface.GlobalField_Restitution.text; var _local10:b2RevoluteJointDef = new b2RevoluteJointDef(); var _local11 = 12; _local5 = 0; while (_local5 < _local11) { _local9 = new b2BodyDef(); _local9.position.Set((((_arg1 + 5) + ((Interface.GlobalField_Size.text * 12) * _local5)) / m_physScale), (_arg2 / m_physScale)); _local9.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local9.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local9.angle = -(_arg3); if (_local5 == 0){ _local9.userData = "chain"; } else { _local9.userData = "tailmace"; }; _local7 = m_world.CreateBody(_local9); _local7.CreateShape(_local8); _local7.SetMassFromShapes(); if (_local5 == 0){ _local13 = _local7.GetPosition(); }; if (_local5 != 0){ _local10.userData = "unbreakable"; _local6.Set(((_arg1 + ((Interface.GlobalField_Size.text * 12) * _local5)) / m_physScale), (_arg2 / m_physScale)); _local10.Initialize(_local12, _local7, _local6); m_world.CreateJoint(_local10); }; _local12 = _local7; _local4.push(_local7); _local5++; }; rotateAroundPoint(_local13, _arg3, _local4); } public function spawnSquare(_arg1, _arg2, _arg3):void{ var _local4:b2Body; var _local5:b2BodyDef; var _local6:b2PolygonDef; _local5 = new b2BodyDef(); _local5.userData = "square"; _local5.angle = _arg3; var _local7:* = Interface.GlobalField_Size.text; _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local5.isBullet = true; _local6 = new b2PolygonDef(); _local6.vertexCount = 4; _local6.vertices[0].Set(((-25 * _local7) / m_phys_scale), ((-25 * _local7) / m_phys_scale)); _local6.vertices[1].Set(((25 * _local7) / m_phys_scale), ((-25 * _local7) / m_phys_scale)); _local6.vertices[2].Set(((25 * _local7) / m_phys_scale), ((25 * _local7) / m_phys_scale)); _local6.vertices[3].Set(((-25 * _local7) / m_phys_scale), ((25 * _local7) / m_phys_scale)); _local6.friction = Interface.GlobalField_Friction.text; _local6.density = ((2 * Interface.GlobalField_Density.text) * Interface.GlobalField_Size.text); _local6.restitution = Interface.GlobalField_Restitution.text; _local4 = m_world.CreateBody(_local5); _local4.CreateShape(_local6); _local4.SetMassFromShapes(); } public function spawnStatic(_arg1, _arg2, _arg3):void{ var _local4:b2Body; var _local5:b2BodyDef; var _local6:b2PolygonDef; _local5 = new b2BodyDef(); _local5.userData = "floating"; _local5.angle = _arg3; var _local7:* = Interface.GlobalField_Size.text; _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local6 = new b2PolygonDef(); _local6.vertexCount = 4; _local6.vertices[0].Set(((-10 * _local7) / m_phys_scale), ((-10 * _local7) / m_phys_scale)); _local6.vertices[1].Set(((10 * _local7) / m_phys_scale), ((-10 * _local7) / m_phys_scale)); _local6.vertices[2].Set(((10 * _local7) / m_phys_scale), ((10 * _local7) / m_phys_scale)); _local6.vertices[3].Set(((-10 * _local7) / m_phys_scale), ((10 * _local7) / m_phys_scale)); _local6.friction = Interface.GlobalField_Friction.text; _local6.density = 0; _local6.restitution = Interface.GlobalField_Restitution.text; _local4 = m_world.CreateBody(_local5); _local4.CreateShape(_local6); _local4.SetMassFromShapes(); } public function spawnExplosive(_arg1, _arg2, _arg3):void{ var _local4:b2BodyDef = new b2BodyDef(); _local4.angle = _arg3; _local4.userData = "explosive"; _local4.isBullet = true; var _local5:b2CircleDef = new b2CircleDef(); _local5.density = Interface.GlobalField_Density.text; _local5.friction = Interface.GlobalField_Friction.text; _local5.restitution = Interface.GlobalField_Restitution.text; _local5.radius = ((10 / m_physScale) * Interface.GlobalField_Size.text); _local4.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local4.linearDamping = (Interface.GlobalField_LDamp.text / 50); var _local6:b2Body = m_world.CreateBody(_local4); _local6.CreateShape(_local5); _local6.SetMassFromShapes(); } public function spawnStar(_arg1, _arg2, _arg3):void{ var _local7:b2Body; var _local9:Array; var _local10:b2PolygonDef; var _local11:Number; var _local4:* = (0.5 * Interface.GlobalField_Size.text); var _local5:Array = [[[-25, -25], [0, -75], [25, -25]], [[-25, -25], [-25, 25], [-75, 0]], [[-25, 25], [25, 25], [0, 75]], [[25, -25], [75, 0], [25, 25]], [[25, -25], [25, 25], [-25, 25], [-25, -25]]]; var _local6:b2BodyDef = new b2BodyDef(); _local6.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local6.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local6.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local6.angle = _arg3; _local6.userData = "star"; _local7 = m_world.CreateBody(_local6); var _local8:Number = 0; while (_local8 < _local5.length) { _local9 = _local5[_local8]; _local10 = new b2PolygonDef(); _local10.density = Interface.GlobalField_Density.text; _local10.restitution = Interface.GlobalField_Restitution.text; _local10.friction = Interface.GlobalField_Friction.text; _local10.vertexCount = _local9.length; _local11 = 0; while (_local11 < _local9.length) { _local10.vertices[_local11].Set(((_local9[_local11][0] * _local4) / m_phys_scale), ((_local9[_local11][1] * _local4) / m_phys_scale)); _local11++; }; _local7.CreateShape(_local10); _local8++; }; _local7.SetMassFromShapes(); } public function spawnBreakable(_arg1, _arg2, _arg3):void{ var _local4:b2Body; var _local5:b2BodyDef; var _local6:b2PolygonDef; _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.angle = _arg3; _local5.userData = "destructable"; _local5.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local6 = new b2PolygonDef(); _local6.SetAsBox((0.5 * Interface.GlobalField_Size.text), (7 * Interface.GlobalField_Size.text)); _local6.friction = Interface.GlobalField_Friction.text; _local6.density = ((5 * Interface.GlobalField_Density.text) * Interface.GlobalField_Size.text); _local6.restitution = Interface.GlobalField_Restitution.text; _local4 = m_world.CreateBody(_local5); _local4.CreateShape(_local6); _local4.SetMassFromShapes(); } public function spawnBreakable2(_arg1, _arg2, _arg3):void{ var _local4:b2Body; var _local5:b2BodyDef; var _local6:b2PolygonDef; _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.angle = _arg3; _local5.userData = "destructable_realistic"; _local5.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local6 = new b2PolygonDef(); _local6.SetAsBox((2 * Interface.GlobalField_Size.text), (8 * Interface.GlobalField_Size.text)); _local6.friction = Interface.GlobalField_Friction.text; _local6.density = ((5 * Interface.GlobalField_Density.text) * Interface.GlobalField_Size.text); _local6.restitution = Interface.GlobalField_Restitution.text; _local4 = m_world.CreateBody(_local5); _local4.CreateShape(_local6); _local4.SetMassFromShapes(); } public function spawnShit(_arg1:Array, _arg2:Array, _arg3:Number, _arg4:String, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Array):void{ var _local11:b2Body; var _local13:Number; var _local14:Array; var _local15:b2PolygonDef; var _local16:Number; var _local9:* = (_arg3 * Interface.GlobalField_Size.text); var _local10:b2BodyDef = new b2BodyDef(); _local10.angle = _arg7; _local10.userData = _arg4; _local10.position.Set((_arg5 / m_physScale), (_arg6 / m_physScale)); _local10.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local10.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local11 = m_world.CreateBody(_local10); var _local12:int; while (_local12 < _arg1.length) { _local13 = 0; while (_local13 < _arg1[_local12].length) { _local14 = _arg1[_local12][_local13]; _local15 = new b2PolygonDef(); if (_arg8[0] != "disabled"){ _local15.userData = _arg8[_local13]; }; _local15.density = (Interface.GlobalField_Density.text * _arg2[_local12]); _local15.restitution = Interface.GlobalField_Restitution.text; _local15.friction = Interface.GlobalField_Friction.text; _local15.vertexCount = _local14.length; _local16 = 0; while (_local16 < _local14.length) { _local15.vertices[_local16].Set(((_local14[_local16][0] * _local9) / m_phys_scale), ((_local14[_local16][1] * _local9) / m_phys_scale)); _local16++; }; _local11.CreateShape(_local15); _local13++; }; _local12++; }; _local11.SetMassFromShapes(); } public function spawnSword(_arg1, _arg2, _arg3):void{ var _local9:b2Body; var _local10:Number; var _local11:Array; var _local12:b2PolygonDef; var _local13:Number; var _local4:* = (2 * Interface.GlobalField_Size.text); var _local5:Number = -6; var _local6:Array = [[[3.9, (33.9 + _local5)], [3.9, (56.95 + _local5)], [-3.2, (56.95 + _local5)], [-3.2, (33.9 + _local5)]], [[19.1, (31.25 + _local5)], [15.45, (33.9 + _local5)], [-14.1, (33.9 + _local5)], [-17.55, (31.25 + _local5)], [-14.1, (28.4 + _local5)], [15.45, (28.4 + _local5)]]]; var _local7:Array = [[[0.25, (-58.65 + _local5)], [3.9, (-48.15 + _local5)], [3.9, (28.4 + _local5)], [-3.2, (28.4 + _local5)], [-3.2, (-48.15 + _local5)]]]; var _local8:b2BodyDef = new b2BodyDef(); _local8.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local8.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local8.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local8.angle = _arg3; _local8.userData = "sword"; _local8.isBullet = true; _local9 = m_world.CreateBody(_local8); _local10 = 0; while (_local10 < _local6.length) { _local11 = _local6[_local10]; _local12 = new b2PolygonDef(); _local12.userData = "sword"; _local12.density = Interface.GlobalField_Density.text; _local12.restitution = Interface.GlobalField_Restitution.text; _local12.friction = Interface.GlobalField_Friction.text; _local12.vertexCount = _local11.length; _local13 = 0; while (_local13 < _local11.length) { _local12.vertices[_local13].Set(((-1 + (_local11[_local13][0] * _local4)) / m_phys_scale), ((_local11[_local13][1] * _local4) / m_phys_scale)); _local13++; }; _local9.CreateShape(_local12); _local10++; }; _local10 = 0; while (_local10 < _local7.length) { _local11 = _local7[_local10]; _local12 = new b2PolygonDef(); _local12.userData = "blade"; _local12.density = Interface.GlobalField_Density.text; _local12.restitution = Interface.GlobalField_Restitution.text; _local12.friction = Interface.GlobalField_Friction.text; _local12.vertexCount = _local11.length; _local13 = 0; while (_local13 < _local11.length) { _local12.vertices[_local13].Set(((-1 + (_local11[_local13][0] * _local4)) / m_phys_scale), ((_local11[_local13][1] * _local4) / m_phys_scale)); _local13++; }; _local9.CreateShape(_local12); _local10++; }; _local9.SetMassFromShapes(); } public function spawnHammer(_arg1, _arg2, _arg3):void{ var _local9:b2Body; var _local10:Number; var _local11:Array; var _local12:b2PolygonDef; var _local13:Number; var _local4:* = (2 * Interface.GlobalField_Size.text); var _local5:Number = 93; var _local6:Array = [[[20.05, (-109.05 + _local5)], [26.7, (-103.75 + _local5)], [26.7, (-83.85 + _local5)], [20.05, (-77.3 + _local5)], [-19.25, (-77.3 + _local5)], [-25.55, (-83.35 + _local5)], [-25.55, (-103.75 + _local5)], [-19.25, (-109.05 + _local5)]]]; var _local7:Array = [[[2.75, (-77.3 + _local5)], [2.75, (-0.25 + _local5)], [-1.95, (-0.25 + _local5)], [-1.95, (-77.3 + _local5)]]]; var _local8:b2BodyDef = new b2BodyDef(); _local8.angle = _arg3; _local8.userData = "hammer"; _local8.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local8.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local8.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local9 = m_world.CreateBody(_local8); _local10 = 0; while (_local10 < _local6.length) { _local11 = _local6[_local10]; _local12 = new b2PolygonDef(); _local12.density = (50 * Interface.GlobalField_Density.text); _local12.restitution = Interface.GlobalField_Restitution.text; _local12.friction = Interface.GlobalField_Friction.text; _local12.vertexCount = _local11.length; _local13 = 0; while (_local13 < _local11.length) { _local12.vertices[_local13].Set((((-0.5 + _local11[_local13][0]) * _local4) / m_phys_scale), ((_local11[_local13][1] * _local4) / m_phys_scale)); _local13++; }; _local9.CreateShape(_local12); _local10++; }; _local10 = 0; while (_local10 < _local7.length) { _local11 = _local7[_local10]; _local12 = new b2PolygonDef(); _local12.density = (Interface.GlobalField_Density.text / 5); _local12.restitution = Interface.GlobalField_Restitution.text; _local12.friction = Interface.GlobalField_Friction.text; _local12.vertexCount = _local11.length; _local13 = 0; while (_local13 < _local11.length) { _local12.vertices[_local13].Set(((_local11[_local13][0] * _local4) / m_phys_scale), ((_local11[_local13][1] * _local4) / m_phys_scale)); _local13++; }; _local9.CreateShape(_local12); _local10++; }; _local9.SetMassFromShapes(); } public function spawnAssault(_arg1, _arg2, _arg3):void{ var _local9:Array; var _local10:Array; var _local11:b2PolygonDef; var _local12:Number; assaultOnStage = true; var _local4:* = (1.5 * Interface.GlobalField_Size.text); var _local5:Array = [[[-92.95, -1.8], [-92.95, -9.35], [-92.05, -5.55], [-92.05, -1.8]], [[-92.95, -9.35], [-90.5, -9.35], [-90.75, -5.55], [-92.05, -5.55]], [[-90.75, -5.55], [-90.5, -9.35], [-88.9, -1.8], [-89.9, -1.8]], [[-93.7, -1.8], [-58.45, -1.8], [-58.45, 2], [-93.7, 1.8]], [[-58.45, -5.2], [-58.45, -1.8], [-76.5, -1.8], [-71.2, -5.2]], [[-58.45, -3.75], [-36.4, -3.75], [-36.4, 4.6], [-58.45, 4.6]], [[-58.45, -3.75], [-58.45, -6.6], [-43.9, -6.6], [-43.9, -3.75]], [[-43.9, -3.75], [-43.9, -8.3], [-33.45, -8.3], [-33.45, -3.75]], [[-33.45, -3.75], [-33.45, -6.6], [-0.9, -6.6], [1.2, -3.7]], [[1.2, -3.7], [3.25, -0.75], [3.2, 4.7], [-36.4, 4.6], [-36.4, -3.75]], [[3.25, -0.75], [37.7, -0.75], [37.7, 14.35], [3.2, 5.35]], [[-29.6, 4.65], [-19.25, 4.7], [-20.1, 11.35], [-30.45, 10.35]], [[-20.1, 11.35], [-22.8, 19.65], [-32.35, 15.6], [-30.45, 10.35]], [[-22.8, 19.65], [-28.35, 26.3], [-35.95, 20.7], [-32.35, 15.6]], [[-35.95, 20.7], [-28.35, 26.3], [-35.3, 32.2], [-41.1, 24.9]], [[3.2, 4.7], [3.2, 5.35], [-7.05, 5.35], [-7.7, 4.7], [-6.8, 4.65]], [[-17.45, 4.7], [-16.65, 8], [-18.2, 8.4], [-19.25, 4.7]], [[-16.65, 8], [-15.2, 9], [-15.75, 10.3], [-18.2, 8.4]], [[-15.2, 9], [-11.3, 9.75], [-11.25, 10.95], [-15.75, 10.3]], [[-11.3, 9.75], [-8.35, 9.2], [-7.05, 9.7], [-11.25, 10.95]], [[-8.35, 9.2], [-7.7, 4.7], [-7.05, 5.35], [-7.05, 9.7]], [[-8.3, 4.7], [-11.5, 8.8], [-10, 4.7]], [[1.35, 5.35], [1.35, 9.7], [-7.05, 9.7], [-7.05, 5.35]], [[4.1, 21.45], [2.05, 22.2], [-1.4, 21.65], [-4.65, 9.7], [1.35, 9.7], [5.1, 19.9]]]; var _local6:Array = [[[-37.95, -0.65], [-3.55, -0.65], [-3.55, 5.45], [-37.95, 14.45]], [[4.35, 9.8], [1.1, 21.75], [-2.35, 22.3], [-4.4, 21.55], [-5.4, 20], [-1.65, 9.8]], [[6.75, 5.45], [6.75, 9.8], [-1.65, 9.8], [-1.65, 5.45]], [[-3.55, 4.8], [7.4, 4.8], [6.75, 5.45], [-3.55, 5.45]], [[7.4, 4.8], [8.05, 9.3], [6.75, 9.8], [6.75, 5.45]], [[8.05, 9.3], [11, 9.85], [10.95, 11.05], [6.75, 9.8]], [[11, 9.85], [14.9, 9.1], [15.45, 10.4], [10.95, 11.05]], [[14.9, 9.1], [16.35, 8.1], [17.9, 8.5], [15.45, 10.4]], [[16.35, 8.1], [16.9, 4.8], [19.3, 4.8], [17.9, 8.5]], [[9.7, 4.8], [11.2, 8.9], [8, 4.8]], [[36.1, -3.6], [36.1, 4.8], [-3.55, 4.8], [-3.55, -0.65], [-1.5, -3.6]], [[33.15, -6.5], [33.15, -3.6], [-1.5, -3.6], [0.6, -6.5]], [[33.15, -3.6], [33.15, -8.2], [43.6, -8.2], [43.6, -3.6]], [[36.1, -3.6], [58.1, -3.6], [58.1, 4.8], [36.1, 4.8]], [[58.1, -6.5], [58.1, -3.6], [43.6, -3.6], [43.6, -6.5]], [[58.1, -1.7], [58.1, -5.1], [70.85, -5.1], [76.15, -1.7]], [[58.1, -1.7], [93.35, -1.7], [93.35, 2.1], [58.1, 2.1]], [[88.55, -1.7], [90.15, -9.25], [90.4, -5.45], [89.55, -1.7]], [[90.15, -9.25], [92.6, -9.25], [91.7, -5.45], [90.4, -5.45]], [[91.7, -5.45], [92.6, -9.25], [92.6, -1.7], [91.7, -1.7]], [[29.3, 10.15], [19.3, 10.25], [19.3, 4.8], [29.3, 4.8]], [[22, 18.35], [19.3, 10.25], [29.3, 10.15], [30.95, 15.65]], [[27.8, 26.5], [22, 18.35], [30.95, 15.65], [34.75, 20.8]], [[34.75, 20.8], [40, 25.3], [35, 32.3], [27.8, 26.5]]]; var _local7:b2BodyDef = new b2BodyDef(); _local7.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local7.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local7.angle = _arg3; _local7.userData = "assault"; if (_arg1 > 400){ _local9 = _local5; assaultDirection = "1"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); } else { _local9 = _local6; assaultDirection = "2"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); }; assaultBody = m_world.CreateBody(_local7); var _local8:Number = 0; while (_local8 < _local9.length) { _local10 = _local9[_local8]; _local11 = new b2PolygonDef(); _local11.density = (10 * Interface.GlobalField_Density.text); _local11.restitution = Interface.GlobalField_Restitution.text; _local11.friction = Interface.GlobalField_Friction.text; _local11.vertexCount = _local10.length; _local12 = (_local10.length - 1); while (_local12 >= 0) { _local11.vertices[_local12].Set(((_local10[_local12][0] * _local4) / m_phys_scale), ((_local10[_local12][1] * _local4) / m_phys_scale)); _local12--; }; assaultBody.CreateShape(_local11); _local8++; }; assaultBody.SetMassFromShapes(); } public function spawnPistol(_arg1, _arg2, _arg3):void{ var _local9:Array; var _local10:Array; var _local11:b2PolygonDef; var _local12:Number; pistolOnStage = true; var _local4:* = (0.75 * Interface.GlobalField_Size.text); var _local5:Array = [[[11.35, 56.65], [30.85, 56.65], [30.85, 59.3], [11.2, 59.3]], [[22.15, 13.45], [35.85, 47.25], [35.85, 54.55], [33.2, 56.65], [9.1, 56.65], [-7.3, 13.45]], [[29.75, 8.85], [22.15, 13.45], [-53.1, 13.45], [-60.05, 11.4], [-60.05, 4.45], [28, 4.45]], [[28, -5.45], [28, 4.45], [-60.05, 4.45], [-60.05, -5.45]], [[-24.4, 13.45], [-26.2, 16.1], [-28.05, 13.45]], [[-28.05, 13.45], [-26.2, 16.1], [-26.2, 21.3], [-27.95, 23.9]], [[-4.55, 20.8], [-2.15, 27.1], [-8.2, 24.8]], [[-2.15, 27.1], [-24.4, 27.1], [-23.3, 24.8], [-8.2, 24.8]], [[-24.4, 27.1], [-27.95, 23.9], [-26.2, 21.3], [-23.3, 24.8]], [[-11.4, 21.35], [-11.4, 13.45], [-7.3, 13.45]], [[-61.85, -2.8], [-60.05, -2.8], [-60.05, 3.15], [-61.85, 3.15]]]; var _local6:Array = [[[-10.85, 56.65], [-10.7, 59.3], [-30.35, 59.3], [-30.35, 56.65]], [[-35.35, 47.25], [-21.65, 13.45], [7.8, 13.45], [-8.6, 56.65], [-32.7, 56.65], [-35.35, 54.55]], [[60.55, 4.45], [60.55, 11.4], [53.6, 13.45], [-21.65, 13.45], [-29.25, 8.85], [-27.5, 4.45]], [[60.55, -5.45], [60.55, 4.45], [-27.5, 4.45], [-27.5, -5.45]], [[24.9, 13.45], [28.55, 13.45], [26.7, 16.1]], [[26.7, 16.1], [28.55, 13.45], [28.45, 23.9], [26.7, 21.3]], [[5.05, 20.8], [8.7, 24.8], [2.65, 27.1]], [[8.7, 24.8], [23.8, 24.8], [24.9, 27.1], [2.65, 27.1]], [[23.8, 24.8], [26.7, 21.3], [28.45, 23.9], [24.9, 27.1]], [[11.9, 21.35], [7.8, 13.45], [11.9, 13.45]], [[60.55, -2.8], [62.35, -2.8], [62.35, 3.15], [60.55, 3.15]]]; var _local7:b2BodyDef = new b2BodyDef(); _local7.angle = _arg3; _local7.userData = "pistol"; if (_arg1 > 400){ _local9 = _local5; pistolDirection = "1"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); } else { _local9 = _local6; pistolDirection = "2"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); }; _local7.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local7.angularDamping = Interface.GlobalField_ADamp.text; pistolBody = m_world.CreateBody(_local7); var _local8:Number = 0; while (_local8 < _local9.length) { _local10 = _local9[_local8]; _local11 = new b2PolygonDef(); _local11.density = (5 * Interface.GlobalField_Density.text); _local11.restitution = Interface.GlobalField_Restitution.text; _local11.friction = Interface.GlobalField_Friction.text; _local11.vertexCount = _local10.length; _local12 = (_local10.length - 1); while (_local12 >= 0) { _local11.vertices[_local12].Set(((_local10[_local12][0] * _local4) / m_phys_scale), ((_local10[_local12][1] * _local4) / m_phys_scale)); _local12--; }; pistolBody.CreateShape(_local11); _local8++; }; pistolBody.SetMassFromShapes(); } public function spawnShotgun(_arg1, _arg2, _arg3):void{ var _local9:Array; var _local10:Array; var _local11:b2PolygonDef; var _local12:Number; shotgunOnStage = true; var _local4:* = (0.75 * Interface.GlobalField_Size.text); var _local5:Array = [[[86.9, 34.75], [83.3, 35.95], [80.5, 35.25], [80.5, 4.8], [84, 4.8], [86.9, 6.95]], [[80.5, 4.8], [80.5, 35.25], [25.55, 21.15], [20.6, 4.8]], [[20.6, 4.8], [25.55, 21.15], [-3.7, 9.9], [-0.15, -1.6]], [[-20.35, -6.25], [-0.15, -1.6], [-3.7, 9.9], [-57.05, 10.75], [-62.85, -5.5]], [[-243.95, -5.5], [-62.85, -5.5], [-60.3, 1.8], [-59.9, 3.05], [-243.95, 3.05]], [[-57.05, 10.75], [-59.05, 13.45], [-143.35, 13.45], [-146.05, 11.5], [-147.15, 6.5], [-147.15, 3.05], [-59.9, 3.05], [-59.35, 4.5]], [[-4.9, 9.9], [-3.7, 9.9], [-8.6, 17.15], [-9.35, 15.4], [-8.4, 10.05]], [[-23.65, 10.5], [-19.6, 17.2], [-20.45, 19.05], [-27.05, 10.6]], [[-19.6, 17.2], [-9.35, 15.4], [-8.6, 17.15], [-20.45, 19.05]], [[-14.45, 10.2], [-11.4, 10.15], [-14.45, 14.8]]]; var _local6:Array = [[[-79.1, 4.8], [-79.1, 35.2], [-81.9, 35.95], [-85.5, 34.75], [-85.5, 6.95], [-82.6, 4.8]], [[-19.2, 4.8], [-24.15, 21.15], [-79.1, 35.2], [-79.1, 4.8]], [[-24.15, 21.15], [-19.2, 4.8], [1.55, -1.6], [5.1, 9.9]], [[1.55, -1.6], [21.75, -6.25], [64.25, -5.5], [58.45, 10.75], [28.45, 10.55], [5.1, 9.9]], [[64.25, -5.5], [245.35, -5.5], [245.35, 3.05], [61.25, 3.05], [61.5, 2.2]], [[148.55, 3.05], [148.55, 6.5], [147.45, 11.5], [144.75, 13.45], [60.45, 13.45], [58.45, 10.75], [60.95, 3.75], [61.25, 3.05]], [[9.75, 10], [10.75, 15.4], [10, 17.15], [5.1, 9.9]], [[10.75, 15.4], [21, 17.2], [21.85, 19.05], [10, 17.15]], [[21.85, 19.05], [21, 17.2], [25.05, 10.45], [28.45, 10.55]], [[15.85, 14.8], [12.8, 10.1], [15.85, 10.2]]]; var _local7:b2BodyDef = new b2BodyDef(); _local7.angle = _arg3; _local7.userData = "shotgun"; if (_arg1 > 400){ _local9 = _local5; shotgunDirection = "1"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); } else { _local9 = _local6; shotgunDirection = "2"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); }; _local7.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local7.angularDamping = Interface.GlobalField_ADamp.text; shotgunBody = m_world.CreateBody(_local7); var _local8:Number = 0; while (_local8 < _local9.length) { _local10 = _local9[_local8]; _local11 = new b2PolygonDef(); _local11.density = (10 * Interface.GlobalField_Density.text); _local11.restitution = Interface.GlobalField_Restitution.text; _local11.friction = Interface.GlobalField_Friction.text; _local11.vertexCount = _local10.length; _local12 = (_local10.length - 1); while (_local12 >= 0) { _local11.vertices[_local12].Set(((_local10[_local12][0] * _local4) / m_phys_scale), ((_local10[_local12][1] * _local4) / m_phys_scale)); _local12--; }; shotgunBody.CreateShape(_local11); _local8++; }; shotgunBody.SetMassFromShapes(); } public function spawnM79(_arg1, _arg2, _arg3):void{ var _local9:Array; var _local10:Array; var _local11:b2PolygonDef; var _local12:Number; m79OnStage = true; var _local4:* = (0.9 * Interface.GlobalField_Size.text); var _local5:Array = [[[73.75, -13.2], [79.25, -14.85], [87.15, -14.85], [87.95, -11.85], [87.95, 14.55], [86.5, 16.3], [66.6, 16.3], [66.6, -7.4]], [[39.15, -2.85], [66.6, -7.4], [66.6, 16.3], [30.4, 16.3], [30.4, 2.7]], [[15.15, 2.7], [30.4, 2.7], [30.4, 16.3], [27.05, 19.15], [22.85, 19.15], [15.15, 12.8]], [[0.65, -4.45], [6.25, -4.45], [15.15, 2.7], [15.15, 12.8], [0.65, 12.8]], [[0.65, -4.45], [0.65, 4.85], [-92.3, 4.85], [-92.3, -4.45]], [[4.8, -7.3], [4.8, -4.45], [-20.3, -4.45], [-16.4, -7.3]], [[9.3, 12.8], [11.1, 12.8], [9.75, 20.6], [8.6, 19.35]], [[-1.45, 12.8], [-1.45, 17.4], [-2.85, 18.1], [-2.85, 12.8]], [[-1.45, 17.4], [0.6, 19.35], [-0.1, 20.6], [-2.85, 18.1]], [[0.6, 19.35], [8.6, 19.35], [9.75, 20.6], [-0.1, 20.6]], [[4.15, 17.75], [4.3, 12.8], [6.75, 12.8]], [[0.65, 4.85], [0.65, 12.8], [-38.5, 12.8], [-38.5, 4.85]], [[-38.5, 4.85], [-38.5, 12.8], [-67.45, 12.8], [-70.6, 11.35], [-70.6, 7], [-68, 4.85]], [[-68, 4.85], [-70.6, 7], [-92.3, 7], [-92.3, 4.85]], [[-88.5, -4.45], [-92.3, -4.45], [-92.3, -9.75], [-90.4, -11.3], [-88.5, -9.55]]]; var _local6:Array = [[[-88.1, -11.85], [-87.3, -14.85], [-79.35, -14.85], [-73.8, -13.2], [-66.65, -7.4], [-66.65, 16.3], [-86.65, 16.3], [-88.1, 14.55]], [[-66.65, -7.4], [-39.05, -2.85], [-30.25, 2.7], [-30.25, 16.3], [-66.65, 16.3]], [[-14.9, 12.8], [-22.65, 19.15], [-26.9, 19.15], [-30.25, 16.3], [-30.25, 2.7], [-14.9, 2.7]], [[-6, -4.45], [-0.35, -4.45], [-0.35, 12.8], [-14.9, 12.8], [-14.9, 2.7]], [[16.8, -7.3], [20.7, -4.45], [-4.5, -4.45], [-4.5, -7.3]], [[93.05, -4.45], [93.05, 4.85], [-0.35, 4.85], [-0.35, -4.45]], [[39, 4.85], [39, 12.8], [-0.35, 12.8], [-0.35, 4.85]], [[68.65, 4.85], [71.25, 7], [71.25, 11.35], [68.1, 12.8], [39, 12.8], [39, 4.85]], [[1.75, 12.8], [3.15, 12.8], [3.15, 18.1], [1.75, 17.4]], [[-9.05, 12.8], [-8.35, 19.35], [-9.5, 20.6], [-10.85, 12.8]], [[-8.35, 19.35], [-0.3, 19.35], [0.4, 20.6], [-9.5, 20.6]], [[-0.3, 19.35], [1.75, 17.4], [3.15, 18.1], [0.4, 20.6]], [[-3.85, 17.75], [-6.5, 12.8], [-4, 12.8]], [[93.05, -4.45], [89.25, -4.45], [89.25, -9.55], [91.15, -11.3], [93.05, -9.75]]]; var _local7:b2BodyDef = new b2BodyDef(); _local7.angle = _arg3; _local7.userData = "m79"; if (_arg1 > 400){ _local9 = _local5; m79Direction = "1"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); } else { _local9 = _local6; m79Direction = "2"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); }; _local7.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local7.angularDamping = Interface.GlobalField_ADamp.text; m79Body = m_world.CreateBody(_local7); var _local8:Number = 0; while (_local8 < _local9.length) { _local10 = _local9[_local8]; _local11 = new b2PolygonDef(); _local11.density = (20 * Interface.GlobalField_Density.text); _local11.restitution = Interface.GlobalField_Restitution.text; _local11.friction = Interface.GlobalField_Friction.text; _local11.vertexCount = _local10.length; _local12 = (_local10.length - 1); while (_local12 >= 0) { _local11.vertices[_local12].Set(((_local10[_local12][0] * _local4) / m_phys_scale), ((_local10[_local12][1] * _local4) / m_phys_scale)); _local12--; }; m79Body.CreateShape(_local11); _local8++; }; m79Body.SetMassFromShapes(); } public function spawnSniper(_arg1, _arg2, _arg3):void{ var _local9:Array; var _local10:Array; var _local11:b2PolygonDef; var _local12:Number; sniperOnStage = true; var _local4:* = (0.75 * Interface.GlobalField_Size.text); var _local5:Array = [[[139.7, -6.85], [146.5, -2.8], [147.1, 29.9], [135.55, 33.65], [135.05, 25.3], [135.05, 9.55]], [[107.6, 9.55], [109.9, 20.5], [106.45, 28.6], [101.05, 9.55]], [[109.9, 20.5], [135.05, 25.3], [135.55, 33.65], [106.45, 28.6]], [[139.7, -6.85], [135.05, 9.55], [-107.35, 9.55], [-107.25, -6.85]], [[64.45, 48.7], [53.45, 19.4], [68.85, 19.4], [76.5, 38.75], [76.5, 48.7]], [[68.85, 19.4], [43.55, 19.4], [43.55, 9.55], [73.45, 9.55]], [[48.85, 19.4], [53.45, 19.4], [48.85, 28.95]], [[26.15, 43.15], [26.45, 24.2], [38.15, 27.2], [38.15, 46.15]], [[26.15, 43.15], [11.15, 39.35], [11.15, 20.3], [26.45, 24.2]], [[11.15, 20.3], [11.15, 39.35], [-2.75, 35.85], [-2.75, 16.85], [0.7, 17.7]], [[43.55, 9.55], [43.55, 19.4], [40.15, 27.7], [-6.05, 15.9], [-10.25, 9.55]], [[17, -13.95], [17, -27.4], [51.75, -27.4], [51.75, -13.95]], [[17, -25.2], [17, -16.25], [-1.9, -16.25], [-1.9, -25.2]], [[-1.9, -27.4], [-1.9, -13.95], [-30.35, -13.95], [-30.35, -27.4]], [[4.8, -16.25], [11.5, -16.25], [11.5, -6.85], [4.8, -6.85]], [[-69.8, 9.55], [-66.6, 9.55], [-66.6, 42.05], [-69.8, 42.05]], [[-76.55, 49.45], [-69.8, 42.05], [-66.6, 42.05], [-59.2, 49.45]], [[-223.45, -3.9], [-107.3, -3.9], [-107.35, 3.75], [-223.45, 3.75]], [[-255.7, -8.75], [-223.45, -8.75], [-223.45, 7.45], [-255.7, 7.45]]]; var _local6:Array = [[[-144.7, -2.8], [-137.9, -6.85], [-133.25, 9.55], [-133.25, 25.3], [-133.75, 33.65], [-145.3, 29.9]], [[-99.25, 9.55], [-104.65, 28.6], [-108.1, 20.5], [-105.8, 9.55]], [[-104.65, 28.6], [-133.75, 33.65], [-133.25, 25.3], [-108.1, 20.5]], [[109.15, 9.55], [-133.25, 9.55], [-137.9, -6.85], [109.05, -6.85]], [[-41.75, 19.4], [-67.05, 19.4], [-71.65, 9.55], [-41.75, 9.55]], [[-67.05, 19.4], [-51.65, 19.4], [-62.65, 48.7], [-74.7, 48.7], [-74.7, 38.75]], [[12.05, 9.55], [7.85, 15.9], [-38.35, 27.7], [-41.75, 19.4], [-41.75, 9.55]], [[-51.65, 19.4], [-47.05, 19.4], [-47.05, 28.95]], [[-24.65, 24.2], [-24.35, 43.15], [-36.35, 46.15], [-36.35, 27.2], [-35.65, 27]], [[-24.35, 43.15], [-24.65, 24.2], [-9.35, 20.3], [-9.35, 39.35]], [[4.55, 16.85], [4.55, 35.85], [-9.35, 39.35], [-9.35, 20.3], [1.05, 17.65]], [[68.4, 9.55], [71.6, 9.55], [71.6, 42.05], [68.4, 42.05]], [[61, 49.45], [68.4, 42.05], [71.6, 42.05], [78.35, 49.45]], [[-49.95, -13.95], [-49.95, -27.4], [-15.2, -27.4], [-15.2, -13.95]], [[3.7, -25.2], [3.7, -16.25], [-15.2, -16.25], [-15.2, -25.2]], [[-9.7, -16.25], [-3, -16.25], [-3, -6.85], [-9.7, -6.85]], [[3.7, -13.95], [3.7, -27.4], [32.15, -27.4], [32.15, -13.95]], [[109.1, -3.9], [225.25, -3.9], [225.25, 3.75], [109.15, 3.75]], [[225.25, -8.75], [257.5, -8.75], [257.5, 7.45], [225.25, 7.45]]]; var _local7:b2BodyDef = new b2BodyDef(); _local7.angle = _arg3; _local7.userData = "sniper"; if (_arg1 > 400){ _local9 = _local5; sniperDirection = "1"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); } else { _local9 = _local6; sniperDirection = "2"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); }; _local7.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local7.angularDamping = Interface.GlobalField_ADamp.text; sniperBody = m_world.CreateBody(_local7); var _local8:Number = 0; while (_local8 < _local9.length) { _local10 = _local9[_local8]; _local11 = new b2PolygonDef(); _local11.density = (40 * Interface.GlobalField_Density.text); _local11.restitution = Interface.GlobalField_Restitution.text; _local11.friction = Interface.GlobalField_Friction.text; _local11.vertexCount = _local10.length; _local12 = (_local10.length - 1); while (_local12 >= 0) { _local11.vertices[_local12].Set(((_local10[_local12][0] * _local4) / m_phys_scale), ((_local10[_local12][1] * _local4) / m_phys_scale)); _local12--; }; sniperBody.CreateShape(_local11); _local8++; }; sniperBody.SetMassFromShapes(); } public function spawnFlamer(_arg1, _arg2, _arg3):void{ var _local11:Array; var _local12:Array; var _local13:b2PolygonDef; var _local14:Number; flamerOnStage = true; var _local4:* = (0.75 * Interface.GlobalField_Size.text); var _local5:Array = [[[-75.35, 3.35], [-75.35, 45], [-80.7, 49.35], [-118.05, 49.35], [-123.45, 45.5], [-123.45, 3.35]], [[-123.45, -1.65], [-75.35, -1.65], [-75.35, 3.35], [-123.45, 3.35]], [[-123.45, -1.65], [-123.45, -31.6], [-117.95, -40.5], [-105.2, -44.75], [-93.45, -44.75], [-81.55, -40.5], [-75.35, -31.6], [-75.35, -1.65]], [[-103.8, -50.65], [-94.9, -50.65], [-93.45, -49], [-93.45, -44.75], [-105.2, -44.75], [-105.2, -49]], [[-96.65, -50.65], [-101.9, -50.65], [-97.85, -58.2], [-95.3, -55.5]], [[-52.8, 2.2], [-62.7, -3.2], [-62, -7.05], [-52.8, -3.65]], [[-62.7, -3.2], [-68.85, -16.75], [-65.7, -17], [-62, -7.05]], [[-68.85, -16.75], [-67.8, -27.7], [-65.2, -28], [-65.7, -17]], [[-67.8, -27.7], [-71.85, -39.35], [-67.65, -40.4], [-65.2, -28]], [[-71.85, -39.35], [-78.2, -49.6], [-74.9, -52.4], [-67.65, -40.4]], [[-78.2, -49.6], [-86.9, -55.25], [-86.9, -60], [-74.9, -52.4]], [[-86.9, -55.25], [-95.3, -55.5], [-97.85, -58.2], [-86.9, -60]], [[-52.8, -6.05], [-49.4, -6.05], [-49.4, 4.25], [-52.8, 4.25]], [[-49.4, -4.2], [-7, -4.2], [-7, 3.65], [-49.4, 3.65]], [[-21.2, 21.25], [-39.35, 21.25], [-43.65, 17.75], [-43.65, 3.65], [-12.5, 3.65]], [[-24, 21.25], [-32.35, 49.15], [-47.7, 49.15], [-39.35, 21.25]], [[-7, -5.65], [-2, -5.65], [-2, 4.7], [-7, 4.7]], [[-2, 3.65], [-2, -4.35], [1.45, -4.35], [1.45, 3.65]], [[1.45, -6.55], [4.1, -6.55], [4.1, 6], [1.45, 6]], [[4.1, -4.35], [27.25, -4.35], [27.25, 4], [4.1, 4]], [[27.25, -7.05], [73.4, -7.05], [67.05, 12.35], [27.25, 12.35]], [[52.45, 12.35], [50.35, 16.05], [36.75, 16.05], [35.4, 12.35]], [[50.35, 16.05], [41.7, 49.15], [28, 49.15], [36.75, 16.05]], [[65.2, 12.35], [67.05, 12.35], [65.2, 19.05]], [[48.8, 21.95], [63.2, 21.85], [63.95, 23.8], [48.35, 23.8], [48.45, 23.25]], [[63.2, 21.85], [65.2, 19.05], [63.95, 23.8]], [[65.2, 19.05], [67.05, 12.35], [67.95, 19.55], [63.95, 23.8]], [[57.1, 12.35], [57.8, 19.9], [53.2, 12.35]], [[72.5, -4.3], [78.75, -4.3], [78.75, 4.4], [69.7, 4.4], [70.2, 2.75]], [[78.75, -11.2], [85.8, -11.2], [85.8, 9.9], [78.75, 9.9]], [[85.8, -9.65], [102.2, -9.65], [102.2, 8.8], [85.8, 8.8]], [[102.2, -7.05], [104.3, -7.05], [104.3, 6.45], [102.2, 6.45]], [[104.3, -8.95], [123.15, -4.9], [123.15, 4.5], [104.3, 8.1]]]; var _local6:Array = [[[123.15, 3.35], [123.15, 45.5], [117.75, 49.35], [80.4, 49.35], [75.05, 45], [75.05, 3.35]], [[75.05, -1.65], [123.15, -1.65], [123.15, 3.35], [75.05, 3.35]], [[75.05, -1.65], [75.05, -31.6], [81.25, -40.5], [93.15, -44.75], [104.9, -44.75], [117.65, -40.5], [123.15, -31.6], [123.15, -1.65]], [[94.6, -50.65], [103.5, -50.65], [104.9, -49], [104.9, -44.75], [93.15, -44.75], [93.15, -49]], [[52.5, -3.65], [61.7, -7.05], [62.4, -3.2], [52.5, 2.2]], [[61.7, -7.05], [65.4, -17], [68.55, -16.75], [62.4, -3.2]], [[65.4, -17], [64.9, -28], [67.5, -27.7], [68.55, -16.75]], [[67.5, -27.7], [64.9, -28], [67.35, -40.4], [74.6, -52.4], [71.55, -39.35]], [[96.35, -50.65], [95, -55.5], [97.55, -58.2], [101.6, -50.65]], [[95, -55.5], [86.6, -55.25], [86.6, -60], [97.55, -58.2]], [[86.6, -55.25], [77.9, -49.6], [74.6, -52.4], [86.6, -60]], [[77.9, -49.6], [71.55, -39.35], [74.6, -52.4]], [[49.1, -6.05], [52.5, -6.05], [52.5, 4.25], [49.1, 4.25]], [[6.7, -4.2], [49.1, -4.2], [49.1, 3.65], [6.7, 3.65]], [[43.35, 3.65], [43.35, 17.75], [39.05, 21.25], [20.9, 21.25], [12.2, 3.65]], [[23.7, 21.25], [39.05, 21.25], [47.4, 49.15], [32.05, 49.15]], [[1.7, -5.65], [6.7, -5.65], [6.7, 4.7], [1.7, 4.7]], [[1.7, -4.35], [1.7, 3.65], [-1.75, 3.65], [-1.75, -4.35]], [[-4.4, -6.55], [-1.75, -6.55], [-1.75, 6], [-4.4, 6]], [[-27.55, -4.35], [-4.4, -4.35], [-4.4, 4], [-27.55, 4]], [[-73.7, -7.05], [-27.55, -7.05], [-27.55, 12.35], [-67.35, 12.35]], [[-35.7, 12.35], [-37.05, 16.05], [-50.65, 16.05], [-52.75, 12.35]], [[-37.05, 16.05], [-28.3, 49.15], [-42, 49.15], [-50.65, 16.05]], [[-65.5, 12.35], [-65.5, 19.05], [-68.25, 19.55], [-67.35, 12.35]], [[-65.5, 19.05], [-63.5, 21.85], [-64.25, 23.8], [-68.25, 19.55]], [[-63.5, 21.85], [-49.15, 21.95], [-48.7, 23.8], [-64.25, 23.8]], [[-57.4, 12.35], [-53.5, 12.35], [-58.1, 19.9]], [[-79.05, -4.3], [-72.8, -4.3], [-70.5, 2.75], [-70, 4.4], [-79.05, 4.4]], [[-86.1, -11.2], [-79.05, -11.2], [-79.05, 9.9], [-86.1, 9.9]], [[-102.5, -9.65], [-86.1, -9.65], [-86.1, 8.8], [-102.5, 8.8]], [[-104.6, -7.05], [-102.5, -7.05], [-102.5, 6.45], [-104.6, 6.45]], [[-123.45, -4.9], [-104.6, -8.95], [-104.6, 8.1], [-123.45, 4.5]]]; var _local7:Array = [[[-167.75, -5.5], [-167.75, -9.05], [-102.25, -9.05], [-102.25, -5.5]], [[-170.05, -2.05], [-102.25, -2.05], [-102.25, 1.5], [-170.05, 1.5]], [[-102.25, 4.95], [-102.25, 8.5], [-167.65, 8.5], [-167.65, 4.95]], [[-102.25, -10.6], [-96.75, -10.6], [-96.75, 10.9], [-102.25, 10.9]], [[-96.75, -4.7], [-96.75, -10.6], [-37.75, -10.6], [-37.75, -4.7]], [[-96.75, -3.2], [-37.75, -3.2], [-37.75, 3.3], [-96.75, 3.3]], [[-37.75, 4.8], [-37.75, 10.9], [-96.75, 10.9], [-96.75, 4.8]], [[-37.75, -14.6], [-23.65, -14.6], [-23.65, 10.9], [-37.75, 10.9]], [[-32.2, -40.35], [-32.2, -14.6], [-36.05, -14.6], [-36.05, -40.35]], [[-98, 24.5], [-101, 24.5], [-101, 10.9], [-98, 10.9]], [[59.75, -4.05], [35.25, -4.05], [39.1, -7.4], [59.75, -7.4]], [[35.25, -4.05], [29.2, -14.6], [32.9, -18.45], [39.1, -7.4]], [[32.9, -18.45], [29.2, -14.6], [-32.2, -14.6], [-32.2, -18.45]], [[-23.65, -11.25], [-18.1, -11.25], [-18.1, 15], [-23.65, 15]], [[9.4, -11.25], [9.4, 5.35], [-18.1, 5.35], [-18.1, -11.25]], [[-18.1, 19.15], [-18.1, 5.35], [-7.05, 5.35], [-7.05, 19.15]], [[-7.05, 24.5], [-7.05, 5.35], [-2, 5.35], [-2, 24.5]], [[35.25, 5.35], [35.25, 24.5], [-2, 24.5], [-2, 5.35]], [[32.05, -9.65], [35.25, -4.05], [35.25, 5.35], [9.4, 5.35], [9.4, -9.65]], [[51.35, -34.25], [59.75, -7.4], [47.7, -7.4], [41.95, -27.1], [44.8, -37.25], [48.85, -37.25]], [[50.7, -35.05], [49.4, -36.6], [51.6, -38.1], [52.8, -36.9]]]; var _local8:Array = [[[106.45, -5.5], [106.45, -9.05], [171.95, -9.05], [171.95, -5.5]], [[106.45, -2.05], [174.25, -2.05], [174.25, 1.5], [106.45, 1.5]], [[171.85, 4.95], [171.85, 8.5], [106.45, 8.5], [106.45, 4.95]], [[100.95, -10.6], [106.45, -10.6], [106.45, 10.9], [100.95, 10.9]], [[102.2, 24.5], [102.2, 10.9], [105.2, 10.9], [105.2, 24.5]], [[41.95, -4.7], [41.95, -10.6], [100.95, -10.6], [100.95, -4.7]], [[41.95, -3.2], [100.95, -3.2], [100.95, 3.3], [41.95, 3.3]], [[100.95, 4.8], [100.95, 10.9], [41.95, 10.9], [41.95, 4.8]], [[36.4, -14.6], [36.4, -30.35], [40.25, -30.35], [40.25, -14.6]], [[27.85, -14.6], [41.95, -14.6], [41.95, 10.9], [27.85, 10.9]], [[22.3, -11.25], [27.85, -11.25], [27.85, 15], [22.3, 15]], [[22.3, 5.35], [-5.2, 5.35], [-5.2, -11.25], [22.3, -11.25]], [[22.3, 5.35], [22.3, 19.15], [11.25, 19.15], [11.25, 5.35]], [[11.25, 5.35], [11.25, 24.5], [6.2, 24.5], [6.2, 5.35]], [[6.2, 5.35], [6.2, 24.5], [-31.05, 24.5], [-31.05, 5.35]], [[-31.05, -4.05], [-27.85, -9.65], [-5.2, -9.65], [-5.2, 5.35], [-31.05, 5.35]], [[36.4, -18.45], [36.4, -14.6], [-25, -14.6], [-28.7, -18.45]], [[-55.55, -7.4], [-34.9, -7.4], [-31.05, -4.05], [-55.55, -4.05]], [[-34.9, -7.4], [-28.7, -18.45], [-25, -14.6], [-31.05, -4.05]], [[-55.55, -7.4], [-47.15, -34.25], [-44.65, -37.25], [-40.6, -37.25], [-37.75, -27.1], [-43.5, -7.4]], [[-45.2, -36.6], [-46.5, -35.05], [-48.6, -36.9], [-47.4, -38.1]]]; var _local9:b2BodyDef = new b2BodyDef(); _local9.angle = _arg3; _local9.userData = "flamer"; if (_arg1 > 400){ _local11 = _local6; flamerDirection = "1"; _local9.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); } else { _local11 = _local5; flamerDirection = "2"; _local9.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); }; _local9.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local9.angularDamping = Interface.GlobalField_ADamp.text; flamerBody = m_world.CreateBody(_local9); var _local10:Number = 0; while (_local10 < _local11.length) { _local12 = _local11[_local10]; _local13 = new b2PolygonDef(); _local13.density = (10 * Interface.GlobalField_Density.text); _local13.restitution = Interface.GlobalField_Restitution.text; _local13.friction = Interface.GlobalField_Friction.text; _local13.vertexCount = _local12.length; _local14 = (_local12.length - 1); while (_local14 >= 0) { _local13.vertices[_local14].Set(((_local12[_local14][0] * _local4) / m_phys_scale), ((_local12[_local14][1] * _local4) / m_phys_scale)); _local14--; }; flamerBody.CreateShape(_local13); _local10++; }; flamerBody.SetMassFromShapes(); } public function spawnMinigun(_arg1, _arg2, _arg3):void{ var _local4:*; var _local5:Array; var _local6:Array; var _local7:b2BodyDef; var _local8:Number; var _local9:Array; var _local10:Array; var _local11:b2PolygonDef; var _local12:Number; minigunOnStage = true; _local4 = (1.5 * Interface.GlobalField_Size.text); _local5 = [[[-167.75, -5.5], [-167.75, -9.05], [-102.25, -9.05], [-102.25, -5.5]], [[-170.05, -2.05], [-102.25, -2.05], [-102.25, 1.5], [-170.05, 1.5]], [[-102.25, 4.95], [-102.25, 8.5], [-167.65, 8.5], [-167.65, 4.95]], [[-102.25, -10.6], [-96.75, -10.6], [-96.75, 10.9], [-102.25, 10.9]], [[-96.75, -4.7], [-96.75, -10.6], [-37.75, -10.6], [-37.75, -4.7]], [[-96.75, -3.2], [-37.75, -3.2], [-37.75, 3.3], [-96.75, 3.3]], [[-37.75, 4.8], [-37.75, 10.9], [-96.75, 10.9], [-96.75, 4.8]], [[-37.75, -14.6], [-23.65, -14.6], [-23.65, 10.9], [-37.75, 10.9]], [[-32.2, -40.35], [-32.2, -14.6], [-36.05, -14.6], [-36.05, -40.35]], [[-98, 24.5], [-101, 24.5], [-101, 10.9], [-98, 10.9]], [[59.75, -4.05], [35.25, -4.05], [39.1, -7.4], [59.75, -7.4]], [[35.25, -4.05], [29.2, -14.6], [32.9, -18.45], [39.1, -7.4]], [[32.9, -18.45], [29.2, -14.6], [-32.2, -14.6], [-32.2, -18.45]], [[-23.65, -11.25], [-18.1, -11.25], [-18.1, 15], [-23.65, 15]], [[9.4, -11.25], [9.4, 5.35], [-18.1, 5.35], [-18.1, -11.25]], [[-18.1, 19.15], [-18.1, 5.35], [-7.05, 5.35], [-7.05, 19.15]], [[-7.05, 24.5], [-7.05, 5.35], [-2, 5.35], [-2, 24.5]], [[35.25, 5.35], [35.25, 24.5], [-2, 24.5], [-2, 5.35]], [[32.05, -9.65], [35.25, -4.05], [35.25, 5.35], [9.4, 5.35], [9.4, -9.65]], [[51.35, -34.25], [59.75, -7.4], [47.7, -7.4], [41.95, -27.1], [44.8, -37.25], [48.85, -37.25]], [[50.7, -35.05], [49.4, -36.6], [51.6, -38.1], [52.8, -36.9]]]; _local6 = [[[106.45, -5.5], [106.45, -9.05], [171.95, -9.05], [171.95, -5.5]], [[106.45, -2.05], [174.25, -2.05], [174.25, 1.5], [106.45, 1.5]], [[171.85, 4.95], [171.85, 8.5], [106.45, 8.5], [106.45, 4.95]], [[100.95, -10.6], [106.45, -10.6], [106.45, 10.9], [100.95, 10.9]], [[102.2, 24.5], [102.2, 10.9], [105.2, 10.9], [105.2, 24.5]], [[41.95, -4.7], [41.95, -10.6], [100.95, -10.6], [100.95, -4.7]], [[41.95, -3.2], [100.95, -3.2], [100.95, 3.3], [41.95, 3.3]], [[100.95, 4.8], [100.95, 10.9], [41.95, 10.9], [41.95, 4.8]], [[36.4, -14.6], [36.4, -30.35], [40.25, -30.35], [40.25, -14.6]], [[27.85, -14.6], [41.95, -14.6], [41.95, 10.9], [27.85, 10.9]], [[22.3, -11.25], [27.85, -11.25], [27.85, 15], [22.3, 15]], [[22.3, 5.35], [-5.2, 5.35], [-5.2, -11.25], [22.3, -11.25]], [[22.3, 5.35], [22.3, 19.15], [11.25, 19.15], [11.25, 5.35]], [[11.25, 5.35], [11.25, 24.5], [6.2, 24.5], [6.2, 5.35]], [[6.2, 5.35], [6.2, 24.5], [-31.05, 24.5], [-31.05, 5.35]], [[-31.05, -4.05], [-27.85, -9.65], [-5.2, -9.65], [-5.2, 5.35], [-31.05, 5.35]], [[36.4, -18.45], [36.4, -14.6], [-25, -14.6], [-28.7, -18.45]], [[-55.55, -7.4], [-34.9, -7.4], [-31.05, -4.05], [-55.55, -4.05]], [[-34.9, -7.4], [-28.7, -18.45], [-25, -14.6], [-31.05, -4.05]], [[-55.55, -7.4], [-47.15, -34.25], [-44.65, -37.25], [-40.6, -37.25], [-37.75, -27.1], [-43.5, -7.4]], [[-45.2, -36.6], [-46.5, -35.05], [-48.6, -36.9], [-47.4, -38.1]]]; _local7 = new b2BodyDef(); _local7.angle = _arg3; _local7.userData = "minigun"; if (_arg1 > 400){ _local9 = _local5; minigunDirection = "1"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); } else { _local9 = _local6; minigunDirection = "2"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); }; _local7.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local7.angularDamping = Interface.GlobalField_ADamp.text; minigunBody = m_world.CreateBody(_local7); _local8 = 0; while (_local8 < _local9.length) { _local10 = _local9[_local8]; _local11 = new b2PolygonDef(); _local11.density = (50 * Interface.GlobalField_Density.text); _local11.restitution = Interface.GlobalField_Restitution.text; _local11.friction = Interface.GlobalField_Friction.text; _local11.vertexCount = _local10.length; _local12 = (_local10.length - 1); while (_local12 >= 0) { _local11.vertices[_local12].Set(((_local10[_local12][0] * _local4) / m_phys_scale), ((_local10[_local12][1] * _local4) / m_phys_scale)); _local12--; }; minigunBody.CreateShape(_local11); _local8++; }; minigunBody.SetMassFromShapes(); } public function spawnCannon(_arg1, _arg2, _arg3):void{ var _local4:*; var _local5:Array; var _local6:Array; var _local7:Array; var _local8:Array; var _local9:Array; var _local10:Array; var _local11:b2BodyDef; var _local12:Number; var _local13:b2Body; var _local14:b2RevoluteJointDef; var _local15:Array; var _local16:Array; var _local17:Array; var _local18:Array; var _local19:b2PolygonDef; var _local20:Number; var _local21:b2Vec2; cannonOnStage = true; _local4 = (1.2 * Interface.GlobalField_Size.text); _local5 = [[[9.55, -45.85], [35.2, -26.1], [35.2, 33.3], [9.55, 52.6], [-231.05, 52.6], [-231.05, -45.85]]]; _local6 = [[[9.55, 52.6], [9.55, 66.4], [-231.05, 66.4], [-231.05, 52.6]], [[9.55, 52.6], [35.2, 33.3], [46, 39.5], [9.55, 66.4]], [[35.2, 33.3], [35.2, -26.1], [46, -32.45], [46, 39.5]], [[35.2, -26.1], [9.55, -45.85], [9.55, -59.95], [46, -32.45]], [[9.55, -59.95], [9.55, -45.85], [-231.05, -45.85], [-231.05, -59.95]]]; _local7 = [[[-50.4, 67.7], [-13, 67.7], [4.25, 156.5], [-50.4, 156.5]], [[184.55, 125.65], [191.9, 156.5], [-0.8, 130.5], [-6.75, 99.85]]]; _local8 = [[[233.15, -45.85], [233.15, 52.6], [-7.65, 52.6], [-33.35, 33.3], [-33.35, -26.1], [-7.65, -45.85]]]; _local9 = [[[233.15, 52.6], [233.15, 66.4], [-7.65, 66.4], [-7.65, 52.6]], [[-7.65, -45.85], [-33.35, -26.1], [-44.15, -32.45], [-7.65, -59.95]], [[-44.15, -32.45], [-33.35, -26.1], [-33.35, 33.3], [-44.15, 39.5]], [[-7.65, 66.4], [-44.15, 39.5], [-33.35, 33.3], [-7.65, 52.6]], [[233.15, -59.95], [233.15, -45.85], [-7.65, -45.85], [-7.65, -59.95]]]; _local10 = [[[14.9, 67.7], [52.35, 67.7], [52.35, 156.5], [-2.35, 156.5]], [[8.65, 99.85], [2.7, 130.5], [-190.15, 156.5], [-182.8, 125.65]]]; _local11 = new b2BodyDef(); _local11.angle = _arg3; _local11.userData = "cannon"; if (_arg1 > 400){ _local15 = _local5; _local16 = _local7; _local17 = _local6; cannonDirection = "1"; _local11.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); } else { _local15 = _local8; _local16 = _local10; _local17 = _local9; cannonDirection = "2"; _local11.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); }; _local11.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local11.angularDamping = Interface.GlobalField_ADamp.text; cannonBody = m_world.CreateBody(_local11); _local12 = 0; while (_local12 < _local15.length) { _local18 = _local15[_local12]; _local19 = new b2PolygonDef(); _local19.density = (20 * Interface.GlobalField_Density.text); _local19.restitution = Interface.GlobalField_Restitution.text; _local19.friction = Interface.GlobalField_Friction.text; _local19.vertexCount = _local18.length; _local19.isSensor = true; _local19.userData = "insidecannon"; _local20 = (_local18.length - 1); while (_local20 >= 0) { _local19.vertices[_local20].Set(((_local18[_local20][0] * _local4) / m_phys_scale), ((_local18[_local20][1] * _local4) / m_phys_scale)); _local20--; }; cannonBody.CreateShape(_local19); _local12++; }; _local13 = m_world.CreateBody(_local11); _local12 = 0; while (_local12 < _local16.length) { _local18 = _local16[_local12]; _local19 = new b2PolygonDef(); _local19.density = (100 * Interface.GlobalField_Density.text); _local19.restitution = Interface.GlobalField_Restitution.text; _local19.friction = Interface.GlobalField_Friction.text; _local19.vertexCount = _local18.length; _local20 = (_local18.length - 1); while (_local20 >= 0) { _local19.vertices[_local20].Set(((_local18[_local20][0] * _local4) / m_phys_scale), ((-2 + (_local18[_local20][1] * _local4)) / m_phys_scale)); _local20--; }; _local13.CreateShape(_local19); _local12++; }; _local12 = 0; while (_local12 < _local17.length) { _local18 = _local17[_local12]; _local19 = new b2PolygonDef(); _local19.density = (20 * Interface.GlobalField_Density.text); _local19.restitution = Interface.GlobalField_Restitution.text; _local19.friction = Interface.GlobalField_Friction.text; _local19.vertexCount = _local18.length; _local20 = (_local18.length - 1); while (_local20 >= 0) { _local19.vertices[_local20].Set(((_local18[_local20][0] * _local4) / m_phys_scale), ((_local18[_local20][1] * _local4) / m_phys_scale)); _local20--; }; cannonBody.CreateShape(_local19); _local12++; }; cannonBody.SetMassFromShapes(); _local13.SetMassFromShapes(); if (cannonDirection == "1"){ _local21 = new b2Vec2((cannonBody.GetPosition().x + ((Math.cos(cannonBody.GetAngle()) * Interface.GlobalField_Size.text) * 1)), (cannonBody.GetPosition().y + ((Math.sin(cannonBody.GetAngle()) * Interface.GlobalField_Size.text) * 1))); } else { _local21 = new b2Vec2((cannonBody.GetPosition().x + ((Math.cos(cannonBody.GetAngle()) * Interface.GlobalField_Size.text) * -1)), (cannonBody.GetPosition().y + ((Math.sin(cannonBody.GetAngle()) * Interface.GlobalField_Size.text) * -1))); }; _local14 = new b2RevoluteJointDef(); _local14.enableLimit = true; _local14.collideConnected = true; _local14.lowerAngle = (-20 / (180 / Math.PI)); _local14.upperAngle = (20 / (180 / Math.PI)); _local14.Initialize(cannonBody, _local13, _local21); _local14.userData = "unbreakable"; m_world.CreateJoint(_local14); } public function spawnHarpoon(_arg1, _arg2, _arg3):void{ var _local4:*; var _local5:Array; var _local6:Array; var _local7:b2BodyDef; var _local8:Number; var _local9:Array; var _local10:Array; var _local11:b2PolygonDef; var _local12:Number; harpoonOnStage = true; _local4 = (0.75 * Interface.GlobalField_Size.text); _local5 = [[[99.45, 34], [86.05, 7.55], [108.2, 2.5], [125, 34]], [[101.1, -9], [108.2, -5.3], [108.2, 2.5], [86.05, 7.55], [40.75, 7.55], [40.75, -9]], [[40.75, 7.55], [3.7, 7.55], [-5.9, -5.2], [40.75, -5.2]], [[40.75, -9], [40.75, -5.2], [-5.9, -5.2], [-5.9, -9.05]], [[-110.35, -5.2], [-5.9, -5.2], [3.7, 7.55], [-102.3, 7.55]], [[-38.65, -5.2], [-38.65, -9.1], [-5.9, -9.05], [-5.9, -5.2]], [[-53.55, -5.2], [-53.55, -11.35], [-38.65, -11.35], [-38.65, -5.2]], [[-110.35, -5.2], [-110.35, -9.1], [-53.55, -9.1], [-53.55, -5.2]], [[-125, -5.2], [-110.35, -5.2], [-102.3, 7.55], [-117.55, 7.55]], [[-125, -5.2], [-125, -9.1], [-110.35, -9.1], [-110.35, -5.2]], [[-125, -9.1], [-125, -16], [-121.2, -16], [-121.2, -9.1]], [[83, 7.55], [86.05, 7.55], [89.3, 13.95], [89.55, 14.5], [81.8, 14.5]], [[76.35, 17.5], [75.25, 18.85], [68.45, 7.55], [70.3, 7.55]], [[91.85, 19], [92.6, 20.55], [75.25, 18.85], [76.35, 17.5]]]; _local6 = [[[-86.05, 7.55], [-99.45, 34], [-125, 34], [-108.2, 2.5]], [[-108.2, -5.3], [-101.1, -9], [-40.75, -9], [-40.75, 7.55], [-86.05, 7.55], [-108.2, 2.5]], [[-40.75, -5.2], [5.9, -5.2], [-3.7, 7.55], [-40.75, 7.55]], [[5.9, -9.05], [5.9, -5.2], [-40.75, -5.2], [-40.75, -9]], [[5.9, -5.2], [110.35, -5.2], [102.3, 7.55], [-3.7, 7.55]], [[38.65, -9.1], [38.65, -5.2], [5.9, -5.2], [5.9, -9.05]], [[38.65, -5.2], [38.65, -11.35], [53.55, -11.35], [53.55, -5.2]], [[53.55, -5.2], [53.55, -9.1], [110.35, -9.1], [110.35, -5.2]], [[110.35, -5.2], [125, -5.2], [117.55, 7.55], [102.3, 7.55]], [[110.35, -5.2], [110.35, -9.1], [125, -9.1], [125, -5.2]], [[121.2, -9.1], [121.2, -16], [125, -16], [125, -9.1]], [[-89.6, 14.5], [-86.05, 7.55], [-83, 7.55], [-81.8, 14.5]], [[-76.35, 17.5], [-75.25, 18.85], [-92.65, 20.55], [-92.25, 19.75], [-91.85, 19]], [[-75.25, 18.85], [-76.35, 17.5], [-70.3, 7.55], [-68.45, 7.55]]]; _local7 = new b2BodyDef(); _local7.angle = _arg3; _local7.userData = "harpoon"; if (_arg1 > 400){ _local9 = _local5; harpoonDirection = "1"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); } else { _local9 = _local6; harpoonDirection = "2"; _local7.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); }; _local7.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local7.angularDamping = Interface.GlobalField_ADamp.text; harpoonBody = m_world.CreateBody(_local7); _local8 = 0; while (_local8 < _local9.length) { _local10 = _local9[_local8]; _local11 = new b2PolygonDef(); _local11.density = (5 * Interface.GlobalField_Density.text); _local11.restitution = Interface.GlobalField_Restitution.text; _local11.friction = Interface.GlobalField_Friction.text; _local11.vertexCount = _local10.length; _local12 = (_local10.length - 1); while (_local12 >= 0) { _local11.vertices[_local12].Set(((_local10[_local12][0] * _local4) / m_phys_scale), ((_local10[_local12][1] * _local4) / m_phys_scale)); _local12--; }; harpoonBody.CreateShape(_local11); _local8++; }; harpoonBody.SetMassFromShapes(); } public function spawnArrow(_arg1, _arg2, _arg3, _arg4):void{ var _local5:*; var _local6:Array; var _local7:Array; var _local8:b2BodyDef; var _local9:b2Body; var _local10:Number; var _local11:Array; var _local12:b2PolygonDef; var _local13:Number; _local5 = (2 * Interface.GlobalField_Size.text); _local6 = [[[14.7, -1.6], [29.35, 0.25], [14.7, 2.1]]]; _local7 = [[[14.7, -1.6], [14.7, 2.1], [-20.65, 2.1], [-20.65, -1.6]]]; _local8 = new b2BodyDef(); _local8.angle = _arg3; _local8.userData = "arrow"; _local8.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local8.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local8.angularDamping = ((Interface.GlobalField_ADamp.text + 1) * 5); _local9 = m_world.CreateBody(_local8); _local10 = 0; while (_local10 < _local6.length) { _local11 = _local6[_local10]; _local12 = new b2PolygonDef(); _local12.userData = "tip"; _local12.density = 50; _local12.restitution = 0; _local12.friction = 1; _local12.vertexCount = _local11.length; _local13 = 0; while (_local13 < _local11.length) { _local12.vertices[_local13].Set(((_local11[_local13][0] * _local5) / m_phys_scale), ((_local11[_local13][1] * _local5) / m_phys_scale)); _local13++; }; _local9.CreateShape(_local12); _local10++; }; _local10 = 0; while (_local10 < _local7.length) { _local11 = _local7[_local10]; _local12 = new b2PolygonDef(); _local12.density = 5; _local12.restitution = 0; _local12.friction = 1; _local12.vertexCount = _local11.length; _local13 = 0; while (_local13 < _local11.length) { _local12.vertices[_local13].Set(((_local11[_local13][0] * _local5) / m_phys_scale), ((_local11[_local13][1] * _local5) / m_phys_scale)); _local13++; }; _local9.CreateShape(_local12); _local10++; }; _local9.SetMassFromShapes(); if (speed != 0){ _local9.ApplyForce(new b2Vec2((((1 / speed) * _arg4) * Math.cos(_arg3)), (((1 / speed) * _arg4) * Math.sin(_arg3))), _local9.GetPosition()); } else { _local9.ApplyForce(new b2Vec2((_arg4 * Math.cos(_arg3)), (_arg4 * Math.sin(_arg3))), _local9.GetPosition()); }; } public function spawnOctagon(_arg1, _arg2, _arg3):void{ var _local4:*; var _local5:Array; var _local6:b2BodyDef; var _local7:b2Body; var _local8:Number; var _local9:Array; var _local10:b2PolygonDef; var _local11:Number; _local4 = (0.5 * Interface.GlobalField_Size.text); _local5 = [[[35, -70], [70, -35], [70, 35], [35, 70], [-35, 70], [-70, 35], [-70, -35], [-35, -70]]]; _local6 = new b2BodyDef(); _local6.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local6.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local6.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local6.angle = _arg3; _local6.userData = "octagon"; _local7 = m_world.CreateBody(_local6); _local8 = 0; while (_local8 < _local5.length) { _local9 = _local5[_local8]; _local10 = new b2PolygonDef(); _local10.density = (5 * Interface.GlobalField_Density.text); _local10.restitution = Interface.GlobalField_Restitution.text; _local10.friction = Interface.GlobalField_Friction.text; _local10.vertexCount = _local9.length; _local11 = 0; while (_local11 < _local9.length) { _local10.vertices[_local11].Set(((_local9[_local11][0] * _local4) / m_phys_scale), ((_local9[_local11][1] * _local4) / m_phys_scale)); _local11++; }; _local7.CreateShape(_local10); _local8++; }; _local7.SetMassFromShapes(); } public function spawnMagnet(_arg1, _arg2, _arg3):void{ trace(("magnet" + magnetNumber)); spawnShit([[[[-13.75, -13.45], [-19.9, -13.45], [-19.9, -17.2], [-13.75, -17.2]], [[20, -13.45], [13.8, -13.45], [13.8, -17.2], [20, -17.25]], [[13.8, -13.45], [20, -13.45], [20, 8.35], [13.8, 5.75]], [[8.35, 19.95], [5.75, 13.75], [13.8, 5.75], [20, 8.35]], [[5.75, 13.75], [8.35, 19.95], [-8.2, 20], [-5.65, 13.8]], [[-5.65, 13.8], [-8.2, 20], [-19.9, 8.25], [-13.75, 5.7]], [[-19.9, -13.45], [-13.75, -13.45], [-13.75, 5.7], [-19.9, 8.25]]]], [(Interface.GlobalField_Density.text * Interface.GlobalField_Size.text)], Interface.GlobalField_Size.text, ("magnet" + magnetNumber), _arg1, _arg2, _arg3, ["magnet1", "magnet1", "magnet2", "magnet2", "magnet2", "magnet2", "magnet2"]); magnetNumber++; } public function spawnCircle(_arg1, _arg2, _arg3):void{ var _local4:b2Body; var _local5:b2BodyDef; var _local6:b2CircleDef; _local5 = new b2BodyDef(); _local5.angle = _arg3; _local5.userData = "circle"; _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.isBullet = true; _local5.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local6 = new b2CircleDef(); _local6.radius = Interface.GlobalField_Size.text; _local6.friction = Interface.GlobalField_Friction.text; _local6.density = ((2 * Interface.GlobalField_Density.text) * Interface.GlobalField_Size.text); _local6.restitution = Interface.GlobalField_Restitution.text; _local4 = m_world.CreateBody(_local5); _local4.CreateShape(_local6); _local4.SetMassFromShapes(); } private function spawnGear(_arg1, _arg2, _arg3):void{ var _local4:*; var _local5:b2BodyDef; var _local6:b2Body; var _local7:*; var _local8:*; var _local9:*; var _local10:*; var _local11:b2PolygonDef; var _local12:uint; var _local13:b2RevoluteJointDef; var _local14:b2BodyDef; var _local15:b2Body; var _local16:b2PolygonDef; var _local17:b2RevoluteJoint; var _local18:b2RevoluteJoint; var _local19:b2GearJointDef; _local4 = Interface.GlobalField_Size.text; _local5 = new b2BodyDef(); _local5.position.Set((_arg1 / m_physScale), (_arg2 / m_physScale)); _local5.angle = _arg3; _local5.userData = "gear"; _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local6 = m_world.CreateBody(_local5); _local7 = 50; _local8 = 15; _local9 = 16; _local10 = 10; _local11 = new b2PolygonDef(); _local12 = 0; while (_local12 < (_local10 / 2)) { _local11.SetAsOrientedBox((((_local8 / 2) * _local4) / m_physScale), (((_local7 + _local9) * _local4) / m_physScale), new b2Vec2(0, 0), (((360 / _local10) * _local12) * (Math.PI / 180))); _local11.density = (Interface.GlobalField_Density.text * 500); _local11.friction = (Interface.GlobalField_Friction.text * 10); _local11.restitution = Interface.GlobalField_Restitution.text; _local6.CreateShape(_local11); _local12++; }; _local6.SetMassFromShapes(); _local13 = new b2RevoluteJointDef(); _local13.userData = "unbreakable"; _local13.motorSpeed = (-2000 * Interface.GlobalField_Wind.text); _local13.maxMotorTorque = 100000; _local13.enableMotor = true; _local13.Initialize(_local6, m_world.GetGroundBody(), _local6.GetPosition()); m_world.CreateJoint(_local13); _local14 = new b2BodyDef(); _local14.position.Set(((_arg1 + (120 * _local4)) / m_physScale), (_arg2 / m_physScale)); _local14.userData = "dontcutme"; _local15 = m_world.CreateBody(_local14); _local16 = new b2PolygonDef(); _local12 = 0; while (_local12 < (_local10 / 2)) { _local16.SetAsOrientedBox((((_local8 / 2) * _local4) / m_physScale), (((_local7 + _local9) * _local4) / m_physScale), new b2Vec2(0, 0), ((20 + ((360 / _local10) * _local12)) * (Math.PI / 180))); _local16.density = (Interface.GlobalField_Density.text * 50); _local16.friction = Interface.GlobalField_Friction.text; _local16.restitution = Interface.GlobalField_Restitution.text; _local15.CreateShape(_local16); _local12++; }; _local15.SetMassFromShapes(); _local13 = new b2RevoluteJointDef(); _local13.userData = "unbreakable"; _local13.Initialize(m_world.GetGroundBody(), _local6, _local6.GetPosition()); _local17 = (m_world.CreateJoint(_local13) as b2RevoluteJoint); _local13.Initialize(m_world.GetGroundBody(), _local15, _local15.GetPosition()); _local18 = (m_world.CreateJoint(_local13) as b2RevoluteJoint); _local19 = new b2GearJointDef(); _local19.body1 = _local6; _local19.body2 = _local15; _local19.joint1 = _local17; _local19.joint2 = _local18; _local19.ratio = 1; (m_world.CreateJoint(_local19) as b2GearJoint); } public function spawnWall(_arg1, _arg2, _arg3):void{ var _local4:b2PolygonDef; var _local5:b2BodyDef; var _local6:b2Body; var _local7:int; var _local8:int; var _local9:int; var _local10:*; var _local11:*; var _local12:*; var _local13:*; var _local14:*; var _local15:*; var _local16:*; _local4 = new b2PolygonDef(); _local5 = new b2BodyDef(); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.userData = "destructable_tile"; _local4.density = (Interface.GlobalField_Density.text * 50); _local4.friction = Interface.GlobalField_Friction.text; _local4.restitution = Interface.GlobalField_Restitution.text; _local10 = 16; _local11 = 12; _local12 = (8 * Interface.GlobalField_Size.text); _local13 = (5 * Interface.GlobalField_Size.text); _local14 = 0; _local15 = ((_arg1 + (0.5 * _local10)) + (0.825 * _local10)); _local16 = ((_arg2 - ((_local12 * 0.25) * _local11)) - ((1.625 * _local11) * _local12)); _local7 = 0; while (_local7 < _local13) { _local14 = 0; _local8 = 0; while (_local8 < _local12) { if ((((_local7 == (_local13 - 1))) && ((_local8 == (_local12 - 1))))){ _local5.userData = "destructable_tile_save"; } else { _local5.userData = "destructable_tile"; }; _local4.SetAsBox((_local10 / m_physScale), (_local11 / m_physScale)); if ((_local14 % 2) != 0){ _local5.position.Set(((((2 * _local10) * _local7) + _local15) / m_physScale), ((((2 * _local11) * _local8) + _local16) / m_physScale)); } else { _local5.position.Set((((_local10 + ((2 * _local10) * _local7)) + _local15) / m_physScale), ((((2 * _local11) * _local8) + _local16) / m_physScale)); }; _local6 = m_world.CreateBody(_local5); _local6.CreateShape(_local4); _local6.SetMassFromShapes(); _local14 = (_local14 + 1); _local8++; }; _local7++; }; _local9 = 0; while (_local9 < _local12) { _local5.userData = "destructable_tile"; if ((_local9 % 2) == 0){ _local4.SetAsBox(((_local10 / 2) / m_physScale), (_local11 / m_physScale)); _local5.position.Set(((_local15 - (0.5 * _local10)) / m_physScale), ((((2 * _local11) * _local9) + _local16) / m_physScale)); _local6 = m_world.CreateBody(_local5); _local6.CreateShape(_local4); _local6.SetMassFromShapes(); }; if ((_local9 % 2) != 0){ _local4.SetAsBox(((_local10 / 2) / m_physScale), (_local11 / m_physScale)); _local5.position.Set(((((((_local13 - 2.5) * _local10) + (_local13 * _local10)) + (2 * _local10)) + _local15) / m_physScale), ((((2 * _local11) * _local9) + _local16) / m_physScale)); _local6 = m_world.CreateBody(_local5); _local6.CreateShape(_local4); _local6.SetMassFromShapes(); }; _local9++; }; } public function addRagdoll(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){ var _local5:b2BodyDef; var _local6:b2PolygonDef; var _local7:b2PolygonDef; var _local8:b2RevoluteJointDef; var _local9:b2RevoluteJointDef; var _local10:b2RevoluteJointDef; var _local11:Array; var _local12:Number; var _local13:Number; var _local14:b2Body; var _local15:b2Body; var _local16:b2Body; var _local17:b2Body; var _local18:b2Body; var _local19:b2Body; var _local20:b2Body; var _local21:b2Body; var _local22:b2Body; var _local23:b2Body; var _local24:b2Body; var _local25:*; _local6 = new b2PolygonDef(); _local7 = new b2PolygonDef(); _local8 = new b2RevoluteJointDef(); _local9 = new b2RevoluteJointDef(); _local10 = new b2RevoluteJointDef(); _local11 = []; _local12 = _arg1; _local13 = _arg2; _local6.SetAsBox(((_arg3 * 12) / m_physScale), ((_arg3 * 12) / m_physScale)); _local6.density = Interface.GlobalField_Density.text; _local6.friction = Interface.GlobalField_Friction.text; _local6.restitution = Interface.GlobalField_Restitution.text; _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.userData = "bodypart_head|hp_20"; _local5.isBullet = true; _local5.position.Set((_local12 / m_physScale), (_local13 / m_physScale)); head = m_world.CreateBody(_local5); head.CreateShape(_local6); head.SetMassFromShapes(); _local7.SetAsBox(((_arg3 * 15) / m_physScale), ((_arg3 * 10) / m_physScale)); _local7.density = Interface.GlobalField_Density.text; _local7.friction = Interface.GlobalField_Friction.text; _local7.restitution = Interface.GlobalField_Restitution.text; _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.isBullet = true; _local5.userData = "bodypartutors|hp_20"; _local5.position.Set((_local12 / m_physScale), ((_local13 + (28 * _arg3)) / m_physScale)); _local14 = m_world.CreateBody(_local5); _local14.CreateShape(_local7); _local14.SetMassFromShapes(); _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.userData = "bodypartmtors|hp_20"; _local5.isBullet = true; _local5.position.Set((_local12 / m_physScale), ((_local13 + (43 * _arg3)) / m_physScale)); _local15 = m_world.CreateBody(_local5); _local15.CreateShape(_local7); _local15.SetMassFromShapes(); _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.userData = "bodypartltors|hp_20"; _local5.position.Set((_local12 / m_physScale), ((_local13 + (58 * _arg3)) / m_physScale)); _local16 = m_world.CreateBody(_local5); _local16.CreateShape(_local7); _local16.SetMassFromShapes(); _local7.SetAsBox(((_arg3 * 18) / m_physScale), ((_arg3 * 6.5) / m_physScale)); _local7.density = Interface.GlobalField_Density.text; _local7.friction = Interface.GlobalField_Friction.text; _local7.restitution = Interface.GlobalField_Restitution.text; _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.userData = "bodypart_uarm|hp_20"; _local5.isBullet = true; _local5.position.Set(((_local12 - (30 * _arg3)) / m_physScale), ((_local13 + (20 * _arg3)) / m_physScale)); _local17 = m_world.CreateBody(_local5); _local17.CreateShape(_local7); _local17.SetMassFromShapes(); _local5.position.Set(((_local12 + (30 * _arg3)) / m_physScale), ((_local13 + (20 * _arg3)) / m_physScale)); _local18 = m_world.CreateBody(_local5); _local18.CreateShape(_local7); _local18.SetMassFromShapes(); _local7.SetAsBox(((_arg3 * 17) / m_physScale), ((_arg3 * 6) / m_physScale)); _local7.density = Interface.GlobalField_Density.text; _local7.friction = Interface.GlobalField_Friction.text; _local7.restitution = Interface.GlobalField_Restitution.text; _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.userData = "bodypart_larm|hp_20"; _local5.isBullet = true; _local5.position.Set(((_local12 - (57 * _arg3)) / m_physScale), ((_local13 + (20 * _arg3)) / m_physScale)); _local19 = m_world.CreateBody(_local5); _local19.CreateShape(_local7); _local19.SetMassFromShapes(); _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.userData = "bodypart_rarm|hp_20"; _local5.isBullet = true; _local5.position.Set(((_local12 + (57 * _arg3)) / m_physScale), ((_local13 + (20 * _arg3)) / m_physScale)); _local20 = m_world.CreateBody(_local5); _local20.CreateShape(_local7); _local20.SetMassFromShapes(); _local7.SetAsBox(((_arg3 * 7) / m_physScale), ((_arg3 * 22) / m_physScale)); _local7.density = Interface.GlobalField_Density.text; _local7.friction = Interface.GlobalField_Friction.text; _local7.restitution = Interface.GlobalField_Restitution.text; _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.userData = "bodypart_lulg|hp_20"; _local5.isBullet = true; _local5.position.Set(((_local12 - (10 * _arg3)) / m_physScale), ((_local13 + (85 * _arg3)) / m_physScale)); _local21 = m_world.CreateBody(_local5); _local21.CreateShape(_local7); _local21.SetMassFromShapes(); _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.userData = "bodypart_rulg|hp_20"; _local5.isBullet = true; _local5.position.Set(((_local12 + (10 * _arg3)) / m_physScale), ((_local13 + (85 * _arg3)) / m_physScale)); _local22 = m_world.CreateBody(_local5); _local22.CreateShape(_local7); _local22.SetMassFromShapes(); _local7.SetAsBox(((_arg3 * 6) / m_physScale), ((_arg3 * 20) / m_physScale)); _local7.density = Interface.GlobalField_Density.text; _local7.friction = Interface.GlobalField_Friction.text; _local7.restitution = Interface.GlobalField_Restitution.text; _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local5.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local5.userData = "bodypart_lleg|hp_20"; _local5.isBullet = true; _local5.position.Set(((_local12 - (8 * _arg3)) / m_physScale), ((_local13 + (120 * _arg3)) / m_physScale)); _local23 = m_world.CreateBody(_local5); _local23.CreateShape(_local7); _local23.SetMassFromShapes(); _local5.position.Set(((_local12 + (8 * _arg3)) / m_physScale), ((_local13 + (120 * _arg3)) / m_physScale)); _local24 = m_world.CreateBody(_local5); _local24.CreateShape(_local7); _local24.SetMassFromShapes(); _local11.push(head); _local11.push(_local14); _local11.push(_local15); _local11.push(_local16); _local11.push(_local17); _local11.push(_local18); _local11.push(_local19); _local11.push(_local20); _local11.push(_local21); _local11.push(_local22); _local11.push(_local23); _local11.push(_local24); _local9.enableLimit = true; _local10.enableLimit = true; _local8.enableLimit = true; _local8.enableMotor = true; _local9.enableMotor = true; _local8.motorSpeed = (-1 * -(Math.PI)); _local8.maxMotorTorque = 1; _local9.motorSpeed = (1 * -(Math.PI)); _local9.maxMotorTorque = 1; _local25 = 1; _local10.lowerAngle = ((_local25 * -20) / (180 / Math.PI)); _local10.upperAngle = ((_local25 * 20) / (180 / Math.PI)); _local10.Initialize(_local14, head, new b2Vec2((_local12 / m_physScale), ((_local13 + (15 * _arg3)) / m_physScale))); m_world.CreateJoint(_local10); _local8.lowerAngle = ((_local25 * -85) / (180 / Math.PI)); _local8.upperAngle = ((_local25 * 130) / (180 / Math.PI)); _local8.Initialize(_local14, _local17, new b2Vec2(((_local12 - (18 * _arg3)) / m_physScale), ((_local13 + (20 * _arg3)) / m_physScale))); m_world.CreateJoint(_local8); _local9.lowerAngle = ((_local25 * -130) / (180 / Math.PI)); _local9.upperAngle = ((_local25 * 85) / (180 / Math.PI)); _local9.Initialize(_local14, _local18, new b2Vec2(((_local12 + (18 * _arg3)) / m_physScale), ((_local13 + (20 * _arg3)) / m_physScale))); m_world.CreateJoint(_local9); _local10.lowerAngle = ((_local25 * -130) / (180 / Math.PI)); _local10.upperAngle = ((_local25 * 10) / (180 / Math.PI)); _local10.Initialize(_local17, _local19, new b2Vec2(((_local12 - (45 * _arg3)) / m_physScale), ((_local13 + (20 * _arg3)) / m_physScale))); m_world.CreateJoint(_local10); _local10.lowerAngle = ((_local25 * -10) / (180 / Math.PI)); _local10.upperAngle = ((_local25 * 130) / (180 / Math.PI)); _local10.Initialize(_local18, _local20, new b2Vec2(((_local12 + (45 * _arg3)) / m_physScale), ((_local13 + (20 * _arg3)) / m_physScale))); m_world.CreateJoint(_local10); _local10.lowerAngle = ((_local25 * -5) / (180 / Math.PI)); _local10.upperAngle = ((_local25 * 5) / (180 / Math.PI)); _local10.Initialize(_local14, _local15, new b2Vec2((_local12 / m_physScale), ((_local13 + (35 * _arg3)) / m_physScale))); m_world.CreateJoint(_local10); _local10.Initialize(_local15, _local16, new b2Vec2((_local12 / m_physScale), ((_local13 + (50 * _arg3)) / m_physScale))); m_world.CreateJoint(_local10); _local9.lowerAngle = ((_local25 * -25) / (180 / Math.PI)); _local9.upperAngle = ((_local25 * 45) / (180 / Math.PI)); _local9.Initialize(_local16, _local21, new b2Vec2(((_local12 - (8 * _arg3)) / m_physScale), ((_local13 + (72 * _arg3)) / m_physScale))); m_world.CreateJoint(_local9); _local9.lowerAngle = ((_local25 * -45) / (180 / Math.PI)); _local9.upperAngle = ((_local25 * 25) / (180 / Math.PI)); _local9.Initialize(_local16, _local22, new b2Vec2(((_local12 + (8 * _arg3)) / m_physScale), ((_local13 + (72 * _arg3)) / m_physScale))); m_world.CreateJoint(_local9); _local10.lowerAngle = ((_local25 * -25) / (180 / Math.PI)); _local10.upperAngle = ((_local25 * 25) / (180 / Math.PI)); _local10.Initialize(_local21, _local23, new b2Vec2(((_local12 - (8 * _arg3)) / m_physScale), ((_local13 + (105 * _arg3)) / m_physScale))); m_world.CreateJoint(_local10); _local10.lowerAngle = ((_local25 * -25) / (180 / Math.PI)); _local10.upperAngle = ((_local25 * 25) / (180 / Math.PI)); _local10.Initialize(_local22, _local24, new b2Vec2(((_local12 + (8 * _arg3)) / m_physScale), ((_local13 + (105 * _arg3)) / m_physScale))); m_world.CreateJoint(_local10); rotateAroundPoint(_local15.GetPosition(), _arg4, _local11); } public function checkKeys(_arg1:KeyboardEvent){ var _local2:*; var _local3:*; var _local4:b2Body; var _local5:b2MouseJointDef; var _local6:*; var _local7:*; var _local8:*; var _local9:*; var _local10:b2Body; var _local11:Point; var _local12:b2BodyDef; var _local13:b2CircleDef; var _local14:*; var _local15:int; var _local16:int; var _local17:Timer; var _local18:Point; var _local19:b2Vec2; var _local20:*; var _local21:Timer; var _local22:b2Vec2; var _local23:*; var _local24:Timer; var _local25:b2Vec2; var _local26:*; var _local27:Timer; var _local28:b2Vec2; var _local29:*; var _local30:Timer; var _local31:b2Vec2; var _local32:*; var _local33:Timer; var _local34:b2Vec2; var _local35:*; var _local36:Timer; var _local37:b2Vec2; var _local38:*; var _local39:Timer; var _local40:*; var _local41:*; var _local42:*; var _local43:b2Vec2; var _local44:*; var _local45:Timer; var _local46:b2Vec2; var _local47:*; var _local48:b2BodyDef; var _local49:b2PolygonDef; if ((((saveMenu.visible == true)) || (colourPickerOpen))){ } else { if (stage.focus != null){ if (((!((stage.focus.name == "console"))) && (!((String(stage.focus.name).substr(0, 11) == "GlobalField"))))){ stage.focus = null; }; }; }; if (_arg1.keyCode == KeySaveMenu){ if (saveMenu.visible == false){ saveMenu.visible = true; saveMenu.tutorial.visible = false; if (togglePause == 1){ pause(); }; } else { closeSaveMenu(null); }; }; if ((((((((((((Interface.y == 450)) && ((mouseY < 450)))) || ((Interface.y == 600)))) && (((((((((!((stage.focus == null))) && (!((stage.focus.name == "savetext"))))) && (!((stage.focus.name == "console"))))) || ((stage.focus == null)))) || ((stage.focus == stage)))))) && ((saveMenu.visible == false)))) && (!(colourPickerOpen)))){ if (_arg1.keyCode == 123){ if (!paused){ if (speed == 1){ speed = 0.1; slomoOn = true; } else { speed = Interface.GlobalField_Time.text; slomoOn = false; }; }; }; if (_arg1.keyCode == KeySave){ saveWorld(_arg1); }; if (_arg1.keyCode == KeyLoad){ loadWorld(_arg1); }; if (_arg1.keyCode == KeyShare){ shareContent(null); }; if (_arg1.keyCode == KeyChain){ spawnObject("chain"); }; if (_arg1.keyCode == KeyPause){ if (speed == 0){ unpause(); } else { slomoOn = false; pause(); }; }; if (_arg1.keyCode == KeyReset){ reset(); }; if (_arg1.keyCode == KeyDrawWall){ drawingWall = true; }; if (_arg1.keyCode == KeyCut){ ctrldown = true; }; if (_arg1.keyCode == KeyDrawObj){ DrawingCustomShape = true; }; if (_arg1.keyCode == KeyWall){ spawnObject("wall"); }; if (_arg1.keyCode == KeySword){ spawnObject("sword"); }; if (_arg1.keyCode == KeyHammer){ spawnObject("hammer"); }; if (_arg1.keyCode == KeyRagdoll){ if (infoText.text.substr(2, 10) == "This quick"){ infoText.text = ""; }; spawnObject("ragdoll"); }; if (_arg1.keyCode == KeyBGJoint){ _local2 = mouseXWorldPhys; _local3 = mouseYWorldPhys; _local4 = GetBodyAt(_local2, _local3); if (_local4){ _local5 = new b2MouseJointDef(); _local5.userData = "bgjoint"; _local5.body1 = m_world.GetGroundBody(); _local5.body2 = _local4; _local5.target.Set(_local2, _local3); _local5.maxForce = (900000 * _local4.GetMass()); _local5.timeStep = m_timeStep; m_world.CreateJoint(_local5); }; }; if (_arg1.keyCode == KeyRopeJoint){ if (jointpoint == null){ _local2 = mouseXWorldPhys; _local3 = mouseYWorldPhys; _local4 = GetBodyAt(_local2, _local3, true); if ((_local4 is b2Body)){ jointpoint = new b2Vec2(_local2, _local3); jointbody = _local4; }; }; }; if (_arg1.keyCode == KeyObjJoint){ if (jointpoint == null){ _local2 = mouseXWorldPhys; _local3 = mouseYWorldPhys; _local4 = GetBodyAt(_local2, _local3, true); if ((_local4 is b2Body)){ jointpoint = new b2Vec2(_local2, _local3); jointbody = _local4; }; }; }; if (_arg1.keyCode == KeyMotorJoint){ if (jointpoint == null){ _local2 = mouseXWorldPhys; _local3 = mouseYWorldPhys; _local4 = GetBodyAt(_local2, _local3, true); if ((_local4 is b2Body)){ jointpoint = new b2Vec2(_local2, _local3); jointbody = _local4; }; }; }; if (_arg1.keyCode == KeyMouseCut){ madeby = "ubercut"; CustomCut(mouseX, mouseY, 36, 100, 1, new Point((Math.random() * 800), (Math.random() * 600)), 360); }; if (_arg1.keyCode == KeyExplosion){ explosion = true; }; if (_arg1.keyCode == KeyMultipleSelect){ multipleSelected = true; if (((Input.mouseDown) && (!((speed == 0))))){ _local9 = 500; _local10 = m_world.m_bodyList; while (_local10) { _local11 = new Point(_local10.GetPosition().x, _local10.GetPosition().y); _local6 = (mouseXWorldPhys - _local11.x); _local7 = (mouseYWorldPhys - _local11.y); _local8 = ((_local6 * _local6) + (_local7 * _local7)); if (_local8 < (50 * lagMod)){ _local10.ApplyImpulse(new b2Vec2(((_local9 * _local10.GetMass()) / (100 / (_local6 / 10))), ((_local9 * _local10.GetMass()) / (100 / (_local7 / 10)))), _local10.GetWorldCenter()); }; _local10 = _local10.m_next; }; }; }; if (_arg1.keyCode == KeyAnnihilator){ _local12 = new b2BodyDef(); bulletType = "ann"; _local12.linearDamping = (Interface.GlobalField_Density.text / 500); _local12.userData = "bullet"; _local12.isBullet = true; _local13 = new b2CircleDef(); _local13.density = (9000 * lagMod); _local13.friction = 0; _local13.restitution = 0; if (toggleSpawn == 1){ _local2 = (Math.random() * 800); _local3 = (Math.random() * 600); } else { _local2 = mouseX; _local3 = mouseY; }; _local13.radius = (((Math.random() * 9) + 3) / m_physScale); _local12.position.Set((_local2 / m_physScale), (_local3 / m_physScale)); _local4 = m_world.CreateBody(_local12); _local4.CreateShape(_local13); _local4.SetMassFromShapes(); }; if (_arg1.keyCode == 90){ spawnObject("explosive"); }; if (_arg1.keyCode == KeyBreakable){ if (multipleSelected){ spawnObject("breakable2"); } else { spawnObject("breakable"); }; }; if (_arg1.keyCode == KeyStar){ spawnObject("star"); }; if (_arg1.keyCode == KeyOctagon){ spawnObject("octagon"); }; if (_arg1.keyCode == KeyCircle){ if (multipleSelected){ spawnObject("magnet"); } else { spawnObject("circle"); }; }; if (_arg1.keyCode == KeyGridCut){ _local14 = (15 * Interface.GlobalField_Size.text); _local2 = (mouseX - ((_local14 * _local14) / 2)); _local3 = (mouseY - ((_local14 * _local14) / 2)); madeby = "ubercut"; _local15 = 0; while (_local15 <= _local14) { CustomCut((_local2 + (_local15 * _local14)), _local3, 1, (1.5 * (_local14 * _local14)), 2, new Point((_local2 + (_local15 * _local14)), (_local3 + _local14)), 0); _local15++; }; _local16 = 0; while (_local16 <= Math.floor((_local14 * 1.5))) { CustomCut(_local2, (_local3 + (_local16 * _local14)), 1, (_local14 * _local14), 2, new Point((_local2 + _local14), (_local3 + (_local16 * _local14))), 0); _local16++; }; }; if (_arg1.keyCode == Keypistol){ if (!pistolOnStage){ spawnObject("pistol"); }; if (pistolOnStage){ if (pistolReady){ pistolReady = false; pistolReloading = true; _local17 = new Timer(((600 / (timerSpeed * 2)) / lagMod), 1); _local17.addEventListener(TimerEvent.TIMER, readyPistol); _local17.start(); if (pistolDirection == "1"){ _local19 = new b2Vec2((pistolBody.GetPosition().x + ((Math.cos(pistolBody.GetAngle()) * Interface.GlobalField_Size.text) * -3)), (pistolBody.GetPosition().y + ((Math.sin(pistolBody.GetAngle()) * Interface.GlobalField_Size.text) * -3))); _local20 = -50; pistolBody.ApplyImpulse(new b2Vec2((40 * Math.cos(pistolBody.GetAngle())), (40 * Math.sin(pistolBody.GetAngle()))), new b2Vec2(_local19.x, _local19.y)); } else { _local19 = new b2Vec2((pistolBody.GetPosition().x + ((Math.cos(pistolBody.GetAngle()) * Interface.GlobalField_Size.text) * 3)), (pistolBody.GetPosition().y + ((Math.sin(pistolBody.GetAngle()) * Interface.GlobalField_Size.text) * 3))); _local20 = 50; pistolBody.ApplyImpulse(new b2Vec2((-40 * Math.cos(pistolBody.GetAngle())), (-40 * Math.sin(pistolBody.GetAngle()))), new b2Vec2(_local19.x, _local19.y)); }; _local18 = new Point(_local19.x, _local19.y); bulletType = "pis"; addbullet((_local18.x * m_phys_scale), (_local18.y * m_phys_scale), 1, 4, new Point((_local20 * Math.cos(pistolBody.GetAngle())), (_local20 * Math.sin(pistolBody.GetAngle()))), 5); } else { if (((!(pistolReady)) && (!(pistolReloading)))){ pistolReloading = true; _local17 = new Timer(((600 / (timerSpeed * 2)) / lagMod), 1); _local17.addEventListener(TimerEvent.TIMER, readyPistol); _local17.start(); }; }; }; }; if (_arg1.keyCode == Keyshotgun){ if (!shotgunOnStage){ spawnObject("shotgun"); }; if (shotgunOnStage){ if (shotgunReady){ shotgunReady = false; shotgunReloading = true; _local21 = new Timer(((1000 / (timerSpeed * 2)) / lagMod), 1); _local21.addEventListener(TimerEvent.TIMER, readyShotgun); _local21.start(); if (shotgunDirection == "1"){ _local22 = new b2Vec2((shotgunBody.GetPosition().x + ((Math.cos(shotgunBody.GetAngle()) * Interface.GlobalField_Size.text) * -11)), ((-0.5 + shotgunBody.GetPosition().y) + ((Math.sin(shotgunBody.GetAngle()) * Interface.GlobalField_Size.text) * -11))); _local23 = -75; shotgunBody.ApplyImpulse(new b2Vec2((800 * Math.cos(shotgunBody.GetAngle())), (800 * Math.sin(shotgunBody.GetAngle()))), new b2Vec2(_local22.x, _local22.y)); } else { _local22 = new b2Vec2((shotgunBody.GetPosition().x + ((Math.cos(shotgunBody.GetAngle()) * Interface.GlobalField_Size.text) * 10)), ((-0.5 + shotgunBody.GetPosition().y) + ((Math.sin(shotgunBody.GetAngle()) * Interface.GlobalField_Size.text) * 10))); _local23 = 75; shotgunBody.ApplyImpulse(new b2Vec2((-800 * Math.cos(shotgunBody.GetAngle())), (-800 * Math.sin(shotgunBody.GetAngle()))), new b2Vec2(_local22.x, _local22.y)); }; _local18 = new Point(_local22.x, _local22.y); bulletType = "sho"; addbullet((_local18.x * m_phys_scale), (_local18.y * m_phys_scale), (18 * lagMod), 2, new Point((_local23 * Math.cos(shotgunBody.GetAngle())), (_local23 * Math.sin(shotgunBody.GetAngle()))), 50); } else { if (((!(shotgunReady)) && (!(shotgunReloading)))){ shotgunReloading = true; _local21 = new Timer(((1000 / (timerSpeed * 2)) / lagMod), 1); _local21.addEventListener(TimerEvent.TIMER, readyShotgun); _local21.start(); }; }; }; }; if (_arg1.keyCode == Keyassault){ if (!assaultOnStage){ spawnObject("assault"); }; if (assaultOnStage){ if (assaultReady){ assaultReady = false; assaultReloading = true; _local24 = new Timer(((100 / (timerSpeed * 2)) / lagMod), 1); _local24.addEventListener(TimerEvent.TIMER, readyAssault); _local24.start(); if (assaultDirection == "1"){ _local25 = new b2Vec2((assaultBody.GetPosition().x + ((Math.cos(assaultBody.GetAngle()) * Interface.GlobalField_Size.text) * -8)), (assaultBody.GetPosition().y + ((Math.sin(assaultBody.GetAngle()) * Interface.GlobalField_Size.text) * -8))); _local26 = -50; assaultBody.ApplyImpulse(new b2Vec2((100 * Math.cos(assaultBody.GetAngle())), (100 * Math.sin(assaultBody.GetAngle()))), new b2Vec2(_local25.x, _local25.y)); } else { _local25 = new b2Vec2((assaultBody.GetPosition().x + ((Math.cos(assaultBody.GetAngle()) * Interface.GlobalField_Size.text) * 8)), (assaultBody.GetPosition().y + ((Math.sin(assaultBody.GetAngle()) * Interface.GlobalField_Size.text) * 8))); _local26 = 50; assaultBody.ApplyImpulse(new b2Vec2((-100 * Math.cos(assaultBody.GetAngle())), (-100 * Math.sin(assaultBody.GetAngle()))), new b2Vec2(_local25.x, _local25.y)); }; _local18 = new Point(_local25.x, _local25.y); bulletType = "ass"; addbullet((_local18.x * m_phys_scale), (_local18.y * m_phys_scale), 1, 5, new Point((_local26 * Math.cos(assaultBody.GetAngle())), (_local26 * Math.sin(assaultBody.GetAngle()))), 30); } else { if (((!(assaultReady)) && (!(assaultReloading)))){ assaultReloading = true; _local24 = new Timer(((100 / (timerSpeed * 2)) / lagMod), 1); _local24.addEventListener(TimerEvent.TIMER, readyAssault); _local24.start(); }; }; }; }; if (_arg1.keyCode == Keym79){ if (!m79OnStage){ spawnObject("m79"); }; if (m79OnStage){ if (m79Ready){ m79Ready = false; m79Reloading = true; _local27 = new Timer(((1200 / (timerSpeed * 2)) / lagMod), 1); _local27.addEventListener(TimerEvent.TIMER, readyM79); _local27.start(); if (m79Direction == "1"){ _local28 = new b2Vec2((m79Body.GetPosition().x + ((Math.cos(m79Body.GetAngle()) * Interface.GlobalField_Size.text) * -5)), (m79Body.GetPosition().y + ((Math.sin(m79Body.GetAngle()) * Interface.GlobalField_Size.text) * -5))); _local29 = -50; m79Body.ApplyImpulse(new b2Vec2((1000 * Math.cos(m79Body.GetAngle())), (1000 * Math.sin(m79Body.GetAngle()))), new b2Vec2(_local28.x, _local28.y)); } else { _local28 = new b2Vec2((m79Body.GetPosition().x + ((Math.cos(m79Body.GetAngle()) * Interface.GlobalField_Size.text) * 5)), (m79Body.GetPosition().y + ((Math.sin(m79Body.GetAngle()) * Interface.GlobalField_Size.text) * 5))); _local29 = 50; m79Body.ApplyImpulse(new b2Vec2((-1000 * Math.cos(m79Body.GetAngle())), (-1000 * Math.sin(m79Body.GetAngle()))), new b2Vec2(_local28.x, _local28.y)); }; _local18 = new Point(_local28.x, _local28.y); bulletType = "m79"; addbullet((_local18.x * m_phys_scale), (_local18.y * m_phys_scale), 1, 6, new Point((_local29 * Math.cos(m79Body.GetAngle())), (_local29 * Math.sin(m79Body.GetAngle()))), 5); } else { if (((!(m79Ready)) && (!(m79Reloading)))){ m79Reloading = true; _local27 = new Timer(((1200 / (timerSpeed * 2)) / lagMod), 1); _local27.addEventListener(TimerEvent.TIMER, readyM79); _local27.start(); }; }; }; }; if (_arg1.keyCode == Keysniper){ if (!sniperOnStage){ spawnObject("sniper"); }; if (sniperOnStage){ if (sniperReady){ sniperReady = false; sniperReloading = true; _local30 = new Timer(((1500 / (timerSpeed * 2)) / lagMod), 1); _local30.addEventListener(TimerEvent.TIMER, readySniper); _local30.start(); if (sniperDirection == "1"){ _local31 = new b2Vec2((sniperBody.GetPosition().x + ((Math.cos(sniperBody.GetAngle()) * Interface.GlobalField_Size.text) * -11)), (sniperBody.GetPosition().y + ((Math.sin(sniperBody.GetAngle()) * Interface.GlobalField_Size.text) * -11))); _local32 = -200; sniperBody.ApplyImpulse(new b2Vec2((3000 * Math.cos(sniperBody.GetAngle())), (1000 * Math.sin(sniperBody.GetAngle()))), new b2Vec2(_local31.x, _local31.y)); } else { _local31 = new b2Vec2((sniperBody.GetPosition().x + ((Math.cos(sniperBody.GetAngle()) * Interface.GlobalField_Size.text) * 11)), (sniperBody.GetPosition().y + ((Math.sin(sniperBody.GetAngle()) * Interface.GlobalField_Size.text) * 11))); _local32 = 200; sniperBody.ApplyImpulse(new b2Vec2((-3000 * Math.cos(sniperBody.GetAngle())), (-1000 * Math.sin(sniperBody.GetAngle()))), new b2Vec2(_local31.x, _local31.y)); }; _local18 = new Point(_local31.x, _local31.y); bulletType = "sni"; addbullet((_local18.x * m_phys_scale), (_local18.y * m_phys_scale), 1, 7, new Point((_local32 * Math.cos(sniperBody.GetAngle())), (_local32 * Math.sin(sniperBody.GetAngle()))), 5); } else { if (((!(sniperReady)) && (!(sniperReloading)))){ sniperReloading = true; _local30 = new Timer(((1500 / (timerSpeed * 2)) / lagMod), 1); _local30.addEventListener(TimerEvent.TIMER, readySniper); _local30.start(); }; }; }; }; if (_arg1.keyCode == Keyflamer){ if (!flamerOnStage){ spawnObject("flamer"); }; if (flamerOnStage){ if (flamerReady){ flamerReady = false; flamerReloading = true; _local33 = new Timer(((100 / (timerSpeed * 2)) / lagMod), 1); _local33.addEventListener(TimerEvent.TIMER, readyFlamer); _local33.start(); if (flamerDirection == "1"){ _local34 = new b2Vec2((flamerBody.GetPosition().x + ((Math.cos(flamerBody.GetAngle()) * Interface.GlobalField_Size.text) * -6)), (flamerBody.GetPosition().y + ((Math.sin(flamerBody.GetAngle()) * Interface.GlobalField_Size.text) * -6))); _local35 = -20; flamerBody.ApplyImpulse(new b2Vec2((10 * Math.cos(flamerBody.GetAngle())), (10 * Math.sin(flamerBody.GetAngle()))), new b2Vec2(_local34.x, _local34.y)); } else { _local34 = new b2Vec2((flamerBody.GetPosition().x + ((Math.cos(flamerBody.GetAngle()) * Interface.GlobalField_Size.text) * 5)), (flamerBody.GetPosition().y + ((Math.sin(flamerBody.GetAngle()) * Interface.GlobalField_Size.text) * 5))); _local35 = 20; flamerBody.ApplyImpulse(new b2Vec2((-10 * Math.cos(flamerBody.GetAngle())), (-10 * Math.sin(flamerBody.GetAngle()))), new b2Vec2(_local34.x, _local34.y)); }; _local18 = new Point(_local34.x, _local34.y); bulletType = "fla"; addbullet((_local18.x * m_phys_scale), (_local18.y * m_phys_scale), 10, 4, new Point((_local35 * Math.cos(flamerBody.GetAngle())), (_local35 * Math.sin(flamerBody.GetAngle()))), 20); } else { if (((!(flamerReady)) && (!(flamerReloading)))){ flamerReloading = true; _local33 = new Timer(((100 / (timerSpeed * 2)) / lagMod), 1); _local33.addEventListener(TimerEvent.TIMER, readyFlamer); _local33.start(); }; }; }; }; if (_arg1.keyCode == Keyminigun){ if (!minigunOnStage){ spawnObject("minigun"); }; if (minigunOnStage){ if (minigunReady){ minigunReady = false; minigunReloading = true; _local36 = new Timer(((10 / (timerSpeed * 2)) / lagMod), 1); _local36.addEventListener(TimerEvent.TIMER, readyMinigun); _local36.start(); if (minigunDirection == "1"){ _local37 = new b2Vec2((minigunBody.GetPosition().x + ((Math.cos(minigunBody.GetAngle()) * Interface.GlobalField_Size.text) * -12)), (minigunBody.GetPosition().y + ((Math.sin(minigunBody.GetAngle()) * Interface.GlobalField_Size.text) * -12))); _local38 = -100; minigunBody.ApplyImpulse(new b2Vec2((1000 * Math.cos(minigunBody.GetAngle())), (500 * Math.sin(minigunBody.GetAngle()))), new b2Vec2(_local37.x, _local37.y)); } else { _local37 = new b2Vec2((minigunBody.GetPosition().x + ((Math.cos(minigunBody.GetAngle()) * Interface.GlobalField_Size.text) * 12)), (minigunBody.GetPosition().y + ((Math.sin(minigunBody.GetAngle()) * Interface.GlobalField_Size.text) * 12))); _local38 = 100; minigunBody.ApplyImpulse(new b2Vec2((-1000 * Math.cos(minigunBody.GetAngle())), (-500 * Math.sin(minigunBody.GetAngle()))), new b2Vec2(_local37.x, _local37.y)); }; _local18 = new Point(_local37.x, _local37.y); bulletType = "min"; addbullet((_local18.x * m_phys_scale), (_local18.y * m_phys_scale), 1, 4, new Point((_local38 * Math.cos(minigunBody.GetAngle())), (_local38 * Math.sin(minigunBody.GetAngle()))), 20); } else { if (((!(minigunReady)) && (!(minigunReloading)))){ minigunReloading = true; _local36 = new Timer(((10 / (timerSpeed * 2)) / lagMod), 1); _local36.addEventListener(TimerEvent.TIMER, readyMinigun); _local36.start(); }; }; }; }; if (_arg1.keyCode == Keycannon){ if (!cannonOnStage){ spawnObject("cannon"); }; if (cannonOnStage){ if (cannonReady){ cannonReady = false; cannonReloading = true; _local39 = new Timer(((1000 / (timerSpeed * 2)) / lagMod), 1); _local39.addEventListener(TimerEvent.TIMER, readyCannon); _local39.start(); if (cannonDirection == "1"){ _local43 = new b2Vec2((cannonBody.GetPosition().x + ((Math.cos(cannonBody.GetAngle()) * Interface.GlobalField_Size.text) * 1)), (cannonBody.GetPosition().y + ((Math.sin(cannonBody.GetAngle()) * Interface.GlobalField_Size.text) * 1))); _local44 = -300; cannonBody.ApplyImpulse(new b2Vec2((10000 * Math.cos(cannonBody.GetAngle())), (10000 * Math.sin(cannonBody.GetAngle()))), new b2Vec2(_local43.x, _local43.y)); } else { _local43 = new b2Vec2((cannonBody.GetPosition().x + ((Math.cos(cannonBody.GetAngle()) * Interface.GlobalField_Size.text) * -1)), (cannonBody.GetPosition().y + ((Math.sin(cannonBody.GetAngle()) * Interface.GlobalField_Size.text) * -1))); _local44 = 300; cannonBody.ApplyImpulse(new b2Vec2((-10000 * Math.cos(cannonBody.GetAngle())), (-10000 * Math.sin(cannonBody.GetAngle()))), new b2Vec2(_local43.x, _local43.y)); }; _local18 = new Point(_local43.x, _local43.y); while (cannonArray.length > 0) { _local10 = cannonArray[0]; _local40 = (_local18.x - _local10.GetPosition().x); _local41 = (_local18.y - _local10.GetPosition().y); _local42 = ((_local40 * _local40) + (_local41 * _local41)); if ((((_local42 < 200)) && (!((_local10.GetUserData() == "cannon"))))){ _local10.ApplyImpulse(new b2Vec2(((_local44 * Math.cos(cannonBody.GetAngle())) * _local10.GetMass()), ((_local44 * Math.sin(cannonBody.GetAngle())) * _local10.GetMass())), _local10.GetPosition()); }; cannonArray.shift(); }; } else { if (((!(cannonReady)) && (!(cannonReloading)))){ cannonReloading = true; _local39 = new Timer(((1000 / (timerSpeed * 2)) / lagMod), 1); _local39.addEventListener(TimerEvent.TIMER, readyCannon); _local39.start(); }; }; }; }; if (_arg1.keyCode == Keyharpoon){ if (!harpoonOnStage){ spawnObject("harpoon"); }; if (harpoonOnStage){ if (harpoonReady){ harpoonReady = false; harpoonReloading = true; _local45 = new Timer(((600 / (timerSpeed * 2)) / lagMod), 1); _local45.addEventListener(TimerEvent.TIMER, readyHarpoon); _local45.start(); if (harpoonDirection == "1"){ _local46 = new b2Vec2((harpoonBody.GetPosition().x + ((Math.cos(harpoonBody.GetAngle()) * Interface.GlobalField_Size.text) * -6)), (harpoonBody.GetPosition().y + ((Math.sin(harpoonBody.GetAngle()) * Interface.GlobalField_Size.text) * -3))); _local47 = 20000; harpoonBody.ApplyImpulse(new b2Vec2((100 * Math.cos(harpoonBody.GetAngle())), (100 * Math.sin(harpoonBody.GetAngle()))), new b2Vec2(_local46.x, _local46.y)); spawnArrow((_local46.x * m_physScale), (_local46.y * m_physScale), (harpoonBody.GetAngle() + Math.PI), _local47); }; if (harpoonDirection == "2"){ _local46 = new b2Vec2((harpoonBody.GetPosition().x + ((Math.cos(harpoonBody.GetAngle()) * Interface.GlobalField_Size.text) * 6)), (harpoonBody.GetPosition().y + ((Math.sin(harpoonBody.GetAngle()) * Interface.GlobalField_Size.text) * 3))); _local47 = 20000; harpoonBody.ApplyImpulse(new b2Vec2((-100 * Math.cos(harpoonBody.GetAngle())), (-100 * Math.sin(harpoonBody.GetAngle()))), new b2Vec2(_local46.x, _local46.y)); spawnArrow((_local46.x * m_physScale), (_local46.y * m_physScale), harpoonBody.GetAngle(), _local47); }; } else { if (((!(harpoonReady)) && (!(harpoonReloading)))){ harpoonReloading = true; _local45 = new Timer(((600 / (timerSpeed * 2)) / lagMod), 1); _local45.addEventListener(TimerEvent.TIMER, readyHarpoon); _local45.start(); }; }; }; }; if (_arg1.keyCode == Keymissile){ spawnObject("rocket"); }; if (_arg1.keyCode == KeyLaser){ if (!laserOnStage){ _local48 = new b2BodyDef(); _local49 = new b2PolygonDef(); _local48.userData = "laser"; _local48.position.Set(mouseXWorldPhys, mouseYWorldPhys); laserBody = m_world.CreateBody(_local48); _local49.SetAsBox(5, 1); _local49.density = 4; laserBody.CreateShape(_local49); laserBody.SetMassFromShapes(); laserOnStage = true; }; if (laserOnStage){ madeby = "laser"; laserStart = new b2Vec2((5 - 0.1), 0); laserDir = new b2Vec2(segmentLength, 0); segment.p1 = laserBody.GetWorldPoint(laserStart); segment.p2 = b2Math.AddVV(segment.p1, laserBody.GetWorldVector(new b2Vec2((laserDir.x * 2), (laserDir.y * 2)))); madeby = "ubercut"; CustomCut((segment.p1.x * m_physScale), (segment.p1.y * m_physScale), (100 * lagMod), 1000, 2, new Point(((segment.p2.x * m_physScale) + (segment.p2.x * Math.cos((laserBody.GetAngle() / (Math.PI / 180))))), ((segment.p2.y * m_physScale) + (segment.p2.y * Math.sin((laserBody.GetAngle() / (Math.PI / 180)))))), 0.3); }; }; if (_arg1.keyCode == KeyRandomCut){ madeby = "ubercut"; _local15 = 0; while (_local15 < (10 * lagMod)) { CustomCut((Math.random() * 800), (Math.random() * 600), 1, ((Math.random() * 500) + 100), 2, new Point((Math.random() * 800), (Math.random() * 600)), 360); _local15++; }; }; if (_arg1.keyCode == KeySquare){ spawnObject("square"); }; if (_arg1.keyCode == KeyDisableHUD){ if (HUDstatus == 1){ Interface.visible = true; InterfaceTOP.visible = true; keyhelp.visible = true; }; if (HUDstatus == 2){ Interface.visible = true; InterfaceTOP.visible = true; keyhelp.visible = false; }; HUDstatus++; if (HUDstatus > 2){ HUDstatus = 1; }; }; if (_arg1.keyCode == KeyUp){ if (multipleSelected){ _local10 = m_world.m_bodyList; while (_local10) { _local11 = new Point(_local10.GetPosition().x, _local10.GetPosition().y); _local6 = (mouseXWorldPhys - _local11.x); _local7 = (mouseYWorldPhys - _local11.y); _local8 = ((_local6 * _local6) + (_local7 * _local7)); if (_local8 < 60){ resizeBodyAtMouse(_local10, 1.25); }; _local10 = _local10.m_next; }; } else { if ((GetBodyAt(mouseXWorldPhys, mouseYWorldPhys) is b2Body)){ if (m_mouseJoint){ m_world.DestroyJoint(m_mouseJoint); m_mouseJoint = null; }; resizeBodyAtMouse(GetBodyAt(mouseXWorldPhys, mouseYWorldPhys), 1.25); }; }; }; if (_arg1.keyCode == KeyDown){ if (multipleSelected){ _local10 = m_world.m_bodyList; while (_local10) { _local11 = new Point(_local10.GetPosition().x, _local10.GetPosition().y); _local6 = (mouseXWorldPhys - _local11.x); _local7 = (mouseYWorldPhys - _local11.y); _local8 = ((_local6 * _local6) + (_local7 * _local7)); if (_local8 < 60){ resizeBodyAtMouse(_local10, 0.8); }; _local10 = _local10.m_next; }; } else { if ((GetBodyAt(mouseXWorldPhys, mouseYWorldPhys) is b2Body)){ if (m_mouseJoint){ m_world.DestroyJoint(m_mouseJoint); m_mouseJoint = null; }; resizeBodyAtMouse(GetBodyAt(mouseXWorldPhys, mouseYWorldPhys), 0.8); }; }; }; if (_arg1.keyCode == KeyRight){ if (multipleSelected){ _local10 = m_world.m_bodyList; while (_local10) { _local11 = new Point(_local10.GetPosition().x, _local10.GetPosition().y); _local6 = (mouseXWorldPhys - _local11.x); _local7 = (mouseYWorldPhys - _local11.y); _local8 = ((_local6 * _local6) + (_local7 * _local7)); if ((((_local8 < 60)) && (!(_local10.IsStatic())))){ _local10.SetXForm(_local10.GetPosition(), (_local10.GetAngle() + (5 * (Math.PI / 180)))); }; _local10 = _local10.m_next; }; } else { if ((GetBodyAt(mouseXWorldPhys, mouseYWorldPhys) is b2Body)){ GetBodyAt(mouseXWorldPhys, mouseYWorldPhys).SetXForm(GetBodyAt(mouseXWorldPhys, mouseYWorldPhys).GetPosition(), (GetBodyAt(mouseXWorldPhys, mouseYWorldPhys).GetAngle() + (5 * (Math.PI / 180)))); }; }; }; if (_arg1.keyCode == KeyLeft){ if (multipleSelected){ _local10 = m_world.m_bodyList; while (_local10) { _local11 = new Point(_local10.GetPosition().x, _local10.GetPosition().y); _local6 = (mouseXWorldPhys - _local11.x); _local7 = (mouseYWorldPhys - _local11.y); _local8 = ((_local6 * _local6) + (_local7 * _local7)); if ((((_local8 < 60)) && (!(_local10.IsStatic())))){ _local10.SetXForm(_local10.GetPosition(), (_local10.GetAngle() - (5 * (Math.PI / 180)))); }; _local10 = _local10.m_next; }; } else { if ((GetBodyAt(mouseXWorldPhys, mouseYWorldPhys) is b2Body)){ GetBodyAt(mouseXWorldPhys, mouseYWorldPhys).SetXForm(GetBodyAt(mouseXWorldPhys, mouseYWorldPhys).GetPosition(), (GetBodyAt(mouseXWorldPhys, mouseYWorldPhys).GetAngle() - (5 * (Math.PI / 180)))); }; }; }; }; } private function reset():void{ var _local1:b2Body; magnetNumber = 0; magnetArray = []; _local1 = m_world.m_bodyList; while (_local1) { destroyBody(_local1); _local1 = _local1.m_next; }; while (blood.numChildren > 0) { blood.removeChildAt(0); Particle.inst.update_i.removeEventListener(TimerEvent.TIMER, update); Particle.inst.update_i.stop(); }; CutterTest(); } private function readyAssault(_arg1:TimerEvent):void{ assaultReady = true; assaultReloading = false; } private function readyShotgun(_arg1:TimerEvent):void{ shotgunReady = true; shotgunReloading = false; } private function readyPistol(_arg1:TimerEvent):void{ pistolReady = true; pistolReloading = false; } private function readyM79(_arg1:TimerEvent):void{ m79Ready = true; m79Reloading = false; } private function readySniper(_arg1:TimerEvent):void{ sniperReady = true; sniperReloading = false; } private function readyFlamer(_arg1:TimerEvent):void{ flamerReady = true; flamerReloading = false; } private function readyMinigun(_arg1:TimerEvent):void{ minigunReady = true; minigunReloading = false; } private function readyCannon(_arg1:TimerEvent):void{ cannonReady = true; cannonReloading = false; } private function readyHarpoon(_arg1:TimerEvent):void{ harpoonReady = true; harpoonReloading = false; } public function throwBall(_arg1:Point, _arg2:Point, _arg3:int):void{ var _local4:*; var _local5:Point; var _local6:Ball; _local4 = 0; while (_local4 <= _arg3) { _local5 = new Point(((Math.random() * _local4) - (_local4 / 2)), ((Math.random() * _local4) - (_local4 / 2))); _local6 = new Ball(_arg1, _local5, particleGravity, particleFriction); blood.addChild(_local6); _local4++; }; } private function removelines(_arg1:TimerEvent):void{ while (sp.numChildren > 0) { sp.removeChildAt(0); }; } public function keyUps(_arg1:KeyboardEvent){ var _local2:*; var _local3:*; var _local4:*; var _local5:b2DistanceJointDef; var _local6:b2RevoluteJointDef; if (_arg1.keyCode == KeyRopeJoint){ if (jointpoint != null){ _local2 = mouseXWorldPhys; _local3 = mouseYWorldPhys; _local4 = GetBodyAt(_local2, _local3, true); if ((((_local4 is b2Body)) && (!((_local4 == jointbody))))){ _local5 = new b2DistanceJointDef(); _local5.collideConnected = true; _local5.userData = "ropejoint"; _local5.Initialize(jointbody, _local4, jointpoint, new b2Vec2(_local2, _local3)); _local5.frequencyHz = 2; _local5.dampingRatio = 0.01; m_world.CreateJoint(_local5); jointpoint = null; jointbody = null; } else { jointpoint = null; }; }; }; if (_arg1.keyCode == KeyObjJoint){ if (jointpoint != null){ _local2 = mouseXWorldPhys; _local3 = mouseYWorldPhys; _local4 = GetBodyAt(_local2, _local3, true); if ((((_local4 is b2Body)) && (!((_local4 == jointbody))))){ _local5 = new b2DistanceJointDef(); _local5.collideConnected = true; _local5.userData = "objjoint"; _local5.Initialize(jointbody, _local4, jointpoint, new b2Vec2(_local2, _local3)); m_world.CreateJoint(_local5); jointpoint = null; jointbody = null; } else { jointpoint = null; }; }; }; if (_arg1.keyCode == KeyMotorJoint){ if (jointpoint != null){ _local2 = mouseXWorldPhys; _local3 = mouseYWorldPhys; _local4 = GetBodyAt(_local2, _local3, true); if ((((_local4 is b2Body)) && (!((_local4 == jointbody))))){ _local6 = new b2RevoluteJointDef(); _local6.Initialize(jointbody, _local4, new b2Vec2(_local2, _local3)); _local6.motorSpeed = 1; _local6.userData = "motjoint"; _local6.collideConnected = true; _local6.maxMotorTorque = (1000 * _local4.GetMass()); _local6.enableMotor = true; _local6.enableLimit = false; m_world.CreateJoint(_local6); jointpoint = null; jointbody = null; } else { jointpoint = null; }; }; }; if (_arg1.keyCode == KeyDrawWall){ drawingWall = false; }; if (_arg1.keyCode == KeyMultipleSelect){ multipleSelected = false; if (pauseMoving == true){ pauseMoving = false; pauseMovingBody = null; pauseMovingBodies = []; pauseMovingPos = null; }; }; if (_arg1.keyCode == KeyCut){ ctrldown = false; }; if (_arg1.keyCode == KeyDrawObj){ DrawingCustomShape = false; create_custom_obj(); customObjArray = []; canvas.graphics.clear(); canvas.graphics.lineStyle(1, 0xFFFFFF); }; } public function CutterTest(){ var _local1:b2Body; var _local2:b2BodyDef; var _local3:b2PolygonDef; _local1 = null; _local2 = new b2BodyDef(); _local2.position.Set(26.5, 0); _local2.userData = "dontcutme"; _local1 = m_world.CreateBody(_local2); _local3 = new b2PolygonDef(); _local3.SetAsBox(27.5, 1); _local3.friction = Interface.GlobalField_Friction.text; _local3.restitution = Interface.GlobalField_Restitution.text; _local1.CreateShape(_local3); _local2.position.Set(26.5, 39); _local2.userData = "dontcutme"; _local1 = m_world.CreateBody(_local2); _local3.SetAsBox(27.5, 1); _local1.CreateShape(_local3); _local2.position.Set(0, 20); _local2.userData = "dontcutme"; _local1 = m_world.CreateBody(_local2); _local3.SetAsBox(1, 21); _local1.CreateShape(_local3); _local2.position.Set(53, 20); _local2.userData = "dontcutme"; _local1 = m_world.CreateBody(_local2); _local3.SetAsBox(1, 21); _local1.CreateShape(_local3); } public function CheckPolyShape(_arg1:b2PolygonDef){ var _local2:Array; var _local3:*; var _local4:b2Vec2; var _local5:Number; var _local6:b2Vec2; var _local7:Number; var _local8:*; var _local9:*; var _local10:b2Vec2; var _local11:*; var _local12:b2Vec2; var _local13:*; var _local14:Number; var _local15:Number; var _local16:b2Vec2; var _local17:b2Vec2; var _local18:*; var _local19:b2Vec2; var _local20:b2Vec2; var _local21:Number; var _local22:Number; var _local23:b2Vec2; var _local24:Number; var _local25:b2Vec2; var _local26:b2Vec2; var _local27:b2Vec2; var _local28:b2Vec2; var _local29:b2Vec2; if (!(((3 <= _arg1.vertexCount)) && ((_arg1.vertexCount <= b2_maxPolygonVertices)))){ return (-1); }; _local2 = new Array(_arg1.vertexCount); _local3 = 0; while (_local3 < _arg1.vertexCount) { _local8 = _local3; _local9 = 0; if ((_local3 + 1) < _arg1.vertexCount){ _local9 = (_local3 + 1); } else { _local9 = 0; }; _local10 = _arg1.vertices[_local9].Copy(); _local10.Subtract(_arg1.vertices[_local8]); if (!(_local10.LengthSquared() > (Number.MIN_VALUE * Number.MIN_VALUE))){ return (-1); }; _local2[_local3] = b2Math.b2CrossVF(_local10, 1); _local2[_local3].Normalize(); _local3++; }; _local3 = 0; while (_local3 < _arg1.vertexCount) { _local11 = 0; while (_local11 < _arg1.vertexCount) { if ((((_local11 == _local3)) || ((_local11 == ((_local3 + 1) % _arg1.vertexCount))))){ } else { _local12 = b2Math.SubtractVV(_arg1.vertices[_local11], _arg1.vertices[_local3]); _local13 = b2Math.b2Dot(_local2[_local3], _local12); if (!(_local13 < -(b2Settings.b2_linearSlop))){ return (-1); }; }; _local11++; }; _local3++; }; _local3 = 1; while (_local3 < _arg1.vertexCount) { _local14 = b2Math.b2CrossVV(_local2[(_local3 - 1)], _local2[_local3]); _local14 = b2Math.b2Clamp(_local14, -1, 1); _local15 = Math.asin(_local14); if (!(_local15 > b2Settings.b2_angularSlop)){ return (-1); }; _local3++; }; _local4 = new b2Vec2(); _local5 = 0; _local6 = new b2Vec2(0, 0); _local7 = (1 / 3); _local3 = 0; while (_local3 < _arg1.vertexCount) { _local16 = _local6; _local17 = _arg1.vertices[_local3]; _local18 = 0; if ((_local3 + 1) < _arg1.vertexCount){ _local18 = _arg1.vertices[(_local3 + 1)]; } else { _local18 = _arg1.vertices[0]; }; _local19 = b2Math.SubtractVV(_local17, _local16); _local20 = b2Math.SubtractVV(_local18, _local16); _local21 = b2Math.b2CrossVV(_local19, _local20); _local22 = (0.5 * _local21); _local5 = (_local5 + _local22); _local23 = _local16.Copy(); _local23.Add(_local16); _local23.Add(_local17); _local24 = (_local22 * _local7); _local25 = b2Math.MulFV(_local24, _local23); _local4.Add(_local23); _local3++; }; if (!(_local5 > Number.MIN_VALUE)){ return (-1); }; b2Math.MulFV((1 / _local5), _local4); _local3 = 0; while (_local3 < _arg1.vertexCount) { if ((_local3 - 1) >= 0){ _local8 = (_local3 - 1); } else { _local8 = (_arg1.vertexCount - 1); }; _local9 = _local3; _local26 = _local2[_local8]; _local27 = _local2[_local9]; _local28 = b2Math.SubtractVV(_arg1.vertices[_local3], _local4); _local29 = new b2Vec2(); _local29.x = (b2Math.b2Dot(_local26, _local28) - b2Settings.b2_toiSlop); _local29.y = (b2Math.b2Dot(_local27, _local28) - b2Settings.b2_toiSlop); _local3++; }; return (0); } public function SplitShape(_arg1:b2PolygonShape, _arg2, _arg3, _arg4:Array){ var _local5:Array; var _local6:b2Vec2; var _local7:b2Body; var _local8:b2XForm; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:b2Segment; var _local12:b2Vec2; var _local13:b2Vec2; var _local14:b2Vec2; var _local15:Array; var _local16:Array; var _local17:*; var _local18:*; var _local19:*; var _local20:b2Vec2; var _local21:b2Vec2; var _local22:*; if (_arg1 == null){ return (-1); }; if (_arg4 == null){ return (-1); }; if (_arg3 <= 0){ return (-1); }; _local5 = [1]; _local6 = new b2Vec2(); _local7 = _arg1.GetBody(); _local8 = _local7.GetXForm(); if (_arg1.TestSegment(_local8, _local5, _local6, _arg2, 1) != b2Shape.e_hitCollide){ return (-1); }; _local9 = _arg2.p1.Copy(); _local9.Multiply((1 - _local5[0])); _local10 = _arg2.p2.Copy(); _local10.Multiply(_local5[0]); _local9.Add(_local10); _local11 = new b2Segment(); _local11.p1 = _arg2.p2; _local11.p2 = _arg2.p1; if (_arg1.TestSegment(_local8, _local5, _local6, _local11, 1) != e_hitCollide){ return (-1); }; _local12 = _local11.p1.Copy(); _local12.Multiply((1 - _local5[0])); _local10 = _local11.p2.Copy(); _local10.Multiply(_local5[0]); _local12.Add(_local10); _local13 = _local7.GetLocalPoint(_local9); _local14 = _local7.GetLocalPoint(_local12); _local15 = _arg1.GetVertices(); _local16 = [-1, -1]; _local17 = -1; _local18 = 0; while (_local18 < _arg1.GetVertexCount()) { if (b2Math.b2Dot(b2Math.b2CrossVF(b2Math.SubtractVV(_local14, _local13), 1), b2Math.SubtractVV(_local15[_local18], _local13)) > 0){ _local19 = 0; } else { _local19 = 1; }; if (_local17 != _local19){ if (_local17 == 0){ if (_local16[0] != -1){ return (-1); }; _local16[0] = _arg4[_local17].vertexCount; _arg4[_local17].vertices[_arg4[_local17].vertexCount] = _local14; _arg4[_local17].vertexCount++; _arg4[_local17].vertices[_arg4[_local17].vertexCount] = _local13; _arg4[_local17].vertexCount++; }; if (_local17 == 1){ if (_local16[_local17] != -1){ return (-1); }; _local16[_local17] = _arg4[_local17].vertexCount; _arg4[_local17].vertices[_arg4[_local17].vertexCount] = _local13; _arg4[_local17].vertexCount++; _arg4[_local17].vertices[_arg4[_local17].vertexCount] = _local14; _arg4[_local17].vertexCount++; }; }; _arg4[_local19].vertices[_arg4[_local19].vertexCount] = _local15[_local18]; _arg4[_local19].vertexCount++; _local17 = _local19; _local18++; }; if (_local16[0] == -1){ _local16[0] = _arg4[0].vertexCount; _arg4[0].vertices[_arg4[0].vertexCount] = _local14; _arg4[0].vertexCount++; _arg4[0].vertices[_arg4[0].vertexCount] = _local13; _arg4[0].vertexCount++; }; if (_local16[1] == -1){ _local16[1] = _arg4[1].vertexCount; _arg4[1].vertices[_arg4[1].vertexCount] = _local13; _arg4[1].vertexCount++; _arg4[1].vertices[_arg4[1].vertexCount] = _local14; _arg4[1].vertexCount++; }; _local19 = 0; while (_local19 < 2) { if (_local16[_local19] > 0){ _local20 = b2Math.SubtractVV(_arg4[_local19].vertices[(_local16[_local19] - 1)], _arg4[_local19].vertices[_local16[_local19]]); } else { _local20 = b2Math.SubtractVV(_arg4[_local19].vertices[(_arg4[_local19].vertexCount - 1)], _arg4[_local19].vertices[0]); }; _local20.Normalize(); _local21 = b2Math.MulFV(_arg3, _local20); _arg4[_local19].vertices[_local16[_local19]] = b2Math.AddVV(_arg4[_local19].vertices[_local16[_local19]], _local21); if (_local16[_local19] < (_arg4[_local19].vertexCount - 2)){ _local20 = b2Math.SubtractVV(_arg4[_local19].vertices[(_local16[_local19] + 2)], _arg4[_local19].vertices[(_local16[_local19] + 1)]); } else { _local20 = b2Math.SubtractVV(_arg4[_local19].vertices[0], _arg4[_local19].vertices[(_arg4[_local19].vertexCount - 1)]); }; _local20.Normalize(); _local21 = b2Math.MulFV(_arg3, _local20); _arg4[_local19].vertices[(_local16[_local19] + 1)] = b2Math.AddVV(_arg4[_local19].vertices[(_local16[_local19] + 1)], _local21); _local19++; }; _local19 = 0; while (_local19 < 2) { _local18 = 0; while (_local18 < _arg4[_local19].vertexCount) { _local22 = 0; while (_local22 < _arg4[_local19].vertexCount) { if (((!((_local18 == _local22))) && ((b2Math.SubtractVV(_arg4[_local19].vertices[_local18], _arg4[_local19].vertices[_local22]).Length() < (0.2 / lagMod))))){ return (-1); }; _local22++; }; _local18++; }; _local19++; }; if (String(_arg1.GetBody().GetUserData()).substr(0, 8) == "bodypart"){ addshit((_local9.x * 25), (_local9.y * 25), (10 * Math.abs((_local9.Length() - _local12.Length())))); addDamage(Math.floor((100 * Math.abs((_local9.Length() - _local12.Length()))))); }; _local19 = 0; while (_local19 < 2) { if (CheckPolyShape(_arg4[_local19])){ return (-1); }; return (0); _local19++; }; } public function CustomCut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Point, _arg7:Number):void{ var _local8:*; var _local9:Number; var _local10:*; var _local11:*; var _local12:Sprite; if (_arg5 == 1){ removelines(null); }; _local8 = 0; while (_local8 < _arg3) { _local9 = ((Math.atan2((_arg6.y - _arg2), (_arg6.x - _arg1)) + (Math.random() * _arg7)) - (_arg7 / 2)); _local10 = (_arg1 + (Math.cos(_local9) * _arg4)); _local11 = (_arg2 + (Math.sin(_local9) * _arg4)); depX = (_arg1 / m_physScale); depY = (_arg2 / m_physScale); arrX = (_local10 / m_physScale); arrY = (_local11 / m_physScale); if (toggleLines == 1){ if (_arg5 != 0){ _local12 = new Sprite(); _local12.graphics.moveTo((depX * m_physScale), (depY * m_physScale)); _local12.graphics.lineStyle(debugLine, 0xFFFFFF); _local12.graphics.lineTo((arrX * m_physScale), (arrY * m_physScale)); sp.addChild(_local12); if (lineTimer){ if (lineTimer.running == false){ lineTimer = new Timer((1000 / timerSpeed), 1); lineTimer.addEventListener(TimerEvent.TIMER, removelines); lineTimer.start(); }; } else { lineTimer = new Timer((1000 / timerSpeed), 1); lineTimer.addEventListener(TimerEvent.TIMER, removelines); lineTimer.start(); }; }; }; laserStart = new b2Vec2(depX, depY); laserDir = new b2Vec2((arrX - depX), (arrY - depY)); segment.p1 = laserStart; segment.p2 = laserDir; segment.p2 = b2Math.AddVV(segment.p2, segment.p1); m_cut = 1; Cut(); m_cut = null; _local8++; }; } public function checkLineCollision(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2, _arg4:b2Vec2):Boolean{ var _local5:*; var _local6:*; var _local7:*; var _local8:*; var _local9:*; var _local10:*; var _local11:*; var _local12:*; var _local13:*; var _local14:*; var _local15:*; var _local16:*; var _local17:*; var _local18:*; _local5 = _arg1.x; _local6 = _arg1.y; _local7 = _arg2.x; _local8 = _arg2.y; _local9 = _arg3.x; _local10 = _arg3.y; _local11 = _arg4.x; _local12 = _arg4.y; if (_local5 != _local7){ _local13 = ((_local8 - _local6) / (_local7 - _local5)); }; if (_local9 != _local11){ _local15 = ((_local12 - _local10) / (_local11 - _local9)); }; if (_local13 == _local15){ return (false); }; _local14 = ((-(_local13) * _local5) + _local6); _local16 = ((-(_local15) * _local9) + _local10); _local17 = ((_local16 - _local14) / (_local13 - _local15)); _local18 = ((_local13 * _local17) + _local14); if (_local5 == _local7){ _local17 = _local5; }; if (_local9 == _local11){ _local17 = _local9; }; if ((((((((_local5 >= _local17)) && ((_local7 <= _local17)))) || ((((((_local5 <= _local17)) && ((_local7 >= _local17)))) && ((((_local6 >= _local18)) && ((_local8 <= _local18)))))))) || ((((_local6 <= _local18)) && ((_local8 >= _local18)))))){ _local18 = ((_local15 * _local17) + _local16); if ((((((((_local9 >= _local17)) && ((_local11 <= _local17)))) || ((((((_local9 <= _local17)) && ((_local11 >= _local17)))) && ((((_local10 >= _local18)) && ((_local12 <= _local18)))))))) || ((((_local10 <= _local18)) && ((_local12 >= _local18)))))){ return (true); }; }; return (false); } public function Cut():void{ var _local1:b2Joint; var _local2:Array; var _local3:*; var _local4:*; var _local5:b2Vec2; var _local6:b2Vec2; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:b2Body; var _local10:b2PolygonShape; var _local11:Array; var _local12:Number; var _local13:Number; var _local14:b2BodyDef; var _local15:b2Body; var _local16:b2Body; _local1 = m_world.GetJointList(); while (_local1) { if (_local1.GetUserData() == null){ } else { _local5 = new b2Vec2((segment.p1.x * m_phys_scale), (segment.p1.y * m_phys_scale)); _local6 = new b2Vec2((segment.p2.x * m_phys_scale), (segment.p2.y * m_phys_scale)); _local7 = new b2Vec2((_local1.GetAnchor1().x * m_phys_scale), (_local1.GetAnchor1().y * m_phys_scale)); _local8 = new b2Vec2((_local1.GetAnchor2().x * m_phys_scale), (_local1.GetAnchor2().y * m_phys_scale)); if (checkLineCollision(_local5, _local6, _local7, _local8) == true){ if (((!((madeby == "guncut"))) && (!((madeby == "breakcut"))))){ m_world.DestroyJoint(_local1); }; }; }; _local1 = _local1.GetNext(); }; _local2 = new Array(); if (madeby == "breakcut"){ max_shapes = Math.round((lagMod * 4)); if (max_shapes < 1){ max_shapes = 1; }; } else { if (madeby == "blade"){ max_shapes = 1; } else { if (madeby == "guncut"){ max_shapes = 4; } else { max_shapes = 64; }; }; }; _local3 = 1; _local3 = m_world.Raycast(segment, _local2, max_shapes, false, null); _local4 = 0; for (;_local4 < _local3;_local4++) { if (_local2[_local4].GetType() != b2Shape.e_polygonShape){ } else { if (_local2[_local4].GetBody().IsStatic() == true){ } else { _local9 = _local2[_local4].GetBody(); if (onlyCutBreakable){ if (String(_local9.GetUserData()).substr(0, 12) != "destructable"){ continue; }; } else { if (_local9.m_shapeCount > 1){ continue; }; }; _local10 = _local2[_local4]; _local11 = new Array(1); _local11[0] = new b2PolygonDef(); _local11[1] = new b2PolygonDef(); _local12 = (Math.random() * (_local9.GetMass() / 5)); _local13 = (Math.random() * (_local9.GetMass() / 5)); if (_local12 < 0.1){ _local12 = 0.1; }; if (_local13 < 0.1){ _local13 = 0.1; }; if (_local12 > 100){ _local12 = 100; }; if (_local13 > 100){ _local13 = 100; }; _local11[0].density = _local12; _local11[1].density = _local13; _local11[0].restitution = Interface.GlobalField_Restitution.text; _local11[1].restitution = Interface.GlobalField_Restitution.text; _local11[0].friction = Interface.GlobalField_Friction.text; _local11[1].friction = Interface.GlobalField_Friction.text; if (SplitShape(_local10, segment, (0.05 / lagMod), _local11) == 0){ _local14 = new b2BodyDef(); _local14.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local14.angularDamping = (Interface.GlobalField_ADamp.text / 50); if (_local9.GetUserData().substr(0, 8) == "bodypart"){ if (_local9.GetUserData().substr(9, 4) == "head"){ _local14.userData = "corpse_hea"; } else { if ((((_local9.GetUserData().substr(10, 3) == "arm")) || ((_local9.GetUserData().substr(9, 4) == "tors")))){ _local14.userData = "corpse_shi"; } else { if ((((_local9.GetUserData().substr(10, 3) == "leg")) || ((_local9.GetUserData().substr(10, 3) == "ulg")))){ _local14.userData = "corpse_pan"; }; }; }; } else { if (_local9.GetUserData().substr(0, 6) == "corpse"){ _local14.userData = _local9.GetUserData(); } else { if ((((String(_local9.GetUserData()).substr(0, 12) == "destructable")) && ((_local9.GetMass() > (20 * lagMod))))){ _local14.userData = _local9.GetUserData(); } else { _local14.userData = "shrapnel"; }; }; }; _local14.position = _local9.GetPosition(); _local14.angle = _local9.GetAngle(); _local15 = m_world.CreateBody(_local14); _local15.CreateShape(_local11[1]); _local15.SetMassFromShapes(); _local15.SetAngularVelocity(_local9.GetAngularVelocity()); _local15.SetLinearVelocity(_local9.GetLinearVelocity()); _local16 = m_world.CreateBody(_local14); _local16.CreateShape(_local11[0]); _local16.SetMassFromShapes(); _local16.SetAngularVelocity(_local9.GetAngularVelocity()); _local16.SetLinearVelocity(_local9.GetLinearVelocity()); destroyBody(_local9); }; }; }; }; } private function SoundComplete_Slice(_arg1:Event):void{ playingSlice = false; } public function Step(_arg1, _arg2){ if (((Input.mouseDown) && ((ctrldown == true)))){ if (!firstClic){ depX = (Input.mouseX / m_physScale); depY = (Input.mouseY / m_physScale); firstClic = true; }; arrX = (Input.mouseX / m_physScale); arrY = (Input.mouseY / m_physScale); laserStart = new b2Vec2(depX, depY); laserDir = new b2Vec2((arrX - depX), (arrY - depY)); segment.p1 = laserStart; segment.p2 = laserDir; segment.p2 = b2Math.AddVV(segment.p2, segment.p1); if (toggleLines == 1){ laserColor = new b2Color(0xFF, 0xFF, 0xFF); dbgDraw.DrawSegment(segment.p1, segment.p2, laserColor); }; m_cut = 1; }; if (!Input.mouseDown){ firstClic = false; }; } public function mouseUpEvent(_arg1:MouseEvent){ var _local2:*; var _local3:*; var _local4:int; if (pauseMoving == true){ pauseMoving = false; pauseMovingBody = null; pauseMovingBodies = []; pauseMovingPos = null; }; if (spawning == true){ _local2 = (mouseX - spawnInit.x); _local3 = (mouseY - spawnInit.y); _local4 = ((_local2 * _local2) + (_local3 * _local3)); if (_local4 < 100){ toggleSpawn = 1; spawnObject(spawnType); toggleSpawn = 0; } else { spawnObject(spawnType); }; spawning = false; }; madeby = "cut"; drawing = false; if (m_cut){ Cut(); m_cut = null; }; } public function addshit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:String="blood", _arg5=10, _arg6=-10):void{ var _local7:*; var _local8:*; var _local9:b2BodyDef; var _local10:b2CircleDef; var _local11:b2Body; var _local12:b2Vec2; if (Interface.GlobalField_Bleed.text < 0){ _local8 = Math.abs(Interface.GlobalField_Bleed.text); } else { _local8 = Interface.GlobalField_Bleed.text; }; if (_arg3 > (30 * _local8)){ _arg3 = (30 * _local8); }; _local7 = 0; while (_local7 < ((_arg3 * _local8) * lagMod)) { _local9 = new b2BodyDef(); _local9.userData = _arg4; _local9.linearDamping = (Interface.GlobalField_LDamp.text / 500); _local10 = new b2CircleDef(); _local10.density = 0.1; _local10.friction = 0.3; _local10.restitution = 0.1; _local10.radius = (((Math.random() * 3) + 3) / m_phys_scale); _local9.position.Set((((_arg1 + (Math.random() * 10)) - 5) / m_phys_scale), (((_arg2 + (Math.random() * 10)) - 5) / m_phys_scale)); _local11 = m_world.CreateBody(_local9); _local11.CreateShape(_local10); _local11.SetMassFromShapes(); _local12 = new b2Vec2(((Math.random() * _arg5) - (_arg5 / 2)), _arg6); _local11.SetLinearVelocity(_local12); _local7++; }; } public function addbullet(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Point, _arg6:Number):void{ var _local7:int; var _local8:b2BodyDef; var _local9:*; var _local10:*; var _local11:b2Body; var _local12:b2Vec2; var _local13:b2CircleDef; var _local14:*; var _local15:Array; var _local16:Number; var _local17:Array; var _local18:b2PolygonDef; var _local19:Number; var _local20:b2PolygonDef; _local7 = 0; while (_local7 < _arg3) { _local8 = new b2BodyDef(); _local8.userData = ("bullet_" + bulletType); _local8.isBullet = true; _local8.fixedRotation = true; _local8.linearDamping = (Interface.GlobalField_LDamp.text / 500); if (((!((bulletType == "fla"))) && (!((bulletType == "sni"))))){ _local13 = new b2CircleDef(); _local13.density = (1000 / (10 / _arg4)); _local13.friction = Interface.GlobalField_Friction.text; _local13.restitution = Interface.GlobalField_Restitution.text; _local13.radius = ((_arg4 * Interface.GlobalField_Size.text) / m_phys_scale); } else { if (bulletType == "fla"){ _local14 = ((Math.random() * 2) + 1); _local15 = [[[0.95, -5.55], [2.95, -1.55], [2.95, 1.85], [1.1, 3.15], [-1, 1.75], [-1, -1.05]]]; _local16 = 0; while (_local16 < _local15.length) { _local17 = _local15[_local16]; _local18 = new b2PolygonDef(); _local18.density = (1000 / (10 / _arg4)); _local18.friction = Interface.GlobalField_Friction.text; _local18.restitution = Interface.GlobalField_Restitution.text; _local18.vertexCount = _local17.length; _local19 = 0; while (_local19 < _local17.length) { _local18.vertices[_local19].Set(((((_local17[_local19][0] + (Math.random() * 1)) - 0.5) * _local14) / m_phys_scale), ((((_local17[_local19][1] + (Math.random() * 1)) - 0.5) * _local14) / m_phys_scale)); _local19++; }; _local16++; }; } else { if (bulletType == "sni"){ _local20 = new b2PolygonDef(); _local20.density = (1000 / (10 / _arg4)); _local20.friction = Interface.GlobalField_Friction.text; _local20.restitution = Interface.GlobalField_Restitution.text; _local20.SetAsOrientedBox((10 / m_phys_scale), (4 / m_phys_scale), new b2Vec2(0, 0), sniperBody.GetAngle()); }; }; }; _local9 = (Math.round(((Math.random() * _arg6) - (_arg6 / 2))) + 1); _local10 = (Math.round(((Math.random() * _arg6) - (_arg6 / 2))) + 1); _local8.position.Set(((Math.abs(_local9) + _arg1) / m_phys_scale), ((Math.abs(_local10) + _arg2) / m_phys_scale)); _local11 = m_world.CreateBody(_local8); if (((!((bulletType == "fla"))) && (!((bulletType == "sni"))))){ _local11.CreateShape(_local13); } else { if (bulletType == "fla"){ _local11.CreateShape(_local18); } else { if (bulletType == "sni"){ _local11.CreateShape(_local20); }; }; }; _local11.SetMassFromShapes(); _local12 = new b2Vec2(((_local9 / 2) + _arg5.x), (_local10 + _arg5.y)); _local11.SetLinearVelocity(_local12); trace(_local12.x, _local12.y); _local7++; }; } public function addpulp(_arg1, _arg2, _arg3):void{ var _local4:*; var _local5:b2BodyDef; var _local6:b2CircleDef; var _local7:b2Body; var _local8:b2Vec2; _local4 = 0; while (_local4 < (_arg3 * lagMod)) { _local5 = new b2BodyDef(); _local5.linearDamping = (Interface.GlobalField_LDamp.text / 500); _local5.userData = "blood"; _local6 = new b2CircleDef(); _local6.density = 0.1; _local6.friction = 0.3; _local6.restitution = 0.1; _local6.radius = (((Math.random() * 6) + 6) / m_phys_scale); _local5.position.Set((((_arg1 + (Math.random() * 10)) - 5) / m_phys_scale), (((_arg2 + (Math.random() * 10)) - 5) / m_phys_scale)); _local7 = m_world.CreateBody(_local5); _local7.CreateShape(_local6); _local7.SetMassFromShapes(); _local8 = new b2Vec2(((Math.random() * 10) - 5), -10); _local7.SetLinearVelocity(_local8); _local4++; }; } public function explode(_arg1:Number, _arg2:Number):void{ var _local3:*; var _local4:*; var _local5:*; var _local6:b2Body; _local6 = m_world.m_bodyList; while (_local6) { _local3 = (_arg1 - _local6.GetPosition().x); _local4 = (_arg2 - _local6.GetPosition().y); _local5 = ((_local3 * _local3) + (_local4 * _local4)); if (_local5 < (200 * lagMod)){ _local6.ApplyImpulse(new b2Vec2((-(_local3) * 500), (-(_local4) * 500)), new b2Vec2((_local6.GetWorldCenter().x + 0.01), _local6.GetWorldCenter().y)); }; _local6 = _local6.m_next; }; } public function destroyBody(_arg1:b2Body):void{ if (_arg1.GetUserData() == "arrow"){ trace("dasd"); }; if (((m_mouseJoint) && ((((_arg1 == m_mouseJoint.getBody1())) || ((_arg1 == m_mouseJoint.getBody2())))))){ m_world.DestroyJoint(m_mouseJoint); m_mouseJoint = null; }; if (String(_arg1.GetUserData()).substr(0, 6) == "magnet"){ magnetArray[int(String(_arg1.GetUserData()).substr(6))] = new b2Vec2(9000, 9000); }; if (_arg1 == laserBody){ laserOnStage = false; }; if (_arg1 == pistolBody){ pistolOnStage = false; pistolReloading = false; pistolReady = false; }; if (_arg1 == shotgunBody){ shotgunOnStage = false; shotgunReloading = false; shotgunReady = false; }; if (_arg1 == assaultBody){ assaultOnStage = false; assaultReloading = false; assaultReady = false; }; if (_arg1 == m79Body){ m79OnStage = false; m79Reloading = false; m79Ready = false; }; if (_arg1 == sniperBody){ sniperOnStage = false; sniperReloading = false; sniperReady = false; }; if (_arg1 == flamerBody){ flamerOnStage = false; flamerReloading = false; flamerReady = false; }; if (_arg1 == minigunBody){ minigunOnStage = false; minigunReloading = false; minigunReady = false; }; if (_arg1 == cannonBody){ cannonOnStage = false; cannonReloading = false; cannonReady = false; }; if (_arg1 == harpoonBody){ harpoonOnStage = false; harpoonReloading = false; harpoonReady = false; }; if (((((multipleSelected) && (!((_arg1.GetUserData() == "dontcutme"))))) || (!(multipleSelected)))){ m_world.DestroyBody(_arg1); }; } public function water(_arg1:Event):void{ var _local2:int; trace("timer:", timerSpeed); if (timerSpeed > 0.01){ waterTimer.delay = (500 / timerSpeed); }; if (speed != 0){ _local2 = 0; while (_local2 < waterArray.length) { addshit(waterArray[_local2].x, waterArray[_local2].y, 1, "water", 0, 5); _local2++; }; }; } public function update(_arg1:Event):void{ var _local2:b2Joint; var _local3:b2Body; var _local4:b2Joint; var _local5:b2Vec2; var _local6:int; var _local7:b2Vec2; var _local8:String; var _local9:*; var _local10:*; var _local11:*; var _local12:*; var _local13:*; var _local14:*; var _local15:*; var _local16:Point; var _local17:*; var _local18:*; var _local19:b2Body; var _local20:*; var _local21:*; var _local22:Number; var _local23:b2JointEdge; var _local24:b2DistanceJointDef; var _local25:b2Vec2; var _local26:b2Vec2; var _local27:Array; joints.graphics.clear(); m_sprite.graphics.clear(); m_world.Step((m_timeStep * speed), m_iterations); Step((m_timeStep * speed), m_iterations); if (jointpoint != null){ joints.graphics.lineStyle(1, 0xFFFFFF, 1); joints.graphics.moveTo((jointpoint.x * m_physScale), (jointpoint.y * m_physScale)); joints.graphics.lineTo(mouseX, mouseY); }; _local2 = m_world.GetJointList(); while (_local2) { if (_local2.GetUserData() == "bgjoint"){ joints.graphics.lineStyle(4, 0xFFFFFF, 1); }; if (_local2.GetUserData() == "ropejoint"){ joints.graphics.lineStyle(3, 0x663300, 1); }; if (_local2.GetUserData() == "objjoint"){ joints.graphics.lineStyle(2, 16777164, 1); }; if (_local2.GetUserData() == "motjoint"){ joints.graphics.lineStyle(2, 0x555555, 1); }; if ((((((_local2.GetUserData() == "bgjoint")) || ((_local2.GetUserData() == "ropejoint")))) || ((_local2.GetUserData() == "objjoint")))){ joints.graphics.moveTo((_local2.GetAnchor1().x * 15), (_local2.GetAnchor1().y * 15)); joints.graphics.lineTo((_local2.GetAnchor2().x * 15), (_local2.GetAnchor2().y * 15)); } else { if (_local2.GetUserData() == "motjoint"){ joints.graphics.moveTo((_local2.GetAnchor1().x * 15), (_local2.GetAnchor1().y * 15)); joints.graphics.lineTo((_local2.GetBody1().GetPosition().x * 15), (_local2.GetBody1().GetPosition().y * 15)); }; }; _local2 = _local2.GetNext(); }; if (stage.focus != null){ if ((((((String(stage.focus.name).substr(0, 11) == "GlobalField")) && ((mouseY < 400)))) && (!(colourPickerOpen)))){ stage.focus = null; }; }; lagMod = Interface.GlobalField_Lag.text; if (((((pauseMoving) && (!(saveMenu.visible)))) && ((Interface.y == 600)))){ if (!multipleSelected){ _local5 = new b2Vec2((pauseMovingPos.x + mouseXWorldPhys), (pauseMovingPos.y + mouseYWorldPhys)); pauseMovingBody.SetXForm(_local5, pauseMovingBody.GetAngle()); } else { if (pauseMovingBodies.length > 0){ _local6 = 0; while (_local6 < pauseMovingBodies.length) { _local7 = pauseMovingBodies[_local6][1]; pauseMovingBodies[_local6][0].SetXForm(new b2Vec2((_local7.x + mouseXWorldPhys), (_local7.y + mouseYWorldPhys)), pauseMovingBodies[_local6][0].GetAngle()); _local6++; }; }; }; }; if (explosion){ explosion = false; explode(mouseXWorldPhys, mouseYWorldPhys); }; if (ctrldown == false){ UpdateMouseWorld(); MouseDestroy(); MouseDrag(); }; if (speed != 0){ if (!slomoOn){ speed = Math.abs(Interface.GlobalField_Time.text); }; if (lagMod < 1){ speed = (speed * 0.8); }; if (speed <= 0){ timerSpeed = 0.001; } else { timerSpeed = speed; }; }; _local3 = m_world.GetBodyList(); while (_local3) { _local8 = _local3.GetUserData(); if (((((((((_local3.GetWorldCenter().x * m_physScale) > 1000)) || (((_local3.GetWorldCenter().x * m_physScale) < -200)))) || (((_local3.GetWorldCenter().y * m_physScale) < -200)))) || (((_local3.GetWorldCenter().y * m_physScale) > 800)))){ destroyBody(_local3); } else { if (((((((!((Interface.GlobalField_Gravity.text == 0))) || (!((Interface.GlobalField_Wind.text == 0))))) && (!((Interface.GlobalField_Gravity.text == "-"))))) && ((speed > 0)))){ _local3.ApplyForce(new b2Vec2((Interface.GlobalField_Wind.text * _local3.GetMass()), (Interface.GlobalField_Gravity.text * _local3.GetMass())), new b2Vec2(_local3.GetWorldCenter().x, _local3.GetWorldCenter().y)); }; if (((toggleStabi) && (!((speed == 0))))){ _local9 = Number(Interface.GlobalField_Gravity.text); _local10 = Number(Interface.GlobalField_Wind.text); if (String(_local8).substr(0, 13) == "bodypartutors"){ _local3.ApplyForce(new b2Vec2((0 * _local10), (-10 * _local9)), _local3.GetPosition()); }; if (String(_local8).substr(0, 13) == "bodypartmtors"){ _local3.ApplyForce(new b2Vec2((0 * _local10), (-5 * _local9)), _local3.GetPosition()); }; if (String(_local8).substr(0, 13) == "bodypartltors"){ _local3.ApplyForce(new b2Vec2((0 * _local10), (5 * _local9)), _local3.GetPosition()); }; if (String(_local8).substr(0, 13) == "bodypart_lleg"){ _local3.ApplyForce(new b2Vec2((0 * _local10), (10 * _local9)), _local3.GetPosition()); }; if (String(_local8).substr(0, 13) == "bodypart_rulg"){ _local3.ApplyForce(new b2Vec2((80 * _local10), (5 * _local9)), _local3.GetPosition()); _local3.ApplyTorque(-50); }; if (String(_local8).substr(0, 13) == "bodypart_lulg"){ _local3.ApplyForce(new b2Vec2((-80 * _local10), (5 * _local9)), _local3.GetPosition()); _local3.ApplyTorque(50); }; if (String(_local8).substr(0, 13) == "bodypart_head"){ _local3.ApplyForce(new b2Vec2((0 * _local10), (-20 * _local9)), _local3.GetPosition()); }; if (String(_local8).substr(0, 13) == "bodypart_larm"){ _local3.ApplyForce(new b2Vec2((-5 * _local10), (-1 * _local9)), _local3.GetPosition()); _local3.ApplyTorque(10); }; if (String(_local8).substr(0, 13) == "bodypart_rarm"){ _local3.ApplyForce(new b2Vec2((5 * _local10), (-1 * _local9)), _local3.GetPosition()); _local3.ApplyTorque(-10); }; if (String(_local8).substr(0, 13) == "bodypart_uarm"){ _local3.ApplyForce(new b2Vec2((0 * _local10), (-1 * _local9)), _local3.GetPosition()); }; }; if (_local8 == "killme"){ destroyBody(_local3); }; if (_local8 == "explodeme"){ _local11 = _local3.GetWorldCenter(); destroyBody(_local3); addshit((_local11.x * m_phys_scale), (_local11.y * m_phys_scale), (Math.random() * 50), "sparkle"); explode(_local11.x, _local11.y); }; if (String(_local8).substr(10, 11) == "killcounter"){ _local12 = String((int(String(_local8).substr(22, 3)) - 1)); if (_local12 == "100"){ destroyBody(_local3); } else { if (_local12 < 900){ _local3.SetUserData(((("bullet_" + bulletType) + "killcounter_") + _local12)); }; }; }; if (speed != 0){ if (_local8 == "rocket"){ _local3.ApplyForce(new b2Vec2(((Math.sin(_local3.GetAngle()) * _local3.GetMass()) * 50), ((Math.cos(_local3.GetAngle()) * -(_local3.GetMass())) * 50)), _local3.GetWorldCenter()); }; if (String(_local8).substr(0, 6) == "magnet"){ magnetArray[int(String(_local8).substr(6))] = _local3.GetWorldCenter(); }; if (magnetArray.length > 0){ _local16 = new Point(_local3.GetPosition().x, _local3.GetPosition().y); _local6 = 0; while (_local6 < magnetArray.length) { if (magnetArray[_local6] != undefined){ _local13 = (magnetArray[_local6].x - _local16.x); _local14 = (magnetArray[_local6].y - _local16.y); _local15 = ((_local13 * _local13) + (_local14 * _local14)); if (_local15 < (1000 * lagMod)){ _local3.ApplyImpulse(new b2Vec2(((_local13 * 0.1) * _local3.GetMass()), ((_local14 * 0.1) * _local3.GetMass())), _local3.GetWorldCenter()); }; }; _local6++; }; }; }; if ((((Interface.GlobalField_Bleed.text < 0)) && ((_local8 == "blood")))){ if (Math.floor((Math.random() * 10)) == 2){ if (blood.numChildren < Math.ceil((200 * lagMod))){ throwBall(new Point((_local3.GetPosition().x * m_physScale), (_local3.GetPosition().y * m_physScale)), new Point(((Math.random() * 5) - 2.5), ((Math.random() * 4) - 2)), 1); } else { blood.removeChildAt(Math.floor((Math.random() * blood.numChildren))); }; }; }; if ((((String(_local8).substr(0, 8) == "bodypart")) && ((int(String(_local8).substr(17, 2)) <= 0)))){ _local17 = (_local3.GetPosition().x * m_phys_scale); _local18 = (_local3.GetPosition().y * m_phys_scale); destroyBody(_local3); addpulp(_local17, _local18, 10); }; }; _local3 = _local3.GetNext(); }; if (m_world.GetBodyCount() > (Interface.GlobalField_Object.text * lagMod)){ _local19 = m_world.GetBodyList(); while (_local19) { if ((((((((_local19.GetUserData() == "shrapnel")) || ((_local19.GetUserData() == "blood")))) && ((_local19.GetMass() < 0.5)))) && ((m_world.GetBodyCount() > Interface.GlobalField_Object.text)))){ destroyBody(_local19); }; _local19 = _local19.GetNext(); }; }; _local4 = m_world.GetJointList(); while (_local4) { _local20 = (30000 / speed); _local21 = _local4.GetUserData(); if (((!((_local21 == "rage"))) && (!((_local21 == "unbreakable"))))){ if (_local21 == "weak"){ _local20 = (_local20 / 4); }; if (_local21 == "objjoint"){ _local20 = (_local20 * 2); }; if (_local21 == "ropejoint"){ _local20 = (_local20 * 4); }; if (_local21 == "motjoint"){ _local20 = (_local20 * 4); }; if (Math.floor(_local4.GetReactionForce().Length()) > _local20){ if (((((((((!((_local21 == "weak"))) && (!((_local21 == "objjoint"))))) && (!((_local21 == "ropejoint"))))) && (!((_local21 == "motjoint"))))) && (!((_local21 == "bgjoint"))))){ if (toggleRagdollBreak == 1){ if (((!(slomoOn)) && ((toggleSlomo == 1)))){ slowTo(50); }; m_world.DestroyJoint(_local4); if ((((String(_local4.GetBody1().GetUserData()).substr(0, 13) == "bodypart_head")) || ((String(_local4.GetBody2().GetUserData()).substr(0, 13) == "bodypart_head")))){ addDamage(500); addshit((_local4.GetAnchor1().x * m_phys_scale), (_local4.GetAnchor1().y * m_phys_scale), ((Math.random() * 10) + 20)); } else { if ((((String(_local4.GetBody1().GetUserData()).substr(0, 8) == "bodypart_head")) || ((String(_local4.GetBody2().GetUserData()).substr(0, 8) == "bodypart")))){ addDamage(200); addshit((_local4.GetAnchor1().x * m_phys_scale), (_local4.GetAnchor1().y * m_phys_scale), ((Math.random() * 10) + 0)); }; }; }; } else { if (toggleJointBreak == 1){ m_world.DestroyJoint(_local4); }; }; }; }; _local4 = _local4.GetNext(); }; if (jointArray.length >= 4){ _local22 = 0; _local23 = jointArray[0].GetJointList(); while (_local23) { _local22 = (_local22 + 1); _local23 = _local23.next; }; _local23 = jointArray[1].GetJointList(); while (_local23) { _local22 = (_local22 + 1); _local23 = _local23.next; }; if (_local22 < (20 * lagMod)){ _local6 = 0; while (_local6 < 2) { _local24 = new b2DistanceJointDef(); _local25 = new b2Vec2((jointArray[2].x + ((_local6 - 1) / 10)), (jointArray[2].y - ((_local6 - 1) / 10))); _local26 = new b2Vec2((jointArray[3].x - ((_local6 - 1) / 10)), (jointArray[3].y + ((_local6 - 1) / 10))); _local24.collideConnected = true; _local24.userData = "weak"; _local24.Initialize(jointArray[0], jointArray[1], _local25, _local26); m_world.CreateJoint(_local24); _local24.Initialize(jointArray[0], jointArray[1], _local26, jointArray[1].GetWorldCenter()); m_world.CreateJoint(_local24); _local6++; }; }; jointArray = []; }; if (cutArray.length >= 5){ onlyCutBreakable = true; while (cutArray.length > 0) { madeby = "breakcut"; CustomCut(cutArray[0], cutArray[1], cutArray[2], cutArray[3], 0, cutArray[5], 1); cutArray.shift(); cutArray.shift(); cutArray.shift(); cutArray.shift(); cutArray.shift(); cutArray.shift(); }; onlyCutBreakable = false; }; if (cutEverythingArray.length >= 1){ _local6 = 0; while (_local6 < cutEverythingArray.length) { madeby = "guncut"; _local27 = cutEverythingArray[_local6]; CustomCut(_local27[0], _local27[1], _local27[2], _local27[3], _local27[4], _local27[5], _local27[6]); cutEverythingArray.shift(); _local6++; }; }; if (shitArray.length >= 3){ if (String(((m_mouseJoint) && (m_mouseJoint.GetBody2().GetUserData()))).substr(0, 8) == "bodypart"){ shitArray = []; } else { addshit((shitArray[0] * 25), (shitArray[1] * 25), shitArray[2]); shitArray = []; }; }; } public function speedTo(_arg1:TimerEvent):void{ if (!paused){ slomoOn = true; slowdownfor = 0; speedtimer = new Timer((10 / timerSpeed)); speedtimer.addEventListener(TimerEvent.TIMER, speedUp); speedtimer.start(); }; } public function slowTo(_arg1:Number){ if (!paused){ slomoOn = true; slowdownfor = (_arg1 / 2); slomotimer = new Timer((50 / timerSpeed), _arg1); slomotimer.addEventListener(TimerEvent.TIMER, slowDown); slomotimer.start(); }; } private function slowDown(_arg1:TimerEvent):void{ if (((slomoOn) && (!(paused)))){ trace("Slow: ", speed); speed = (speed - 0.2); slowdownfor = (slowdownfor - 1); if (speed < 0.1){ speed = 0.1; }; if (slowdownfor <= 0){ slomotimer.reset(); speedTo(_arg1); }; }; } private function speedUp(_arg1:TimerEvent):void{ if (((slomoOn) && (!(paused)))){ trace("Speed: ", speed, slowdownfor, speedtimer.running); slomotimer.stop(); speed = (speed + 0.05); if (speed >= 1){ speed = 1; slomoOn = false; speedtimer.reset(); }; }; } public function UpdateMouseWorld():void{ mouseXWorldPhys = (Input.mouseX / m_physScale); mouseYWorldPhys = (Input.mouseY / m_physScale); mouseXWorld = Input.mouseX; mouseYWorld = Input.mouseY; } public function MouseDrag():void{ var _local1:b2Body; var _local2:b2MouseJointDef; var _local3:*; var _local4:*; var _local5:*; var _local6:b2Body; var _local7:Point; var _local8:*; var _local9:*; var _local10:*; var _local11:*; var _local12:b2Vec2; var _local13:b2Vec2; if (((Input.mouseDown) && (!(m_mouseJoint)))){ _local1 = GetBodyAt(mouseXWorldPhys, mouseYWorldPhys); if (((((((((((((_local1) && (!(drawingWall)))) && (!(DrawingCustomShape)))) && (!(spawning)))) && (!(multipleSelected)))) && (!((speed == 0))))) && ((saveMenu.visible == false)))){ if ((((((Interface.y == 450)) && ((mouseY < 425)))) || ((Interface.y == 600)))){ if ((((((InterfaceTOP.y == 100)) && ((mouseY > 125)))) || ((InterfaceTOP.y == 0)))){ _local2 = new b2MouseJointDef(); _local2.userData = "rage"; _local2.body1 = m_world.GetGroundBody(); _local2.body2 = _local1; _local2.target.Set(mouseXWorldPhys, mouseYWorldPhys); _local2.maxForce = (25000 * _local1.GetMass()); _local2.timeStep = m_timeStep; m_mouseJoint = (m_world.CreateJoint(_local2) as b2MouseJoint); _local1.WakeUp(); }; }; }; if (((Input.mouseDown) && (multipleSelected))){ if ((((((speed == 0)) && ((pauseMovingBodies.length == 0)))) && (!(spawning)))){ pauseMoving = true; _local6 = m_world.m_bodyList; while (_local6) { _local7 = new Point(_local6.GetPosition().x, _local6.GetPosition().y); _local3 = (mouseXWorldPhys - _local7.x); _local4 = (mouseYWorldPhys - _local7.y); _local5 = ((_local3 * _local3) + (_local4 * _local4)); if ((((_local5 < 60)) && (!(_local6.IsStatic())))){ _local8 = mouseXWorldPhys; _local9 = mouseYWorldPhys; _local10 = _local6.GetPosition().x; _local11 = _local6.GetPosition().y; _local12 = new b2Vec2((_local10 - _local8), (_local11 - _local9)); trace("vector:", _local12.x, _local12.y); pauseMovingBodies.push([_local6, _local12]); }; _local6 = _local6.m_next; }; }; } else { if (((((((_local1) && ((speed == 0)))) && ((pauseMovingBody == null)))) && (!(spawning)))){ if ((((((Interface.y == 450)) && ((_local9 < 425)))) || ((Interface.y == 600)))){ if ((((((InterfaceTOP.y == 100)) && ((_local9 > 125)))) || ((InterfaceTOP.y == 0)))){ pauseMovingPos = new b2Vec2((_local1.GetPosition().x - mouseXWorldPhys), (_local1.GetPosition().y - mouseYWorldPhys)); pauseMovingBody = _local1; pauseMoving = true; }; }; }; }; }; if (!Input.mouseDown){ if (m_mouseJoint){ m_world.DestroyJoint(m_mouseJoint); m_mouseJoint = null; }; }; if (m_mouseJoint){ _local13 = new b2Vec2(mouseXWorldPhys, mouseYWorldPhys); m_mouseJoint.SetTarget(_local13); }; } public function MouseDestroy():void{ var _local1:b2Body; var _local2:*; var _local3:*; var _local4:*; var _local5:b2Body; var _local6:Point; if (Input.isKeyPressed(46)){ if (((!(Input.mouseDown)) && (!(multipleSelected)))){ _local1 = GetBodyAt(mouseXWorldPhys, mouseYWorldPhys, true); if (_local1){ destroyBody(_local1); return; }; }; if (multipleSelected){ _local5 = m_world.m_bodyList; while (_local5) { _local6 = new Point(_local5.GetPosition().x, _local5.GetPosition().y); _local2 = (mouseXWorldPhys - _local6.x); _local3 = (mouseYWorldPhys - _local6.y); _local4 = ((_local2 * _local2) + (_local3 * _local3)); if (_local4 < 50){ destroyBody(_local5); }; _local5 = _local5.m_next; }; }; }; } public function resizeBodyAtMouse(_arg1:b2Body, _arg2:Number):void{ var _local4:*; var _local5:*; var _local6:*; var _local7:*; var _local8:b2Shape; var _local9:int; var _local10:*; var _local11:b2Body; var _local12:b2BodyDef; var _local13:b2CircleShape; var _local14:*; var _local15:*; var _local16:*; var _local17:b2CircleDef; var _local18:b2PolygonShape; var _local19:int; var _local20:Array; var _local21:b2PolygonDef; var _local22:b2Vec2; var _local3:* = _arg1.GetUserData(); if (_arg1.m_shapeCount < 2){ if (((_arg1) && (!(_arg1.IsStatic())))){ _local4 = _arg1.GetAngle(); _local5 = _arg1.GetLinearVelocity(); _local6 = _arg1.GetAngularVelocity(); _local7 = 1; trace(_arg1.GetMass()); _local8 = _arg1.GetShapeList(); _local9 = _local8.GetType(); switch (_local9){ case 0: _local10 = _arg1.GetUserData(); _local12 = new b2BodyDef(); _local12.userData = _local10; _local12.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local12.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local12.position.Set(_arg1.GetPosition().x, _arg1.GetPosition().y); _local13 = (_arg1.GetShapeList() as b2CircleShape); _local14 = _local13.GetFriction(); _local15 = _local13.GetRestitution(); _local16 = _local13.GetRadius(); destroyBody(_arg1); _local17 = new b2CircleDef(); _local17.radius = (_local16 * _arg2); _local17.density = (_local7 / 5); _local17.friction = _local14; _local17.restitution = _local15; _local11 = m_world.CreateBody(_local12); _local11.CreateShape(_local17); _local11.SetMassFromShapes(); _local11.SetXForm(_local11.GetPosition(), _local4); break; case 1: _local18 = (_arg1.GetShapeList() as b2PolygonShape); _local10 = _arg1.GetUserData(); _local14 = _local18.GetFriction(); _local15 = _local18.GetRestitution(); _local12 = new b2BodyDef(); _local12.userData = _local10; _local12.linearDamping = (Interface.GlobalField_LDamp.text / 50); _local12.angularDamping = (Interface.GlobalField_ADamp.text / 50); _local12.position.Set(_arg1.GetPosition().x, _arg1.GetPosition().y); _local19 = _local18.GetVertexCount(); _local20 = _local18.GetVertices(); for each (_local22 in _local20) { _local22.Multiply(_arg2); }; destroyBody(_arg1); _local21 = new b2PolygonDef(); _local21.vertexCount = _local19; _local21.vertices = _local20; _local21.friction = _local14; _local21.density = (_local7 / 5); _local21.restitution = _local15; _local11 = m_world.CreateBody(_local12); _local11.CreateShape(_local21); _local11.SetMassFromShapes(); _local11.SetXForm(_local11.GetPosition(), _local4); break; }; }; }; } public function GetBodyAt(_arg1:Number, _arg2:Number, _arg3:Boolean=false):b2Body{ var _local4:b2AABB; var _local5:int; var _local6:Array; var _local7:int; var _local8:b2Body; var _local9:int; var _local10:b2Shape; var _local11:Boolean; mousePVec.Set(_arg1, _arg2); _local4 = new b2AABB(); _local4.lowerBound.Set((_arg1 - 0.001), (_arg2 - 0.001)); _local4.upperBound.Set((_arg1 + 0.001), (_arg2 + 0.001)); _local5 = 10; _local6 = new Array(); _local7 = m_world.Query(_local4, _local6, _local5); _local8 = null; _local9 = 0; while (_local9 < _local7) { if ((((((((_local6[_local9].GetBody().IsStatic() == false)) || ((_local6[_local9].GetBody().GetUserData() == "static")))) || ((_local6[_local9].GetBody().GetUserData() == "wall")))) || (_arg3))){ _local10 = (_local6[_local9] as b2Shape); _local11 = (_local6[_local9] as b2Shape).TestPoint(_local10.GetBody().GetXForm(), mousePVec); if (_local11){ _local8 = _local10.GetBody(); break; }; }; _local9++; }; return (_local8); } } }//package
Section 106
//mochi (mochi) package { import flash.display.*; public dynamic class mochi extends MovieClip { public var mochiclose:MovieClip; public var adhere:MovieClip; } }//package
Section 107
//Particle (Particle) package { import flash.display.*; import flash.events.*; import flash.utils.*; import flash.geom.*; public class Particle extends MovieClip { protected var position:Point; protected var vector:Point; private var gravity:int; private var friction:Number; public var update_i:Timer; public static var inst:Particle; public function Particle(_arg1:Point, _arg2:Point, _arg3:int, _arg4:Number){ inst = this; position = _arg1; vector = _arg2; gravity = _arg3; friction = _arg4; if (((!((Main.instance.Interface.GlobalField_Time.text == 1))) && (!((Main.instance.Interface.GlobalField_Time.text == 0))))){ update_i = new Timer((25 * (1 / Main.instance.Interface.GlobalField_Time.text))); } else { update_i = new Timer(25); }; update_i.addEventListener(TimerEvent.TIMER, update, false, 0, true); update_i.start(); } public function update(_arg1:TimerEvent):void{ if (alpha > 0.05){ if (position.x > 795){ position.x = 795; } else { if (position.x < 15){ position.x = 15; } else { position.x = (position.x + vector.x); position.y = (position.y + vector.y); }; }; if ((((position.x > 790)) || ((position.x < 15)))){ vector.y = 0; } else { if (position.y > 570){ position.y = 570; }; if (position.y < 15){ position.y = 15; vector.x = 0; vector.y = (vector.y + (Main.instance.Interface.GlobalField_Gravity.text / 10)); } else { if (Main.instance.Interface.GlobalField_Time.text != 0){ vector.y = (vector.y + ((Main.instance.Interface.GlobalField_Gravity.text / 10) * Main.instance.Interface.GlobalField_Time.text)); vector.x = (vector.x + ((Main.instance.Interface.GlobalField_Wind.text / 10) * Main.instance.Interface.GlobalField_Time.text)); }; }; }; vector.x = (vector.x * friction); alpha = (alpha - 0.01); if ((((alpha < 0.1)) && ((Main.instance.blood.numChildren > 0)))){ update_i.removeEventListener(TimerEvent.TIMER, update); update_i.stop(); }; }; } } }//package
Section 108
//savemenu (savemenu) package { import flash.display.*; import flash.text.*; public dynamic class savemenu extends MovieClip { public var contentSave:MovieClip; public var nameSO:TextField; public var tutorial:MovieClip; public var copyIt:MovieClip; public var loadIt:MovieClip; public var savetext:TextField; public var saveSharedObj:MovieClip; public var helpthefuckingidiots:MovieClip; public var contentLoad:MovieClip; public var doneIt:MovieClip; public var loadSharedObj:MovieClip; public var saveIt:MovieClip; } }//package
Section 109
//SliderEvent (SliderEvent) package { import flash.events.*; public class SliderEvent extends Event { public var data; public static const SLIDER_UPDATED:String = "SLIDER_UPDATED"; public function SliderEvent(_arg1:String, _arg2:Boolean=true, _arg3:Object=null){ super(_arg1, _arg2); this.data = _arg3; } } }//package
Section 110
//SplitContactListener (SplitContactListener) package { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.*; import flash.geom.*; public class SplitContactListener extends b2ContactListener { public var temphealth:Number; public var newhealth:Number; public var headforce:Number; override public function Add(_arg1:b2ContactPoint):void{ var _local7:Number; var _local8:Array; var _local9:*; var _local10:int; var _local11:*; var _local12:Number; var _local13:Point; var _local14:Number; var _local15:Point; var _local16:Number; var _local17:Point; var _local18:Point; var _local19:*; var _local20:*; var _local2:* = _arg1.shape1.GetBody().GetUserData(); var _local3:* = _arg1.shape2.GetBody().GetUserData(); var _local4:* = (((_arg1.velocity.Length() / 10) * (_arg1.shape2.GetBody().GetMass() * 10)) / (Main.instance.Interface.GlobalField_Size.text * 2)); if ((((_arg1.shape1.GetUserData() == "insidecannon")) && (!((_arg1.shape2.GetBody().GetUserData() == "cannon"))))){ trace("Hurr"); Main.instance.cannonArray.push(_arg1.shape2.GetBody()); }; if ((((_arg1.shape2.GetUserData() == "insidecannon")) && (!((_arg1.shape1.GetBody().GetUserData() == "cannon"))))){ trace("Hurr"); Main.instance.cannonArray.push(_arg1.shape1.GetBody()); }; if (_arg1.velocity.Length() > 10){ if ((((((_arg1.shape1.GetUserData() == "blade")) && (((!((_local2 == "dontcutme"))) && (!((_local3 == "dontcutme"))))))) && (((!((_local2 == "blood"))) && (!((_local3 == "blood"))))))){ Main.instance.madeby = "blade"; _local8 = []; _local8[0] = ((_arg1.position.x + Math.abs((_arg1.shape2.GetBody().GetPosition().x - _arg1.position.x))) * 15); _local8[1] = ((_arg1.position.y + Math.abs((_arg1.shape2.GetBody().GetPosition().y - _arg1.position.y))) * 15); _local8[2] = 1; _local8[3] = 100; _local8[4] = 0; _local8[5] = new Point((_arg1.shape2.GetBody().GetPosition().x * 15), (_arg1.shape2.GetBody().GetPosition().y * 15)); _local8[6] = 0.5; Main.instance.cutEverythingArray.push(_local8); }; if ((((((_arg1.shape2.GetUserData() == "blade")) && (((!((_local2 == "dontcutme"))) && (!((_local3 == "dontcutme"))))))) && (((!((_local2 == "blood"))) && (!((_local3 == "blood"))))))){ Main.instance.madeby = "blade"; _local8 = []; _local8[0] = ((_arg1.position.x + Math.abs((_arg1.shape1.GetBody().GetPosition().x - _arg1.position.x))) * 15); _local8[1] = ((_arg1.position.y + Math.abs((_arg1.shape1.GetBody().GetPosition().y - _arg1.position.y))) * 15); _local8[2] = 1; _local8[3] = 100; _local8[4] = 0; _local8[5] = new Point((_arg1.shape1.GetBody().GetPosition().x * 15), (_arg1.shape1.GetBody().GetPosition().y * 15)); _local8[6] = 0.5; Main.instance.cutEverythingArray.push(_local8); }; }; if (Main.instance.sTransform.volume == 1){ if ((((_local4 > 50)) && ((_local4 < 100)))){ if (((((((!((String(_local2).substr(0, 8) == "bodypart"))) || (!((String(_local3).substr(0, 8) == "bodypart"))))) && (!((_local2 == "shrapnel"))))) && (!((_local3 == "shrapnel"))))){ if ((((((((String(_local2).substr(0, 8) == "bodypart")) || ((String(_local3).substr(0, 8) == "bodypart")))) && (!((_local2 == "shrapnel"))))) && (!((_local3 == "shrapnel"))))){ Main.instance.addDamage(1); }; }; }; if ((((_local4 > 100)) && ((_local4 < 500)))){ if (((((((!((String(_local2).substr(0, 8) == "bodypart"))) || (!((String(_local3).substr(0, 8) == "bodypart"))))) && (!((_local2 == "shrapnel"))))) && (!((_local3 == "shrapnel"))))){ if ((((((((String(_local2).substr(0, 8) == "bodypart")) || ((String(_local3).substr(0, 8) == "bodypart")))) && (!((_local2 == "shrapnel"))))) && (!((_local3 == "shrapnel"))))){ Main.instance.addDamage(2); }; }; }; }; if (_local4 > 500){ if ((((((((String(_local2).substr(0, 8) == "bodypart")) && (!((String(_local3).substr(0, 8) == "bodypart"))))) || (((!((String(_local2).substr(0, 8) == "bodypart"))) && ((String(_local3).substr(0, 8) == "bodypart")))))) || (((!((String(_local2).substr(0, 8) == "bodypart"))) && (!((String(_local3).substr(0, 8) == "bodypart"))))))){ if (((!(Main.instance.slomoOn)) && ((Main.instance.toggleSlomo == 1)))){ Main.instance.slowTo(50); }; }; }; if ((((((_local2 == "rocket")) && (!((_local3 == "dontcutme"))))) && (!((_local3 == "rocket"))))){ if (_arg1.shape2.GetBody().GetMass() > 1){ _arg1.shape1.GetBody().SetUserData("explodeme"); }; }; if ((((((_local3 == "rocket")) && (!((_local2 == "dontcutme"))))) && (!((_local2 == "rocket"))))){ if (_arg1.shape1.GetBody().GetMass() > 1){ _arg1.shape2.GetBody().SetUserData("explodeme"); }; }; if ((((((((((((((((_local2 == "explosive")) && (!((_local3 == "dontcutme"))))) && (!((_local3 == "explosive"))))) && (!((_local3 == "killme"))))) && (!((_local3 == "wall"))))) && (!((_local3 == "cannon"))))) && (!((_local3 == "static"))))) && (!((_local3 == "trash"))))){ _arg1.shape1.GetBody().SetUserData("killme"); Main.instance.explode(_arg1.shape1.GetBody().GetWorldCenter().x, _arg1.shape2.GetBody().GetWorldCenter().y); }; if ((((((((((((((((_local3 == "explosive")) && (!((_local2 == "dontcutme"))))) && (!((_local2 == "explosive"))))) && (!((_local2 == "killme"))))) && (!((_local2 == "wall"))))) && (!((_local2 == "cannon"))))) && (!((_local2 == "static"))))) && (!((_local2 == "trash"))))){ _arg1.shape2.GetBody().SetUserData("killme"); Main.instance.explode(_arg1.shape2.GetBody().GetWorldCenter().x, _arg1.shape2.GetBody().GetWorldCenter().y); }; if ((((((((_local2 == "trash")) && (!((_local3 == "dontcutme"))))) && (!((_local3 == "static"))))) && (!((_local3 == "wall"))))){ if (String(_local3).substr(0, 6) == "magnet"){ Main.instance.magnetArray[String(_local3).substr(6, 7)] = new Point(9000, 9000); }; _arg1.shape2.GetBody().SetUserData("killme"); }; if ((((((((_local3 == "trash")) && (!((_local2 == "dontcutme"))))) && (!((_local2 == "static"))))) && (!((_local2 == "wall"))))){ if (String(_local3).substr(0, 6) == "magnet"){ Main.instance.magnetArray[String(_local2).substr(6, 7)] = new Point(9000, 9000); }; _arg1.shape1.GetBody().SetUserData("killme"); }; if ((((String(_local2).substr(0, 6) == "bullet")) && (!((String(_local3).substr(0, 6) == "bullet"))))){ _local9 = 0; if (String(_local2).substr(7, 3) == "pis"){ _local9 = 2; }; if (String(_local2).substr(7, 3) == "sho"){ _local9 = 1; }; if (String(_local2).substr(7, 3) == "ass"){ _local9 = 3; }; if (String(_local2).substr(7, 3) == "m79"){ _local9 = 50; }; if (String(_local2).substr(7, 3) == "sni"){ _local9 = 1; }; if (String(_local2).substr(7, 3) == "ann"){ _local9 = 1; }; if (String(_local2).substr(7, 3) == "fla"){ _local9 = 1; }; if (String(_local2).substr(7, 3) == "min"){ _local9 = 5; }; if (String(_local2).substr(7, 3) == "can"){ _local9 = 1; }; if ((((String(_local3).substr(0, 8) == "bodypart")) && (!((String(_local2).substr(7, 3) == "m79"))))){ _local9 = 1; }; if (((((!((_local3 == "dontcutme"))) || ((((_arg1.shape2.GetBody().GetMass() > (25 * Main.instance.lagMod))) && ((_local3 == "destructable")))))) && ((((_arg1.velocity.Length() > 20)) || ((String(_local2).substr(7, 3) == "ann")))))){ if (String(_local2).substr(7, 3) == "sni"){ _local10 = 0; while (_local10 < (_local9 * 10)) { _local8 = []; _local8[0] = (((_arg1.position.x * 15) + (Math.random() * (_local9 * 20))) - ((_local9 * 20) / 2)); _local8[1] = (_arg1.position.y * 15); _local8[2] = 1; _local8[3] = 100; _local8[4] = 0; _local8[5] = new Point(((_arg1.position.x * 15) + _arg1.velocity.x), ((_arg1.position.y * 15) + _arg1.velocity.y)); _local8[6] = 10; Main.instance.cutEverythingArray.push(_local8); _local10++; }; } else { _local10 = 0; while (_local10 < _local9) { if ((((String(_local2).substr(7, 3) == "fla")) && ((Math.floor((Math.random() * 10)) == 5)))){ _local8 = []; _local8[0] = (((_arg1.position.x * 15) + (Math.random() * (_local9 * 5))) - ((_local9 * 5) / 2)); _local8[1] = (((_arg1.position.y * 15) + (Math.random() * (_local9 * 5))) - ((_local9 * 5) / 2)); _local8[2] = 1; _local8[3] = 100; _local8[4] = 0; _local8[5] = new Point(((_arg1.position.x * 15) + _arg1.velocity.x), ((_arg1.position.y * 15) + _arg1.velocity.y)); _local8[6] = 9000; Main.instance.cutEverythingArray.push(_local8); }; _local10++; }; }; }; if (String(_local2).substr(7, 3) == "m79"){ _arg1.shape2.GetBody().SetUserData("killme"); Main.instance.explode(_arg1.position.x, _arg1.position.y); } else { if (String(_local2).substr(7, 3) == "ann"){ _arg1.shape1.GetBody().SetUserData(((("bullet_" + Main.instance.bulletType) + "killcounter_") + 999)); } else { if (String(_local2).substr(7, 3) == "fla"){ _arg1.shape1.GetBody().SetUserData("killme"); } else { _local11 = (((_local9 * 5) * Main.instance.lagMod) + 100); trace(((("bullet_" + Main.instance.bulletType) + "killcounter_") + String(_local9))); _arg1.shape1.GetBody().SetUserData(((("bullet_" + Main.instance.bulletType) + "killcounter_") + String(_local11))); }; }; }; }; if ((((String(_local3).substr(0, 6) == "bullet")) && (!((String(_local2).substr(0, 6) == "bullet"))))){ _local9 = 0; if (String(_local3).substr(7, 3) == "pis"){ _local9 = 2; }; if (String(_local3).substr(7, 3) == "sho"){ _local9 = 1; }; if (String(_local3).substr(7, 3) == "ass"){ _local9 = 3; }; if (String(_local3).substr(7, 3) == "m79"){ _local9 = 50; }; if (String(_local3).substr(7, 3) == "sni"){ _local9 = 1; }; if (String(_local3).substr(7, 3) == "ann"){ _local9 = 1; }; if (String(_local3).substr(7, 3) == "fla"){ _local9 = 1; }; if (String(_local3).substr(7, 3) == "min"){ _local9 = 5; }; if (String(_local3).substr(7, 3) == "can"){ _local9 = 1; }; if ((((String(_local2).substr(0, 8) == "bodypart")) && (!((String(_local3).substr(7, 3) == "m79"))))){ _local9 = 1; }; if (((((!((_local2 == "dontcutme"))) || ((((_arg1.shape1.GetBody().GetMass() > (25 * Main.instance.lagMod))) && ((_local2 == "destructable")))))) && ((((_arg1.velocity.Length() > 20)) || ((String(_local3).substr(7, 3) == "ann")))))){ if (String(_local3).substr(7, 3) == "sni"){ _local10 = 0; while (_local10 < (_local9 * 10)) { _local8 = []; _local8[0] = (((_arg1.position.x * 15) + (Math.random() * (_local9 * 20))) - ((_local9 * 20) / 2)); _local8[1] = (_arg1.position.y * 15); _local8[2] = 1; _local8[3] = 100; _local8[4] = 0; _local8[5] = new Point(((_arg1.position.x * 15) + _arg1.velocity.x), ((_arg1.position.y * 15) + _arg1.velocity.y)); _local8[6] = 10; Main.instance.cutEverythingArray.push(_local8); _local10++; }; } else { _local10 = 0; while (_local10 < _local9) { _local8 = []; _local8[0] = (((_arg1.position.x * 15) + (Math.random() * (_local9 * 5))) - ((_local9 * 5) / 2)); _local8[1] = (((_arg1.position.y * 15) + (Math.random() * (_local9 * 5))) - ((_local9 * 5) / 2)); _local8[2] = 1; _local8[3] = 100; _local8[4] = 0; _local8[5] = new Point(((_arg1.position.x * 15) + _arg1.velocity.x), ((_arg1.position.y * 15) + _arg1.velocity.y)); _local8[6] = 9000; Main.instance.cutEverythingArray.push(_local8); _local10++; }; }; }; if (String(_local3).substr(7, 3) == "m79"){ _arg1.shape2.GetBody().SetUserData("killme"); Main.instance.explode(_arg1.position.x, _arg1.position.y); } else { if (String(_local3).substr(7, 3) == "ann"){ _arg1.shape2.GetBody().SetUserData(((("bullet_" + Main.instance.bulletType) + "killcounter_") + 999)); } else { if (String(_local3).substr(7, 3) == "fla"){ _arg1.shape2.GetBody().SetUserData("killme"); } else { _local11 = (((_local9 * 5) * Main.instance.lagMod) + 100); trace(((("bullet_" + Main.instance.bulletType) + "killcounter_") + String(_local9))); _arg1.shape2.GetBody().SetUserData(((("bullet_" + Main.instance.bulletType) + "killcounter_") + String(_local11))); }; }; }; }; if ((((((String(_local2).substr(0, 12) == "destructable")) && (!((_local3 == "trash"))))) && (!((_local3 == "destructable_realistic"))))){ if (_arg1.shape1.GetBody().GetMass() > (25 / Main.instance.lagMod)){ _local7 = (((_arg1.velocity.Length() / 10) * (_arg1.shape1.GetBody().GetMass() * 10)) / (Main.instance.Interface.GlobalField_Size.text * 2)); if (String(_local2).substr(13, 4) == "tile"){ _local12 = 3000; } else { _local12 = 1000; }; if (_local7 > _local12){ _local13 = new Point(((_arg1.position.x * 15) + _arg1.velocity.x), ((_arg1.position.y * 15) + _arg1.velocity.y)); _local10 = 0; while (_local10 < Math.ceil((10 * Main.instance.lagMod))) { Main.instance.cutArray.push((((_arg1.position.x * 15) + (Math.random() * 30)) - 15), (((_arg1.position.y * 15) + (Math.random() * 30)) - 15), 1, 100, 0, _local13); _local10++; }; }; }; }; if ((((((String(_local3).substr(0, 12) == "destructable")) && (!((_local2 == "trash"))))) && (!((_local2 == "destructable_realistic"))))){ if (_arg1.shape2.GetBody().GetMass() > (25 / Main.instance.lagMod)){ _local14 = (((_arg1.velocity.Length() / 10) * (_arg1.shape2.GetBody().GetMass() * 10)) / (Main.instance.Interface.GlobalField_Size.text * 2)); if (String(_local2).substr(13, 4) == "tile"){ _local12 = 3000; } else { _local12 = 1000; }; if (_local14 > _local12){ _local15 = new Point(((_arg1.position.x * 15) + _arg1.velocity.x), ((_arg1.position.y * 15) + _arg1.velocity.y)); _local10 = 0; while (_local10 < Math.ceil((10 * Main.instance.lagMod))) { Main.instance.cutArray.push((((_arg1.position.x * 15) + (Math.random() * 30)) - 15), (((_arg1.position.y * 15) + (Math.random() * 30)) - 15), 1, 100, 0, _local15); _local10++; }; }; }; }; var _local5:Number = (Math.abs((((_arg1.shape1.GetBody().GetLinearVelocity().x * 5) * _arg1.shape1.GetBody().GetMass()) / 5)) + Math.abs((((_arg1.shape2.GetBody().GetLinearVelocity().x * 5) * _arg1.shape2.GetBody().GetMass()) / 5))); var _local6:Number = (Math.abs((((_arg1.shape1.GetBody().GetLinearVelocity().y * 5) * _arg1.shape1.GetBody().GetMass()) / 5)) + Math.abs((((_arg1.shape2.GetBody().GetLinearVelocity().y * 5) * _arg1.shape2.GetBody().GetMass()) / 5))); _local7 = Math.sqrt((((_local5 * _local5) + _local6) + _local6)); if (_local7 > 10000){ trace(("F: " + _local7), _arg1.shape1.GetBody().GetMass(), _arg1.shape2.GetBody().GetMass()); }; if ((((_local2 == "destructable_realistic")) && (!((_local3 == "trash"))))){ if (_local7 > 1000){ _local13 = new Point(((_arg1.position.x * 15) + _arg1.shape2.GetBody().GetLinearVelocity().x), ((_arg1.position.y * 15) + _arg1.shape2.GetBody().GetLinearVelocity().y)); _local10 = 0; while (_local10 < 1) { Main.instance.cutArray.push((_arg1.position.x * 15), (_arg1.position.y * 15), 1, 100, 0, _local13); _local10++; }; }; }; if ((((_local3 == "destructable_realistic")) && (!((_local2 == "trash"))))){ if (_local7 > 1000){ _local15 = new Point(((_arg1.position.x * 15) + _arg1.shape1.GetBody().GetLinearVelocity().x), ((_arg1.position.y * 15) + _arg1.shape1.GetBody().GetLinearVelocity().y)); trace(_local15.x, _local15.y); _local10 = 0; while (_local10 < 1) { Main.instance.cutArray.push((_arg1.position.x * 15), (_arg1.position.y * 15), 1, 100, 0, _local15); _local10++; }; }; }; if ((((((((((((String(_local2).substr(0, 8) == "bodypart")) && (!((String(_local3).substr(0, 8) == "bodypart"))))) && (!((_local2 == "blood"))))) && (!((_local3 == "blood"))))) && (!((_local2 == "trash"))))) && (!((_local3 == "trash"))))){ headforce = (((_arg1.velocity.Length() / 10) * (_arg1.shape1.GetBody().GetMass() * 10)) / (Main.instance.Interface.GlobalField_Size.text * 2)); if (headforce > 50){ Main.instance.shitArray.push(_arg1.position.x, _arg1.position.y, (headforce / 20)); if (((!(Main.instance.slomoOn)) && ((Main.instance.toggleSlomo == 1)))){ Main.instance.slowTo(50); }; }; if ((((headforce > 100)) && ((int(String(_local2).substr(17, 2)) > 0)))){ temphealth = int(String(_local2).substr(17, 2)); newhealth = (int(String(_local2).substr(17, 2)) - (headforce / 50)); if (newhealth < 0){ newhealth = 0; }; Main.instance.addDamage(((Math.floor((temphealth - newhealth)) * headforce) / 50)); if (Main.instance.toggleRagdollBreak == 1){ _arg1.shape1.GetBody().SetUserData((String(_local2).substr(0, 17) + newhealth)); if (headforce > 1000){ headforce = 100; }; Main.instance.shitArray.push(_arg1.position.x, _arg1.position.y, (headforce / 50)); if (((!(Main.instance.slomoOn)) && ((Main.instance.toggleSlomo == 1)))){ Main.instance.slowTo(50); }; }; }; }; if ((((((((String(_local3).substr(0, 8) == "bodypart")) && (!((String(_local2).substr(0, 8) == "bodypart"))))) && (!((_local2 == "blood"))))) && (!((_local3 == "blood"))))){ headforce = (((_arg1.velocity.Length() / 10) * (_arg1.shape2.GetBody().GetMass() * 10)) / (Main.instance.Interface.GlobalField_Size.text * 2)); if (headforce > 50){ Main.instance.shitArray.push(_arg1.position.x, _arg1.position.y, (headforce / 20)); if (((!(Main.instance.slomoOn)) && ((Main.instance.toggleSlomo == 1)))){ Main.instance.slowTo(50); }; }; if ((((headforce > 100)) && ((int(String(_local3).substr(17, 2)) > 0)))){ temphealth = int(String(_local3).substr(17, 2)); newhealth = (int(String(_local3).substr(17, 2)) - (headforce / 50)); if (newhealth < 0){ newhealth = 0; }; Main.instance.addDamage(((Math.floor((temphealth - newhealth)) * headforce) / 50)); if (Main.instance.toggleRagdollBreak == 1){ _arg1.shape2.GetBody().SetUserData((String(_local3).substr(0, 17) + newhealth)); if (headforce > 1000){ headforce = 100; }; Main.instance.shitArray.push(_arg1.position.x, _arg1.position.y, (headforce / 50)); if (((!(Main.instance.slomoOn)) && ((Main.instance.toggleSlomo == 1)))){ Main.instance.slowTo(50); }; }; }; }; if ((((((((_local2 == "star")) || ((_local3 == "star")))) && (((!((_local2 == "insidecannon"))) && (!((_local3 == "insidecannon"))))))) && (((!((_local2 == "trash"))) && (!((_local3 == "trash"))))))){ _local16 = ((_arg1.velocity.Length() / 10) * (_arg1.shape2.GetBody().GetMass() * 10)); if (_local16 > 100){ _local17 = new Point((_arg1.position.x + ((_arg1.shape1.GetBody().GetPosition().x - _arg1.position.x) / 10)), (_arg1.position.y + ((_arg1.shape1.GetBody().GetPosition().y - _arg1.position.y) / 10))); _local18 = new Point((_arg1.position.x + ((_arg1.shape2.GetBody().GetPosition().x - _arg1.position.x) / 10)), (_arg1.position.y + ((_arg1.shape2.GetBody().GetPosition().y - _arg1.position.y) / 10))); Main.instance.jointArray.push(_arg1.shape1.GetBody(), _arg1.shape2.GetBody(), _local17, _local18); }; }; if ((((((((((((((((_arg1.shape1.GetUserData() == "tip")) || ((_arg1.shape2.GetUserData() == "tip")))) && (!((_local2 == "insidecannon"))))) && (!((_local3 == "insidecannon"))))) && (!((_local2 == "trash"))))) && (!((_local3 == "trash"))))) && (!((_local2 == "blood"))))) && (!((_local3 == "blood"))))){ _local19 = new b2Vec2(_arg1.shape1.GetBody().GetLinearVelocity().x, _arg1.shape1.GetBody().GetLinearVelocity().y); _local20 = new b2Vec2(_arg1.shape2.GetBody().GetLinearVelocity().x, _arg1.shape2.GetBody().GetLinearVelocity().y); trace(_local2, _local3); if ((((((((Math.abs(_local19.x) > 30)) || ((Math.abs(_local20.x) > 30)))) || ((Math.abs(_local19.y) > 30)))) || ((Math.abs(_local20.y) > 30)))){ _local17 = new Point((_arg1.position.x + ((_arg1.shape1.GetBody().GetPosition().x - _arg1.position.x) / 10)), (_arg1.position.y + ((_arg1.shape1.GetBody().GetPosition().y - _arg1.position.y) / 10))); _local18 = new Point((_arg1.position.x + ((_arg1.shape2.GetBody().GetPosition().x - _arg1.position.x) / 10)), (_arg1.position.y + ((_arg1.shape2.GetBody().GetPosition().y - _arg1.position.y) / 10))); Main.instance.jointArray.push(_arg1.shape1.GetBody(), _arg1.shape2.GetBody(), _local17, _local18); }; }; super.Add(_arg1); } } }//package
Section 111
//userInterface (userInterface) package { import flash.display.*; import flash.text.*; public dynamic class userInterface extends MovieClip { public var damagemeter:TextField; public var help:MovieClip; public var loadworld:MovieClip; public var KeyMap:TextField; public var tutorial:MovieClip; public var GlobalField_Angle:TextField; public var GlobalToggle_Spawn:MovieClip; public var GlobalField_Object:TextField; public var spawnhammer:MovieClip; public var GlobalToggle_Sound:MovieClip; public var spawnragdoll:MovieClip; public var GlobalField_Lag:TextField; public var panic:MovieClip; public var spawncircle:MovieClip; public var GlobalToggle_Stabi:MovieClip; public var GlobalField_Size:TextField; public var spawnsword:MovieClip; public var spawnoctagon:MovieClip; public var GlobalField_Gravity:TextField; public var spawnmagnet:MovieClip; public var spawnbreakable2:MovieClip; public var GlobalToggle_Slomo:MovieClip; public var GlobalToggle_Pause:MovieClip; public var spawnwall:MovieClip; public var toggle:MovieClip; public var spawnchain:MovieClip; public var spawnsquare:MovieClip; public var setkeys:MovieClip; public var GlobalToggle_Lines:MovieClip; public var GlobalField_LDamp:TextField; public var GlobalField_Density:TextField; public var GlobalField_Time:TextField; public var saveworld:MovieClip; public var spawnstar:MovieClip; public var GlobalToggle_RagdollBreak:MovieClip; public var GlobalToggle_JointBreak:MovieClip; public var GlobalField_ADamp:TextField; public var GlobalField_Bleed:TextField; public var GlobalField_Friction:TextField; public var spawngear:MovieClip; public var spawnbreakable:MovieClip; public var GlobalField_Restitution:TextField; public var GlobalField_Wind:TextField; public var spawntrash:MovieClip; public var spawnexplosive:MovieClip; } }//package
Section 112
//userInterfaceTOP (userInterfaceTOP) package { import flash.display.*; public dynamic class userInterfaceTOP extends MovieClip { public var help:MovieClip; public var tutorial:MovieClip; public var sliderAlpha:MovieClip; public var sliderLine:MovieClip; public var knobAlpha:MovieClip; public var sliderTone:MovieClip; public var knobLine:MovieClip; public var toggle:MovieClip; public var knobTone:MovieClip; } }//package
Section 113
//xblood (xblood) package { import flash.display.*; public dynamic class xblood extends MovieClip { } }//package

Library Items

Symbol 1 GraphicUsed by:26
Symbol 2 FontUsed by:3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 154
Symbol 3 EditableTextUses:2Used by:26
Symbol 4 GraphicUsed by:26
Symbol 5 TextUses:2Used by:26
Symbol 6 TextUses:2Used by:26
Symbol 7 TextUses:2Used by:26
Symbol 8 TextUses:2Used by:26
Symbol 9 TextUses:2Used by:26
Symbol 10 TextUses:2Used by:26
Symbol 11 TextUses:2Used by:26
Symbol 12 EditableTextUses:2Used by:26
Symbol 13 TextUses:2Used by:26
Symbol 14 TextUses:2Used by:26
Symbol 15 TextUses:2Used by:26
Symbol 16 EditableTextUses:2Used by:23
Symbol 17 EditableTextUses:2Used by:23
Symbol 18 EditableTextUses:2Used by:23
Symbol 19 EditableTextUses:2Used by:23
Symbol 20 EditableTextUses:2Used by:23
Symbol 21 EditableTextUses:2Used by:23
Symbol 22 EditableTextUses:2Used by:23
Symbol 23 MovieClipUses:16 17 18 19 20 21 22Used by:26
Symbol 24 GraphicUsed by:25
Symbol 25 MovieClipUses:24Used by:26 49 108 113
Symbol 26 MovieClip {savemenu}Uses:1 3 4 5 6 7 8 9 10 11 12 13 14 15 23 25
Symbol 27 GraphicUsed by:49
Symbol 28 FontUsed by:29 30 31 36 37 38 39 44 45 47 48 56 57 58 61 62 63 64 67 68 69 70 71 74 76 80 90 91 94 97 99 101 102 103 104 105 106 112 115 116 117 118 119 120 121 122 123 124 125 126
Symbol 29 TextUses:28Used by:49
Symbol 30 TextUses:28Used by:49
Symbol 31 TextUses:28Used by:49
Symbol 32 GraphicUsed by:33
Symbol 33 MovieClipUses:32Used by:49
Symbol 34 GraphicUsed by:35
Symbol 35 MovieClipUses:34Used by:49
Symbol 36 TextUses:28Used by:49
Symbol 37 TextUses:28Used by:49
Symbol 38 TextUses:28Used by:49
Symbol 39 TextUses:28Used by:49
Symbol 40 GraphicUsed by:49 108
Symbol 41 FontUsed by:42 96
Symbol 42 TextUses:41Used by:49 108
Symbol 43 GraphicUsed by:46
Symbol 44 TextUses:28Used by:46
Symbol 45 TextUses:28Used by:46
Symbol 46 MovieClipUses:43 44 45Used by:49
Symbol 47 TextUses:28Used by:49
Symbol 48 TextUses:28Used by:49
Symbol 49 MovieClip {userInterfaceTOP}Uses:27 25 29 30 31 33 35 36 37 38 39 40 42 46 47 48
Symbol 50 GraphicUsed by:108
Symbol 51 GraphicUsed by:108
Symbol 52 FontUsed by:53 54 55 59 60 65 66 72 73 75 92 93 98
Symbol 53 EditableTextUses:52Used by:108
Symbol 54 EditableTextUses:52Used by:108
Symbol 55 EditableTextUses:52Used by:108
Symbol 56 TextUses:28Used by:108
Symbol 57 TextUses:28Used by:108
Symbol 58 TextUses:28Used by:108
Symbol 59 EditableTextUses:52Used by:108
Symbol 60 EditableTextUses:52Used by:108
Symbol 61 TextUses:28Used by:108
Symbol 62 TextUses:28Used by:108
Symbol 63 TextUses:28Used by:108
Symbol 64 TextUses:28Used by:108
Symbol 65 EditableTextUses:52Used by:108
Symbol 66 EditableTextUses:52Used by:108
Symbol 67 TextUses:28Used by:108
Symbol 68 TextUses:28Used by:108
Symbol 69 TextUses:28Used by:108
Symbol 70 TextUses:28Used by:108
Symbol 71 TextUses:28Used by:108
Symbol 72 EditableTextUses:52Used by:108
Symbol 73 EditableTextUses:52Used by:108
Symbol 74 TextUses:28Used by:108
Symbol 75 EditableTextUses:52Used by:108
Symbol 76 TextUses:28Used by:108
Symbol 77 GraphicUsed by:79
Symbol 78 GraphicUsed by:79
Symbol 79 MovieClipUses:77 78Used by:108
Symbol 80 TextUses:28Used by:108
Symbol 81 FontUsed by:82 83 84 85 87 88 89
Symbol 82 TextUses:81Used by:108
Symbol 83 TextUses:81Used by:108
Symbol 84 EditableTextUses:81Used by:108
Symbol 85 EditableTextUses:81Used by:108
Symbol 86 GraphicUsed by:108
Symbol 87 TextUses:81Used by:108
Symbol 88 TextUses:81Used by:108
Symbol 89 TextUses:81Used by:108
Symbol 90 TextUses:28Used by:108
Symbol 91 TextUses:28Used by:108
Symbol 92 EditableTextUses:52Used by:108
Symbol 93 EditableTextUses:52Used by:108
Symbol 94 TextUses:28Used by:108
Symbol 95 GraphicUsed by:108
Symbol 96 TextUses:41Used by:108
Symbol 97 TextUses:28Used by:108
Symbol 98 EditableTextUses:52Used by:108
Symbol 99 TextUses:28Used by:108
Symbol 100 GraphicUsed by:107
Symbol 101 TextUses:28Used by:107
Symbol 102 TextUses:28Used by:107
Symbol 103 TextUses:28Used by:107
Symbol 104 TextUses:28Used by:107
Symbol 105 TextUses:28Used by:107
Symbol 106 TextUses:28Used by:107
Symbol 107 MovieClipUses:100 101 102 103 104 105 106Used by:108
Symbol 108 MovieClip {userInterface}Uses:50 25 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 79 80 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 40 42 97 98 99 107
Symbol 109 GraphicUsed by:110 153
Symbol 110 MovieClip {Ball}Uses:109
Symbol 111 GraphicUsed by:113
Symbol 112 TextUses:28Used by:113
Symbol 113 MovieClip {mochi}Uses:111 25 112
Symbol 114 GraphicUsed by:127
Symbol 115 EditableTextUses:28Used by:127
Symbol 116 EditableTextUses:28Used by:127
Symbol 117 EditableTextUses:28Used by:127
Symbol 118 EditableTextUses:28Used by:127
Symbol 119 EditableTextUses:28Used by:127
Symbol 120 EditableTextUses:28Used by:127
Symbol 121 EditableTextUses:28Used by:127
Symbol 122 EditableTextUses:28Used by:127
Symbol 123 EditableTextUses:28Used by:127
Symbol 124 EditableTextUses:28Used by:127
Symbol 125 EditableTextUses:28Used by:127
Symbol 126 EditableTextUses:28Used by:127
Symbol 127 MovieClip {help}Uses:114 115 116 117 118 119 120 121 122 123 124 125 126
Symbol 128 GraphicUsed by:129
Symbol 129 MovieClipUses:128Used by:152
Symbol 130 MovieClip {fl.core.ComponentShim}Used by:152
Symbol 131 GraphicUsed by:132
Symbol 132 MovieClip {ColorPicker_upSkin}Uses:131Used by:152
Symbol 133 GraphicUsed by:134
Symbol 134 MovieClip {ColorPicker_disabledSkin}Uses:133Used by:152
Symbol 135 GraphicUsed by:136
Symbol 136 MovieClip {ColorPicker_swatchSkin}Uses:135Used by:152
Symbol 137 GraphicUsed by:138
Symbol 138 MovieClipUses:137Used by:141 152
Symbol 139 GraphicUsed by:140
Symbol 140 MovieClipUses:139Used by:141 152
Symbol 141 MovieClip {ColorPicker_backgroundSkin}Uses:138 140Used by:152
Symbol 142 GraphicUsed by:143
Symbol 143 MovieClip {ColorPicker_downSkin}Uses:142Used by:152
Symbol 144 GraphicUsed by:145
Symbol 145 MovieClip {ColorPicker_textFieldSkin}Uses:144Used by:152
Symbol 146 GraphicUsed by:147
Symbol 147 MovieClip {ColorPicker_overSkin}Uses:146Used by:152
Symbol 148 GraphicUsed by:149
Symbol 149 MovieClip {ColorPicker_colorWell}Uses:148Used by:152
Symbol 150 GraphicUsed by:151
Symbol 151 MovieClip {ColorPicker_swatchSelectedSkin}Uses:150Used by:152
Symbol 152 MovieClip {fl.controls.ColorPicker}Uses:129 130 132 134 136 141 143 145 147 149 151 140 138
Symbol 153 MovieClip {xblood}Uses:109
Symbol 154 EditableTextUses:2Used by:158
Symbol 155 GraphicUsed by:158
Symbol 156 GraphicUsed by:158
Symbol 157 GraphicUsed by:158
Symbol 158 MovieClipUses:154 155 156 157Used by:Timeline
Symbol 159 MovieClip {fl.controls.Button}

Instance Names

"preloader"Frame 1Symbol 158 MovieClip
"savetext"Symbol 26 MovieClip {savemenu} Frame 1Symbol 3 EditableText
"nameSO"Symbol 26 MovieClip {savemenu} Frame 1Symbol 12 EditableText
"tutorial"Symbol 26 MovieClip {savemenu} Frame 1Symbol 23 MovieClip
"loadIt"Symbol 26 MovieClip {savemenu} Frame 1Symbol 25 MovieClip
"copyIt"Symbol 26 MovieClip {savemenu} Frame 1Symbol 25 MovieClip
"saveIt"Symbol 26 MovieClip {savemenu} Frame 1Symbol 25 MovieClip
"doneIt"Symbol 26 MovieClip {savemenu} Frame 1Symbol 25 MovieClip
"loadSharedObj"Symbol 26 MovieClip {savemenu} Frame 1Symbol 25 MovieClip
"saveSharedObj"Symbol 26 MovieClip {savemenu} Frame 1Symbol 25 MovieClip
"contentLoad"Symbol 26 MovieClip {savemenu} Frame 1Symbol 25 MovieClip
"contentSave"Symbol 26 MovieClip {savemenu} Frame 1Symbol 25 MovieClip
"helpthefuckingidiots"Symbol 26 MovieClip {savemenu} Frame 1Symbol 25 MovieClip
"toggle"Symbol 49 MovieClip {userInterfaceTOP} Frame 1Symbol 25 MovieClip
"sliderAlpha"Symbol 49 MovieClip {userInterfaceTOP} Frame 1Symbol 33 MovieClip
"knobAlpha"Symbol 49 MovieClip {userInterfaceTOP} Frame 1Symbol 35 MovieClip
"sliderLine"Symbol 49 MovieClip {userInterfaceTOP} Frame 1Symbol 33 MovieClip
"knobLine"Symbol 49 MovieClip {userInterfaceTOP} Frame 1Symbol 35 MovieClip
"sliderTone"Symbol 49 MovieClip {userInterfaceTOP} Frame 1Symbol 33 MovieClip
"knobTone"Symbol 49 MovieClip {userInterfaceTOP} Frame 1Symbol 35 MovieClip
"help"Symbol 49 MovieClip {userInterfaceTOP} Frame 1Symbol 25 MovieClip
"tutorial"Symbol 49 MovieClip {userInterfaceTOP} Frame 1Symbol 46 MovieClip
"spawnsquare"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawnmagnet"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawnstar"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawnragdoll"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawnbreakable"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawnoctagon"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawncircle"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"panic"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"saveworld"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawnexplosive"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawnbreakable2"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawnsword"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawnhammer"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawnchain"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"toggle"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"help"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawntrash"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawngear"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"spawnwall"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"GlobalField_Size"Symbol 108 MovieClip {userInterface} Frame 1Symbol 53 EditableText
"GlobalField_Density"Symbol 108 MovieClip {userInterface} Frame 1Symbol 54 EditableText
"GlobalField_Friction"Symbol 108 MovieClip {userInterface} Frame 1Symbol 55 EditableText
"GlobalField_Restitution"Symbol 108 MovieClip {userInterface} Frame 1Symbol 59 EditableText
"GlobalField_LDamp"Symbol 108 MovieClip {userInterface} Frame 1Symbol 60 EditableText
"GlobalField_Time"Symbol 108 MovieClip {userInterface} Frame 1Symbol 65 EditableText
"GlobalField_Bleed"Symbol 108 MovieClip {userInterface} Frame 1Symbol 66 EditableText
"GlobalField_Object"Symbol 108 MovieClip {userInterface} Frame 1Symbol 72 EditableText
"GlobalField_Wind"Symbol 108 MovieClip {userInterface} Frame 1Symbol 73 EditableText
"GlobalField_Gravity"Symbol 108 MovieClip {userInterface} Frame 1Symbol 75 EditableText
"GlobalToggle_Pause"Symbol 108 MovieClip {userInterface} Frame 1Symbol 79 MovieClip
"GlobalToggle_Slomo"Symbol 108 MovieClip {userInterface} Frame 1Symbol 79 MovieClip
"GlobalToggle_RagdollBreak"Symbol 108 MovieClip {userInterface} Frame 1Symbol 79 MovieClip
"GlobalToggle_Lines"Symbol 108 MovieClip {userInterface} Frame 1Symbol 79 MovieClip
"GlobalToggle_Spawn"Symbol 108 MovieClip {userInterface} Frame 1Symbol 79 MovieClip
"GlobalToggle_Sound"Symbol 108 MovieClip {userInterface} Frame 1Symbol 79 MovieClip
"damagemeter"Symbol 108 MovieClip {userInterface} Frame 1Symbol 84 EditableText
"KeyMap"Symbol 108 MovieClip {userInterface} Frame 1Symbol 85 EditableText
"setkeys"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"loadworld"Symbol 108 MovieClip {userInterface} Frame 1Symbol 25 MovieClip
"GlobalToggle_Stabi"Symbol 108 MovieClip {userInterface} Frame 1Symbol 79 MovieClip
"GlobalField_Lag"Symbol 108 MovieClip {userInterface} Frame 1Symbol 92 EditableText
"GlobalField_ADamp"Symbol 108 MovieClip {userInterface} Frame 1Symbol 93 EditableText
"GlobalToggle_JointBreak"Symbol 108 MovieClip {userInterface} Frame 1Symbol 79 MovieClip
"GlobalField_Angle"Symbol 108 MovieClip {userInterface} Frame 1Symbol 98 EditableText
"tutorial"Symbol 108 MovieClip {userInterface} Frame 1Symbol 107 MovieClip
"mochiclose"Symbol 113 MovieClip {mochi} Frame 1Symbol 25 MovieClip
"adhere"Symbol 113 MovieClip {mochi} Frame 1Symbol 25 MovieClip

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 11284 bytes "<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmln ..."




http://swfchan.com/21/101571/info.shtml
Created: 20/3 -2019 08:16:53 Last modified: 20/3 -2019 08:16:53 Server time: 14/11 -2024 06:46:25