Section 1
//BreakBlock (Actions.BreakBlock)
package Actions {
import General.*;
import flash.display.*;
import General.Utility.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import Graphics.Particle.*;
import Actors.Projectile.*;
import World.AssetManager.*;
import Physics.Box2D.Common.*;
public class BreakBlock implements ICollisionAction {
private var _breakgroup:String;
public function BreakBlock(_arg1:String){
_breakgroup = _arg1;
}
public function run(_arg1:b2Shape, _arg2:b2Shape, _arg3:b2Manifold):void{
var _local5:b2Body;
var _local6:IActor;
var _local8:ParticleEmitter;
var _local4:GroupList = _arg1.m_userData.m_group_list;
if (_local4.Contains(_breakgroup)){
_local5 = _arg2.m_body;
_local6 = _arg2.m_userData.m_actor;
} else {
_local5 = _arg1.m_body;
_local6 = _arg1.m_userData.m_actor;
};
var _local7:BitmapData = ImageAssets.images["blockparticle"];
_local8 = new ParticleEmitter(_local5, _local7, new b2Vec2(4, 4), 7, new b2Vec2(0, 0), 0.95, false, 360, new b2Vec2(10, 10), new b2Vec2(10, 10));
_local8.update();
_local8 = null;
Environment.world.DestroyBody(_local5);
_local6 = null;
_local5 = null;
Environment.level.levelInfo.blocksbroken = (Environment.level.levelInfo.blocksbroken + 1);
}
}
}//package Actions
Section 2
//CollectShape (Actions.CollectShape)
package Actions {
import General.*;
import General.Utility.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Sound.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import World.AssetManager.*;
import Physics.Box2D.Common.*;
public class CollectShape implements ICollisionAction {
private var _collectgroup:String;
public function CollectShape(_arg1:String){
_collectgroup = _arg1;
}
public function run(_arg1:b2Shape, _arg2:b2Shape, _arg3:b2Manifold):void{
var _local5:b2Body;
var _local6:IActor;
var _local4:GroupList = _arg1.m_userData.m_group_list;
if (_local4.Contains(_collectgroup)){
_local5 = _arg1.m_body;
_local6 = _arg1.m_userData.m_actor;
} else {
_local5 = _arg2.m_body;
_local6 = _arg2.m_userData.m_actor;
};
Environment.world.DestroyBody(_local5);
_local6 = null;
_local5 = null;
trace("Shape Collected");
if (GameState.levelactive == true){
Environment.level.levelInfo.collected = (Environment.level.levelInfo.collected + 1);
};
if (Environment.level.levelInfo.collected == GameState.totalshapes){
Environment.level.levelInfo.collected = 0;
SoundManager.getInstance().playsound(SoundAssets.sounds["endlevel"], 0, 0.45, 0);
Environment.endgame = true;
};
}
}
}//package Actions
Section 3
//ConstantImpulse (Actions.ConstantImpulse)
package Actions {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
public class ConstantImpulse implements IAction {
private var _body:b2Body;
private var _speed:Number;
public function ConstantImpulse(_arg1:b2Body, _arg2:Number){
_body = _arg1;
_speed = _arg2;
}
public function run():void{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local1:b2Vec2 = _body.GetLinearVelocity();
var _local2:Number = _local1.Length();
if (_local2 < _speed){
_local3 = _local1.Copy();
_local3.Normalize();
_local3.Multiply(_speed);
_local4 = _local1.Copy();
_local4.Subtract(_local3);
_local4 = new b2Vec2(-(_local4.x), -(_local4.y));
_body.ApplyImpulse(_local4, _body.GetCenterPosition());
} else {
if (_local2 > _speed){
_local3 = _local1.Copy();
_local3.Normalize();
_local3.Multiply(_speed);
_local4 = _local3.Copy();
_local4.Subtract(_local1);
_body.ApplyImpulse(_local4, _body.GetCenterPosition());
};
};
}
}
}//package Actions
Section 4
//IAction (Actions.IAction)
package Actions {
public interface IAction {
function run():void;
}
}//package Actions
Section 5
//ICollisionAction (Actions.ICollisionAction)
package Actions {
import Physics.Box2D.Collision.*;
import Physics.Box2D.Collision.Shapes.*;
public interface ICollisionAction {
function run(_arg1:b2Shape, _arg2:b2Shape, _arg3:b2Manifold):void;
}
}//package Actions
Section 6
//KeyboardShoot (Actions.KeyboardShoot)
package Actions {
import Actors.*;
public class KeyboardShoot implements IAction {
private var _actor:Ship;
public function KeyboardShoot(_arg1:Ship){
_actor = _arg1;
}
public function run():void{
_actor.keyboardshoot();
}
}
}//package Actions
Section 7
//LimitVelocity (Actions.LimitVelocity)
package Actions {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
public class LimitVelocity implements IAction {
private var _body:b2Body;
private var _limit:Number;
public function LimitVelocity(_arg1:b2Body, _arg2:Number){
_body = _arg1;
_limit = _arg2;
}
public function run():void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local1:b2Vec2 = _body.GetLinearVelocity();
if (_local1.Length() > _limit){
_local2 = _local1.Copy();
_local2.Normalize();
_local2.Multiply(_limit);
_local3 = _local1.Copy();
_local3.Subtract(_local2);
_local3 = new b2Vec2(-(_local3.x), -(_local3.y));
_body.ApplyImpulse(_local3, _body.GetCenterPosition());
};
}
}
}//package Actions
Section 8
//PlaySound (Actions.PlaySound)
package Actions {
import General.*;
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import Sound.*;
import mx.core.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Collision.Shapes.*;
import flash.utils.*;
public class PlaySound implements ICollisionAction {
private var _priority:int;
private var _delay:int;// = 0
private var _useimpulse:Boolean;
private var _sound:SoundAsset;
private var _last:uint;
private var _coord:b2Vec2;
private var _volume:Number;
private var _usedelay:Boolean;
public function PlaySound(_arg1:SoundAsset, _arg2:Number, _arg3:int=0, _arg4:int=0, _arg5:Boolean=true){
_sound = _arg1;
_volume = _arg2;
_priority = _arg3;
_delay = _arg4;
_useimpulse = _arg5;
if (_delay > 0){
_usedelay = true;
_last = getTimer();
};
}
public function run(_arg1:b2Shape, _arg2:b2Shape, _arg3:b2Manifold):void{
var _local4:b2ContactPoint;
var _local5:Number;
if (_usedelay == true){
if ((getTimer() - _last) < _delay){
return;
};
_last = getTimer();
};
_local4 = (_arg3.points[0] as b2ContactPoint);
_local5 = _local4.normalImpulse;
if (!_useimpulse){
_local5 = 1;
} else {
_local5 = (_local4.normalImpulse / 5);
_local5 = (_local5 * _volume);
if (_local5 > 1){
_local5 = 1;
};
};
_coord = _local4.position.Copy();
var _local6:b2Vec2 = View.GetActor().GetPosition();
var _local7:b2Vec2 = _coord.Copy();
_local7.Subtract(_local6);
_local7.Multiply(Environment.physScale);
var _local8:Number = _local7.Length();
SoundManager.getInstance().QueueSound(_sound, _local8, _local7, _priority, _local5);
}
}
}//package Actions
Section 9
//PusherImpulse (Actions.PusherImpulse)
package Actions {
import General.*;
import General.Utility.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import Actors.Projectile.*;
import Physics.Box2D.Common.*;
public class PusherImpulse implements ICollisionAction {
private var _pushergroup:String;
public function PusherImpulse(_arg1:String){
_pushergroup = _arg1;
}
public function run(_arg1:b2Shape, _arg2:b2Shape, _arg3:b2Manifold):void{
var _local5:b2Body;
var _local6:b2Body;
var _local7:IActor;
var _local8:b2Vec2;
var _local9:b2ContactPoint;
var _local4:GroupList = _arg1.m_userData.m_group_list;
if (_local4.Contains(_pushergroup)){
_local5 = _arg1.m_body;
_local7 = _arg1.m_userData.m_actor;
_local6 = _arg2.m_body;
} else {
_local5 = _arg2.m_body;
_local7 = _arg2.m_userData.m_actor;
_local6 = _arg1.m_body;
};
_local9 = (_arg3.points[0] as b2ContactPoint);
_local8 = _local5.m_linearVelocity.Copy();
_local8.Normalize();
_local8.Multiply((_local7 as IProjectile).GetForce());
_local6.WakeUp();
_local6.ApplyImpulse(_local8, _local9.position);
Environment.world.DestroyBody(_local5);
_local7 = null;
_local5 = null;
}
}
}//package Actions
Section 10
//RepelImpulse (Actions.RepelImpulse)
package Actions {
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.Box2D.Common.*;
public class RepelImpulse implements ICollisionAction {
private var _push:Number;
private var _pushedgroup:String;
private var _pushergroup:String;
public function RepelImpulse(_arg1:String, _arg2:String, _arg3:Number){
_push = _arg3;
_pushergroup = _arg1;
_pushedgroup = _arg2;
}
private function dopush(_arg1:b2Shape, _arg2:b2Shape, _arg3:b2Manifold):void{
var _local4:b2Body;
var _local5:b2Body;
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:Number;
_local4 = _arg2.m_body;
_local5 = _arg1.m_body;
_local6 = _local4.GetCenterPosition().Copy();
_local7 = _local5.GetCenterPosition().Copy();
_local6.Subtract(_local7);
_local8 = _local6.Length();
_local6.Normalize();
_local6.Multiply((_local8 * _push));
_local7.x = -(_local6.x);
_local7.y = -(_local6.y);
_local4.WakeUp();
_local4.ApplyImpulse(_local6, _local4.GetCenterPosition());
_local5.WakeUp();
_local5.ApplyImpulse(_local7, _local5.GetCenterPosition());
}
public function run(_arg1:b2Shape, _arg2:b2Shape, _arg3:b2Manifold):void{
var _local4:IActor = (_arg1.m_userData.m_actor as IActor);
var _local5:IActor = (_arg2.m_userData.m_actor as IActor);
dopush(_arg1, _arg2, _arg3);
}
}
}//package Actions
Section 11
//SeekAngle (Actions.SeekAngle)
package Actions {
import Physics.Box2D.Dynamics.Joints.*;
public class SeekAngle implements IAction {
private var _flipper:b2RevoluteJoint;
private var _angle:Number;
private var _error:Number;
private var _speed:Number;
public function SeekAngle(_arg1:b2RevoluteJoint, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){
_flipper = _arg1;
_flipper.m_enableMotor = true;
_flipper.m_maxMotorTorque = _arg4;
_flipper.m_enableLimit = true;
_flipper.m_lowerAngle = (_arg5 * (Math.PI / 180));
_flipper.m_upperAngle = (_arg6 * (Math.PI / 180));
_angle = (_arg2 * (Math.PI / 180));
_speed = _arg3;
}
public function run():void{
_error = (_flipper.GetJointAngle() - _angle);
_flipper.SetMotorSpeed((-(_speed) * _error));
}
}
}//package Actions
Section 12
//SentryFire (Actions.SentryFire)
package Actions {
import General.*;
import General.Utility.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import Graphics.Style.*;
import Actors.Projectile.*;
import World.AssetManager.*;
import Physics.Box2D.Common.*;
public class SentryFire implements ICollisionAction {
private var _group:String;
public function SentryFire(_arg1:String){
_group = _arg1;
}
public function run(_arg1:b2Shape, _arg2:b2Shape, _arg3:b2Manifold):void{
var _local5:b2Body;
var _local6:SentryGun;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:ShapeStyle;
var _local13:FadeBullet;
var _local14:b2Body;
var _local4:GroupList = _arg1.m_userData.m_group_list;
if (_local4.Contains(_group)){
_local5 = _arg2.m_body;
_local6 = (_arg1.m_userData.m_actor as SentryGun);
} else {
_local5 = _arg1.m_body;
_local6 = (_arg2.m_userData.m_actor as SentryGun);
};
if (_local6.canFire() == true){
_local6.resetFire();
_local7 = _local6.GetPosition().Copy();
_local8 = _local5.GetCenterPosition().Copy();
_local7.Subtract(_local8);
_local7.Normalize();
_local10 = _local6.GetPosition().Copy();
_local9 = _local10;
_local11 = _local7.Copy();
_local11.Multiply(-1.25);
_local9.Add(_local11);
_local12 = new ShapeStyle();
_local12.SetSprite(ImageAssets.images["fadebullet"]);
_local9.Multiply(Environment.physScale);
_local13 = new FadeBullet(_local9, 8, _local12);
_local13.Create();
_local7.Multiply(-16);
_local14 = _local13.GetProjectile();
_local14.WakeUp();
_local14.ApplyImpulse(_local7, _local9);
};
}
}
}//package Actions
Section 13
//ZoneImpulse (Actions.ZoneImpulse)
package Actions {
import General.Utility.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import flash.utils.*;
import Physics.Box2D.Common.*;
public class ZoneImpulse implements ICollisionAction {
private var _push:b2Vec2;
private var _pushedgroup:Array;
private var _pushergroup:Array;
private var _zone:uint;
public function ZoneImpulse(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:b2Vec2){
_zone = _arg3;
_push = _arg4;
_pushergroup = _arg1;
_pushedgroup = _arg2;
}
private function dopush(_arg1:b2Shape, _arg2:b2Shape, _arg3:b2Manifold):void{
var _local6:b2Body;
var _local7:b2Body;
var _local4:GroupList = _arg1.m_userData.m_group_list;
var _local5:GroupList = _arg2.m_userData.m_group_list;
var _local8:Function = GroupManager.getInstance().Name;
var _local9:Dictionary = _local4.GetGroups();
var _local10:Dictionary = _local5.GetGroups();
if (_local4.ContainsAny(_pushergroup)){
_local7 = _arg2.m_body;
} else {
_local7 = _arg1.m_body;
};
_local7.WakeUp();
_local7.ApplyImpulse(_push, _local7.GetCenterPosition());
}
public function run(_arg1:b2Shape, _arg2:b2Shape, _arg3:b2Manifold):void{
var _local4:IActor = (_arg1.m_userData.m_actor as IActor);
var _local5:IActor = (_arg2.m_userData.m_actor as IActor);
if ((((_local4.getID() == _zone)) || ((_local5.getID() == _zone)))){
dopush(_arg1, _arg2, _arg3);
};
}
}
}//package Actions
Section 14
//FadeBullet (Actors.Projectile.FadeBullet)
package Actors.Projectile {
import flash.events.*;
import General.*;
import flash.display.*;
import General.Utility.*;
import Graphics.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import flash.utils.*;
import Graphics.Engine.*;
import flash.text.*;
import World.Shapes.*;
import Physics.Box2D.Common.*;
public class FadeBullet extends AbstractActor implements IActor, IProjectile {
private var _timer:Timer;
private var _parent:Pusher;
private var _bitmap:BitmapData;
private var _pos:b2Vec2;
private var _clone:Boolean;
private var _force:Number;
private var _radius:Number;
private var _projectile_body:b2Body;
public function FadeBullet(_arg1:b2Vec2, _arg2:Number, _arg3:ShapeStyle=null, _arg4:BitmapData=null){
if (_arg3 == null){
_arg3 = new ShapeStyle();
};
_pos = _arg1;
_radius = _arg2;
_style = _arg3;
_bitmap = _arg4;
super();
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
return (null);
}
public function GetBitmap():BitmapData{
return (_projectile_body.m_shapeList.m_userData.m_bitmap);
}
private function destroytimer(_arg1:TimerEvent):void{
if (_timer != null){
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, destroytimer);
_timer = null;
};
if (((!((_projectile_body == null))) && (!((Environment.world == null))))){
Environment.world.DestroyBody(_projectile_body);
};
}
override public function StopTimers():void{
if (_timer != null){
_timer.stop();
};
}
override public function command(_arg1:int):void{
}
override public function Create():void{
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
var _local2:GameShape = CreateGameShape({style:_style, grouplist:CreateGroups(["FadeBullet"]), render:Render.CACHE_BITMAP, layer:0, visible:true});
var _local3:b2ShapeDef = ShapeFactory.Circle({radius:_radius, density:3, sensor:false, restitution:0.65});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
AddShape(_local1, _local3, _local2);
_projectile_body = CreateBody(_local1);
ActorManager.Push(this);
_timer = new Timer(3000, 1);
_timer.addEventListener(TimerEvent.TIMER, destroytimer);
_timer.start();
}
public function GetForce():Number{
return (_force);
}
public function GetProjectile():b2Body{
return (_projectile_body);
}
}
}//package Actors.Projectile
Section 15
//IProjectile (Actors.Projectile.IProjectile)
package Actors.Projectile {
public interface IProjectile {
function GetForce():Number;
}
}//package Actors.Projectile
Section 16
//Pusher (Actors.Projectile.Pusher)
package Actors.Projectile {
import flash.display.*;
import General.Utility.*;
import Graphics.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Graphics.Particle.*;
import Graphics.Engine.*;
import World.AssetManager.*;
import flash.text.*;
import World.Shapes.*;
import Physics.Box2D.Common.*;
public class Pusher extends AbstractActor implements IActor, IProjectile {
private var _parent:Pusher;
private var _force:Number;
private var _bitmap:BitmapData;
private var _radius:Number;
private var _pos:b2Vec2;
private var _projectile_body:b2Body;
private var _clone:Boolean;
public function Pusher(_arg1:b2Vec2, _arg2:Number, _arg3:Number, _arg4:ShapeStyle=null, _arg5:BitmapData=null, _arg6:Boolean=false, _arg7:Pusher=null){
if (_arg4 == null){
_arg4 = new ShapeStyle();
};
_pos = _arg1;
_radius = _arg2;
_force = _arg3;
_style = _arg4;
_bitmap = _arg5;
super();
}
public function GetBitmap():BitmapData{
return (_projectile_body.m_shapeList.m_userData.m_bitmap);
}
override public function Create():void{
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
var _local2:GameShape = CreateGameShape({style:_style, grouplist:CreateGroups(["Pusher"]), render:Render.CACHE_BITMAP, layer:0, visible:false});
var _local3:b2ShapeDef = ShapeFactory.Circle({radius:_radius, density:3, sensor:true});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
AddShape(_local1, _local3, _local2);
_projectile_body = CreateBody(_local1);
var _local4:ParticleEmitter = new ParticleEmitter(_projectile_body, ImageAssets.images["bubbleparticle"], new b2Vec2(0.05, 0.05), 0.4, new b2Vec2(0, 0), 0.75, true, 60, new b2Vec2(50, 50), new b2Vec2(-30, -30));
_local4.init();
_local2.m_particle_emitter = _local4;
ActorManager.Push(this);
}
public function GetForce():Number{
return (_force);
}
override public function command(_arg1:int):void{
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
return (null);
}
public function GetProjectile():b2Body{
return (_projectile_body);
}
}
}//package Actors.Projectile
Section 17
//CurvedCorner (Actors.StaticStructure.CurvedCorner)
package Actors.StaticStructure {
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class CurvedCorner extends AbstractActor implements IActor {
private var bodyDef:b2BodyDef;
private var _width:Number;
private var _height:Number;
private var arc:b2Body;
private var _pos:b2Vec2;
private var _friction:Number;
private var _rotation:Number;
private var _restitution:Number;
private var _curve:Number;
public function CurvedCorner(_arg1:b2Vec2, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:ShapeStyle=null, _arg7:Number=0.2, _arg8:Number=0.2){
_pos = _arg1;
_width = _arg2;
_height = _arg3;
_curve = _arg5;
_style = _arg6;
_rotation = _arg4;
_friction = _arg7;
_restitution = _arg8;
super();
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:CurvedCorner;
_local3 = GetBitmaps();
_local4 = new CurvedCorner(_arg1, _width, _height, _arg2, _curve, _style, _friction, _restitution);
_local4.Create();
_local4.SetBitmaps(_local3);
return (_local4);
}
override public function command(_arg1:int):void{
}
override public function Cache():void{
ActorManager.Push(this);
}
override public function Create():void{
var _local2:b2ShapeDef;
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.ConcaveArc({extents:new b2Vec2(_width, _height), density:0, friction:_friction, restitution:_restitution, curve:_curve, categoryBits:5, maskBits:5});
var _local3:GameShape = CreateGameShape({style:_style, name:"CurvedCorner", render:Render.CACHE_BITMAP, layer:3, grouplist:CreateGroups(["Box"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local1.rotation = _rotation;
AddShape(_local1, _local2, _local3);
arc = CreateBody(_local1);
}
public function SetRotation(_arg1:Number):void{
_rotation = _arg1;
}
override public function GetPosition():b2Vec2{
if (_created){
return (arc.GetCenterPosition());
};
return (null);
}
}
}//package Actors.StaticStructure
Section 18
//AbstractActor (Actors.AbstractActor)
package Actors {
import General.*;
import flash.display.*;
import General.Utility.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import flash.utils.*;
import World.Shapes.*;
public class AbstractActor implements IActor {
protected var _enabled:Boolean;// = false
protected var m_physScale:Number;
protected var _created:Boolean;// = false
protected var _style:ShapeStyle;
protected var _id:uint;// = 0
protected var _bodyList:Array;
protected var _jointList:Array;
protected var _layer:int;// = 0
public function AbstractActor(){
m_physScale = Environment.physScale;
_bodyList = new Array();
_jointList = new Array();
if (!Environment.auto_create_actors){
disable();
};
}
public function enable():void{
var _local2:*;
var _local3:b2Shape;
var _local4:b2Joint;
var _local1:Array = getBodies();
for (_local2 in _local1) {
_local3 = _local1[_local2].m_shapeList;
while (_local3 != null) {
_local3.m_categoryBits = _local3.m_userData.m_category_bits;
_local3.m_userData.m_enable_render = true;
_local3.m_userData.m_enable_sounds = true;
_local3 = _local3.m_next;
};
_local4 = _local1[_local2].m_jointList;
while (_local4 != null) {
_local4.m_userData.m_enable_render = true;
_local4.m_userData.m_enable_sounds = true;
_local4 = _local4.m_next;
};
};
_enabled = true;
}
public function SetBitmaps(_arg1:Array):void{
var _local2:*;
var _local4:b2Shape;
var _local3:int;
for (_local2 in _bodyList) {
_local4 = _bodyList[_local2].m_shapeList;
while (_local4 != null) {
_local4.m_userData.m_bitmap = _arg1[_local3];
_local3++;
_local4 = _local4.m_next;
};
};
}
public function GetBitmaps():Array{
var _local1:*;
var _local4:b2Shape;
var _local5:GroupList;
var _local6:Dictionary;
var _local7:String;
var _local2:Array = new Array();
var _local3:Function = GroupManager.getInstance().Name;
for (_local1 in _bodyList) {
_local4 = _bodyList[_local1].m_shapeList;
while (_local4 != null) {
_local5 = _local4.m_userData.m_group_list;
_local6 = _local5.GetGroups();
_local2.push(_local4.m_userData.m_bitmap);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function StopTimers():void{
}
protected function CreateGameShape(_arg1:Object):GameShape{
return (new GameShape(_arg1));
}
protected function AddJoint(_arg1:b2Body, _arg2:b2Body, _arg3:b2JointDef, _arg4:GameJoint=null):b2Joint{
_arg3.body1 = _arg1;
_arg3.body2 = _arg2;
_arg3.userData = _arg4;
return (CreateJoint(_arg3));
}
public function getJoints():Array{
if (_jointList != null){
return (_jointList);
};
return (null);
}
protected function AddShape(_arg1:b2BodyDef, _arg2:b2ShapeDef, _arg3:GameShape):void{
_arg2.userData = _arg3;
_arg3.m_actor = this;
_arg3.m_category_bits = _arg2.categoryBits;
_arg1.AddShape(_arg2);
}
public function GetPosition():b2Vec2{
if (_bodyList){
return (_bodyList[0].GetCenterPosition());
};
return (null);
}
public function Create():void{
_created = true;
}
protected function CreateGroups(_arg1:Array):GroupList{
var _local3:*;
var _local2:GroupList = new GroupList(GroupManager.getInstance());
for (_local3 in _arg1) {
_local2.AddGroup(_arg1[_local3]);
};
return (_local2);
}
public function SetLayer(_arg1:int):void{
_layer = _arg1;
}
public function isEnabled():Boolean{
return (_enabled);
}
public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
return (null);
}
public function getBodies():Array{
if (_bodyList != null){
return (_bodyList);
};
return (null);
}
public function command(_arg1:int):void{
}
protected function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local2:b2Joint = Environment.world.CreateJoint(_arg1);
_jointList.push(_local2);
return (_local2);
}
protected function CreateBody(_arg1:b2BodyDef):b2Body{
var _local2:b2Body = Environment.world.CreateBody(_arg1);
_bodyList.push(_local2);
return (_local2);
}
public function Destroy():void{
var _local2:*;
var _local3:b2JointNode;
var _local1:Array = getBodies();
StopTimers();
for (_local2 in _local1) {
_local3 = _local1[_local2].m_jointList;
while (_local3 != null) {
Environment.world.DestroyJoint(_local3.joint);
_local3 = _local3.next;
};
};
for (_local2 in _local1) {
Environment.world.DestroyBody(_local1[_local2]);
};
ActorManager.DeleteID(_id);
_bodyList = null;
_jointList = null;
}
public function disable():void{
var _local2:*;
var _local3:b2Shape;
var _local4:b2Joint;
var _local1:Array = getBodies();
for (_local2 in _local1) {
_local3 = _local1[_local2].m_shapeList;
while (_local3 != null) {
_local3.m_categoryBits = 0;
_local3.m_userData.m_enable_render = false;
_local3.m_userData.m_enable_sounds = false;
_local3 = _local3.m_next;
};
_local4 = _local1[_local2].m_jointList;
while (_local4 != null) {
_local4.m_userData.m_enable_render = false;
_local4.m_userData.m_enable_sounds = false;
_local4 = _local4.m_next;
};
};
_enabled = false;
}
public function Cache():void{
_id = ActorManager.Push(this);
}
public function setMask(_arg1:uint=0):void{
var _local2:*;
var _local3:b2Shape;
for (_local2 in _bodyList) {
_local3 = _bodyList[_local2].m_shapeList;
while (_local3 != null) {
_local3.m_maskBits = _arg1;
_local3 = _local3.m_next;
};
};
}
public function getID():uint{
return (_id);
}
protected function CreateGameJoint(_arg1:Object):GameJoint{
return (new GameJoint(_arg1));
}
public function setID(_arg1:uint):void{
_id = _arg1;
}
}
}//package Actors
Section 19
//ActorManager (Actors.ActorManager)
package Actors {
import flash.display.*;
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import flash.utils.*;
import Graphics.Engine.*;
import flash.text.*;
import Physics.Box2D.Common.*;
public class ActorManager {
private static var actorlabels:Dictionary = new Dictionary();
private static var counter:uint = 0;
private static var actors:Array = new Array();
public static function DeleteID(_arg1:uint):void{
actors[_arg1] = null;
}
public static function Push(_arg1:IActor, _arg2:Boolean=true):uint{
var _local3:Array;
var _local4:*;
var _local5:b2Shape;
counter = (counter + 1);
if (_arg2 == true){
if (_arg1 != null){
_local3 = _arg1.getBodies();
for (_local4 in _local3) {
_local5 = _local3[_local4].m_shapeList;
while (_local5 != null) {
ShapeCache.getInstance().Cache(_local5);
_local5 = _local5.m_next;
};
};
};
};
actors.push(_arg1);
return (counter);
}
public static function Clear():void{
var _local1:*;
var _local2:IActor;
var _local3:Array;
var _local4:*;
var _local5:b2Shape;
var _local6:GameShape;
for (_local1 in actors) {
if (actors[_local1] != null){
_local2 = (actors[_local1] as IActor);
_local3 = _local2.getBodies();
for (_local4 in _local3) {
_local5 = _local3[_local4].m_shapeList;
while (_local5 != null) {
if (_local6 != null){
_local6 = (_local5.m_userData as GameShape);
_local6.m_bitmap.dispose();
_local6.m_bitmap = null;
_local6.m_rotated_bitmap.dispose();
_local6.m_rotated_bitmap = null;
_local5.m_userData = null;
};
_local5 = _local5.m_next;
};
};
_local2.Destroy();
actors[_local1] = null;
};
};
actors = null;
actors = new Array();
counter = 0;
}
}
}//package Actors
Section 20
//Agitator (Actors.Agitator)
package Actors {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Triggers.*;
import Actions.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class Agitator extends AbstractActor implements IActor {
private var circle:b2Body;
private var _pos:b2Vec2;
private var _friction:Number;
private var _clone:Boolean;
private var _restitution:Number;
private var _density:Number;
private var _radius:Number;
public function Agitator(_arg1:b2Vec2, _arg2:Number, _arg3:Number=1, _arg4:Number=0.2, _arg5:Number=0, _arg6:ShapeStyle=null){
var _local7:b2CircleDef;
_pos = _arg1;
_style = _arg6;
_radius = _arg2;
_density = _arg3;
_friction = _arg4;
_restitution = _arg5;
super();
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:Agitator;
_local3 = GetBitmaps();
_local4 = new Agitator(_arg1, _radius, _density, _friction, _restitution, _style);
_local4.Create();
_local4.SetBitmaps(_local3);
_local4.randomImpulse();
return (_local4);
}
override public function command(_arg1:int):void{
}
override public function Create():void{
var _local2:b2ShapeDef;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.Circle({radius:_radius, density:_density, friction:_friction, restitution:_restitution});
var _local3:GameShape = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["Agitator"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local1.linearDamping = 0;
AddShape(_local1, _local2, _local3);
circle = CreateBody(_local1);
var _local4:ConstantImpulse = new ConstantImpulse(circle, 12);
TriggerManager.getInstance().addEnterFrameTrigger(this, _local4);
}
public function randomImpulse():void{
var _local1:b2Vec2;
_local1 = new b2Vec2();
_local1.x = ((Math.random() * 2) - 1);
_local1.y = ((Math.random() * 2) - 1);
circle.WakeUp();
circle.ApplyImpulse(_local1, circle.GetCenterPosition());
}
override public function Cache():void{
ActorManager.Push(this);
}
override public function GetPosition():b2Vec2{
return (circle.GetCenterPosition());
}
}
}//package Actors
Section 21
//Box (Actors.Box)
package Actors {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class Box extends AbstractActor implements IActor {
private var bodyDef:b2BodyDef;
private var _width:Number;
private var _damping:Number;
private var box:b2Body;
private var _height:Number;
private var _pos:b2Vec2;
private var _friction:Number;
private var _rotation:Number;
private var _density:Number;
private var _restitution:Number;
public function Box(_arg1:b2Vec2, _arg2:Number, _arg3:Number, _arg4:Number=1, _arg5:Number=0, _arg6:ShapeStyle=null, _arg7:Number=0.2, _arg8:Number=0, _arg9:Number=0){
_pos = _arg1;
_width = _arg2;
_height = _arg3;
_density = _arg4;
_style = _arg6;
_rotation = _arg5;
_friction = _arg7;
_restitution = _arg8;
_damping = _arg9;
super();
}
override public function command(_arg1:int):void{
}
override public function Create():void{
var _local2:b2ShapeDef;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.Rectangle({extents:new b2Vec2(_width, _height), density:_density, friction:_friction, restitution:_restitution, categoryBits:5, maskBits:5});
var _local3:GameShape = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["Box"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local1.rotation = _rotation;
_local1.linearDamping = _damping;
_local1.angularDamping = _damping;
AddShape(_local1, _local2, _local3);
box = CreateBody(_local1);
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:Box;
_local3 = GetBitmaps();
_local4 = new Box(_arg1, _width, _height, _density, _rotation, _style, _friction, _restitution, _damping);
_local4.Create();
_local4.SetBitmaps(_local3);
return (_local4);
}
override public function GetPosition():b2Vec2{
if (_created){
return (box.GetCenterPosition());
};
return (null);
}
}
}//package Actors
Section 22
//BreakableBlock (Actors.BreakableBlock)
package Actors {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class BreakableBlock extends AbstractActor implements IActor {
private var bodyDef:b2BodyDef;
private var _width:Number;
private var _damping:Number;
private var box:b2Body;
private var _height:Number;
private var _pos:b2Vec2;
private var _friction:Number;
private var _rotation:Number;
private var _density:Number;
private var _restitution:Number;
public function BreakableBlock(_arg1:b2Vec2, _arg2:Number, _arg3:Number, _arg4:Number=1, _arg5:Number=0, _arg6:ShapeStyle=null, _arg7:Number=0.2, _arg8:Number=0, _arg9:Number=0){
_pos = _arg1;
_width = _arg2;
_height = _arg3;
_density = _arg4;
_style = _arg6;
_rotation = _arg5;
_friction = _arg7;
_restitution = _arg8;
_damping = _arg9;
super();
}
override public function command(_arg1:int):void{
}
override public function Cache():void{
ActorManager.Push(this);
}
override public function Create():void{
var _local2:b2ShapeDef;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.Rectangle({extents:new b2Vec2(_width, _height), density:_density, friction:_friction, restitution:_restitution});
var _local3:GameShape = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["BreakableBlock"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local1.rotation = _rotation;
_local1.linearDamping = _damping;
_local1.angularDamping = _damping;
AddShape(_local1, _local2, _local3);
box = CreateBody(_local1);
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:BreakableBlock;
_local3 = GetBitmaps();
_local4 = new BreakableBlock(_arg1, _width, _height, _density, _rotation, _style, _friction, _restitution, _damping);
_local4.Create();
_local4.SetBitmaps(_local3);
return (_local4);
}
override public function GetPosition():b2Vec2{
if (_created){
return (box.GetCenterPosition());
};
return (null);
}
}
}//package Actors
Section 23
//Circle (Actors.Circle)
package Actors {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Triggers.*;
import Actions.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class Circle extends AbstractActor implements IActor {
private var _density:Number;
private var _restitution:Number;
private var circle:b2Body;
private var _radius:Number;
private var _pos:b2Vec2;
private var _friction:Number;
private var _clone:Boolean;
public function Circle(_arg1:b2Vec2, _arg2:Number, _arg3:Number=1, _arg4:Number=0.2, _arg5:Number=0, _arg6:ShapeStyle=null){
var _local7:b2CircleDef;
_pos = _arg1;
_style = _arg6;
_radius = _arg2;
_density = _arg3;
_friction = _arg4;
_restitution = _arg5;
super();
}
override public function Create():void{
var _local2:b2ShapeDef;
var _local3:GameShape;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.Circle({radius:_radius, density:_density, friction:_friction, restitution:_restitution, categoryBits:9});
_local3 = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["Circle"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local1.linearDamping = 0.02;
_local1.angularDamping = 0.03;
AddShape(_local1, _local2, _local3);
var _local4:b2ShapeDef = ShapeFactory.Circle({radius:(_radius * 7), density:0, sensor:true, categoryBits:2, maskBits:2});
var _local5:GameShape = CreateGameShape({grouplist:CreateGroups(["CircleAttractor"]), visible:false});
AddShape(_local1, _local4, _local5);
circle = CreateBody(_local1);
}
public function LIMIT_VELOCITY(_arg1:Number):void{
var _local2:LimitVelocity = new LimitVelocity(circle, _arg1);
TriggerManager.getInstance().addEnterFrameTrigger(this, _local2);
}
override public function command(_arg1:int):void{
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:Circle;
_local3 = GetBitmaps();
_local4 = new Circle(_arg1, _radius, _density, _friction, _restitution, _style);
_local4.Create();
_local4.SetBitmaps(_local3);
var _local5:uint = ActorManager.Push(_local4, false);
_local4.setID(_local5);
return (_local4);
}
override public function GetPosition():b2Vec2{
return (circle.GetCenterPosition());
}
}
}//package Actors
Section 24
//FlipperDoor (Actors.FlipperDoor)
package Actors {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Triggers.*;
import Actions.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class FlipperDoor extends AbstractActor implements IActor {
private var _length:Number;
private var _pos:b2Vec2;
private var jointDef:b2RevoluteJointDef;
private var _density:Number;
private var _restitution:Number;
private var _torque:Number;
private var _style1:ShapeStyle;
private var _height:Number;
private var _style2:ShapeStyle;
private var jointList:Array;
private var fPoint:b2BodyDef;
private var pinBody:b2Body;
private var _upangle:Number;
private var flipperJoint:b2RevoluteJoint;
private var _rotation:Number;
private var _lowangle:Number;
private var bodyList:Array;
private var _friction:Number;
private var fRect:b2BodyDef;
private var doorBody:b2Body;
private var _motor:Number;
public function FlipperDoor(_arg1:b2Vec2, _arg2:Number, _arg3:Number, _arg4:Number=1, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0, _arg9:Number=0, _arg10:Number=0.2, _arg11:Number=0, _arg12:ShapeStyle=null, _arg13:ShapeStyle=null){
bodyList = new Array();
jointList = new Array();
_pos = _arg1;
_length = _arg2;
_height = _arg3;
_density = _arg4;
_rotation = _arg5;
_lowangle = _arg6;
_upangle = _arg7;
_motor = _arg8;
_torque = _arg9;
_friction = _arg10;
_restitution = _arg11;
_style1 = _arg12;
_style2 = _arg13;
super();
}
override public function Create():void{
var _local2:b2ShapeDef;
var _local5:b2Vec2;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
var _local3:int = (_height * 0.75);
_local2 = ShapeFactory.Circle({radius:_local3, density:0, restitution:0.5});
var _local4:GameShape = CreateGameShape({style:_style1, render:Render.CACHE_BITMAP, layer:_layer, visible:false, grouplist:CreateGroups(["Pin"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
AddShape(_local1, _local2, _local4);
pinBody = CreateBody(_local1);
_local5 = new b2Vec2();
_local5.x = Math.cos((_rotation * (Math.PI / 180)));
_local5.y = Math.sin((_rotation * (Math.PI / 180)));
_local5.Multiply(((_length / 2) - (_height / 2)));
fRect = new b2BodyDef();
_local2 = ShapeFactory.Rectangle({extents:new b2Vec2((_length / 2), (_height / 2)), friction:_friction, restitution:_restitution, density:_density});
_local4 = CreateGameShape({style:_style2, render:Render.CACHE_BITMAP, layer:(_layer + 1), grouplist:CreateGroups(["Flipper"])});
_local1 = new b2BodyDef();
_local1.rotation = (_rotation * (Math.PI / 180));
_local1.position.Set(((_pos.x + _local5.x) / m_physScale), ((_pos.y + _local5.y) / m_physScale));
AddShape(_local1, _local2, _local4);
doorBody = CreateBody(_local1);
jointDef = new b2RevoluteJointDef();
jointDef.anchorPoint = pinBody.GetCenterPosition();
if ((((_lowangle == 0)) && ((_upangle == 0)))){
jointDef.enableLimit = false;
} else {
jointDef.enableLimit = true;
};
if (_torque == 0){
jointDef.enableMotor = false;
} else {
jointDef.enableMotor = true;
};
jointDef.lowerAngle = (_lowangle * (Math.PI / 180));
jointDef.upperAngle = (_upangle * (Math.PI / 180));
jointDef.motorTorque = _torque;
jointDef.motorSpeed = _motor;
flipperJoint = (AddJoint(pinBody, doorBody, jointDef, null) as b2RevoluteJoint);
}
public function SEEK_ANGLE(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:SeekAngle = new SeekAngle(flipperJoint, _arg1, _arg2, _arg3, _arg4, _arg5);
TriggerManager.getInstance().addEnterFrameTrigger(this, _local6);
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:FlipperDoor;
_local3 = GetBitmaps();
_local4 = new FlipperDoor(_arg1, _length, _height, _density, _rotation, _lowangle, _upangle, _motor, _torque, _friction, _restitution, _style1, _style2);
_local4.Create();
_local4.SetBitmaps(_local3);
return (_local4);
}
override public function command(_arg1:int):void{
}
override public function Cache():void{
ActorManager.Push(this);
}
override public function GetPosition():b2Vec2{
return (pinBody.GetCenterPosition());
}
}
}//package Actors
Section 25
//FreeBlock (Actors.FreeBlock)
package Actors {
import General.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class FreeBlock extends AbstractActor implements IActor {
private var bodyDef:b2BodyDef;
private var _width:Number;
private var _horizontal:Boolean;
private var box:b2Body;
private var _height:Number;
private var _friction:Number;
private var _damping:Number;
private var _pos:b2Vec2;
private var _rotation:Number;
private var _density:Number;
private var _restitution:Number;
private var _prismaticJoint:b2PrismaticJoint;
public function FreeBlock(_arg1:b2Vec2, _arg2:Number, _arg3:Number, _arg4:Number=1, _arg5:Number=0, _arg6:ShapeStyle=null, _arg7:Number=0.2, _arg8:Number=0, _arg9:Number=0, _arg10:Boolean=true){
_pos = _arg1;
_width = _arg2;
_height = _arg3;
_density = _arg4;
_style = _arg6;
_rotation = _arg5;
_friction = _arg7;
_restitution = _arg8;
_damping = _arg9;
_horizontal = _arg10;
super();
}
override public function command(_arg1:int):void{
}
override public function Cache():void{
ActorManager.Push(this);
}
override public function Create():void{
var _local2:b2ShapeDef;
var _local5:b2ShapeDef;
var _local8:b2Joint;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.Rectangle({extents:new b2Vec2(_width, _height), density:_density, friction:_friction, restitution:_restitution});
var _local3:GameShape = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["Box"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local1.rotation = _rotation;
_local1.linearDamping = _damping;
_local1.angularDamping = _damping;
AddShape(_local1, _local2, _local3);
box = CreateBody(_local1);
var _local4:b2BodyDef = new b2BodyDef();
_local5 = ShapeFactory.Circle({radius:5, density:0, sensor:true});
_local4.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local4.AddShape(_local5);
var _local6:b2Body = Environment.world.CreateBody(_local4);
var _local7:b2PrismaticJointDef = new b2PrismaticJointDef();
_local7.body1 = _local6;
_local7.body2 = box;
_local7.anchorPoint = _local6.GetCenterPosition();
if (_horizontal == true){
_local7.axis.Set(1, 0);
} else {
_local7.axis.Set(0, 1);
};
_local7.lowerTranslation = -200;
_local7.upperTranslation = 200;
_local7.enableLimit = true;
_local8 = Environment.world.CreateJoint(_local7);
_prismaticJoint = (_local8 as b2PrismaticJoint);
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:FreeBlock;
_local3 = GetBitmaps();
_local4 = new FreeBlock(_arg1, _width, _height, _density, _rotation, _style, _friction, _restitution, _damping, _horizontal);
_local4.Create();
_local4.SetBitmaps(_local3);
return (_local4);
}
override public function GetPosition():b2Vec2{
if (_created){
return (box.GetCenterPosition());
};
return (null);
}
}
}//package Actors
Section 26
//IActor (Actors.IActor)
package Actors {
import Physics.Box2D.Common.Math.*;
public interface IActor {
function Cache():void;
function GetPosition():b2Vec2;
function command(_arg1:int):void;
function setMask(_arg1:uint=0):void;
function StopTimers():void;
function getID():uint;
function getBodies():Array;
function Destroy():void;
function Create():void;
function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor;
function getJoints():Array;
}
}//package Actors
Section 27
//MovingBlock (Actors.MovingBlock)
package Actors {
import General.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Triggers.*;
import Actions.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class MovingBlock extends AbstractActor implements IActor {
private var bodyDef:b2BodyDef;
private var _width:Number;
private var _horizontal:Boolean;
private var box:b2Body;
private var _height:Number;
private var _friction:Number;
private var _damping:Number;
private var _pos:b2Vec2;
private var _rotation:Number;
private var _density:Number;
private var _restitution:Number;
private var _prismaticJoint:b2PrismaticJoint;
public function MovingBlock(_arg1:b2Vec2, _arg2:Number, _arg3:Number, _arg4:Number=1, _arg5:Number=0, _arg6:ShapeStyle=null, _arg7:Number=0.2, _arg8:Number=0, _arg9:Number=0, _arg10:Boolean=true){
_pos = _arg1;
_width = _arg2;
_height = _arg3;
_density = _arg4;
_style = _arg6;
_rotation = _arg5;
_friction = _arg7;
_restitution = _arg8;
_damping = _arg9;
_horizontal = _arg10;
super();
}
override public function command(_arg1:int):void{
}
override public function Cache():void{
ActorManager.Push(this);
}
override public function Create():void{
var _local2:b2ShapeDef;
var _local5:b2ShapeDef;
var _local8:b2Joint;
var _local10:b2Vec2;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.Rectangle({extents:new b2Vec2(_width, _height), density:_density, friction:_friction, restitution:_restitution});
var _local3:GameShape = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["MovingBlock"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local1.rotation = _rotation;
_local1.linearDamping = 0.1;
AddShape(_local1, _local2, _local3);
box = CreateBody(_local1);
var _local4:b2BodyDef = new b2BodyDef();
_local5 = ShapeFactory.Circle({radius:5, density:0, sensor:true});
_local4.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local4.AddShape(_local5);
var _local6:b2Body = Environment.world.CreateBody(_local4);
var _local7:b2PrismaticJointDef = new b2PrismaticJointDef();
_local7.body1 = _local6;
_local7.body2 = box;
_local7.anchorPoint = _local6.GetCenterPosition();
if (_horizontal == true){
_local7.axis.Set(1, 0);
} else {
_local7.axis.Set(0, 1);
};
_local7.lowerTranslation = -200;
_local7.upperTranslation = 200;
_local7.enableLimit = true;
_local8 = Environment.world.CreateJoint(_local7);
_prismaticJoint = (_local8 as b2PrismaticJoint);
var _local9:ConstantImpulse = new ConstantImpulse(box, 12);
TriggerManager.getInstance().addEnterFrameTrigger(this, _local9);
if (_horizontal == true){
_local10 = new b2Vec2(1, 0);
} else {
_local10 = new b2Vec2(0, -1);
};
box.WakeUp();
box.ApplyImpulse(_local10, box.GetCenterPosition());
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:MovingBlock;
_local3 = GetBitmaps();
_local4 = new MovingBlock(_arg1, _width, _height, _density, _rotation, _style, _friction, _restitution, _damping, _horizontal);
_local4.Create();
_local4.SetBitmaps(_local3);
return (_local4);
}
override public function GetPosition():b2Vec2{
if (_created){
return (box.GetCenterPosition());
};
return (null);
}
}
}//package Actors
Section 28
//Peg (Actors.Peg)
package Actors {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class Peg extends AbstractActor implements IActor {
private var _density:Number;
private var _restitution:Number;
private var circle:b2Body;
private var _radius:Number;
private var _pos:b2Vec2;
private var _friction:Number;
private var _clone:Boolean;
public function Peg(_arg1:b2Vec2, _arg2:Number, _arg3:Number=0.2, _arg4:Number=0, _arg5:ShapeStyle=null){
var _local6:b2CircleDef;
_pos = _arg1;
_style = _arg5;
_radius = _arg2;
_density = 0;
_friction = _arg3;
_restitution = _arg4;
super();
}
override public function Create():void{
var _local2:b2ShapeDef;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.Circle({radius:_radius, density:_density, friction:_friction, restitution:_restitution, categoryBits:5, maskBits:5});
var _local3:GameShape = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["Peg"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
AddShape(_local1, _local2, _local3);
circle = CreateBody(_local1);
}
override public function command(_arg1:int):void{
}
override public function Cache():void{
ActorManager.Push(this);
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:Peg;
_local3 = GetBitmaps();
_local4 = new Peg(_arg1, _radius, _friction, _restitution, _style);
_local4.Create();
_local4.SetBitmaps(_local3);
return (_local4);
}
override public function GetPosition():b2Vec2{
return (circle.GetCenterPosition());
}
}
}//package Actors
Section 29
//PushZone (Actors.PushZone)
package Actors {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Triggers.*;
import Actions.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class PushZone extends AbstractActor implements IActor {
private var _height:Number;
private var _width:Number;
private var _pos:b2Vec2;
private var _rotation:Number;
private var bodyList:Array;
private var _density:Number;
private var pushbox:b2Body;
public var _push:b2Vec2;
public function PushZone(_arg1:b2Vec2, _arg2:Number, _arg3:Number, _arg4:b2Vec2, _arg5:Number=0, _arg6:ShapeStyle=null){
_pos = _arg1;
_push = _arg4;
_density = 0;
_width = _arg2;
_height = _arg3;
_rotation = _arg5;
_style = _arg6;
_layer = 10;
super();
}
override public function command(_arg1:int):void{
}
public function getPush():b2Vec2{
return (_push);
}
public function setTriggers(_arg1:uint):void{
var _local2:ZoneImpulse = new ZoneImpulse(["PushZone"], ["Circle", "Ship", "Agitator"], _arg1, _push);
TriggerManager.getInstance().addCollisionTrigger("PushZone", "Circle", _local2);
TriggerManager.getInstance().addCollisionTrigger("PushZone", "Ship", _local2);
TriggerManager.getInstance().addCollisionTrigger("PushZone", "Agitator", _local2);
}
override public function Create():void{
var _local2:b2ShapeDef;
var _local4:b2ShapeDef;
var _local5:GameShape;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.Rectangle({extents:new b2Vec2(_width, _height), density:_density, sensor:true});
var _local3:GameShape = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["PushZone"]), visible:false});
AddShape(_local1, _local2, _local3);
_local4 = ShapeFactory.Rectangle({extents:new b2Vec2((_width / 2), (_height / 2)), density:_density, categoryBits:0});
_local5 = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["PushZoneGraphic"]), visible:true});
AddShape(_local1, _local4, _local5);
_local1.rotation = (_rotation * (Math.PI / 180));
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
pushbox = CreateBody(_local1);
}
override public function Cache():void{
ActorManager.Push(this);
}
public function SetPush(_arg1:b2Vec2):void{
_push = _arg1;
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:PushZone;
_local3 = GetBitmaps();
_local4 = new PushZone(_arg1, _width, _height, _push, _rotation, _style);
_local4.Create();
_local4.SetBitmaps(_local3);
var _local5:uint = ActorManager.Push(_local4, false);
_local4.setID(_local5);
setTriggers(_local5);
return (_local4);
}
override public function GetPosition():b2Vec2{
return (pushbox.GetCenterPosition());
}
}
}//package Actors
Section 30
//RotatingDoor (Actors.RotatingDoor)
package Actors {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Triggers.*;
import Actions.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class RotatingDoor extends AbstractActor implements IActor {
private var _length:Number;
private var _pos:b2Vec2;
private var jointDef:b2RevoluteJointDef;
private var _density:Number;
private var _restitution:Number;
private var _torque:Number;
private var _style1:ShapeStyle;
private var _height:Number;
private var _style2:ShapeStyle;
private var jointList:Array;
private var fPoint:b2BodyDef;
private var pinBody:b2Body;
private var _upangle:Number;
private var flipperJoint:b2RevoluteJoint;
private var _rotation:Number;
private var _lowangle:Number;
private var bodyList:Array;
private var _friction:Number;
private var fRect:b2BodyDef;
private var doorBody:b2Body;
private var _motor:Number;
public function RotatingDoor(_arg1:b2Vec2, _arg2:Number, _arg3:Number, _arg4:Number=1, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0, _arg9:Number=0, _arg10:Number=0.2, _arg11:Number=0, _arg12:ShapeStyle=null, _arg13:ShapeStyle=null){
bodyList = new Array();
jointList = new Array();
_pos = _arg1;
_length = _arg2;
_height = _arg3;
_density = _arg4;
_rotation = _arg5;
_lowangle = _arg6;
_upangle = _arg7;
_motor = _arg8;
_torque = _arg9;
_friction = _arg10;
_restitution = _arg11;
_style1 = _arg12;
_style2 = _arg13;
super();
}
override public function Create():void{
var _local2:b2ShapeDef;
var _local5:b2Vec2;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
var _local3:int = (_height * 0.75);
_local2 = ShapeFactory.Circle({radius:_local3, density:0, restitution:0.5});
var _local4:GameShape = CreateGameShape({style:_style1, render:Render.CACHE_BITMAP, layer:_layer, visible:false, grouplist:CreateGroups(["Pin"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
AddShape(_local1, _local2, _local4);
pinBody = CreateBody(_local1);
_local5 = new b2Vec2();
_local5.x = Math.cos((_rotation * (Math.PI / 180)));
_local5.y = Math.sin((_rotation * (Math.PI / 180)));
_local5.Multiply(((_length / 2) - (_height / 2)));
fRect = new b2BodyDef();
_local2 = ShapeFactory.Rectangle({extents:new b2Vec2(_length, (_height / 2)), friction:_friction, restitution:_restitution, density:_density});
_local4 = CreateGameShape({style:_style2, render:Render.CACHE_BITMAP, layer:(_layer + 1), grouplist:CreateGroups(["Flipper"])});
_local1 = new b2BodyDef();
_local1.rotation = (_rotation * (Math.PI / 180));
_local1.angularDamping = 0.03;
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
AddShape(_local1, _local2, _local4);
doorBody = CreateBody(_local1);
jointDef = new b2RevoluteJointDef();
jointDef.anchorPoint = pinBody.GetCenterPosition();
if ((((_lowangle == 0)) && ((_upangle == 0)))){
jointDef.enableLimit = false;
} else {
jointDef.enableLimit = true;
};
if (_torque == 0){
jointDef.enableMotor = false;
} else {
jointDef.enableMotor = true;
};
jointDef.lowerAngle = (_lowangle * (Math.PI / 180));
jointDef.upperAngle = (_upangle * (Math.PI / 180));
jointDef.motorTorque = _torque;
jointDef.motorSpeed = _motor;
flipperJoint = (AddJoint(pinBody, doorBody, jointDef, null) as b2RevoluteJoint);
}
public function SEEK_ANGLE(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:SeekAngle = new SeekAngle(flipperJoint, _arg1, _arg2, _arg3, _arg4, _arg5);
TriggerManager.getInstance().addEnterFrameTrigger(this, _local6);
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:RotatingDoor;
_local3 = GetBitmaps();
_local4 = new RotatingDoor(_arg1, _length, _height, _density, _rotation, _lowangle, _upangle, _motor, _torque, _friction, _restitution, _style1, _style2);
_local4.Create();
_local4.SetBitmaps(_local3);
return (_local4);
}
override public function command(_arg1:int):void{
}
override public function Cache():void{
ActorManager.Push(this);
}
override public function GetPosition():b2Vec2{
return (pinBody.GetCenterPosition());
}
}
}//package Actors
Section 31
//SentryGun (Actors.SentryGun)
package Actors {
import flash.events.*;
import General.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import flash.utils.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class SentryGun extends AbstractActor implements IActor {
private var _canfire:Boolean;
private var _pos:b2Vec2;
private var _friction:Number;
private var _clone:Boolean;
private var circle:b2Body;
private var _firetimer:Timer;
private var _density:Number;
private var _restitution:Number;
private var _radius:Number;
private var _sensor:b2Body;
public function SentryGun(_arg1:b2Vec2, _arg2:Number, _arg3:Number=0.2, _arg4:Number=0, _arg5:ShapeStyle=null){
var _local6:b2CircleDef;
_pos = _arg1;
_style = _arg5;
_radius = _arg2;
_density = 0;
_friction = _arg3;
_restitution = _arg4;
super();
}
override public function command(_arg1:int):void{
}
override public function StopTimers():void{
if (_firetimer != null){
_firetimer.stop();
};
}
override public function Create():void{
var _local2:b2ShapeDef;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.Circle({radius:_radius, density:_density, friction:_friction, restitution:_restitution});
var _local3:GameShape = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["Peg"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
AddShape(_local1, _local2, _local3);
_local2 = ShapeFactory.Circle({radius:(_radius * 8), density:_density, sensor:true, maskBits:8});
_local3 = CreateGameShape({grouplist:CreateGroups(["SentryVision"])});
_local3.m_actor = this;
_local2.userData = _local3;
var _local4:b2BodyDef = new b2BodyDef();
_local4.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local4.AddShape(_local2);
_sensor = Environment.world.CreateBody(_local4);
circle = CreateBody(_local1);
_canfire = false;
_firetimer = new Timer(500, 0);
_firetimer.addEventListener(TimerEvent.TIMER, setcanfire);
_firetimer.start();
}
private function setcanfire(_arg1:TimerEvent):void{
_canfire = true;
}
public function resetFire():void{
_canfire = false;
}
public function canFire():Boolean{
return (_canfire);
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:SentryGun;
_local3 = GetBitmaps();
_local4 = new SentryGun(_arg1, _radius, _friction, _restitution, _style);
_local4.Create();
_local4.SetBitmaps(_local3);
ActorManager.Push(_local4);
return (_local4);
}
override public function GetPosition():b2Vec2{
return (circle.GetCenterPosition());
}
}
}//package Actors
Section 32
//ShapeExit (Actors.ShapeExit)
package Actors {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Graphics.Engine.*;
import World.Shapes.*;
public class ShapeExit extends AbstractActor implements IActor {
private var bodyDef:b2BodyDef;
private var _width:Number;
private var _density:Number;
private var box:b2Body;
private var _height:Number;
private var _pos:b2Vec2;
private var _rotation:Number;
public function ShapeExit(_arg1:b2Vec2, _arg2:Number, _arg3:Number, _arg4:Number=0, _arg5:ShapeStyle=null){
_pos = _arg1;
_width = _arg2;
_height = _arg3;
_style = _arg5;
_rotation = _arg4;
super();
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:ShapeExit;
_local3 = GetBitmaps();
_local4 = new ShapeExit(_arg1, _width, _height, _rotation, _style);
_local4.Create();
_local4.SetBitmaps(_local3);
return (_local4);
}
override public function GetPosition():b2Vec2{
if (_created){
return (box.GetCenterPosition());
};
return (null);
}
override public function command(_arg1:int):void{
}
override public function Create():void{
var _local2:b2ShapeDef;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.Rectangle({extents:new b2Vec2(_width, _height), density:0, sensor:true});
var _local3:GameShape = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["ShapeExit"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local1.rotation = _rotation;
AddShape(_local1, _local2, _local3);
box = CreateBody(_local1);
}
}
}//package Actors
Section 33
//Ship (Actors.Ship)
package Actors {
import General.*;
import flash.display.*;
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.*;
import Graphics.Style.*;
import Triggers.*;
import Actions.*;
import Graphics.Particle.*;
import Actors.Projectile.*;
import Graphics.Engine.*;
import General.Control.*;
import World.AssetManager.*;
import World.Shapes.*;
public class Ship extends AbstractActor implements IActor {
private var _keyshootvector:b2Vec2;
private var _damping:Number;
private var _gunforce:Number;
private var _projectile_bitmap:BitmapData;
private var _pos:b2Vec2;
private var _ship:b2Body;
private var _size:Number;
private var _gunwidth:Number;
private var _gunspeed:Number;
private var _accel:Number;
private var _emitter:ParticleEmitter;
private var _health:int;
public function Ship(_arg1:b2Vec2, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:ShapeStyle=null){
_pos = _arg1;
_size = _arg2;
_style = _arg8;
_accel = _arg3;
_damping = _arg4;
_gunspeed = _arg5;
_gunwidth = _arg6;
_gunforce = _arg7;
if (_arg8 == null){
_arg8 = new ShapeStyle();
};
super();
}
public function LIMIT_VELOCITY(_arg1:Number):void{
var _local2:LimitVelocity = new LimitVelocity(_ship, _arg1);
TriggerManager.getInstance().addEnterFrameTrigger(this, _local2);
}
public function left():void{
_ship.WakeUp();
_ship.ApplyImpulse(new b2Vec2(-(_accel), 0), _ship.m_shapeList.GetPosition());
}
public function up():void{
_ship.WakeUp();
_ship.ApplyImpulse(new b2Vec2(0, -(_accel)), _ship.m_shapeList.GetPosition());
}
override public function command(_arg1:int):void{
if (_arg1 == Command.C_LEFT){
left();
};
if (_arg1 == Command.C_RIGHT){
right();
};
if (_arg1 == Command.C_UP){
up();
};
if (_arg1 == Command.C_DOWN){
down();
};
if (_arg1 == Command.C_LEFT_CLICK){
click();
};
if (_arg1 == Command.C_SHOOT_LEFT){
_keyshootvector.x = (_keyshootvector.x - 1);
};
if (_arg1 == Command.C_SHOOT_RIGHT){
_keyshootvector.x = (_keyshootvector.x + 1);
};
if (_arg1 == Command.C_SHOOT_UP){
_keyshootvector.y = (_keyshootvector.y - 1);
};
if (_arg1 == Command.C_SHOOT_DOWN){
_keyshootvector.y = (_keyshootvector.y + 1);
};
}
public function click():void{
var _local5:b2Vec2;
var _local7:Pusher;
var _local9:b2Body;
var _local1:Number = Environment.physScale;
var _local2:Sprite = View.viewSprite;
var _local3:b2Vec2 = new b2Vec2((Input.mouseX / _local1), (Input.mouseY / _local1));
var _local4:b2Vec2 = _ship.m_shapeList.GetPosition().Copy();
_local3.Subtract(_local4);
_local3.Normalize();
_local5 = new b2Vec2(_ship.m_shapeList.GetPosition().x, _ship.m_shapeList.GetPosition().y);
var _local6:b2Vec2 = _local3.Copy();
_local6.Multiply(0.25);
_local5.Add(_local6);
var _local8:ShapeStyle = new ShapeStyle();
_local8.SetColor(new Color(180, 40, 40));
_local5.Multiply(_local1);
_local7 = new Pusher(_local5, _gunwidth, _gunforce, _local8, _projectile_bitmap);
_local7.Create();
if (!_projectile_bitmap){
_projectile_bitmap = _local7.GetBitmap();
};
_local3.Multiply(_gunspeed);
_local9 = _local7.GetProjectile();
_local9.WakeUp();
_local9.ApplyImpulse(_local3, _local5);
}
public function keyboardshoot():void{
var _local1:Number;
var _local2:Sprite;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:Pusher;
var _local7:ShapeStyle;
var _local8:b2Body;
if (_keyshootvector != null){
if (((!((_keyshootvector.x == 0))) || (!((_keyshootvector.y == 0))))){
_local1 = Environment.physScale;
_local2 = View.viewSprite;
_local3 = _keyshootvector.Copy();
_local3.Normalize();
_local4 = new b2Vec2(_ship.m_shapeList.GetPosition().x, _ship.m_shapeList.GetPosition().y);
_local5 = _local3.Copy();
_local5.Multiply(0.25);
_local4.Add(_local5);
_local7 = new ShapeStyle();
_local7.SetColor(new Color(180, 40, 40));
_local4.Multiply(_local1);
_local6 = new Pusher(_local4, _gunwidth, _gunforce, _local7, _projectile_bitmap);
_local6.Create();
if (!_projectile_bitmap){
_projectile_bitmap = _local6.GetBitmap();
};
_local3.Multiply(_gunspeed);
_local8 = _local6.GetProjectile();
_local8.WakeUp();
_local8.ApplyImpulse(_local3, _local4);
_keyshootvector = new b2Vec2(0, 0);
};
};
_keyshootvector = new b2Vec2(0, 0);
}
override public function Create():void{
var _local2:b2ShapeDef;
super.Create();
var _local1:b2BodyDef = new b2BodyDef();
_local2 = ShapeFactory.Circle({radius:_size, density:2, friction:0.3});
var _local3:BitmapData = new BitmapData(15, 15, true, 0);
var _local4:Sprite = new Sprite();
_local4.graphics.lineStyle(2, 0xFFFFFF, 1, true);
_local4.graphics.beginFill(0xFFFFFF, 1);
_local4.graphics.drawCircle(6, 6, 4);
_local4.graphics.endFill();
_local3.draw(ImageAssets.images["starparticle"]);
var _local5:GameShape = CreateGameShape({style:_style, render:Render.CACHE_BITMAP, layer:_layer, grouplist:CreateGroups(["Ship"])});
_local1.position.Set((_pos.x / m_physScale), (_pos.y / m_physScale));
_local1.rotation = 0;
_local1.linearDamping = _damping;
_local1.angularDamping = _damping;
AddShape(_local1, _local2, _local5);
_ship = CreateBody(_local1);
}
override public function Clone(_arg1:b2Vec2, _arg2:Number=0):IActor{
var _local3:Array;
var _local4:Ship;
_local3 = GetBitmaps();
_local4 = new Ship(_arg1, _size, _accel, _damping, _gunspeed, _gunwidth, _gunforce, _style);
_local4.Create();
_local4.SetBitmaps(_local3);
return (_local4);
}
override public function Cache():void{
ActorManager.Push(this);
}
public function getkeyvector():b2Vec2{
if (_keyshootvector != null){
return (_keyshootvector);
};
return (new b2Vec2(0, 0));
}
public function KEYBOARD_SHOOT():void{
var _local1:KeyboardShoot = new KeyboardShoot(this);
TriggerManager.getInstance().addEnterFrameTrigger(this, _local1);
}
public function right():void{
_ship.WakeUp();
_ship.ApplyImpulse(new b2Vec2(_accel, 0), _ship.m_shapeList.GetPosition());
}
public function get gunforce():Number{
return (_gunforce);
}
public function down():void{
_ship.WakeUp();
_ship.ApplyImpulse(new b2Vec2(0, _accel), _ship.m_shapeList.GetPosition());
}
override public function GetPosition():b2Vec2{
return (_ship.GetCenterPosition());
}
}
}//package Actors
Section 34
//Command (General.Control.Command)
package General.Control {
import General.*;
public class Command {
public static const C_RIGHT:int = 3;
public static const C_LEFT:int = 2;
public static const C_SHOOT_LEFT:int = 5;
public static const C_SHOOT_RIGHT:int = 6;
public static const C_SHOOT_UP:int = 7;
public static const C_SHOOT_DOWN:int = 8;
public static const C_DOWN:int = 1;
public static const C_UP:int = 0;
public static const C_LEFT_CLICK:int = 4;
private static var togglefire:Boolean = false;
private static var mouseDown:Boolean = false;
private static var paused:Boolean = false;
public static function unpause():void{
togglefire = false;
paused = false;
}
public static function resetfire():void{
togglefire = false;
}
public static function GetKeys():void{
var _local1:KeyObject = Environment.keyObject;
if (Input.mouseDown){
mouseDown = true;
};
if (Input.mouseReleased){
if (togglefire){
togglefire = false;
} else {
togglefire = true;
};
mouseDown = false;
};
if (((mouseDown) && (!(Environment.autoFire)))){
GameState.controllableActor.command(C_LEFT_CLICK);
};
if (Environment.mouseControl == true){
if (((_local1.isDown(39)) || (_local1.isDown(68)))){
GameState.controllableActor.command(C_RIGHT);
};
if (((_local1.isDown(37)) || (_local1.isDown(65)))){
GameState.controllableActor.command(C_LEFT);
};
if (((_local1.isDown(38)) || (_local1.isDown(87)))){
GameState.controllableActor.command(C_UP);
};
if (((_local1.isDown(40)) || (_local1.isDown(83)))){
GameState.controllableActor.command(C_DOWN);
};
if (((((togglefire) && (!(paused)))) && (Environment.autoFire))){
GameState.controllableActor.command(C_LEFT_CLICK);
};
} else {
if (_local1.isDown(68)){
GameState.controllableActor.command(C_RIGHT);
};
if (_local1.isDown(65)){
GameState.controllableActor.command(C_LEFT);
};
if (_local1.isDown(87)){
GameState.controllableActor.command(C_UP);
};
if (_local1.isDown(83)){
GameState.controllableActor.command(C_DOWN);
};
if (_local1.isDown(39)){
GameState.controllableActor.command(C_SHOOT_RIGHT);
};
if (_local1.isDown(37)){
GameState.controllableActor.command(C_SHOOT_LEFT);
};
if (_local1.isDown(38)){
GameState.controllableActor.command(C_SHOOT_UP);
};
if (_local1.isDown(40)){
GameState.controllableActor.command(C_SHOOT_DOWN);
};
};
}
public static function KeyReleased(_arg1:uint):void{
if (GameState.levelactive){
if (_arg1 == 80){
Environment.level.Pause();
Command.pause();
} else {
if (_arg1 == 27){
Environment.level.Pause();
Command.pause();
};
};
if (Environment.mouseControl == false){
CustomCursor.disable();
} else {
CustomCursor.enable();
};
};
}
public static function pause():void{
if (paused){
paused = false;
} else {
paused = true;
};
}
}
}//package General.Control
Section 35
//CustomCursor (General.Control.CustomCursor)
package General.Control {
import General.*;
import flash.geom.*;
import flash.display.*;
import Graphics.*;
import World.AssetManager.*;
import flash.ui.*;
public class CustomCursor {
public static var enabled:Boolean;
public static var cursorbitmap:BitmapData;
private static var cursoroffset:Point;
public static var crosshairbitmap:BitmapData;
public static var showCursor:Boolean;
public static var defaultCursor:Sprite;
public static function enable():void{
enabled = true;
show();
}
public static function disable():void{
enabled = false;
showCursor = false;
Mouse.hide();
}
public static function draw():void{
if ((((showCursor == true)) && ((enabled == true)))){
View.DrawBitmap(cursorbitmap, cursorbitmap.rect, new Point((Input.screenX + cursoroffset.x), (Input.screenY + cursoroffset.y)), null, null, true);
};
}
public static function hide():void{
showCursor = false;
Mouse.show();
}
public static function init(_arg1:Boolean):void{
showCursor = false;
cursoroffset = new Point(0, 0);
defaultCursor = new Sprite();
defaultCursor.graphics.lineStyle(2, 0xFFFFFF, 1);
defaultCursor.graphics.drawCircle(6, 6, 5);
crosshairbitmap = new BitmapData(15, 15, true, 0);
crosshairbitmap.draw(defaultCursor);
setdefault();
}
public static function setCursor(_arg1:String):void{
if (_arg1 == "default"){
cursorbitmap = crosshairbitmap;
cursoroffset = new Point(-5, -5);
show();
} else {
if (_arg1 == "link"){
cursorbitmap = ImageAssets.images["linkcursor"];
cursoroffset = new Point(-4, 0);
show();
} else {
if (_arg1 == "arrow"){
hide();
};
};
};
if (Environment.mouseControl == false){
if (Environment.level != null){
if (GameState.paused == false){
showCursor = false;
enabled = false;
Mouse.hide();
};
};
};
}
public static function show():void{
showCursor = true;
enabled = true;
Mouse.hide();
}
public static function isEnabled():Boolean{
return (enabled);
}
private static function setdefault():void{
cursorbitmap = new BitmapData(15, 15, true, 0);
cursorbitmap.draw(defaultCursor);
}
}
}//package General.Control
Section 36
//Input (General.Control.Input)
package General.Control {
import flash.events.*;
import General.*;
import flash.geom.*;
import flash.display.*;
import Graphics.*;
public class Input {
public static var timeSinceLastKey:Number = 0;
public static var m_stageMc:Sprite;
public static var ascii:Array;
public static var mouseY:Number = 0;
public static var mouseMoved:Boolean = false;
private static var keyArr:Array;
private static var bufferSize:int;
public static var mouse:Sprite = new Sprite();
public static var mouseDown:Boolean = false;
public static var lastKey:int = 0;
public static var mouseX:Number = 0;
public static var mouseReleased:Boolean = false;
private static var keyState:Array;
private static var keyBuffer:Array;
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++;
};
Environment.stageObject.addEventListener(MouseEvent.MOUSE_DOWN, mousePress, false, 0, true);
Environment.stageObject.addEventListener(MouseEvent.CLICK, mouseRelease, false, 0, true);
Environment.stageObject.addEventListener(MouseEvent.MOUSE_UP, mouseUp, false, 0, true);
Environment.stageObject.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove, false, 0, true);
Environment.stageObject.addEventListener(Event.MOUSE_LEAVE, mouseLeave, false, 0, true);
}
public function mouseUp(_arg1:MouseEvent):void{
mouseDown = false;
mouseReleased = true;
}
public function mouseLeave(_arg1:Event):void{
CustomCursor.hide();
}
public function keyPress(_arg1:KeyboardEvent):void{
keyState[_arg1.keyCode] = Math.max(keyState[_arg1.keyCode], 1);
lastKey = _arg1.keyCode;
}
private function fillAscii():void{
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 function mouseMove(_arg1:MouseEvent):void{
mouse.x = mouseX;
mouse.y = mouseY;
if (CustomCursor.enabled == true){
CustomCursor.show();
};
_arg1.updateAfterEvent();
}
public function keyRelease(_arg1:KeyboardEvent):void{
keyState[_arg1.keyCode] = -1;
var _local2:int = (bufferSize - 1);
while (_local2 > 0) {
keyBuffer[_local2] = keyBuffer[(_local2 - 1)];
_local2--;
};
keyBuffer[0] = [_arg1.keyCode, 0];
}
public function mouseRelease(_arg1:MouseEvent):void{
}
public function mousePress(_arg1:MouseEvent):void{
mouseDown = true;
mouseReleased = false;
}
public static function screenPoint():Point{
return (new Point((mouseX - View.viewLocation.x), (mouseY - View.viewLocation.y)));
}
public static function getKeyHold(_arg1:int):int{
return (Math.max(0, keyState[_arg1]));
}
public static function update():void{
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++;
};
mouseX = m_stageMc.mouseX;
mouseY = m_stageMc.mouseY;
mouseX = (mouseX + View.viewLocation.x);
mouseY = (mouseY + View.viewLocation.y);
}
public static function isKeyPressed(_arg1:int):Boolean{
timeSinceLastKey = 0;
return ((keyState[_arg1] == 1));
}
public static function isKeyDown(_arg1:int):Boolean{
return ((keyState[_arg1] > 0));
}
public static function mouseClear():void{
mouseReleased = false;
mouseMoved = false;
}
public static function get screenX():int{
return ((mouseX - View.viewLocation.x));
}
public static function get screenY():int{
return ((mouseY - View.viewLocation.y));
}
public static function isKeyReleased(_arg1:int):Boolean{
return ((keyState[_arg1] == -1));
}
public static function isKeyInBuffer(_arg1:int, _arg2:int, _arg3:int):Boolean{
return ((((keyBuffer[_arg2][0] == _arg1)) && ((keyBuffer[_arg2][1] <= _arg3))));
}
public static function getKeyString(_arg1:uint):String{
return (ascii[_arg1]);
}
}
}//package General.Control
Section 37
//KeyObject (General.Control.KeyObject)
package General.Control {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.ui.*;
public dynamic class KeyObject extends Proxy {
private static var keysDown:Object;
private static var stage:Stage;
public function KeyObject(_arg1:Stage){
construct(_arg1);
}
private function lostFocus(_arg1:Event):void{
keysDown = null;
keysDown = new Object();
}
private function keyReleased(_arg1:KeyboardEvent):void{
delete keysDown[_arg1.keyCode];
Command.KeyReleased(_arg1.keyCode);
}
public function deconstruct():void{
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyReleased);
keysDown = new Object();
KeyObject.stage = null;
}
public function construct(_arg1:Stage):void{
KeyObject.stage = _arg1;
keysDown = new Object();
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
_arg1.addEventListener(Event.DEACTIVATE, lostFocus);
_arg1.addEventListener(Event.MOUSE_LEAVE, lostFocus);
}
private function keyPressed(_arg1:KeyboardEvent):void{
keysDown[_arg1.keyCode] = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (((_arg1 in Keyboard)) ? Keyboard[_arg1] : -1);
}
public function isDown(_arg1:int):Boolean{
return (Boolean((_arg1 in keysDown)));
}
}
}//package General.Control
Section 38
//ArrayedStack (General.DataStructure.ArrayedStack)
package General.DataStructure {
public class ArrayedStack implements Collection {
private var _stack:Array;
private var _top:int;
private var _size:int;
public function ArrayedStack(_arg1:int){
_size = _arg1;
clear();
}
public function get size():int{
return (_top);
}
public function isEmpty():Boolean{
return ((_top == 0));
}
public function get maxSize():int{
return (_size);
}
public function clear():void{
_stack = new Array(_size);
_top = 0;
}
public function pop(){
if (_top > 0){
return (_stack[--_top]);
};
return (null);
}
public function push(_arg1):Boolean{
if (_size != _top){
var _local2 = _top++;
_stack[_local2] = _arg1;
return (true);
};
return (false);
}
public function peek(){
return (_stack[int((_top - 1))]);
}
public function getIterator():Iterator{
return (new ArrayedStackIterator(this));
}
public function toArray():Array{
return (_stack.concat());
}
public function contains(_arg1):Boolean{
var _local2:int;
while (_local2 < _top) {
if (_stack[_local2] === _arg1){
return (true);
};
_local2++;
};
return (false);
}
public function getAt(_arg1:int){
if (_arg1 >= _top){
return (null);
};
return (_stack[_arg1]);
}
public function dump():String{
var _local1 = "[ArrayedStack]";
if (_top == 0){
return (_local1);
};
var _local2:int = (_top - 1);
var _temp1 = _local2;
_local2 = (_local2 - 1);
_local1 = (_local1 + (("\n\t" + _stack[_temp1]) + " -> front\n"));
var _local3:int = _local2;
while (_local3 >= 0) {
_local1 = (_local1 + (("\t" + _stack[_local3]) + "\n"));
_local3--;
};
return (_local1);
}
public function setAt(_arg1:int, _arg2):void{
if (_arg1 >= _top){
return;
};
_stack[_arg1] = _arg2;
}
public function toString():String{
return ((("[ArrayedStack, size= " + _top) + "]"));
}
}
}//package General.DataStructure
class ArrayedStackIterator implements Iterator {
private var _stack:ArrayedStack;
private var _cursor:int;
private function ArrayedStackIterator(_arg1:ArrayedStack){
_stack = _arg1;
start();
}
public function get data(){
return (_stack.getAt(_cursor));
}
public function next(){
if (_cursor >= 0){
return (_stack.getAt(_cursor--));
};
return (null);
}
public function hasNext():Boolean{
return ((_cursor >= 0));
}
public function set data(_arg1):void{
_stack.setAt(_cursor, _arg1);
}
public function start():void{
_cursor = (_stack.size - 1);
}
}
Section 39
//Collection (General.DataStructure.Collection)
package General.DataStructure {
public interface Collection {
function get size():int;
function isEmpty():Boolean;
function getIterator():Iterator;
function clear():void;
function toArray():Array;
function contains(_arg1):Boolean;
}
}//package General.DataStructure
Section 40
//Iterator (General.DataStructure.Iterator)
package General.DataStructure {
public interface Iterator {
function start():void;
function set data(_arg1):void;
function get data();
function next();
function hasNext():Boolean;
}
}//package General.DataStructure
Section 41
//AbstractComponent (General.GUI.AbstractComponent)
package General.GUI {
import flash.geom.*;
import General.Control.*;
public class AbstractComponent implements IInterfaceComponent {
public var _parent:Menu;
public var _min:Point;
public var _pos:Point;
public var _pressed:Boolean;// = false
public var _max:Point;
public var _active:Boolean;
public var _cursor:String;
public var _function:Function;
public var _hover:Boolean;// = false
public function AbstractComponent(){
_min = new Point(0, 0);
_max = new Point(0, 0);
_active = true;
_cursor = "arrow";
}
public function set pressed(_arg1:Boolean):void{
_pressed = _arg1;
}
public function click():void{
if (((_active) && (!((_function == null))))){
_function();
};
}
public function set active(_arg1:Boolean):void{
_active = _arg1;
}
public function get active():Boolean{
return (_active);
}
public function reset():void{
_pressed = false;
_hover = false;
}
public function set position(_arg1:Point):void{
_pos = _arg1;
}
public function set parent(_arg1:Menu):void{
_parent = _arg1;
}
public function draw(_arg1:Point):void{
}
public function checkmouse(_arg1:Point):void{
if (_active){
if ((((_arg1.x > _min.x)) && ((_arg1.x < _max.x)))){
if ((((_arg1.y > _min.y)) && ((_arg1.y < _max.y)))){
_hover = true;
CustomCursor.setCursor(_cursor);
if (Input.mouseDown == true){
_pressed = true;
} else {
if (Input.mouseReleased == true){
click();
};
};
};
};
};
}
public function get max():Point{
return (_max);
}
public function get min():Point{
return (_min);
}
public function set hover(_arg1:Boolean):void{
_hover = _arg1;
}
public function set cursor(_arg1:String):void{
_cursor = _arg1;
}
}
}//package General.GUI
Section 42
//ArrowButton (General.GUI.ArrowButton)
package General.GUI {
import flash.geom.*;
import flash.display.*;
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import General.Control.*;
import World.AssetManager.*;
public class ArrowButton extends AbstractComponent implements IInterfaceComponent {
public var _direction:String;
public var _text:String;
public var _size:b2Vec2;
public var _downState:BitmapData;
public var _centered:Boolean;
public var _hoverState:BitmapData;
public var _hoverfunction:Function;
public var _upState:BitmapData;
public function ArrowButton(_arg1:Point, _arg2:String, _arg3:String, _arg4:Function=null, _arg5:Function=null, _arg6:Boolean=false){
_pos = _arg1;
_size = new b2Vec2(50, 50);
_text = _arg2;
_cursor = "link";
_direction = _arg3;
_function = _arg5;
_hoverfunction = _arg4;
_min = new Point(_pos.x, _pos.y);
_max = new Point((_pos.x + _size.x), (_pos.y + _size.y));
_centered = _arg6;
init();
}
override public function click():void{
if (_function != null){
_function();
};
}
override public function draw(_arg1:Point):void{
var _local2:Point = new Point((_arg1.x + _pos.x), (_arg1.y + _pos.y));
if (_pressed == true){
View.DrawBitmap(_downState, _downState.rect, _local2, null, null, true);
} else {
if (_hover == true){
View.DrawBitmap(_hoverState, _hoverState.rect, _local2, null, null, true);
} else {
View.DrawBitmap(_upState, _upState.rect, _local2, null, null, true);
};
};
}
override public function checkmouse(_arg1:Point):void{
if (_active){
if ((((_arg1.x > _min.x)) && ((_arg1.x < _max.x)))){
if ((((_arg1.y > _min.y)) && ((_arg1.y < _max.y)))){
_hover = true;
if (_hoverfunction != null){
_hoverfunction();
};
CustomCursor.setCursor(_cursor);
if (Input.mouseDown == true){
_pressed = true;
} else {
if (Input.mouseReleased == true){
click();
};
};
};
};
};
}
private function init():void{
var _local5:BitmapData;
_upState = new BitmapData(_size.x, _size.y, true, 0);
_downState = new BitmapData(_size.x, _size.y, true, 0);
_hoverState = new BitmapData(_size.x, _size.y, true, 0);
var _local1:Sprite = new Sprite();
var _local2:Sprite = new Sprite();
var _local3:Sprite = new Sprite();
var _local4:Matrix = new Matrix();
_local4.createGradientBox(_size.x, _size.y, (Math.PI * 1.5), 0, 0);
if (_direction == "left"){
_hoverState = ImageAssets.images["buttonlefthover"];
_upState = ImageAssets.images["buttonleft"];
_downState = ImageAssets.images["buttonlefthover"];
} else {
if (_direction == "right"){
_hoverState = ImageAssets.images["buttonrighthover"];
_upState = ImageAssets.images["buttonright"];
_downState = ImageAssets.images["buttonrighthover"];
};
};
}
}
}//package General.GUI
Section 43
//Background (General.GUI.Background)
package General.GUI {
import flash.geom.*;
import flash.display.*;
import Graphics.*;
public class Background extends AbstractComponent implements IInterfaceComponent {
private var _size:Point;
private var _bitmap:BitmapData;
public function Background(_arg1:Point, _arg2:BitmapData=null, _arg3:Point=null){
var _local4:Sprite;
var _local5:Matrix;
super();
if (_arg2 != null){
_bitmap = _arg2.clone();
_size = new Point();
_size.x = _bitmap.width;
_size.y = _bitmap.height;
};
if ((((_bitmap == null)) && (!((_arg3 == null))))){
_size = _arg3;
_local4 = new Sprite();
_local5 = new Matrix();
_local5.createGradientBox(_size.x, _size.y, (Math.PI * 1.5), 0, 0);
_local4.graphics.beginGradientFill("linear", [1325713, 10009325], [0.9, 0.9], [0, 0xFF], _local5, "pad", "rgb", 0.5);
_local4.graphics.drawRoundRect(0, 0, _size.x, _size.y, 10, 10);
_local4.graphics.endFill();
_bitmap = new BitmapData(_size.x, _size.y, true, 0);
_bitmap.draw(_local4, null, null, null, null, true);
};
_pos = _arg1.clone();
_min = new Point(_pos.x, _pos.y);
_max = new Point((_pos.x + _bitmap.width), (_pos.y + _bitmap.height));
}
override public function draw(_arg1:Point):void{
var _local2:Point;
if (_active){
_local2 = _pos.clone();
_local2.add(_arg1);
View.DrawBitmap(_bitmap, _bitmap.rect, _local2, null, null, true);
};
}
public function setaction(_arg1:Function):void{
_function = _arg1;
}
}
}//package General.GUI
Section 44
//Button (General.GUI.Button)
package General.GUI {
import flash.geom.*;
import flash.display.*;
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import flash.filters.*;
import flash.text.*;
public class Button extends AbstractComponent implements IInterfaceComponent {
public var _text:String;
public var _size:b2Vec2;
public var _downState:BitmapData;
public var _centered:Boolean;
public var _hoverState:BitmapData;
public var _upState:BitmapData;
public function Button(_arg1:Point, _arg2:b2Vec2, _arg3:String, _arg4:Function, _arg5:Boolean=false){
_pos = _arg1;
_size = _arg2;
_text = _arg3;
_function = _arg4;
_cursor = "link";
_min = new Point(_pos.x, _pos.y);
_max = new Point((_pos.x + _size.x), (_pos.y + _size.y));
_centered = _arg5;
init();
}
override public function click():void{
if (_active){
_function();
};
}
override public function draw(_arg1:Point):void{
var _local2:Point;
if (_active){
_local2 = new Point(_pos.x, _pos.y);
if (_pressed == true){
View.DrawBitmap(_downState, _downState.rect, _local2, null, null, true);
} else {
if (_hover == true){
View.DrawBitmap(_hoverState, _hoverState.rect, _local2, null, null, true);
} else {
View.DrawBitmap(_upState, _upState.rect, _local2, null, null, true);
};
};
};
}
public function setText(_arg1:String):void{
_text = _arg1;
init();
}
override public function checkmouse(_arg1:Point):void{
super.checkmouse(_arg1);
}
private function init():void{
var _local8:BitmapData;
_upState = new BitmapData(_size.x, _size.y, true, 0);
_downState = new BitmapData(_size.x, _size.y, true, 0);
_hoverState = new BitmapData(_size.x, _size.y, true, 0);
var _local1:Sprite = new Sprite();
var _local2:Sprite = new Sprite();
var _local3:Sprite = new Sprite();
var _local4:Matrix = new Matrix();
_local4.createGradientBox(_size.x, _size.y, (Math.PI * 1.5), 0, 0);
var _local5:Point = new Point((_size.x * 0.9), (_size.y * 0.7));
_local2.graphics.beginGradientFill("linear", [3756474, 0xFFFFFF], [1, 1], [0, 0xFF], _local4, "pad", "rgb", 0.5);
_local2.graphics.drawRoundRect(5, 5, _local5.x, _local5.y, 5, 5);
_local2.graphics.endFill();
_hoverState.draw(_local2, null, null, null, null, true);
_local1.graphics.beginFill(20650, 1);
_local1.graphics.drawRoundRect(5, 5, _local5.x, _local5.y, 5, 5);
_local1.graphics.endFill();
_upState.draw(_local1, null, null, null, null, true);
_local3.graphics.beginFill(5284010, 1);
_local3.graphics.drawRoundRect(5, 5, _local5.x, _local5.y, 5, 5);
_local3.graphics.endFill();
_downState.draw(_local3, null, null, null, null, true);
var _local6:GlowFilter = new GlowFilter(0xFFFFFF, 1, 5, 5, 2, 3, false, false);
_upState.applyFilter(_upState, _upState.rect, new Point(0, 0), _local6);
_hoverState.applyFilter(_hoverState, _hoverState.rect, new Point(0, 0), _local6);
_downState.applyFilter(_downState, _downState.rect, new Point(0, 0), _local6);
var _local7:TextField = new TextField();
_local7.filters.push(_local6);
_local7.text = _text;
_local7.textColor = 0xFFFFFF;
_local7.setTextFormat(new TextFormat("Verdana", 12, null, false));
_local7.antiAliasType = "advanced";
_local7.gridFitType = "pixel";
_local8 = new BitmapData((_local7.textWidth * 2), (_local7.textHeight * 2), true, 0);
_local8.draw(_local7);
var _local9:b2Vec2 = new b2Vec2();
if (_centered == true){
_local9.x = ((((_size.x - _local5.x) / 2) + ((_local5.x - _local7.textWidth) / 2)) - 2);
} else {
_local9.x = 7;
};
_local9.y = (((_size.y - _local5.y) / 2) + 2);
_upState.copyPixels(_local8, _local8.rect, new Point(_local9.x, _local9.y), null, null, true);
_downState.copyPixels(_local8, _local8.rect, new Point(_local9.x, _local9.y), null, null, true);
_local7.textColor = 0;
_local8 = new BitmapData((_local7.textWidth * 2), (_local7.textHeight * 2), true, 0);
_local8.draw(_local7);
_hoverState.copyPixels(_local8, _local8.rect, new Point(_local9.x, _local9.y), null, null, true);
}
}
}//package General.GUI
Section 45
//IInterfaceComponent (General.GUI.IInterfaceComponent)
package General.GUI {
import flash.geom.*;
public interface IInterfaceComponent {
function set pressed(_arg1:Boolean):void;
function get active():Boolean;
function click():void;
function get max():Point;
function set active(_arg1:Boolean):void;
function reset():void;
function get min():Point;
function draw(_arg1:Point):void;
function set parent(_arg1:Menu):void;
function set hover(_arg1:Boolean):void;
function set position(_arg1:Point):void;
function checkmouse(_arg1:Point):void;
}
}//package General.GUI
Section 46
//LevelButton (General.GUI.LevelButton)
package General.GUI {
import General.*;
import flash.geom.*;
import flash.display.*;
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import General.Control.*;
import World.AssetManager.*;
import flash.text.*;
public class LevelButton extends AbstractComponent implements IInterfaceComponent {
public var _text:String;
public var _downState:BitmapData;
public var _incompleteHoverState:BitmapData;
public var _centered:Boolean;
public var _hoverState:BitmapData;
public var _hoverfunction:Function;
public var _incompleteState:BitmapData;
public var _complete:Boolean;
public var _levelnum:int;
public var _size:b2Vec2;
public var _lockState:BitmapData;
public var _upState:BitmapData;
public function LevelButton(_arg1:Point, _arg2:String, _arg3:int, _arg4:Function=null, _arg5:Function=null, _arg6:Boolean=false){
_pos = _arg1;
_size = new b2Vec2(50, 50);
_text = _arg2;
_cursor = "link";
_levelnum = _arg3;
_function = _arg5;
_hoverfunction = _arg4;
_min = new Point(_pos.x, _pos.y);
_max = new Point((_pos.x + _size.x), (_pos.y + _size.y));
_centered = _arg6;
init();
}
override public function draw(_arg1:Point):void{
var _local3:BitmapData;
var _local2:Point = new Point((_arg1.x + _pos.x), (_arg1.y + _pos.y));
if (_active == true){
if (Environment.playerInfo.unlocked >= _levelnum){
if (_pressed == true){
View.DrawBitmap(_downState, _downState.rect, _local2, null, null, true);
drawnumber(_levelnum, 0xFFFFFF);
} else {
if (_hover == true){
if (_complete == true){
View.DrawBitmap(_hoverState, _hoverState.rect, _local2, null, null, true);
drawnumber(_levelnum, 0);
} else {
View.DrawBitmap(_incompleteHoverState, _incompleteHoverState.rect, _local2, null, null, true);
drawnumber(_levelnum, 0);
};
} else {
if (_complete == true){
View.DrawBitmap(_upState, _upState.rect, _local2, null, null, true);
drawnumber(_levelnum, 0xFFFFFF);
} else {
View.DrawBitmap(_incompleteState, _incompleteState.rect, _local2, null, null, true);
drawnumber(_levelnum, 0xFFFFFF);
};
};
};
} else {
_local3 = ImageAssets.images["lockbutton"];
View.DrawBitmap(_local3, _local3.rect, _local2, null, null, true);
};
};
}
override public function click():void{
if (Environment.playerInfo.unlocked >= _levelnum){
_function();
};
}
public function update(_arg1:int=0):void{
_text = String(_arg1);
_levelnum = _arg1;
}
private function drawnumber(_arg1:int, _arg2:uint):void{
var _local3:TextField = new TextField();
_local3.text = _text;
_local3.textColor = _arg2;
_local3.setTextFormat(new TextFormat("Verdana", 16, null, true));
_local3.antiAliasType = "advanced";
var _local4:BitmapData = new BitmapData((_local3.textWidth * 2), (_local3.textHeight * 2), true, 0);
_local4.draw(_local3);
var _local5:Point = new Point();
if (_centered == true){
_local5.x = (((_size.x / 2) - (_local3.textWidth / 2)) - 2);
} else {
_local5.x = 7;
};
_local5.y = (((_size.y / 2) - (_local3.textHeight / 2)) - 2);
_local5.x = (_local5.x + _pos.x);
_local5.y = (_local5.y + _pos.y);
View.DrawBitmap(_local4, _local4.rect, _local5, null, null, true);
}
private function init():void{
var _local1:Sprite = new Sprite();
var _local2:Sprite = new Sprite();
var _local3:Sprite = new Sprite();
var _local4:Matrix = new Matrix();
_local4.createGradientBox(_size.x, _size.y, (Math.PI * 1.5), 0, 0);
_hoverState = ImageAssets.images["smallbuttonhover"];
_upState = ImageAssets.images["smallbuttonup"];
_downState = ImageAssets.images["smallbuttonhover"];
_incompleteState = ImageAssets.images["greenbutton"];
_incompleteHoverState = ImageAssets.images["yellowbutton"];
}
override public function checkmouse(_arg1:Point):void{
if (_active){
if ((((_arg1.x > _min.x)) && ((_arg1.x < _max.x)))){
if ((((_arg1.y > _min.y)) && ((_arg1.y < _max.y)))){
_hover = true;
_hoverfunction(_levelnum);
CustomCursor.setCursor(_cursor);
if (Input.mouseDown == true){
_pressed = true;
} else {
if (Input.mouseReleased == true){
click();
};
};
};
};
};
}
public function set complete(_arg1:Boolean):void{
_complete = _arg1;
}
}
}//package General.GUI
Section 47
//LevelPreview (General.GUI.LevelPreview)
package General.GUI {
import General.*;
import flash.geom.*;
import flash.display.*;
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import World.Levels.*;
public class LevelPreview extends AbstractComponent implements IInterfaceComponent {
public var _size:b2Vec2;
public var _text:String;
public var _bitmap:BitmapData;
private var _current:int;// = 0
private var _levelbitmaps:Array;
public function LevelPreview(_arg1:Point, _arg2:Function){
_pos = _arg1;
_size = new b2Vec2(200, 200);
_function = _arg2;
_cursor = "link";
_min = new Point(_pos.x, _pos.y);
_max = new Point((_pos.x + _size.x), (_pos.y + _size.y));
}
private function cachelevel(_arg1:int):void{
var _local6:int;
var _local7:int;
_bitmap = new BitmapData(_size.x, _size.y, false, 0);
var _local2:BitmapData = _bitmap;
var _local3:Level = Environment.levelCollection.getLevel(_arg1);
var _local4:Array = _local3.level_matrix;
var _local5:Point = _local3.level_dimensions;
_local3 = null;
var _local8:int = _local4.length;
var _local9:Point = new Point();
var _local10:Point = new Point();
_local10.x = int(((_size.x / 2) - (_local5.x / 1)));
_local10.y = int(((_size.y / 2) - (_local5.y / 1)));
var _local11:int;
while (_local11 < _local8) {
_local6 = (int(_local11) % int(_local5.x));
_local7 = (Math.ceil(((_local11 + 1) / _local5.x)) - 1);
_local6 = ((_local6 * 2) + _local10.x);
_local7 = ((_local7 * 2) + _local10.y);
if (_local4[_local11] == 1){
drawTile(_local6, _local7, 0xFFFFFF);
} else {
if (_local4[_local11] == 7){
drawTile(_local6, _local7, 0xFF0000);
} else {
if (_local4[_local11] == 5){
drawTile(_local6, _local7, 0xFF00);
} else {
if (_local4[_local11] == 8){
drawTile(_local6, _local7, 22015);
} else {
if (_local4[_local11] == 9){
drawTile(_local6, _local7, 0x333333);
} else {
if (_local4[_local11] == 15){
drawTile(_local6, _local7, 16724787);
};
};
};
};
};
};
_local11++;
};
_current = _arg1;
}
override public function click():void{
if (_active){
_function();
};
}
public function update(_arg1:int):void{
if (_current != _arg1){
cachelevel(_arg1);
};
_current = _arg1;
}
override public function draw(_arg1:Point):void{
var _local2:Point;
if (((_active) && (!((_bitmap == null))))){
_local2 = new Point(_pos.x, _pos.y);
View.DrawBitmap(_bitmap, _bitmap.rect, _local2, null, null, false);
};
}
private function init():void{
var _local2:int;
_levelbitmaps = new Array();
var _local1:int = Environment.levelCollection.getSize();
_local2 = 1;
while (_local2 <= _local1) {
cachelevel(_local2);
_local2++;
};
}
private function drawTile(_arg1:int, _arg2:int, _arg3:uint):void{
_bitmap.setPixel(_arg1, _arg2, _arg3);
_bitmap.setPixel((_arg1 + 1), _arg2, _arg3);
_bitmap.setPixel(_arg1, (_arg2 + 1), _arg3);
_bitmap.setPixel((_arg1 + 1), (_arg2 + 1), _arg3);
}
override public function checkmouse(_arg1:Point):void{
super.checkmouse(_arg1);
}
}
}//package General.GUI
Section 48
//Menu (General.GUI.Menu)
package General.GUI {
import flash.geom.*;
public class Menu extends AbstractComponent implements IInterfaceComponent {
public var menuItems:Array;
public var _position:Point;
public function Menu(_arg1:Point){
_position = _arg1;
menuItems = new Array();
}
public function Draw(_arg1:Point):void{
var _local2:*;
var _local3:IInterfaceComponent;
if (_active){
for (_local2 in menuItems) {
_local3 = (menuItems[_local2] as IInterfaceComponent);
_local3.draw(_arg1);
};
};
}
public function update(_arg1:Point):void{
if (_active){
reset();
checkmouse(_arg1);
Draw(_position);
};
}
override public function draw(_arg1:Point):void{
Draw(_arg1);
}
override public function checkmouse(_arg1:Point):void{
var _local2:*;
var _local3:IInterfaceComponent;
if (_active){
for (_local2 in menuItems) {
_local3 = (menuItems[_local2] as IInterfaceComponent);
_local3.checkmouse(_arg1);
};
super.checkmouse(_arg1);
};
}
public function Clear():void{
menuItems = new Array();
}
public function AddButton(_arg1:Button):void{
Push(_arg1);
}
override public function reset():void{
var _local1:*;
var _local2:IInterfaceComponent;
_pressed = false;
_hover = false;
for (_local1 in menuItems) {
_local2 = (menuItems[_local1] as IInterfaceComponent);
_local2.reset();
};
}
public function Push(_arg1:IInterfaceComponent):void{
menuItems.push(_arg1);
_arg1.parent = this;
}
}
}//package General.GUI
Section 49
//MenuCollection (General.GUI.MenuCollection)
package General.GUI {
import General.*;
import flash.geom.*;
import flash.display.*;
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import Sound.*;
import General.Control.*;
import World.AssetManager.*;
import World.*;
import mochi.*;
import flash.net.*;
import flash.system.*;
public class MenuCollection {
public var next_level_menu:Menu;
public var pause_menu:Menu;
public var levelcompletetime:TextBlock;
private var menu_background:BitmapData;
public var load_menu:Menu;
public var main_menu:Menu;
public var submitscorebutton:Button;
public var level_menu:Menu;
private var transparent_background:Background;
public var leveltime:TextBlock;
public var levelcompletelabel:TextBlock;
public var level_bitmap:LevelPreview;
public var level_button_pos:int;// = 1
private var autofire:Button;
private var small_background:Background;
public var unlock_menu:Menu;
private var controlmode:Button;
public var level_select_menu:Menu;
private var unlocktext:TextBlock;
public var levelscore:TextBlock;
public var unlockgamepoints:TextBlock;
private var mutefxbutton:Button;
public var levelcompleteunlocked:TextBlock;
public var hover_number:int;// = 1
public var lslevellabel:TextBlock;
public var instructions_menu:Menu;
public var levelgrouparray:Array;
public var game_points_label:TextBlock;
public var points_needed_label:TextBlock;
public var initialized:Boolean;// = false
public var levelselectarray:Array;
private var mutemusicbutton:Button;
public var levelcompletepoints:TextBlock;
public var scoreclip:MovieClip;
public var score_menu:Menu;
public var newscore:int;// = 0
public var levelcompletescore:TextBlock;
public function MenuCollection(){
var _local1:Button;
var _local2:String;
var _local3:TextBlock;
var _local4:TextBlock;
var _local6:TextBlock;
menu_background = ImageAssets.images["cloglogo"];
super();
pause_menu = new Menu(new Point(160, 90));
small_background = new Background(new Point(160, 90), null, new Point(320, 300));
pause_menu.Push(small_background);
var _local5:Menu = new Menu(new Point(0, 0));
_local2 = "Sound FX";
_local4 = new TextBlock(new Point(175, 100), 200, 50, _local2, 0xFFFFFF, 14);
_local5.Push(_local4);
_local2 = "Background Sound";
_local4 = new TextBlock(new Point(175, 130), 200, 50, _local2, 0xFFFFFF, 14);
_local5.Push(_local4);
_local2 = "Aim Controls";
_local4 = new TextBlock(new Point(175, 160), 200, 50, _local2, 0xFFFFFF, 14);
_local5.Push(_local4);
_local2 = "Auto Fire";
_local4 = new TextBlock(new Point(175, 190), 200, 50, _local2, 0xFFFFFF, 14);
_local5.Push(_local4);
mutefxbutton = new Button(new Point(350, 95), new b2Vec2(100, 30), "On", mutefx, true);
_local5.Push(mutefxbutton);
mutemusicbutton = new Button(new Point(350, 125), new b2Vec2(100, 30), "On", mutemusic, true);
_local5.Push(mutemusicbutton);
pause_menu.Push(_local5);
controlmode = new Button(new Point(350, 155), new b2Vec2(100, 30), "Mouse", controltoggle, true);
pause_menu.Push(controlmode);
autofire = new Button(new Point(350, 185), new b2Vec2(100, 30), "On", autofiretoggle, true);
pause_menu.Push(autofire);
_local1 = new Button(new Point(350, 215), new b2Vec2(100, 30), "Help", help, true);
pause_menu.Push(_local1);
_local1 = new Button(new Point(270, 320), new b2Vec2(100, 30), "Level Select", changelevel, true);
pause_menu.Push(_local1);
_local1 = new Button(new Point(170, 350), new b2Vec2(90, 30), "Quit Game", cancelgame, true);
pause_menu.Push(_local1);
_local1 = new Button(new Point(270, 350), new b2Vec2(100, 30), "Restart Level", retrylevel, true);
pause_menu.Push(_local1);
_local1 = new Button(new Point(380, 350), new b2Vec2(90, 30), "Close", unpause, true);
pause_menu.Push(_local1);
next_level_menu = new Menu(new Point(160, 90));
next_level_menu.Push(small_background);
_local2 = "Level Complete";
levelcompletelabel = new TextBlock(new Point(245, 110), 200, 30, _local2, 0xFFFFFF, 22);
next_level_menu.Push(levelcompletelabel);
_local2 = "Time";
levelcompletetime = new TextBlock(new Point(205, 150), 200, 30, _local2, 0xFFFFFF, 18);
next_level_menu.Push(levelcompletetime);
_local2 = "Score";
levelcompletetime = new TextBlock(new Point(205, 185), 200, 30, _local2, 0xFFFFFF, 18);
next_level_menu.Push(levelcompletetime);
_local2 = "Total Points";
levelcompletetime = new TextBlock(new Point(205, 220), 200, 30, _local2, 0xFFFFFF, 18);
next_level_menu.Push(levelcompletetime);
_local2 = " ";
levelcompletetime = new TextBlock(new Point(355, 150), 200, 30, _local2, 0xFFFFFF, 22);
next_level_menu.Push(levelcompletetime);
_local2 = " ";
levelcompletescore = new TextBlock(new Point(355, 185), 200, 30, _local2, 0xFFFFFF, 22);
next_level_menu.Push(levelcompletescore);
_local2 = " ";
levelcompletepoints = new TextBlock(new Point(355, 220), 200, 30, _local2, 0xFFFFFF, 22);
next_level_menu.Push(levelcompletepoints);
_local2 = " ";
levelcompleteunlocked = new TextBlock(new Point(210, 280), 275, 30, _local2, 0xFFFFFF, 22, true);
next_level_menu.Push(levelcompleteunlocked);
_local1 = new Button(new Point(170, 350), new b2Vec2(90, 30), "Main Menu", mainmenu, true);
next_level_menu.Push(_local1);
_local1 = new Button(new Point(275, 350), new b2Vec2(90, 30), "Redo Level", retrylevel, true);
next_level_menu.Push(_local1);
_local1 = new Button(new Point(380, 350), new b2Vec2(90, 30), "Next Level", nextlevel, true);
next_level_menu.Push(_local1);
submitscorebutton = new Button(new Point(270, 315), new b2Vec2(100, 30), "Submit Score", submitscore, true);
next_level_menu.Push(submitscorebutton);
_local1 = new Button(new Point(380, 315), new b2Vec2(90, 30), "Select", changelevel, true);
next_level_menu.Push(_local1);
}
public function instructionsback():void{
if (GameState.paused == true){
Environment.current_menu = Environment.previous_menu;
CustomCursor.setCursor("arrow");
} else {
mainmenu();
};
}
public function init():void{
var tempbutton:Button;
var temptext:String;
var tempblock:TextBlock;
var templevelbutton:LevelButton;
var bgimage:Background;
var controlframe:Menu;
var gameplayframe:Menu;
initialized = true;
levelgrouparray = new Array();
level_select_menu = new Menu(new Point(0, 0));
transparent_background = new Background(new Point(10, 10), null, new Point(620, 460));
level_select_menu.Push(transparent_background);
tempblock = new TextBlock(new Point(62, 30), 200, 30, "Select Level", 0xFFFFFF, 20);
level_select_menu.Push(tempblock);
var i:int;
while (i < 10) {
levelgrouparray.push(new LevelButton(new Point((60 + (i * 52)), 60), String((i + 1)), (i + 1), levelhover, playselected, true));
level_select_menu.Push(levelgrouparray[i]);
i = (i + 1);
};
updatelevelbuttons();
var arrowleft:ArrowButton = new ArrowButton(new Point(476, 120), " ", "left", null, viewlevelsleft);
var arrowright:ArrowButton = new ArrowButton(new Point(528, 120), " ", "right", null, viewlevelsright);
level_select_menu.Push(arrowleft);
level_select_menu.Push(arrowright);
game_points_label = new TextBlock(new Point(62, 140), 200, 40, " ", 0xFFFFFF, 12);
level_select_menu.Push(game_points_label);
points_needed_label = new TextBlock(new Point(62, 160), 200, 40, " ", 0xFFFFFF, 16);
level_select_menu.Push(points_needed_label);
level_bitmap = new LevelPreview(new Point(62, 190), playselected);
level_select_menu.Push(level_bitmap);
lslevellabel = new TextBlock(new Point(120, 392), 100, 30, " ", 0xFFFFFF, 16);
level_select_menu.Push(lslevellabel);
levelscore = new TextBlock(new Point(280, 190), 300, 40, " ", 0xFFFFFF, 16);
level_select_menu.Push(levelscore);
leveltime = new TextBlock(new Point(280, 220), 300, 40, " ", 0xFFFFFF, 16);
level_select_menu.Push(leveltime);
tempbutton = new Button(new Point(500, 430), new b2Vec2(120, 30), "Back", levelselectback, true);
level_select_menu.Push(tempbutton);
tempbutton = new Button(new Point(20, 430), new b2Vec2(150, 30), "Clear Progress", deleteprogress, true);
level_select_menu.Push(tempbutton);
tempbutton = new Button(new Point(280, 380), new b2Vec2(120, 30), "Submit Score", submitscore, true);
level_select_menu.Push(tempbutton);
unlock_menu = new Menu(new Point(0, 0));
unlock_menu.Push(transparent_background);
temptext = (((("You need more Game Points to unlock later levels!\n\n" + "Game points are earned for every 100 score points on a level. However, you only") + " get Game Points for your highest score on each level. Higher scores are easier") + " to get on lower difficulty levels. Keep this in mind if you have trouble unlocking") + " the later levels in the game.");
unlocktext = new TextBlock(new Point(30, 30), 450, 500, temptext, 0xFFFFFF, 16);
unlock_menu.Push(unlocktext);
temptext = ("Your Game Points:\n" + "Points needed:");
unlocktext = new TextBlock(new Point(30, 200), 300, 300, temptext, 0xFFFFFF, 24);
unlock_menu.Push(unlocktext);
temptext = " ";
unlockgamepoints = new TextBlock(new Point(250, 200), 300, 300, temptext, 0xFFFFFF, 24);
unlock_menu.Push(unlockgamepoints);
tempbutton = new Button(new Point(260, 350), new b2Vec2(120, 30), "Level Select", mainmenu, true);
unlock_menu.Push(tempbutton);
tempbutton = new Button(new Point(260, 380), new b2Vec2(120, 30), "Main Menu", mainmenu, true);
unlock_menu.Push(tempbutton);
level_menu = new Menu(new Point(0, 0));
level_menu.Push(transparent_background);
tempbutton = new Button(new Point(240, 80), new b2Vec2(160, 30), "New Game", mainmenu, true);
level_menu.Push(tempbutton);
tempbutton = new Button(new Point(240, 80), new b2Vec2(160, 30), "Continue", mainmenu, true);
level_menu.Push(tempbutton);
tempbutton = new Button(new Point(240, 80), new b2Vec2(160, 30), "Load", mainmenu, true);
level_menu.Push(tempbutton);
tempbutton = new Button(new Point(240, 80), new b2Vec2(160, 30), "Level Select", mainmenu, true);
level_menu.Push(tempbutton);
tempbutton = new Button(new Point(240, 80), new b2Vec2(160, 30), "Back", mainmenu, true);
level_menu.Push(tempbutton);
score_menu = new Menu(new Point(0, 0));
score_menu.Push(transparent_background);
tempbutton = new Button(new Point(20, 20), new b2Vec2(160, 30), "High Scores", showscores, true);
score_menu.Push(tempbutton);
tempbutton = new Button(new Point(20, 50), new b2Vec2(160, 30), "Your Statistics", showstats, true);
score_menu.Push(tempbutton);
tempbutton = new Button(new Point(20, 80), new b2Vec2(160, 30), "Back", mainmenu, true);
score_menu.Push(tempbutton);
tempbutton = new Button(new Point(20, 200), new b2Vec2(160, 30), "Delete Progress", deleteprogress, true);
score_menu.Push(tempbutton);
var showcontrols:Function = function ():void{
controlframe.active = true;
gameplayframe.active = false;
};
var showgameplay:Function = function ():void{
controlframe.active = false;
gameplayframe.active = true;
};
instructions_menu = new Menu(new Point(0, 0));
instructions_menu.Push(transparent_background);
tempbutton = new Button(new Point(20, 20), new b2Vec2(160, 30), "Controls", showcontrols, true);
instructions_menu.Push(tempbutton);
tempbutton = new Button(new Point(20, 50), new b2Vec2(160, 30), "Gameplay", showgameplay, true);
instructions_menu.Push(tempbutton);
tempbutton = new Button(new Point(20, 80), new b2Vec2(160, 30), "Back", instructionsback, true);
instructions_menu.Push(tempbutton);
controlframe = new Menu(new Point(0, 0));
temptext = "Controls";
var controlinstructions:TextBlock = new TextBlock(new Point(200, 20), 500, 400, temptext, 0xFFFFFF, 18);
controlframe.Push(controlinstructions);
temptext = "WASD or Arrow keys to move";
controlinstructions = new TextBlock(new Point(200, 50), 500, 400, temptext, 0xFFFFFF, 16);
controlframe.Push(controlinstructions);
bgimage = new Background(new Point(200, 80), ImageAssets.images["wasdkeys"]);
controlframe.Push(bgimage);
bgimage = new Background(new Point(400, 80), ImageAssets.images["arrowkeys"]);
controlframe.Push(bgimage);
temptext = "Pause/Options";
controlinstructions = new TextBlock(new Point(200, 170), 500, 400, temptext, 0xFFFFFF, 14);
controlframe.Push(controlinstructions);
bgimage = new Background(new Point(200, 200), ImageAssets.images["pausekey"]);
controlframe.Push(bgimage);
bgimage = new Background(new Point(300, 200), ImageAssets.images["escapekey"]);
controlframe.Push(bgimage);
instructions_menu.Push(controlframe);
gameplayframe = new Menu(new Point(0, 0));
temptext = "Gameplay";
var gameplayinstructions:TextBlock = new TextBlock(new Point(200, 20), 300, 400, temptext, 0xFFFFFF, 18);
gameplayframe.Push(gameplayinstructions);
temptext = "The object of the game is to get your shapes into the exits. Exits look like this:";
gameplayinstructions = new TextBlock(new Point(200, 50), 380, 400, temptext, 0xFFFFFF, 16);
gameplayframe.Push(gameplayinstructions);
bgimage = new Background(new Point(300, 100), ImageAssets.images["goodexit"]);
gameplayframe.Push(bgimage);
temptext = ("You will need to get all your shapes to the exit as fast as possible. " + "The faster you complete the level, the better your score.");
gameplayinstructions = new TextBlock(new Point(200, 200), 380, 400, temptext, 0xFFFFFF, 16);
gameplayframe.Push(gameplayinstructions);
instructions_menu.Push(gameplayframe);
gameplayframe.active = false;
main_menu = new Menu(new Point(0, 0));
main_menu.Push(new Background(new Point(0, 0), menu_background));
var brainclogimage:Background = new Background(new Point(430, 445), ImageAssets.images["braincloglogo"]);
brainclogimage.setaction(braincloglink);
brainclogimage.cursor = "link";
main_menu.Push(brainclogimage);
var box2dimage:Background = new Background(new Point(0, 420), ImageAssets.images["box2d"]);
box2dimage.setaction(box2dlink);
box2dimage.cursor = "link";
main_menu.Push(box2dimage);
tempbutton = new Button(new Point(240, 300), new b2Vec2(160, 30), "Level Select", levelselect, true);
main_menu.Push(tempbutton);
tempbutton = new Button(new Point(240, 330), new b2Vec2(160, 30), "Play", startgame, true);
main_menu.Push(tempbutton);
tempbutton = new Button(new Point(240, 360), new b2Vec2(160, 30), "Instructions", instructions, true);
main_menu.Push(tempbutton);
tempbutton = new Button(new Point(240, 390), new b2Vec2(160, 30), "Scores", scores, true);
main_menu.Push(tempbutton);
level_bitmap.update(hover_number);
}
public function scores():void{
showscores();
}
public function levelhover(_arg1:int):void{
var _local2:int;
var _local3:int;
if (_arg1 != hover_number){
hover_number = _arg1;
level_bitmap.update(_arg1);
};
if (Environment.playerInfo.scores[hover_number] != null){
_local2 = Environment.playerInfo.scores[hover_number];
levelscore.update(("Score: " + _local2.toString()));
_local3 = Environment.playerInfo.times[hover_number];
leveltime.update(("Time: " + formatTime(_local3)));
} else {
leveltime.update(" ");
levelscore.update("Not Completed");
};
lslevellabel.update(("Level " + _arg1.toString()));
updatelevelbuttons();
}
public function unlock():void{
var _local2:int;
var _local3:BitmapData;
var _local1:int = Environment.playerInfo.gamepoints;
_local2 = getNeededPoints(_local1);
unlockgamepoints.update(((String(_local1) + "\n") + String(_local2)));
_local3 = View.getbuffer().clone();
var _local4:Menu = new Menu(new Point(0, 0));
_local4.Push(new Background(new Point(0, 0), _local3));
_local4.Push(unlock_menu);
Environment.current_menu = _local4;
}
public function viewlevelsright():void{
level_button_pos = (level_button_pos + 5);
var _local1:int = (Environment.levelCollection.getSize() - 9);
if (_local1 < 1){
_local1 = 1;
};
if (level_button_pos >= _local1){
level_button_pos = _local1;
};
updatelevelbuttons();
}
public function endgame():void{
Environment.endgame = true;
}
public function help():void{
Environment.previous_menu = Environment.current_menu;
var _local1:Menu = new Menu(new Point(0, 0));
_local1.Push(new Background(new Point(0, 0), ImageAssets.images["gamebackground"]));
_local1.Push(instructions_menu);
Environment.current_menu = _local1;
}
public function startgame():void{
Environment.playerInfo.unlocked = getUnlocked(Environment.playerInfo.gamepoints);
var _local1:int = Environment.playerInfo.currentlevel;
if (Environment.playerInfo.unlocked >= _local1){
Environment.startgame = true;
CustomCursor.setCursor("default");
} else {
levelselect();
};
}
public function viewlevelsleft():void{
level_button_pos = (level_button_pos - 5);
if (level_button_pos < 1){
level_button_pos = 1;
};
updatelevelbuttons();
}
public function showscores():void{
MochiScores.showLeaderboard({boardID:"5940e791800368ac", numScores:20, preloaderDisplay:true});
}
public function getUnlocked(_arg1:int):int{
var _local2 = 1;
while (_local2 <= Environment.levelCollection.getSize()) {
if (Environment.playerInfo.gamepoints < getNeededPoints(_local2)){
return ((_local2 - 1));
};
_local2++;
};
return (_local2);
}
public function formatTime(_arg1:uint):String{
var _local3:String;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local2:uint = _arg1;
_local4 = Math.floor((_local2 / 36000));
_local2 = (_local2 - (36000 * _local4));
_local5 = Math.floor((_local2 / 600));
_local2 = (_local2 - (600 * _local5));
_local6 = Math.floor((_local2 / 10));
_local2 = (_local2 - (10 * _local6));
_local7 = _local2;
var _local8:String = _local6.toString();
if (_local8.length == 1){
_local8 = ("0" + _local8);
};
if (_local4 != 0){
_local3 = (_local4 + ":");
} else {
_local3 = "";
};
_local3 = (_local3 + ((((_local5 + ":") + _local8) + ".") + _local7));
return (_local3);
}
public function levelselectback():void{
if (GameState.paused == true){
Environment.current_menu = Environment.previous_menu;
CustomCursor.setCursor("arrow");
} else {
mainmenu();
};
}
public function cancelgame():void{
Environment.current_menu = main_menu;
Environment.cancelgame = true;
}
public function showMemory(_arg1:String):void{
var _local2:String = new String();
_local2 = (((_arg1 + ": ") + String(Math.round((System.totalMemory / 0x100000)))) + " MB used");
trace(_local2);
}
public function braincloglink():void{
var url = "http://brainclog.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request);
} catch(e:Error) {
};
}
public function getNeededPoints(_arg1:int):int{
var _local5:int;
var _local2:Number = 70;
var _local3:Number = 4;
var _local4:Number = 0;
if (_arg1 == 1){
return (0);
};
_local5 = 1;
while (_local5 < _arg1) {
_local4 = (_local4 + (_local2 + (_local3 * _local5)));
_local5++;
};
return (int(_local4));
}
public function nextlevel():void{
Environment.playerInfo.currentlevel = (Environment.playerInfo.currentlevel + 1);
if (Environment.playerInfo.currentlevel > Environment.levelCollection.getSize()){
Environment.playerInfo.currentlevel = 1;
};
Environment.playerInfo.unlocked = getUnlocked(Environment.playerInfo.gamepoints);
if ((((Environment.playerInfo.currentlevel > Environment.levelCollection.getSize())) || ((Environment.playerInfo.currentlevel > Environment.playerInfo.unlocked)))){
levelselect();
} else {
Environment.startgame = true;
CustomCursor.setCursor("default");
};
}
public function submitscore():void{
submitscorebutton.active = false;
MochiScores.showLeaderboard({boardID:"5940e791800368ac", numScores:20, score:getTotalScore()});
}
public function nextleveltest():void{
Environment.current_menu = next_level_menu;
}
public function levelselect():void{
var _local1:Menu = new Menu(new Point(0, 0));
_local1.Push(new Background(new Point(0, 0), ImageAssets.images["gamebackground"]));
_local1.Push(level_select_menu);
Environment.current_menu = _local1;
update_level_select();
}
public function ClearMemory():void{
main_menu = null;
level_menu = null;
level_select_menu = null;
load_menu = null;
unlock_menu = null;
instructions_menu = null;
score_menu = null;
transparent_background = null;
initialized = false;
Environment.previous_menu = null;
unlocktext = null;
unlockgamepoints = null;
levelgrouparray = null;
levelselectarray = null;
level_bitmap = null;
}
public function mainmenu():void{
Environment.exitgame = true;
}
public function getTotalScore():int{
var _local3:*;
var _local1:Array = Environment.playerInfo.scores;
var _local2:int;
for (_local3 in _local1) {
if (_local1[_local3] != null){
_local2 = (_local2 + _local1[_local3]);
};
};
return (_local2);
}
public function instructions():void{
var _local1:Menu = new Menu(new Point(0, 0));
_local1.Push(new Background(new Point(0, 0), ImageAssets.images["gamebackground"]));
_local1.Push(instructions_menu);
Environment.current_menu = _local1;
}
public function mutefx():void{
SoundManager.getInstance().ToggleFX();
refreshsoundbuttons();
}
public function mutemusic():void{
SoundManager.getInstance().ToggleMusic();
refreshsoundbuttons();
}
public function showstats():void{
}
public function update_level_select():void{
var _local1:String;
_local1 = ("Game Points: " + Environment.playerInfo.gamepoints);
game_points_label.update(_local1);
Environment.playerInfo.unlocked = getUnlocked(Environment.playerInfo.gamepoints);
var _local2:int = (getNeededPoints((Environment.playerInfo.unlocked + 1)) - Environment.playerInfo.gamepoints);
if (Environment.playerInfo.unlocked >= Environment.levelCollection.getSize()){
_local1 = "All levels unlocked!";
} else {
_local1 = ("Points to unlock next level: " + String(_local2));
};
lslevellabel.update(("Level " + hover_number.toString()));
points_needed_label.update(_local1);
updatelevelbuttons();
}
public function playselected():void{
if (GameState.paused == true){
Environment.cancelgame = true;
};
Environment.playerInfo.currentlevel = hover_number;
Environment.startgame = true;
CustomCursor.setCursor("default");
}
public function updatelevelbuttons():void{
var _local1:int;
while (_local1 < 10) {
if ((_local1 + 1) > Environment.levelCollection.getSize()){
levelgrouparray[_local1].active = false;
} else {
levelgrouparray[_local1].active = true;
levelgrouparray[_local1].update((level_button_pos + _local1));
};
if (Environment.playerInfo.scores[(level_button_pos + _local1)] == null){
levelgrouparray[_local1].complete = false;
} else {
levelgrouparray[_local1].complete = true;
};
_local1++;
};
}
public function changelevel():void{
Environment.previous_menu = Environment.current_menu;
var _local1:Menu = new Menu(new Point(0, 0));
_local1.Push(new Background(new Point(0, 0), ImageAssets.images["gamebackground"]));
_local1.Push(level_select_menu);
Environment.current_menu = _local1;
update_level_select();
}
public function retrylevel():void{
Environment.startgame = true;
if (Environment.level != null){
Environment.level.End();
Environment.level = null;
};
CustomCursor.setCursor("default");
Command.resetfire();
unpause();
}
public function deleteprogress():void{
registerClassAlias("World.PlayerInformation", PlayerInformation);
var _local1:SharedObject = SharedObject.getLocal("clogsave");
_local1.clear();
var _local2:PlayerInformation = Environment.playerInfo;
Environment.playerInfo = new PlayerInformation();
Environment.playerInfo.mousecontrol = _local2.mousecontrol;
Environment.playerInfo.currentlevel = 1;
updatelevelbuttons();
update_level_select();
}
public function levelmenu():void{
Environment.current_menu = level_menu;
}
public function refreshsoundbuttons():void{
if (SoundManager.getInstance().isMusicEnabled()){
mutemusicbutton.setText("On");
} else {
mutemusicbutton.setText("Off");
};
if (SoundManager.getInstance().isFXEnabled()){
mutefxbutton.setText("On");
} else {
mutefxbutton.setText("Off");
};
}
public function controltoggle():void{
if (Environment.mouseControl == true){
Environment.mouseControl = false;
CustomCursor.disable();
controlmode.setText("Keyboard");
autofire.setText("Disabled");
} else {
Environment.mouseControl = true;
controlmode.setText("Mouse");
if (Environment.autoFire == true){
autofire.setText("On");
} else {
autofire.setText("Off");
};
};
}
public function box2dlink():void{
var url = "http://box2d.org";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request);
} catch(e:Error) {
};
}
public function autofiretoggle():void{
if (Environment.autoFire == true){
Environment.autoFire = false;
autofire.setText("Off");
} else {
Environment.autoFire = true;
autofire.setText("On");
};
}
public function unpause():void{
if (Environment.level != null){
Environment.level.Pause();
Command.pause();
};
}
}
}//package General.GUI
Section 50
//TextBlock (General.GUI.TextBlock)
package General.GUI {
import flash.geom.*;
import flash.display.*;
import Graphics.*;
import flash.text.*;
public class TextBlock extends AbstractComponent implements IInterfaceComponent {
private var _size:int;
private var _color:uint;
private var _bold:Boolean;
private var _text:String;
private var txt:TextField;
private var bitmap:BitmapData;
private var format:TextFormat;
public function TextBlock(_arg1:Point, _arg2:int, _arg3:int, _arg4:String, _arg5:uint, _arg6:int, _arg7:Boolean=false){
_pos = _arg1;
_text = _arg4;
_color = _arg5;
_size = _arg6;
_bold = _arg7;
txt = new TextField();
txt.text = _arg4;
txt.setTextFormat(new TextFormat("Verdana", _arg6, _arg5, false, false, false));
txt.embedFonts = true;
txt.antiAliasType = AntiAliasType.ADVANCED;
txt.width = _arg2;
txt.height = _arg3;
txt.multiline = true;
txt.wordWrap = true;
txt.autoSize = TextFieldAutoSize.LEFT;
txt.selectable = false;
}
public function update(_arg1:String):void{
_text = _arg1;
}
private function getExtents():Point{
var _local1:Point = new Point((txt.textWidth * 2), (txt.textHeight * 2));
if (_local1.x < 1){
_local1.x = 1;
};
if (_local1.y < 1){
_local1.y = 1;
};
return (_local1);
}
override public function draw(_arg1:Point):void{
var _local2:Point;
if (_active){
_local2 = new Point((_arg1.x + _pos.x), (_arg1.y + _pos.y));
View.DrawParagraph(_local2, _text, new Point(400, 300), 16, 0xFFFFFF);
};
}
}
}//package General.GUI
Section 51
//GameMath (General.Math.GameMath)
package General.Math {
import Physics.Box2D.Common.Math.*;
public class GameMath {
public static function RandRect(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2();
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:b2Vec2 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.x + _arg2.x));
var _local7:b2Vec2 = new b2Vec2((_arg1.y - _arg2.y), (_arg1.y + _arg2.y));
if (_local6.x < 0){
_local4 = -(_local6.x);
};
if (_local7.x < 0){
_local5 = -(_local7.x);
};
_local3.x = (RNG.nextIntRange((_local6.x + _local4), (_local6.y + _local4)) - _local4);
_local3.y = (RNG.nextIntRange((_local7.x + _local5), (_local7.y + _local5)) - _local5);
return (_local3);
}
public static function RandCircle(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:Number;
var _local4:Number;
var _local5:b2Vec2;
_local3 = RNG.nextDouble();
_local4 = RNG.nextDoubleRange(0, (2 * Math.PI));
_local3 = (_arg2 - (Math.sqrt(_local3) * _arg2));
_local5 = new b2Vec2();
_local5.x = ((Math.cos(_local4) * _local3) + _arg1.x);
_local5.y = ((Math.sin(_local4) * _local3) + _arg1.y);
return (_local5);
}
}
}//package General.Math
Section 52
//RNG (General.Math.RNG)
package General.Math {
import flash.utils.*;
public class RNG {
private static var seed:uint = getTimer();
public function RNG(){
seed = 1;
}
public function seed(_arg1:uint):void{
seed = _arg1;
}
public static function nextDoubleRange(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + ((_arg2 - _arg1) * nextDouble())));
}
public static function nextIntRange(_arg1:Number, _arg2:Number):uint{
_arg1 = (_arg1 - 0.4999);
_arg2 = (_arg2 + 0.4999);
return (Math.round((_arg1 + ((_arg2 - _arg1) * nextDouble()))));
}
public static function nextDouble():Number{
return ((gen() / 2147483647));
}
private static function gen():uint{
return ((seed = ((seed * 16807) % 2147483647)));
}
public static function nextInt():uint{
return (gen());
}
}
}//package General.Math
Section 53
//Rounding (General.Math.Rounding)
package General.Math {
public class Rounding {
public static function roundUpToNearest(_arg1:Number, _arg2:Number):Number{
return ((Math.ceil((_arg1 / _arg2)) * _arg2));
}
public static function roundDownToNearest(_arg1:Number, _arg2:Number):Number{
return ((Math.floor((_arg1 / _arg2)) * _arg2));
}
public static function roundToPrecision(_arg1:Number, _arg2:int=0):Number{
var _local3:Number = Math.pow(10, _arg2);
return ((Math.round((_local3 * _arg1)) / _local3));
}
public static function roundToNearest(_arg1:Number, _arg2:Number):Number{
return ((Math.round((_arg1 / _arg2)) * _arg2));
}
}
}//package General.Math
Section 54
//FpsCounter (General.Utility.FpsCounter)
package General.Utility {
import flash.geom.*;
import flash.display.*;
import Graphics.*;
import flash.utils.*;
import flash.system.*;
public class FpsCounter extends Sprite {
private var oldT:int;
private var currentfps:int;
private var mfpsCount:int;// = 0
private var avgCount2:int;// = 30
private var avgInterval:int;// = 30
private var avgCount:int;// = 30
private var mfpsCount2:int;// = 0
public function FpsCounter(){
oldT = getTimer();
avgCount = avgInterval;
}
public function update():void{
var _local1:int = getTimer();
var _local2:int = (_local1 - oldT);
mfpsCount = (mfpsCount + _local2);
if (avgCount < 1){
currentfps = Math.round((1000 / (mfpsCount / avgInterval)));
avgCount = avgInterval;
mfpsCount = 0;
};
avgCount--;
oldT = getTimer();
var _local3:String = new String();
_local3 = (String(currentfps) + " FPS");
View.DrawText(new Point(10, 25), _local3, 0xFF0000, 12);
var _local4:String = new String();
_local4 = (Math.round((System.totalMemory / 0x100000)) + " MB used");
View.DrawText(new Point(10, 10), _local4, 0xFF0000, 12);
}
}
}//package General.Utility
Section 55
//FRateLimiter (General.Utility.FRateLimiter)
package General.Utility {
import flash.utils.*;
public class FRateLimiter {
public static var fTime:int;
private static var newT:int = oldT;
private static var oldT:int = getTimer();
public static function limitFrame():void{
while (Math.abs((newT - oldT)) < fTime) {
newT = getTimer();
};
oldT = getTimer();
}
}
}//package General.Utility
Section 56
//GameTimer (General.Utility.GameTimer)
package General.Utility {
import flash.utils.*;
public class GameTimer {
public var start_time:uint;
public var time:uint;
public var paused:Boolean;// = false
public function GameTimer(){
start_time = getTimer();
time = 0;
}
public function resume():void{
start_time = getTimer();
paused = false;
}
public function pause():void{
paused = true;
}
public function update():void{
time = (time + (getTimer() - start_time));
start_time = getTimer();
}
}
}//package General.Utility
Section 57
//GroupList (General.Utility.GroupList)
package General.Utility {
import flash.utils.*;
public class GroupList {
private var _manager:GroupManager;
private var _grouplist:Dictionary;
public function GroupList(_arg1:GroupManager){
_manager = GroupManager.getInstance();
_grouplist = new Dictionary(false);
}
public function ContainsAll(_arg1:Array):Boolean{
var _local2:*;
for (_local2 in _arg1) {
if (_grouplist[_manager.Group(_arg1[_local2])] == null){
return (false);
};
};
return (true);
}
public function AddGroup(_arg1:String):void{
_manager.AddGroup(_arg1);
if (_manager.Group(_arg1) != -1){
_grouplist[_manager.Group(_arg1)] = true;
};
}
public function GetGroups():Dictionary{
return (_grouplist);
}
public function ContainsAny(_arg1:Array):Boolean{
var _local2:*;
for (_local2 in _arg1) {
if (_grouplist[_manager.Group(_arg1[_local2])] != null){
return (true);
};
};
return (false);
}
public function AddMultiple(_arg1:Array):void{
var _local2:*;
for (_local2 in _arg1) {
AddGroup(_arg1[_local2]);
};
}
public function RemoveMultiple(_arg1:Array):void{
var _local2:*;
for (_local2 in _arg1) {
RemoveGroup(_arg1[_local2]);
};
}
public function RemoveGroup(_arg1:String):void{
if (_grouplist[_manager.Group(_arg1)] != null){
_grouplist[_manager.Group(_arg1)] = null;
};
}
public function Contains(_arg1:String):Boolean{
if (_grouplist[_manager.Group(_arg1)] != null){
return (true);
};
return (false);
}
}
}//package General.Utility
Section 58
//GroupManager (General.Utility.GroupManager)
package General.Utility {
import flash.utils.*;
public class GroupManager {
private static var _count:int = 0;
private static var _groupindex:Dictionary = new Dictionary(false);
private static var _groups:Dictionary = new Dictionary(false);
private static var _instance:GroupManager;
public function Name(_arg1:int):String{
return (_groupindex[_arg1]);
}
public function AddGroup(_arg1:String):void{
if (_arg1 != null){
if (_groups[_arg1] == null){
_groups[_arg1] = _count;
_groupindex[_count] = _arg1;
_count++;
};
};
}
public function Group(_arg1:String):int{
if (_groups != null){
if (_groups[_arg1] !== undefined){
return (_groups[_arg1]);
};
};
return (-1);
}
public static function getInstance():GroupManager{
if (GroupManager._instance == null){
GroupManager._instance = new (GroupManager);
};
return (GroupManager._instance);
}
public static function Clear():void{
_groups = null;
_groupindex = null;
_count = 0;
_groups = new Dictionary(false);
_groupindex = new Dictionary(false);
}
}
}//package General.Utility
Section 59
//MochiBot (General.Utility.MochiBot)
package General.Utility {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var _local3:MochiBot = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var _local4 = "http://core.mochibot.com/my/core.swf";
var _local5:URLVariables = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
var _local6:String = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
var _local7:URLRequest = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
var _local8:Loader = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package General.Utility
Section 60
//Preloader (General.Utility.Preloader)
package General.Utility {
import flash.events.*;
import flash.display.*;
import mochi.*;
import flash.utils.*;
public dynamic class Preloader extends MovieClip {
private var GAME_OPTIONS:Object;
private var ad_complete:Boolean;// = false
private var ad_enabled:Boolean;// = true
public function Preloader(){
GAME_OPTIONS = {clip:root, id:"221c1b756678f874", res:"640x480", ad_finished:MochiAdComplete};
super();
stop();
stage.frameRate = 45;
stage.showDefaultContextMenu = false;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
try {
MochiServices.connect("221c1b756678f874", root);
} catch(e:Error) {
};
if (ad_enabled == true){
try {
MochiAd.showPreGameAd(GAME_OPTIONS);
} catch(e:Error) {
};
};
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function init():void{
var _local2:Object;
var _local1:Class = Class(getDefinitionByName("Clog"));
if (_local1){
_local2 = new (_local1);
addChild((_local2 as DisplayObject));
};
}
public function onEnterFrame(_arg1:Event):void{
var _local2:Number;
graphics.clear();
if ((((framesLoaded == totalFrames)) && ((((((ad_complete == true)) && ((ad_enabled == true)))) || (!(ad_enabled)))))){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
nextFrame();
init();
} else {
_local2 = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal);
graphics.beginFill(0);
graphics.drawRect(0, ((stage.stageHeight / 2) - 10), (stage.stageWidth * _local2), 20);
graphics.endFill();
};
}
private function MochiAdComplete():void{
ad_complete = true;
}
}
}//package General.Utility
Section 61
//Profiler (General.Utility.Profiler)
package General.Utility {
import flash.geom.*;
public class Profiler {
public static var render:Profile;
public static var physics:Profile;
public static var sound:Profile;
public function Profiler(){
render = new Profile("Render", new Point(100, 10));
physics = new Profile("Physics", new Point(195, 10));
sound = new Profile("Sound", new Point(290, 10));
}
public function draw():void{
render.draw();
physics.draw();
sound.draw();
}
}
}//package General.Utility
import flash.geom.*;
import Graphics.*;
import flash.utils.*;
import General.Math.*;
class Profile {
public var dif:uint;// = 0
private var _init:Boolean;
public var end_time:uint;
private var _pos:Point;
public var ms_count:uint;// = 0
public var avgInterval:int;// = 30
public var label_text:String;
public var start_time:uint;
public var avgCount:int;// = 0
public var avgTime:Number;
private function Profile(_arg1:String, _arg2:Point){
_pos = _arg2;
label_text = _arg1;
start_time = getTimer();
avgCount = avgInterval;
}
public function start():void{
start_time = getTimer();
}
public function draw():void{
var _local1:String;
if (_init){
_local1 = ((label_text + ": ") + String(Rounding.roundToPrecision(avgTime, 2)));
View.DrawText(_pos, _local1, 0xFF0000, 12);
};
}
public function end():void{
end_time = getTimer();
dif = (end_time - start_time);
ms_count = (ms_count + dif);
if (avgCount < 1){
avgTime = (ms_count / avgInterval);
avgCount = avgInterval;
ms_count = 30;
_init = true;
};
avgCount--;
}
}
Section 62
//Environment (General.Environment)
package General {
import flash.display.*;
import General.Utility.*;
import General.GUI.*;
import World.Levels.*;
import Physics.Box2D.Dynamics.*;
import General.Control.*;
import World.*;
public class Environment {
public static var levelCollection:LevelCollection;
public static var level:Level;
public static var keyObject:KeyObject;
public static var saved_games:Array;
public static var autoFire:Boolean = true;
public static var endgame:Boolean = false;
public static var exitgame:Boolean = false;
public static var world:b2World;
public static var startgame:Boolean = false;
public static var physScale:Number;
public static var framelimiter:FRateLimiter;
public static var stageObject:Stage;
public static var current_menu:Menu;
public static var previous_menu:Menu;
public static var cancelgame:Boolean = false;
public static var playerInfo:PlayerInformation;
public static var auto_create_actors:Boolean = true;
public static var sprite:Sprite;
private static var _instance:Environment;
public static var mouseControl:Boolean = true;
public static var savecount:int;
public static var currentsave:int;
public static var stage:Sprite;
public function Environment(_arg1:SingletonEnforcer){
}
public static function getInstance():Environment{
if (Environment._instance == null){
Environment._instance = new Environment(new SingletonEnforcer());
};
return (Environment._instance);
}
public static function Clear():void{
world = null;
}
}
}//package General
class SingletonEnforcer {
private function SingletonEnforcer(){
}
}
Section 63
//ColorMatrix (Graphics.Engine.ColorMatrix)
package Graphics.Engine {
import flash.filters.*;
public class ColorMatrix {
public var matrix:Array;
private static var r_lum:Number = 0.212671;
private static var b_lum:Number = 0.072169;
private static var g_lum:Number = 0.71516;
private static var IDENTITY:Array = new Array(1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0);
public function ColorMatrix(_arg1:Object=null){
if ((_arg1 is ColorMatrix)){
matrix = _arg1.matrix.concat();
} else {
if ((_arg1 is Array)){
matrix = _arg1.concat();
} else {
reset();
};
};
}
public function adjustBrightness(_arg1:Number, _arg2:Number, _arg3:Number):void{
_arg2 = ((_arg2) || (_arg1));
_arg3 = ((_arg3) || (_arg1));
var _local4:Array = new Array(1, 0, 0, 0, _arg1, 0, 1, 0, 0, _arg2, 0, 0, 1, 0, _arg3, 0, 0, 0, 1, 0);
concat(_local4);
}
public function adjustSaturation(_arg1:Number):void{
var _local2:Number = (1 - _arg1);
var _local3:Number = (_local2 * r_lum);
var _local4:Number = (_local2 * g_lum);
var _local5:Number = (_local2 * b_lum);
var _local6:Array = new Array((_local3 + _arg1), _local4, _local5, 0, 0, _local3, (_local4 + _arg1), _local5, 0, 0, _local3, _local4, (_local5 + _arg1), 0, 0, 0, 0, 0, 1, 0);
concat(_local6);
}
public function adjustHue(_arg1:Number):void{
_arg1 = (_arg1 * (Math.PI / 180));
var _local2:Number = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
var _local4:Number = 0.213;
var _local5:Number = 0.715;
var _local6:Number = 0.072;
var _local7:Array = new Array(((_local4 + (_local2 * (1 - _local4))) + (_local3 * -(_local4))), ((_local5 + (_local2 * -(_local5))) + (_local3 * -(_local5))), ((_local6 + (_local2 * -(_local6))) + (_local3 * (1 - _local6))), 0, 0, ((_local4 + (_local2 * -(_local4))) + (_local3 * 0.143)), ((_local5 + (_local2 * (1 - _local5))) + (_local3 * 0.14)), ((_local6 + (_local2 * -(_local6))) + (_local3 * -0.283)), 0, 0, ((_local4 + (_local2 * -(_local4))) + (_local3 * -((1 - _local4)))), ((_local5 + (_local2 * -(_local5))) + (_local3 * _local5)), ((_local6 + (_local2 * (1 - _local6))) + (_local3 * _local6)), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1);
concat(_local7);
}
public function blend(_arg1:ColorMatrix, _arg2:Number):void{
var _local3:Number = (1 - _arg2);
var _local4:Number = 0;
while (_local4 < 20) {
matrix[_local4] = ((_local3 * matrix[_local4]) + (_arg2 * _arg1.matrix[_local4]));
_local4++;
};
}
public function threshold(_arg1:Number):void{
var _local2:Array = new Array((r_lum * 0x0100), (g_lum * 0x0100), (b_lum * 0x0100), 0, (-256 * _arg1), (r_lum * 0x0100), (g_lum * 0x0100), (b_lum * 0x0100), 0, (-256 * _arg1), (r_lum * 0x0100), (g_lum * 0x0100), (b_lum * 0x0100), 0, (-256 * _arg1), 0, 0, 0, 1, 0);
concat(_local2);
}
public function reset():void{
matrix = IDENTITY.concat();
}
public function desaturate():void{
var _local1:Array = new Array(r_lum, g_lum, b_lum, 0, 0, r_lum, g_lum, b_lum, 0, 0, r_lum, g_lum, b_lum, 0, 0, 0, 0, 0, 1, 0);
concat(_local1);
}
public function adjustContrast(_arg1:Number, _arg2:Number, _arg3:Number):void{
_arg2 = ((_arg2) || (_arg1));
_arg3 = ((_arg3) || (_arg1));
_arg1 = (_arg1 + 1);
_arg2 = (_arg2 + 1);
_arg3 = (_arg3 + 1);
var _local4:Array = new Array(_arg1, 0, 0, 0, (128 * (1 - _arg1)), 0, _arg2, 0, 0, (128 * (1 - _arg2)), 0, 0, _arg3, 0, (128 * (1 - _arg3)), 0, 0, 0, 1, 0);
concat(_local4);
}
public function setChannels(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Number = ((((((_arg1 & 1) == 1)) ? 1 : 0 + (((_arg1 & 2) == 2)) ? 1 : 0) + (((_arg1 & 4) == 4)) ? 1 : 0) + (((_arg1 & 8) == 8)) ? 1 : 0);
if (_local5 > 0){
_local5 = (1 / _local5);
};
var _local6:Number = ((((((_arg2 & 1) == 1)) ? 1 : 0 + (((_arg2 & 2) == 2)) ? 1 : 0) + (((_arg2 & 4) == 4)) ? 1 : 0) + (((_arg2 & 8) == 8)) ? 1 : 0);
if (_local6 > 0){
_local6 = (1 / _local6);
};
var _local7:Number = ((((((_arg3 & 1) == 1)) ? 1 : 0 + (((_arg3 & 2) == 2)) ? 1 : 0) + (((_arg3 & 4) == 4)) ? 1 : 0) + (((_arg3 & 8) == 8)) ? 1 : 0);
if (_local7 > 0){
_local7 = (1 / _local7);
};
var _local8:Number = ((((((_arg4 & 1) == 1)) ? 1 : 0 + (((_arg4 & 2) == 2)) ? 1 : 0) + (((_arg4 & 4) == 4)) ? 1 : 0) + (((_arg4 & 8) == 8)) ? 1 : 0);
if (_local8 > 0){
_local8 = (1 / _local8);
};
var _local9:Array = new Array((((_arg1 & 1) == 1)) ? _local5 : 0, (((_arg1 & 2) == 2)) ? _local5 : 0, (((_arg1 & 4) == 4)) ? _local5 : 0, (((_arg1 & 8) == 8)) ? _local5 : 0, 0, (((_arg2 & 1) == 1)) ? _local6 : 0, (((_arg2 & 2) == 2)) ? _local6 : 0, (((_arg2 & 4) == 4)) ? _local6 : 0, (((_arg2 & 8) == 8)) ? _local6 : 0, 0, (((_arg3 & 1) == 1)) ? _local7 : 0, (((_arg3 & 2) == 2)) ? _local7 : 0, (((_arg3 & 4) == 4)) ? _local7 : 0, (((_arg3 & 8) == 8)) ? _local7 : 0, 0, (((_arg4 & 1) == 1)) ? _local8 : 0, (((_arg4 & 2) == 2)) ? _local8 : 0, (((_arg4 & 4) == 4)) ? _local8 : 0, (((_arg4 & 8) == 8)) ? _local8 : 0, 0);
concat(_local9);
}
public function concat(_arg1:Array):void{
var _local5:Number;
var _local2:Array = new Array();
var _local3:Number = 0;
var _local4:Number = 0;
while (_local4 < 4) {
_local5 = 0;
while (_local5 < 5) {
_local2[(_local3 + _local5)] = (((((_arg1[_local3] * matrix[_local5]) + (_arg1[(_local3 + 1)] * matrix[(_local5 + 5)])) + (_arg1[(_local3 + 2)] * matrix[(_local5 + 10)])) + (_arg1[(_local3 + 3)] * matrix[(_local5 + 15)])) + ((_local5 == 4)) ? _arg1[(_local3 + 4)] : 0);
_local5++;
};
_local3 = (_local3 + 5);
_local4++;
};
matrix = _local2;
}
public function invert():void{
var _local1:Array = new Array(-1, 0, 0, 0, 0xFF, 0, -1, 0, 0, 0xFF, 0, 0, -1, 0, 0xFF, 0, 0, 0, 1, 0);
concat(_local1);
}
public function colorize(_arg1:Number, _arg2:Number=1):void{
var _local3:Number = (((_arg1 >> 16) & 0xFF) / 0xFF);
var _local4:Number = (((_arg1 >> 8) & 0xFF) / 0xFF);
var _local5:Number = ((_arg1 & 0xFF) / 0xFF);
var _local6:Number = (1 - _arg2);
var _local7:Array = new Array((_local6 + ((_arg2 * _local3) * r_lum)), ((_arg2 * _local3) * g_lum), ((_arg2 * _local3) * b_lum), 0, 0, ((_arg2 * _local4) * r_lum), (_local6 + ((_arg2 * _local4) * g_lum)), ((_arg2 * _local4) * b_lum), 0, 0, ((_arg2 * _local5) * r_lum), ((_arg2 * _local5) * g_lum), (_local6 + ((_arg2 * _local5) * b_lum)), 0, 0, 0, 0, 0, 1, 0);
concat(_local7);
}
public function setAlpha(_arg1:Number):void{
var _local2:Array = new Array(1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, _arg1, 0);
concat(_local2);
}
public function clone():ColorMatrix{
return (new ColorMatrix(matrix));
}
public function randomize(_arg1:Number=1):void{
var _local2:Number = (1 - _arg1);
var _local3:Number = (_local2 + (_arg1 * (Math.random() - Math.random())));
var _local4:Number = (_arg1 * (Math.random() - Math.random()));
var _local5:Number = (_arg1 * (Math.random() - Math.random()));
var _local6:Number = ((_arg1 * 0xFF) * (Math.random() - Math.random()));
var _local7:Number = (_arg1 * (Math.random() - Math.random()));
var _local8:Number = (_local2 + (_arg1 * (Math.random() - Math.random())));
var _local9:Number = (_arg1 * (Math.random() - Math.random()));
var _local10:Number = ((_arg1 * 0xFF) * (Math.random() - Math.random()));
var _local11:Number = (_arg1 * (Math.random() - Math.random()));
var _local12:Number = (_arg1 * (Math.random() - Math.random()));
var _local13:Number = (_local2 + (_arg1 * (Math.random() - Math.random())));
var _local14:Number = ((_arg1 * 0xFF) * (Math.random() - Math.random()));
var _local15:Array = new Array(_local3, _local4, _local5, 0, _local6, _local7, _local8, _local9, 0, _local10, _local11, _local12, _local13, 0, _local14, 0, 0, 0, 1, 0);
concat(_local15);
}
public function get filter():ColorMatrixFilter{
return (new ColorMatrixFilter(matrix));
}
}
}//package Graphics.Engine
Section 64
//Render (Graphics.Engine.Render)
package Graphics.Engine {
public class Render {
public static const CACHE_AND_ROTATE:int = 2;
public static const EFFECT_RENDER:int = 4;
public static const CACHE_ROTATION:int = 1;
public static const CACHE_BITMAP:int = 0;
public static const DYNAMIC_RENDER:int = 3;
}
}//package Graphics.Engine
Section 65
//RenderList (Graphics.Engine.RenderList)
package Graphics.Engine {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Collision.Shapes.*;
import flash.utils.*;
public class RenderList {
private var _layers:Dictionary;
public function RenderList(){
_layers = new Dictionary(false);
}
public function AddShape(_arg1:b2Shape):void{
var _local2:int;
var _local3:Renderable;
if (_arg1.m_userData != null){
_local2 = _arg1.m_userData.m_layer;
if (_layers[_local2] == null){
_layers[_local2] = new RLinkedList();
};
_local3 = new Renderable(_arg1);
_layers[_local2].append(_local3);
};
}
public function Render():void{
var _local2:*;
var _local3:Renderable;
var _local1:RenderPipeline = new RenderPipeline();
for (_local2 in _layers) {
if (_layers[_local2].enabled){
_local3 = _layers[_local2].head;
while (_local3 != null) {
if (_local3.shape != null){
_local1.RenderShape(_local3.shape);
} else {
if (_local3.joint != null){
_local1.RenderJoint(_local3.joint);
};
};
_local3 = _local3.next;
};
};
};
}
public function AddJoint(_arg1:b2Joint):void{
var _local2:int = _arg1.m_userData.m_layer;
if (_layers[_local2] == null){
_layers[_local2] = new RLinkedList();
};
var _local3:Renderable = new Renderable(null, _arg1);
_layers[_local2].append(_local3);
}
public function Clear():void{
_layers = null;
_layers = new Dictionary(false);
}
}
}//package Graphics.Engine
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Collision.Shapes.*;
class Renderable {
public var shape:b2Shape;
public var next:Renderable;
public var joint:b2Joint;
private function Renderable(_arg1:b2Shape=null, _arg2:b2Joint=null){
if (_arg1 != null){
shape = _arg1;
};
if (_arg2 != null){
joint = _arg2;
};
}
}
class RLinkedList {
public var head:Renderable;// = null
public var enabled:Boolean;// = true
public var tail:Renderable;// = null
private function RLinkedList(){
}
public function append(_arg1:Renderable):void{
if (head == null){
head = _arg1;
tail = _arg1;
_arg1.next = null;
} else {
tail.next = _arg1;
tail = _arg1;
};
}
}
Section 66
//RenderPipeline (Graphics.Engine.RenderPipeline)
package Graphics.Engine {
import General.*;
import flash.geom.*;
import flash.display.*;
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Collision.Shapes.*;
import Graphics.Style.*;
public class RenderPipeline {
public var m_physScale:Number;
public var m_sprite:Sprite;
public function RenderPipeline(){
m_physScale = Environment.physScale;
m_sprite = Environment.sprite;
}
public function DrawPoly(_arg1:b2PolyShape):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:BitmapData;
var _local9:Matrix;
var _local10:Number;
var _local11:Point;
var _local12:BitmapData;
var _local13:b2Vec2;
var _local14:b2Vec2;
var _local15:BitmapData;
if (_arg1.m_userData.m_bitmap != null){
_local4 = _arg1.m_position;
_local5 = _arg1.m_localOBB.extents;
_local6 = (((_local4.x - _local5.x) * m_physScale) - View.viewLocation.x);
_local7 = (((_local4.y - _local5.y) * m_physScale) - View.viewLocation.y);
_local8 = _arg1.m_userData.m_bitmap;
_local9 = new Matrix();
if (_arg1.m_body.m_rotation == 0){
View.DrawBitmap(_local8, _local8.rect, new Point(_local6, _local7), null, null, true);
} else {
if (_arg1.m_body.m_mass == 0){
if (_arg1.m_userData.m_last_rotation == _arg1.m_body.m_rotation){
_local12 = _arg1.m_userData.m_last_rotation;
View.DrawBitmap(_local12, _local12.rect, new Point(_local6, _local7), null, null, true);
} else {
_local10 = _arg1.m_body.m_rotation;
_local10;
_local11 = new Point(((_local5.x * 1) * m_physScale), ((_local5.y * 1) * m_physScale));
_local11;
_local11 = _local9.transformPoint(_local11);
_local11;
(_local9.tx = (_local9.tx - _local11.x));
(_local9.ty = (_local9.ty - _local11.y));
_local9.rotate(_local10);
(_local9.tx = (_local9.tx + _local11.x));
(_local9.ty = (_local9.ty + _local11.y));
_local9.translate((_local5.x * m_physScale), (_local5.y * m_physScale));
_local12 = new BitmapData(((_local5.x * 4) * m_physScale), ((_local5.y * 4) * m_physScale), true, 0);
_local12;
_local12.draw(_local8, _local9, null, "normal", null, true);
_local6 = (_local6 - (_local5.x * m_physScale));
_local6;
_local7 = (_local7 - (_local5.y * m_physScale));
_local7;
View.DrawBitmap(_local12, _local12.rect, new Point(_local6, _local7), null, null, true);
};
} else {
_local13 = new b2Vec2();
if (_local5.x > _local5.y){
(_local13.y = ((_local5.x * 2) * m_physScale));
(_local13.x = ((_local5.x * 2) * m_physScale));
} else {
(_local13.x = ((_local5.y * 2) * m_physScale));
(_local13.y = ((_local5.y * 2) * m_physScale));
};
_local14 = new b2Vec2();
(_local14.x = ((_local13.x * 0.5) - (_local5.x * m_physScale)));
(_local14.y = ((_local13.y * 0.5) - (_local5.y * m_physScale)));
_local6 = (_local6 - _local14.x);
_local6;
_local7 = (_local7 - _local14.y);
_local7;
_local10 = _arg1.m_body.m_rotation;
_local10;
_local11 = new Point(((_local5.x * 1) * m_physScale), ((_local5.y * 1) * m_physScale));
_local11;
_local11 = _local9.transformPoint(_local11);
_local11;
(_local9.tx = (_local9.tx - _local11.x));
(_local9.ty = (_local9.ty - _local11.y));
_local9.rotate(_local10);
(_local9.tx = (_local9.tx + _local11.x));
(_local9.ty = (_local9.ty + _local11.y));
_local9.translate(_local14.x, _local14.y);
_local15 = new BitmapData(_local13.x, _local13.y, true, 0);
_local15.draw(_local8, _local9, null, "normal", null, true);
View.DrawBitmap(_local15, _local15.rect, new Point(_local6, _local7), null, null, true);
};
};
};
}
public function RenderJoint(_arg1:b2Joint):void{
}
public function DrawCircle(_arg1:b2CircleShape):void{
var _local6:Number;
var _local7:Number;
var _local8:Sprite;
var _local9:BitmapData;
var _local10:int;
var _local11:int;
var _local2:b2Vec2 = _arg1.m_position;
var _local3:Number = _arg1.m_radius;
var _local4:Number = 16;
var _local5:Number = ((2 * Math.PI) / _local4);
switch (_arg1.m_userData.m_render_type){
case Render.DYNAMIC_RENDER:
break;
case Render.CACHE_BITMAP:
break;
case Render.CACHE_AND_ROTATE:
break;
case Render.CACHE_ROTATION:
break;
case Render.EFFECT_RENDER:
break;
};
if (_arg1.m_userData.m_bitmap != null){
_local8 = View.viewSprite;
_local9 = _arg1.m_userData.m_bitmap;
_local10 = ((_local9.width / 2) - (_local3 * m_physScale));
_local11 = ((_local9.height / 2) - (_local3 * m_physScale));
_local6 = ((((_local2.x - _local3) * m_physScale) - _local10) - View.viewLocation.x);
_local6;
_local7 = ((((_local2.y - _local3) * m_physScale) - _local11) - View.viewLocation.y);
_local7;
View.DrawBitmap(_local9, _local9.rect, new Point(_local6, _local7), null, null, true);
};
}
public function DrawArc(_arg1:b2ConcaveArcShape):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:ShapeStyle;
var _local5:b2Vec2;
var _local6:b2Vec2;
var _local7:Number;
var _local8:Point;
var _local9:b2Vec2;
var _local10:Number;
var _local11:Number;
var _local12:BitmapData;
var _local13:Matrix;
var _local14:BitmapData;
var _local15:b2Vec2;
var _local16:b2Vec2;
var _local17:b2Vec2;
var _local18:BitmapData;
if (_arg1.m_userData.m_bitmap != null){
_local2 = _arg1.m_body.m_position;
_local3 = _arg1.m_localOBB.extents;
_local4 = _arg1.m_userData.m_style;
_local5 = new b2Vec2();
if (_local4.GetBorder()){
_local6 = new b2Vec2(_local4.GetBorder().width, _local4.GetBorder().width);
_local6;
} else {
_local6 = new b2Vec2(0, 0);
_local6;
};
_local9 = new b2Vec2();
_local10 = 0;
_local11 = 0;
(_local9.x = ((_local2.x * m_physScale) - View.viewLocation.x));
(_local9.y = ((_local2.y * m_physScale) - View.viewLocation.y));
_local12 = _arg1.m_userData.m_bitmap;
_local13 = new Matrix();
if (((false) && ((_arg1.m_body.m_rotation == 0)))){
View.DrawBitmap(_local12, _local12.rect, new Point(_local10, _local11), null, null, true);
} else {
if (_arg1.m_body.m_mass == 0){
if (_arg1.m_userData.m_last_rotation == _arg1.m_body.m_rotation){
_local14 = _arg1.m_userData.m_rotated_bitmap;
_local10 = (_arg1.m_userData.m_last_offset.x + _local9.x);
_local10;
_local11 = (_arg1.m_userData.m_last_offset.y + _local9.y);
_local11;
View.DrawBitmap(_local14, _local14.rect, new Point(_local10, _local11), null, null, true);
} else {
_local15 = new b2Vec2();
if (_local3.x > _local3.y){
(_local15.y = ((_local3.x * 4) * m_physScale));
(_local15.x = ((_local3.x * 4) * m_physScale));
} else {
(_local15.x = ((_local3.y * 4) * m_physScale));
(_local15.y = ((_local3.y * 4) * m_physScale));
};
_local5 = new b2Vec2();
_local5;
(_local5.x = ((_local15.x * 0.5) - (_local3.x * m_physScale)));
(_local5.y = ((_local15.y * 0.5) - (_local3.y * m_physScale)));
_local10 = (_local10 - _local5.x);
_local10;
_local11 = (_local11 - _local5.y);
_local11;
_local7 = _arg1.m_body.m_rotation;
_local7;
(_arg1.m_userData.m_last_rotation = _local7);
_local8 = new Point((_local3.x * m_physScale), (_local3.y * m_physScale));
_local8;
_local8 = _local13.transformPoint(_local8);
_local8;
(_local13.tx = (_local13.tx - _local8.x));
(_local13.ty = (_local13.ty - _local8.y));
_local13.rotate(_local7);
(_local13.tx = (_local13.tx + _local8.x));
(_local13.ty = (_local13.ty + _local8.y));
_local13.translate(_local5.x, _local5.y);
_local14 = new BitmapData(_local15.x, _local15.y, true, 0);
_local14;
_local14.draw(_local12, _local13, null, "normal", null, true);
_local10 = (_local10 - (_local3.x * m_physScale));
_local10;
_local11 = (_local11 - (_local3.y * m_physScale));
_local11;
_local16 = new b2Vec2();
(_local16.x = (((Math.cos((_local7 + (Math.PI / 4))) * _local3.x) * 1.41) * m_physScale));
(_local16.y = (((Math.sin((_local7 + (Math.PI / 4))) * _local3.y) * 1.41) * m_physScale));
_local10 = (_local10 + _local16.x);
_local10;
_local11 = (_local11 + _local16.y);
_local11;
_local17 = new b2Vec2();
(_local17.x = _local10);
(_local17.y = _local11);
(_arg1.m_userData.m_last_offset = _local17);
(_arg1.m_userData.m_rotated_bitmap = _local14);
_local10 = (_local10 + _local9.x);
_local10;
_local11 = (_local11 + _local9.y);
_local11;
View.DrawBitmap(_local14, _local14.rect, new Point(_local10, _local11), null, null, true);
};
} else {
_local10 = (_local10 - (_local3.x * m_physScale));
_local10;
_local11 = (_local11 - (_local3.y * m_physScale));
_local11;
_local7 = _arg1.m_body.m_rotation;
_local7;
_local8 = new Point(((_local3.x * 1) * m_physScale), ((_local3.y * 1) * m_physScale));
_local8;
_local8 = _local13.transformPoint(_local8);
_local8;
(_local13.tx = (_local13.tx - _local8.x));
(_local13.ty = (_local13.ty - _local8.y));
_local13.rotate(_local7);
(_local13.tx = (_local13.tx + _local8.x));
(_local13.ty = (_local13.ty + _local8.y));
_local13.translate((_local3.x * m_physScale), (_local3.y * m_physScale));
_local18 = new BitmapData(((_local3.x * 4) * m_physScale), ((_local3.y * 4) * m_physScale), true, 0);
_local18.draw(_local12, _local13, null, "normal", null, true);
View.DrawBitmap(_local18, _local18.rect, new Point(_local10, _local11), null, null, true);
};
};
};
}
public function RenderContact():void{
}
public function RenderShape(_arg1:b2Shape):void{
var _local2:b2CircleShape;
var _local3:b2PolyShape;
var _local4:b2ConcaveArcShape;
if (_arg1.m_userData.m_particle_emitter){
_arg1.m_userData.m_particle_emitter.update();
};
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local2 = (_arg1 as b2CircleShape);
DrawCircle(_local2);
break;
case b2Shape.e_polyShape:
_local3 = (_arg1 as b2PolyShape);
DrawPoly(_local3);
break;
case b2Shape.e_concaveArcShape:
_local4 = (_arg1 as b2ConcaveArcShape);
DrawArc(_local4);
break;
};
}
}
}//package Graphics.Engine
Section 67
//ShapeCache (Graphics.Engine.ShapeCache)
package Graphics.Engine {
import General.*;
import flash.display.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.Shapes.*;
import Graphics.Style.*;
public class ShapeCache {
private static var _instance:ShapeCache;
private static var m_physScale:Number = Environment.physScale;
private function CacheArc(_arg1:b2ConcaveArcShape, _arg2:int):void{
var _local3:ShapeStyle;
var _local4:BitmapData;
if ((((_arg2 == Render.CACHE_BITMAP)) || ((_arg2 == Render.CACHE_AND_ROTATE)))){
_local3 = _arg1.m_userData.m_style;
if (_local3.GetSprite() != null){
_arg1.m_userData.m_bitmap = _local3.GetSprite();
} else {
_local4 = StyleRender.getInstance().RenderArc(_arg1, _local3);
_arg1.m_userData.m_bitmap = _local4;
};
};
if (_arg2 == Render.CACHE_ROTATION){
};
if (_arg2 == Render.CACHE_AND_ROTATE){
};
}
private function CacheCircle(_arg1:b2CircleShape, _arg2:int):void{
var _local3:Number;
var _local4:ShapeStyle;
var _local5:BitmapData;
if ((((_arg2 == Render.CACHE_BITMAP)) || ((_arg2 == Render.CACHE_AND_ROTATE)))){
_local3 = _arg1.m_radius;
_local4 = _arg1.m_userData.m_style;
_local5 = StyleRender.getInstance().RenderCircle(_local3, _local4);
_arg1.m_userData.m_bitmap = _local5;
};
if (_arg2 == Render.CACHE_ROTATION){
};
if (_arg2 == Render.CACHE_AND_ROTATE){
};
}
public function Cache(_arg1:b2Shape):void{
var _local3:b2CircleShape;
var _local4:b2PolyShape;
var _local5:b2ConcaveArcShape;
var _local2:int = _arg1.m_userData.m_render_type;
if (((!((_arg1.m_userData.m_bitmap == null))) || ((_arg1.m_userData.m_visible == false)))){
return;
};
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local3 = (_arg1 as b2CircleShape);
CacheCircle(_local3, _local2);
break;
case b2Shape.e_polyShape:
_local4 = (_arg1 as b2PolyShape);
CachePoly(_local4, _local2);
break;
case b2Shape.e_concaveArcShape:
_local5 = (_arg1 as b2ConcaveArcShape);
CacheArc(_local5, _local2);
break;
};
}
private function CachePoly(_arg1:b2PolyShape, _arg2:int):void{
var _local3:ShapeStyle;
var _local4:BitmapData;
if ((((_arg2 == Render.CACHE_BITMAP)) || ((_arg2 == Render.CACHE_AND_ROTATE)))){
_local3 = _arg1.m_userData.m_style;
_local4 = StyleRender.getInstance().RenderPoly(_arg1, _local3);
_arg1.m_userData.m_bitmap = _local4;
};
if (_arg2 == Render.CACHE_ROTATION){
};
if (_arg2 == Render.CACHE_AND_ROTATE){
};
}
public static function getInstance():ShapeCache{
if (ShapeCache._instance == null){
ShapeCache._instance = new (ShapeCache);
};
return (ShapeCache._instance);
}
}
}//package Graphics.Engine
Section 68
//StyleRender (Graphics.Engine.StyleRender)
package Graphics.Engine {
import General.*;
import flash.geom.*;
import flash.display.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Collision.Shapes.*;
import Graphics.Style.*;
import flash.filters.*;
public class StyleRender {
private static var _instance:StyleRender;
private static var m_physScale:Number = Environment.physScale;
public function RenderPoly(_arg1:b2PolyShape, _arg2:ShapeStyle):BitmapData{
var _local8:int;
var _local9:b2Vec2;
var _local12:BitmapData;
var _local13:Sprite;
var _local14:b2Vec2;
var _local15:b2Vec2;
var _local16:BitmapData;
var _local17:Matrix;
var _local18:b2Vec2;
var _local3:b2OBB = _arg1.m_localOBB;
var _local4:b2Mat22 = _local3.R;
var _local5:Array = _arg1.m_vertices;
var _local6:int = _arg1.m_vertexCount;
var _local7:b2Vec2 = _local3.extents;
var _local10:int = (((_local7.x * 4) * m_physScale) as int);
var _local11:int = (((_local7.y * 4) * m_physScale) as int);
_local12 = new BitmapData(_local10, _local11, true, 0);
if (_arg2.GetSprite() == null){
_local13 = new Sprite();
SetLineStyle(_local13, _local10, _local11, _arg2);
_local14 = new b2Vec2(_local7.x, _local7.y);
_local15 = b2Math.AddVV(_local14, b2Math.b2MulMV(_local4, _local5[_local8]));
if (_arg2.GetBorder()){
_local13.graphics.lineStyle(_arg2.GetBorder().width, _arg2.GetBorder().color, 1, true);
};
_local13.graphics.moveTo((_local15.x * m_physScale), (_local15.y * m_physScale));
_local8 = 0;
while (_local8 < _local6) {
_local9 = b2Math.AddVV(_local14, b2Math.b2MulMV(_local4, _local5[_local8]));
_local13.graphics.lineTo((_local9.x * m_physScale), (_local9.y * m_physScale));
_local8++;
};
_local13.graphics.lineTo((_local15.x * m_physScale), (_local15.y * m_physScale));
_local13.graphics.endFill();
_local12.draw(_local13);
return (RenderFilters(_local12, _arg2));
} else {
_local16 = _arg2.GetSprite();
_local17 = new Matrix();
_local18 = new b2Vec2();
_local18.x = ((_local10 / 2) / _local16.width);
_local18.y = ((_local11 / 2) / _local16.height);
_local17.scale(_local18.x, _local18.y);
_local12.draw(_local16, _local17, null, null, null, true);
};
return (_local12.RenderFilters(_arg2, !NULL!));
}
public function RenderFilters(_arg1:BitmapData, _arg2:ShapeStyle):BitmapData{
var _local3:Array;
var _local4:*;
var _local5:GlowFilter;
var _local6:BevelFilter;
var _local7:ColorAdjust;
var _local8:ColorMatrix;
var _local9:Rectangle;
var _local10:BitmapData;
if (_arg2.GetStyles()){
_local3 = _arg2.GetStyles();
for (_local4 in _local3) {
if ((_local3[_local4] is Glow)){
_local5 = (_local3[_local4].filter as GlowFilter);
_arg1.generateFilterRect(_arg1.rect, _local5);
_arg1.applyFilter(_arg1, _arg1.rect, new Point(0, 0), _local5);
} else {
if ((_local3[_local4] is Bevel)){
_local6 = (_local3[_local4].filter as BevelFilter);
_arg1.generateFilterRect(_arg1.rect, _local6);
_arg1.applyFilter(_arg1, _arg1.rect, new Point(0, 0), _local6);
} else {
if ((_local3[_local4] is ColorAdjust)){
_local7 = (_local3[_local4] as ColorAdjust);
_local8 = new ColorMatrix();
if (_local7.type == ColorAdjust.CONTRAST){
_local8.adjustContrast(_local7.r, _local7.g, _local7.b);
} else {
if (_local7.type == ColorAdjust.SATURATION){
_local8.adjustSaturation(_local7.amount);
} else {
if (_local7.type == ColorAdjust.BRIGHTNESS){
_local8.adjustBrightness(_local7.r, _local7.g, _local7.b);
} else {
if (_local7.type == ColorAdjust.HUE){
_local8.adjustHue(_local7.amount);
} else {
if (_local7.type == ColorAdjust.ALPHA){
_local8.setAlpha(_local7.amount);
};
};
};
};
};
_arg1.applyFilter(_arg1, _arg1.rect, new Point(0, 0), _local8.filter);
};
};
};
};
};
if (_arg2.trim == true){
_local9 = _arg1.getColorBoundsRect(4278190080, 0, false);
_local10 = new BitmapData(_local9.width, _local9.height, true, 0);
_local10.copyPixels(_arg1, _local9, new Point(0, 0), null, null, true);
return (_local10);
};
return (_arg1);
}
public function RenderCircle(_arg1:Number, _arg2:ShapeStyle):BitmapData{
var _local3:Number;
var _local5:BitmapData;
var _local8:BitmapData;
var _local9:Matrix;
var _local10:b2Vec2;
if (_arg2.GetBorder()){
_local3 = _arg2.GetBorder().width;
} else {
_local3 = 2;
};
var _local4:int = (((_arg1 * m_physScale) * 3) as int);
_local5 = new BitmapData(_local4, _local4, true, 0);
var _local6:Number = (_arg1 * m_physScale);
var _local7:Sprite = new Sprite();
if (_arg2.GetSprite() == null){
SetLineStyle(_local7, _local4, _local4, _arg2);
_local7.graphics.drawCircle((_local6 * 1.5), (_local6 * 1.5), _local6);
_local7.graphics.endFill();
_local5.draw(_local7);
return (RenderFilters(_local5, _arg2));
};
_local8 = _arg2.GetSprite();
_local9 = new Matrix();
_local10 = new b2Vec2();
_local10.x = ((_local6 * 2) / _local8.width);
_local10.y = ((_local6 * 2) / _local8.height);
_local9.scale(_local10.x, _local10.y);
_local5.draw(_local8, _local9, null, null, null, true);
return (RenderFilters(_local5, _arg2));
}
public function RenderMove(_arg1:Sprite, _arg2:Number, _arg3:Number):void{
_arg1.graphics.moveTo(Math.round((_arg2 * m_physScale)), Math.round((_arg3 * m_physScale)));
}
public function RenderLine(_arg1:Sprite, _arg2:Number, _arg3:Number):void{
_arg1.graphics.lineTo(Math.round((_arg2 * m_physScale)), Math.round((_arg3 * m_physScale)));
}
public function SetLineStyle(_arg1:Sprite, _arg2:Number, _arg3:Number, _arg4:ShapeStyle):void{
var _local5:Gradient;
var _local6:Matrix;
if (_arg4.GetBorder()){
_arg1.graphics.lineStyle(_arg4.GetBorder().width, _arg4.GetBorder().color, 1, true);
} else {
_arg1.graphics.lineStyle(0, 0, 0);
};
if (_arg4.GetGradient()){
_local5 = _arg4.GetGradient();
_local6.createGradientBox(_arg2, _arg3, 0);
_arg1.graphics.beginGradientFill(_local5.type, _local5.colors, _local5.alphas, _local5.ratios, _local6, _local5.spread, _local5.inter, _local5.focal);
} else {
if (_arg4.GetColor()){
_arg1.graphics.beginFill(_arg4.GetColor().color, 1);
};
};
}
public function RenderArc(_arg1:b2ConcaveArcShape, _arg2:ShapeStyle):BitmapData{
var _local3:int;
var _local4:Number;
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local12:b2Vec2;
var _local23:b2Vec2;
var _local24:b2Vec2;
_local4 = _arg1.m_radius;
var _local9:b2OBB = _arg1.m_localOBB;
var _local10:b2Mat22 = _local9.R;
var _local11:b2Vec2 = _local9.extents;
if (_arg2.GetBorder()){
_local12 = new b2Vec2(_arg2.GetBorder().width, _arg2.GetBorder().width);
} else {
_local12 = new b2Vec2(0, 0);
};
_local5 = b2Math.AddVV(_local12, b2Math.b2MulMV(_local10, _arg1.m_arcCenter));
var _local13:b2Vec2 = b2Math.AddVV(_local12, b2Math.b2MulMV(_arg1.m_R, _arg1.m_vertices[0]));
var _local14:b2Vec2 = b2Math.AddVV(_local12, b2Math.b2MulMV(_arg1.m_R, _arg1.m_vertices[1]));
var _local15:Number = Math.atan2((_local13.y - _local5.y), (_local13.x - _local5.x));
var _local16:Number = Math.atan2((_local14.y - _local5.y), (_local14.x - _local5.x));
var _local17:Sprite = new Sprite();
while (_local15 < _local16) {
_local15 = (_local15 + (Math.PI * 2));
};
_local6 = 16;
_local7 = ((_local15 - _local16) / _local6);
var _local18:int = ((_local11.x * 4) * m_physScale);
var _local19:int = ((_local11.y * 4) * m_physScale);
var _local20:BitmapData = new BitmapData(_local18, _local19, true, 0);
SetLineStyle(_local17, _local18, _local19, _arg2);
_local8 = _local15;
var _local21:b2Vec2 = new b2Vec2((_local4 * Math.cos(_local8)), (_local4 * Math.sin(_local8)));
var _local22:b2Vec2 = b2Math.AddVV(_local5, _local21);
_local21 = new b2Vec2((_local4 * Math.cos(_local8)), (_local4 * Math.sin(_local8)));
_local22 = b2Math.AddVV(_local5, _local21);
RenderMove(_local17, _local22.x, _local22.y);
_local3 = 0;
while (_local3 < _local6) {
_local8 = (_local8 - _local7);
_local21 = new b2Vec2((_local4 * Math.cos(_local8)), (_local4 * Math.sin(_local8)));
_local22 = b2Math.AddVV(_local5, _local21);
RenderLine(_local17, _local22.x, _local22.y);
_local3++;
};
_local24 = new b2Vec2((_local22.x * m_physScale), (_local22.y * m_physScale));
var _local25:b2PolyShape = (_arg1 as b2PolyShape);
var _local26:b2Vec2 = b2Math.AddVV(_local12, b2Math.b2MulMV(_local10, _local25.m_vertices[1]));
_local3 = 1;
while (_local3 < _local25.m_vertexCount) {
_local22 = b2Math.AddVV(_local12, b2Math.b2MulMV(_local10, _local25.m_vertices[_local3]));
if (((!((Math.round(_local24.x) == Math.round((_local22.x * m_physScale))))) || (!((Math.round(_local24.y) == Math.round((_local22.y * m_physScale))))))){
RenderLine(_local17, _local22.x, _local22.y);
};
_local24 = new b2Vec2((_local22.x * m_physScale), (_local22.y * m_physScale));
_local3++;
};
_local26 = b2Math.AddVV(_local12, b2Math.b2MulMV(_local10, _local25.m_vertices[0]));
_local17.graphics.endFill();
_local20.draw(_local17);
return (RenderFilters(_local20, _arg2));
}
public static function getInstance():StyleRender{
if (StyleRender._instance == null){
StyleRender._instance = new (StyleRender);
};
return (StyleRender._instance);
}
}
}//package Graphics.Engine
Section 69
//Particle (Graphics.Particle.Particle)
package Graphics.Particle {
import General.*;
import flash.geom.*;
import flash.display.*;
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
public class Particle {
private var _fadecounter:int;
private var _damping:Number;
public var enabled:Boolean;
private var _parent:ParticleEmitter;
private var _bitmap:BitmapData;
private var _gravity:b2Vec2;
private var _pos:b2Vec2;
private var _fade:Number;
private var _alpha:Number;// = 1
private var _shrink:Number;
private var _fadesteps:int;
private var _velocity:b2Vec2;
public function Particle(_arg1:ParticleEmitter, _arg2:BitmapData, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:Number, _arg6:b2Vec2, _arg7:Number, _arg8:int){
_parent = _arg1;
_pos = _arg3;
_velocity = _arg4;
_damping = _arg5;
_gravity = _arg6;
_fade = _arg7;
_fadesteps = _arg8;
_fadecounter = 0;
enabled = true;
}
public function get pos():b2Vec2{
return (_pos);
}
public function update():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:b2AABB;
_velocity.x = (_velocity.x + _gravity.x);
_velocity.y = (_velocity.y + _gravity.y);
_pos.Add(_velocity);
_velocity.Multiply(_damping);
_bitmap = _parent.getFade(_fadecounter);
if (_bitmap != null){
_local3 = Environment.physScale;
_local1 = ((_pos.x - View.viewLocation.x) - (_bitmap.width * 0.5));
_local2 = ((_pos.y - View.viewLocation.y) - (_bitmap.height * 0.5));
_local4 = new b2AABB();
_local4.minVertex.x = View.viewLocation.x;
_local4.minVertex.y = View.viewLocation.y;
_local4.maxVertex.x = (View.viewLocation.x + Environment.stageObject.stageWidth);
_local4.maxVertex.y = (View.viewLocation.y + Environment.stageObject.stageHeight);
if ((((_pos.x >= _local4.minVertex.x)) && (((_pos.x + bitmap.width) < _local4.maxVertex.x)))){
if ((((_pos.y >= _local4.minVertex.y)) && (((_pos.y + bitmap.height) < _local4.maxVertex.y)))){
View.DrawBitmap(_bitmap, _bitmap.rect, new Point(_local1, _local2), null, null, true);
};
};
} else {
enabled = false;
};
_fadecounter = (_fadecounter + 1);
if (_fadecounter >= _fadesteps){
enabled = false;
};
}
public function get bitmap():BitmapData{
return (_bitmap);
}
}
}//package Graphics.Particle
Section 70
//ParticleEmitter (Graphics.Particle.ParticleEmitter)
package Graphics.Particle {
import General.*;
import flash.geom.*;
import flash.display.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
public class ParticleEmitter {
private var _direction:Number;
private var _body:b2Body;
private var _enabled:Boolean;// = false
private var _particlelist:Array;
private var _displacement:b2Vec2;
private var _speed:Number;
private var _bitmap:BitmapData;
private var _gravity:b2Vec2;
private var _spread:Number;
public var pos:b2Vec2;
private var _fade:Number;
private var _rotation:Number;
private var _vector:b2Vec2;
private var _distribution:b2Vec2;
private var _usevelocity:Boolean;
private var _fadebitmaps:Array;
private var _fadesteps:int;
private var _counter:Number;
public function ParticleEmitter(_arg1:b2Body, _arg2:BitmapData, _arg3:b2Vec2, _arg4:Number, _arg5:b2Vec2, _arg6:Number, _arg7:Boolean=true, _arg8:Number=0, _arg9:b2Vec2=null, _arg10:b2Vec2=null){
_body = _arg1;
_fade = _arg6;
_speed = _arg4;
_gravity = _arg5;
_spread = (_arg8 * 0.0174532925);
_vector = _arg3;
_bitmap = _arg2;
_enabled = true;
_usevelocity = _arg7;
_counter = 0;
_displacement = _arg10;
_distribution = _arg9;
cacheFade();
}
private function CreateParticle():void{
var _local2:Particle;
var _local3:b2Vec2;
var _local4:Number;
var _local6:Number;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local1:Number = Environment.physScale;
pos = _body.m_position.Copy();
pos.Multiply(_local1);
if (_displacement != null){
_local8 = new b2Vec2(0, 0);
_local8 = _body.m_linearVelocity.Copy();
_local8.Normalize();
_local8.x = (_local8.x * _displacement.x);
_local8.y = (_local8.y * _displacement.y);
pos.Add(_local8);
};
if (_distribution != null){
_local9 = new b2Vec2(0, 0);
_local9.x = ((Math.random() * _distribution.x) - (_distribution.x / 2));
_local9.y = ((Math.random() * _distribution.y) - (_distribution.y / 2));
pos.Add(_local9);
};
if (_usevelocity){
_local3 = _body.m_linearVelocity.Copy();
_local4 = _local3.Length();
} else {
_local3 = new b2Vec2(0, 0);
_local4 = 1;
};
var _local5:b2Vec2 = _local3.Copy();
_local5.Normalize();
_local6 = Math.atan2(_local5.y, _local5.x);
_local6 = (_local6 + ((Math.random() * _spread) - (_spread / 2)));
_local7 = new b2Vec2(Math.cos(_local6), Math.sin(_local6));
_local7.Multiply(_local4);
_local7.x = (_local7.x * _vector.x);
_local7.y = (_local7.y * _vector.y);
_local2 = new Particle(this, _bitmap, pos, _local7, 0.98, new b2Vec2(0, 0), _fade, _fadesteps);
ParticleManager.Add(_local2);
}
public function init():void{
_counter = 0.5;
}
public function update():void{
_counter = (_counter + _speed);
while (_counter >= 1) {
_counter--;
CreateParticle();
};
}
private function cacheFade():void{
var _local2:ColorTransform;
var _local3:BitmapData;
_fadebitmaps = new Array();
_fadesteps = 0;
var _local1:Number = 1;
while (_local1 > 0.1) {
_local1 = (_local1 * _fade);
_fadesteps = (_fadesteps + 1);
};
_local1 = 1;
var _local4:int;
while (_local4 < _fadesteps) {
_local2 = new ColorTransform();
_local2.alphaMultiplier = _local1;
_local3 = new BitmapData(_bitmap.width, _bitmap.height, true, 0);
_local3.copyPixels(_bitmap, _bitmap.rect, new Point(0, 0), null, null, true);
_local3.colorTransform(_local3.rect, _local2);
_fadebitmaps.push(_local3);
_local1 = (_local1 * _fade);
_local4++;
};
}
public function disable():void{
_enabled = false;
}
public function enable():void{
_enabled = true;
}
public function getFade(_arg1:int):BitmapData{
if (_fadebitmaps[_arg1] != null){
return (_fadebitmaps[_arg1]);
};
return (null);
}
}
}//package Graphics.Particle
Section 71
//ParticleManager (Graphics.Particle.ParticleManager)
package Graphics.Particle {
import flash.display.*;
import flash.utils.*;
public class ParticleManager {
private static var _bitmaps:Dictionary = new Dictionary(false);
private static var _particles:Array = new Array();
public static function Add(_arg1:Particle):void{
_particles.push(_arg1);
}
public static function GetBitmap(_arg1:int, _arg2:int):BitmapData{
var _local3:BitmapData;
var _local5:Array;
var _local6:*;
var _local4:Boolean;
if (_bitmaps[_arg1] != null){
if (_bitmaps[_arg1][_arg2] != null){
_local5 = _bitmaps[_arg1][_arg2];
for (_local6 in _local5) {
if (_local5[_local6] != null){
_local3 = _local5[_local6];
_local5[_local6] = null;
return (_local3);
};
};
return (new BitmapData(_arg1, _arg2, true, 0));
} else {
return (new BitmapData(_arg1, _arg2, true, 0));
};
//unresolved jump
};
return (new BitmapData(_arg1, _arg2, true, 0));
}
public static function update():void{
var _local1:*;
for (_local1 in _particles) {
if (_particles[_local1] != null){
if (_particles[_local1].enabled){
_particles[_local1].update();
} else {
delete _particles[_local1];
};
};
};
}
public static function Clear():void{
_particles = null;
_particles = new Array();
}
public static function ReturnBitmap(_arg1:BitmapData):void{
var _local3:int;
var _local4:int;
var _local5:Array;
var _local6:*;
var _local2:Boolean;
_local3 = _arg1.width;
_local4 = _arg1.height;
if (_bitmaps[_local3] != null){
if (_bitmaps[_local3][_local4] != null){
_local5 = _bitmaps[_local3][_local4];
for (_local6 in _local5) {
if (_local5[_local6] == null){
_local5[_local6] = _arg1;
_local2 = true;
};
};
if (_local2 == false){
_local5.push(_arg1);
_local2 = true;
};
} else {
_bitmaps[_local3][_local4] = new Array();
_bitmaps[_local3][_local4].push(_arg1);
};
} else {
_bitmaps[_local3] = new Dictionary(false);
_bitmaps[_local3][_local4] = new Array();
_bitmaps[_local3][_local4].push(_arg1);
};
}
}
}//package Graphics.Particle
Section 72
//Bevel (Graphics.Style.Bevel)
package Graphics.Style {
import flash.filters.*;
public class Bevel {
private var _bevel:BevelFilter;
public function Bevel(_arg1:Number=4, _arg2:Number=45, _arg3:Number=4, _arg4:Number=1, _arg5:Number=1){
_bevel = new BevelFilter(_arg1, _arg2, 0xFFFFFF, 1, 0, 1, _arg3, _arg3, _arg4, _arg5, BitmapFilterType.INNER);
}
public function get filter():BevelFilter{
return (_bevel);
}
}
}//package Graphics.Style
Section 73
//Border (Graphics.Style.Border)
package Graphics.Style {
public class Border {
private var _color:uint;
private var _width:Number;
public function Border(_arg1:Number=0, _arg2:uint=0, _arg3:uint=0, _arg4:uint=0){
_color = (((_arg2 << 16) + (_arg3 << 8)) + _arg4);
_width = _arg1;
}
public function get color():uint{
return (_color);
}
public function get width():Number{
return (_width);
}
}
}//package Graphics.Style
Section 74
//Color (Graphics.Style.Color)
package Graphics.Style {
public class Color {
private var _b:Number;
private var _color:uint;
private var _g:Number;
private var _r:Number;
public function Color(_arg1:uint, _arg2:uint, _arg3:uint){
_color = (((_arg1 << 16) + (_arg2 << 8)) + _arg3);
_r = _arg1;
_g = _arg2;
_b = _arg3;
}
public function get b():Number{
return (_b);
}
public function get g():Number{
return (_g);
}
public function get color():uint{
return (_color);
}
public function set r(_arg1:Number):void{
_r = _arg1;
_color = (((_r << 16) + (_g << 8)) + _b);
}
public function set g(_arg1:Number):void{
_g = _arg1;
_color = (((_r << 16) + (_g << 8)) + _b);
}
public function get r():Number{
return (_r);
}
public function hex2RGB(_arg1:uint):void{
}
public function set b(_arg1:Number):void{
_b = _arg1;
_color = (((_r << 16) + (_g << 8)) + _b);
}
public static function RGB2hex(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:uint):uint{
var _local5:uint = ((((_arg1 << 24) + (_arg2 << 16)) + (_arg3 << 8)) + _arg4);
return (null);
}
}
}//package Graphics.Style
Section 75
//ColorAdjust (Graphics.Style.ColorAdjust)
package Graphics.Style {
public class ColorAdjust {
private var _b:Number;
private var _g:Number;
private var _r:Number;
private var _amount:Number;
private var _type:int;
public static const SATURATION:int = 1;
public static const CONTRAST:int = 0;
public static const BRIGHTNESS:int = 3;
public static const HUE:int = 2;
public static const ALPHA:int = 4;
public function ColorAdjust(_arg1:int=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0){
_type = _arg1;
_amount = _arg2;
_r = _arg3;
_g = _arg4;
_b = _arg5;
}
public function get r():Number{
return (_r);
}
public function get g():Number{
return (_g);
}
public function get b():Number{
return (_b);
}
public function get amount():Number{
return (_amount);
}
public function get type():int{
return (_type);
}
}
}//package Graphics.Style
Section 76
//Glow (Graphics.Style.Glow)
package Graphics.Style {
import flash.filters.*;
public class Glow {
private var _glow:GlowFilter;
public function Glow(_arg1:uint, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
_glow = new GlowFilter(_arg1, _arg2, _arg3, _arg3, _arg4, _arg5, false, false);
}
public function get filter():GlowFilter{
return (_glow);
}
}
}//package Graphics.Style
Section 77
//Gradient (Graphics.Style.Gradient)
package Graphics.Style {
import flash.geom.*;
import Graphics.*;
public class Gradient {
public var focal:Number;
public var ratios:Array;
public var mtrx:Matrix;
public var colors:Array;
public var spread:String;
public var alphas:Array;
public var type:String;
public var inter:String;
public function Gradient(_arg1:String, _arg2:Array, _arg3:Array, _arg4:Array, _arg5:Matrix, _arg6:String, _arg7:String, _arg8:Number){
type = _arg1;
colors = _arg2;
alphas = _arg3;
ratios = _arg4;
mtrx = _arg5;
spread = _arg6;
inter = _arg7;
focal = _arg8;
}
public function fill():void{
}
public function end():void{
View.viewSprite.graphics.endFill();
}
}
}//package Graphics.Style
Section 78
//ShapeStyle (Graphics.Style.ShapeStyle)
package Graphics.Style {
import flash.display.*;
public class ShapeStyle {
private var _styles:Array;
private var _border:Border;
private var _bitmap:BitmapData;
private var _trim:Boolean;// = true
private var _gradient:Gradient;
private var _type:int;
private var _color:Color;
public function ShapeStyle(){
_styles = new Array();
super();
}
public function adjustBrightness(_arg1:int, _arg2:int, _arg3:int):void{
_styles.push(new ColorAdjust(ColorAdjust.BRIGHTNESS, 0, _arg1, _arg2, _arg3));
}
public function set trim(_arg1:Boolean):void{
_trim = _arg1;
}
public function GetGradient():Gradient{
return (_gradient);
}
public function SetColor(_arg1:Color):void{
_color = _arg1;
}
public function GetColor():Color{
return (_color);
}
public function GetBorder():Border{
return (_border);
}
public function SetBorder(_arg1:Border):void{
_border = _arg1;
}
public function GetSprite():BitmapData{
return (_bitmap);
}
public function get trim():Boolean{
return (_trim);
}
public function adjustSaturation(_arg1:int):void{
_styles.push(new ColorAdjust(ColorAdjust.SATURATION, _arg1));
}
public function SetSprite(_arg1:BitmapData):void{
_bitmap = _arg1;
}
public function adjustHue(_arg1:int, _arg2:int, _arg3:int):void{
_styles.push(new ColorAdjust(ColorAdjust.HUE, 0, _arg1, _arg2, _arg3));
}
public function applyGlow(_arg1:Glow):void{
_styles.push(_arg1);
}
public function Draw():void{
}
public function applyBevel(_arg1:Bevel):void{
_styles.push(_arg1);
}
public function adjustContrast(_arg1:int, _arg2:int, _arg3:int):void{
_styles.push(new ColorAdjust(ColorAdjust.CONTRAST, 0, _arg1, _arg2, _arg3));
}
public function setGradient(_arg1:Gradient):void{
_gradient = _arg1;
}
public function GetStyles():Array{
return (_styles);
}
public function adjustAlpha(_arg1:int):void{
_styles.push(new ColorAdjust(ColorAdjust.ALPHA, _arg1));
}
}
}//package Graphics.Style
Section 79
//View (Graphics.View)
package Graphics {
import General.*;
import flash.geom.*;
import flash.display.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Graphics.Engine.*;
import General.Control.*;
import flash.text.*;
public class View {
private var viewRect:Rectangle;
private var ywidth:int;
private var xwidth:int;
private var x:int;// = 640
private var y:int;// = 480
private var ys:int;
private var xs:int;// = 0
private var xinterval:int;// = 8
private var yinterval:int;// = 4
public static var viewBuffer:BitmapData;
private static var zeroPoint:Point = new Point(0, 0);
private static var drawcount:int = 0;
public static var viewBuffer2:BitmapData;
public static var viewSprite:Sprite;
public static var renderList:RenderList;
public static var screenAdjust:Point = new Point(0, 0);
public static var adjustcount:Number;
private static var _tfield:TextField = new TextField();
public static var alphaBitmap:BitmapData;
public static var screenCenter:Point = new Point();
private static var _instance:View;
public static var viewLocation:Point = new Point(0, 0);
public static var viewBitmap:Bitmap;
public static var _actor:IActor;
public function View(_arg1:SingletonEnforcer){
viewRect = new Rectangle();
ys = y;
ywidth = (y / yinterval);
xwidth = (x / xinterval);
super();
viewRect = viewBuffer.rect;
}
public function swapbuffer():void{
}
public static function getInstance():View{
if (View._instance == null){
View._instance = new View(new SingletonEnforcer());
};
return (View._instance);
}
public static function SetActor(_arg1:IActor):void{
_actor = _arg1;
}
public static function getbuffer():BitmapData{
return (viewBuffer);
}
public static function GetActor():IActor{
return (_actor);
}
public static function SetCoordinate(_arg1:b2Vec2):void{
}
public static function DrawParagraph(_arg1:Point, _arg2:String, _arg3:Point, _arg4:int=16, _arg5:uint=0xFFFFFF):void{
_tfield.text = _arg2;
_tfield.textColor = _arg5;
_tfield.autoSize = TextFieldAutoSize.LEFT;
_tfield.width = _arg3.x;
_tfield.multiline = true;
_tfield.wordWrap = true;
_tfield.setTextFormat(new TextFormat("Verdana", _arg4, null));
_tfield.antiAliasType = AntiAliasType.ADVANCED;
_tfield.sharpness = 100;
viewBuffer.draw(_tfield, new Matrix(1, 0, 0, 1, _arg1.x, _arg1.y));
}
public static function DrawText(_arg1:Point, _arg2:String, _arg3:uint=0xFFFFFF, _arg4:int=12, _arg5:Boolean=false):void{
_tfield.text = _arg2;
_tfield.textColor = _arg3;
_tfield.autoSize = TextFieldAutoSize.LEFT;
_tfield.setTextFormat(new TextFormat("Verdana", _arg4, null, _arg5));
_tfield.antiAliasType = AntiAliasType.ADVANCED;
_tfield.sharpness = 100;
_tfield.gridFitType = GridFitType.PIXEL;
viewBuffer.draw(_tfield, new Matrix(1, 0, 0, 1, _arg1.x, _arg1.y));
}
public static function DrawBitmap(_arg1:BitmapData, _arg2:Rectangle, _arg3:Point, _arg4:BitmapData=null, _arg5:Point=null, _arg6:Boolean=false):void{
viewBuffer.copyPixels(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
}
public static function Center():void{
var _local8:Ship;
var _local1:Number = Environment.physScale;
var _local2:int;
var _local3:int;
if (Environment.mouseControl == true){
_local2 = ((_actor.GetPosition().x * _local1) - Input.mouseX);
_local3 = ((_actor.GetPosition().y * _local1) - Input.mouseY);
} else {
_local8 = (_actor as Ship);
_local2 = (-(_local8.getkeyvector().x) * 200);
_local3 = (-(_local8.getkeyvector().y) * 200);
_local2 = (_local2 * Environment.stageObject.scaleX);
_local3 = (_local3 * Environment.stageObject.scaleY);
};
_local2 = (_local2 * 0.4);
_local3 = (_local3 * 0.4);
var _local4:Number = 90;
if (_local2 > _local4){
_local2 = _local4;
};
if (_local2 < -(_local4)){
_local2 = -(_local4);
};
if (_local3 > _local4){
_local3 = _local4;
};
if (_local3 < -(_local4)){
_local3 = -(_local4);
};
var _local5:b2Vec2 = new b2Vec2();
_local5.x = (_local2 - screenAdjust.x);
_local5.y = (_local3 - screenAdjust.y);
if (Environment.mouseControl == true){
_local5.Multiply(0.2);
} else {
_local5.Multiply(0.05);
};
screenAdjust.x = (screenAdjust.x + _local5.x);
screenAdjust.y = (screenAdjust.y + _local5.y);
_local2 = screenAdjust.x;
_local3 = screenAdjust.y;
var _local6:Point = new Point();
_local6.x = (Environment.stageObject.width * 0.5);
_local6.y = (Environment.stageObject.height * 0.5);
var _local7:Point = new Point();
_local7.x = (_actor.GetPosition().x * _local1);
_local7.y = (_actor.GetPosition().y * _local1);
viewSprite.x = 0;
viewSprite.y = 0;
screenCenter.x = (_local7.x - _local2);
screenCenter.y = (_local7.y - _local3);
viewLocation.x = (screenCenter.x - _local6.x);
viewLocation.y = (screenCenter.y - _local6.y);
viewBitmap.x = 0;
viewBitmap.y = 0;
}
public static function ClearScreen():void{
viewBuffer.fillRect(viewBuffer.rect, 4278192674);
}
public static function Clear():void{
_actor = null;
renderList = null;
}
}
}//package Graphics
class SingletonEnforcer {
private function SingletonEnforcer(){
}
}
Section 80
//MochiScores (mochi.MochiScores)
package mochi {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
var _local2:Object = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi
Section 81
//MochiServices (mochi.MochiServices)
package mochi {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function getVersion():String{
return ("1.31");
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
_rcvChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
return (_local2);
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()});
_rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = this.client._callbacks[cb];
if (!cblst){
return;
};
var method:* = cblst.callbackMethod;
methodName = "";
var obj:Object = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
_rcvChannel.connect(_rcvChannelName);
trace("connected!");
_connecting = false;
_connected = true;
_listenChannel.close();
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
_rcvChannelName = _arg1;
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var id = _arg1;
var clip = _arg2;
var clipname:String = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
MochiServices.allowDomains(_gatewayURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
var f:Function = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
var req:URLRequest = new URLRequest(_gatewayURL);
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain("*", "localhost");
_rcvChannel.allowInsecureDomain("*", "localhost");
_rcvChannel.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
var mc:MovieClip = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 82
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "3.0.0.0";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 83
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 84
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 85
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 86
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 87
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 88
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 89
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var _local2:String;
var _local4:String;
var _local5:Array;
var _local3:DisplayObject = _arg1;
while (_local3 != null) {
if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
break;
};
_local4 = _local3.name;
if ((_local3 is IRepeaterClient)){
_local5 = IRepeaterClient(_local3).instanceIndices;
if (_local5){
_local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
};
};
_local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2);
_local3 = _local3.parent;
};
return (_local2);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 90
//b2BoxDef (Physics.Box2D.Collision.Shapes.b2BoxDef)
package Physics.Box2D.Collision.Shapes {
import Physics.Box2D.Common.Math.*;
public class b2BoxDef extends b2ShapeDef {
public var extents:b2Vec2;
public function b2BoxDef(){
type = b2Shape.e_boxShape;
extents = new b2Vec2(1, 1);
}
}
}//package Physics.Box2D.Collision.Shapes
Section 91
//b2CircleDef (Physics.Box2D.Collision.Shapes.b2CircleDef)
package Physics.Box2D.Collision.Shapes {
public class b2CircleDef extends b2ShapeDef {
public var radius:Number;
public function b2CircleDef(){
type = b2Shape.e_circleShape;
radius = 1;
}
}
}//package Physics.Box2D.Collision.Shapes
Section 92
//b2CircleShape (Physics.Box2D.Collision.Shapes.b2CircleShape)
package Physics.Box2D.Collision.Shapes {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
public class b2CircleShape extends b2Shape {
public var m_localPosition:b2Vec2;
public var m_radius:Number;
public function b2CircleShape(_arg1:b2ShapeDef, _arg2:b2Body, _arg3:b2Vec2){
var _local5:Number;
var _local6:Number;
m_localPosition = new b2Vec2();
super(_arg1, _arg2);
var _local4:b2CircleDef = (_arg1 as b2CircleDef);
m_localPosition.Set((_arg1.localPosition.x - _arg3.x), (_arg1.localPosition.y - _arg3.y));
m_type = b2Shape.e_circleShape;
m_radius = _local4.radius;
m_R.SetM(m_body.m_R);
_local5 = ((m_R.col1.x * m_localPosition.x) + (m_R.col2.x * m_localPosition.y));
_local6 = ((m_R.col1.y * m_localPosition.x) + (m_R.col2.y * m_localPosition.y));
m_position.x = (m_body.m_position.x + _local5);
m_position.y = (m_body.m_position.y + _local6);
m_maxRadius = (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))) + m_radius);
var _local7:b2AABB = new b2AABB();
_local7.minVertex.Set((m_position.x - m_radius), (m_position.y - m_radius));
_local7.maxVertex.Set((m_position.x + m_radius), (m_position.y + m_radius));
var _local8:b2BroadPhase = m_body.m_world.m_broadPhase;
if (_local8.InRange(_local7)){
m_proxyId = _local8.CreateProxy(_local7, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
if (m_proxyId == b2Pair.b2_nullProxy){
m_body.Freeze();
};
}
override public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{
m_R.SetM(_arg4);
m_position.x = (((_arg4.col1.x * m_localPosition.x) + (_arg4.col2.x * m_localPosition.y)) + _arg3.x);
m_position.y = (((_arg4.col1.y * m_localPosition.x) + (_arg4.col2.y * m_localPosition.y)) + _arg3.y);
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
var _local5:Number = (_arg1.x + ((_arg2.col1.x * m_localPosition.x) + (_arg2.col2.x * m_localPosition.y)));
var _local6:Number = (_arg1.y + ((_arg2.col1.y * m_localPosition.x) + (_arg2.col2.y * m_localPosition.y)));
var _local7:Number = Math.min(_local5, m_position.x);
var _local8:Number = Math.min(_local6, m_position.y);
var _local9:Number = Math.max(_local5, m_position.x);
var _local10:Number = Math.max(_local6, m_position.y);
var _local11:b2AABB = new b2AABB();
_local11.minVertex.Set((_local7 - m_radius), (_local8 - m_radius));
_local11.maxVertex.Set((_local9 + m_radius), (_local10 + m_radius));
var _local12:b2BroadPhase = m_body.m_world.m_broadPhase;
if (_local12.InRange(_local11)){
_local12.MoveProxy(m_proxyId, _local11);
} else {
m_body.Freeze();
};
}
override public function Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{
var _local4:Number = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
_arg1 = (_arg1 / _local4);
_arg2 = (_arg2 / _local4);
_arg3.Set((m_position.x + (m_radius * _arg1)), (m_position.y + (m_radius * _arg2)));
}
override public function QuickSync(_arg1:b2Vec2, _arg2:b2Mat22):void{
m_R.SetM(_arg2);
m_position.x = (((_arg2.col1.x * m_localPosition.x) + (_arg2.col2.x * m_localPosition.y)) + _arg1.x);
m_position.y = (((_arg2.col1.y * m_localPosition.x) + (_arg2.col2.y * m_localPosition.y)) + _arg1.y);
}
override public function TestPoint(_arg1:b2Vec2):Boolean{
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(_arg1);
_local2.Subtract(m_position);
return ((b2Math.b2Dot(_local2, _local2) <= (m_radius * m_radius)));
}
override public function ResetProxy(_arg1:b2BroadPhase):void{
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
var _local2:b2Proxy = _arg1.GetProxy(m_proxyId);
_arg1.DestroyProxy(m_proxyId);
_local2 = null;
var _local3:b2AABB = new b2AABB();
_local3.minVertex.Set((m_position.x - m_radius), (m_position.y - m_radius));
_local3.maxVertex.Set((m_position.x + m_radius), (m_position.y + m_radius));
if (_arg1.InRange(_local3)){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
if (m_proxyId == b2Pair.b2_nullProxy){
m_body.Freeze();
};
}
}
}//package Physics.Box2D.Collision.Shapes
Section 93
//b2ConcaveArcDef (Physics.Box2D.Collision.Shapes.b2ConcaveArcDef)
package Physics.Box2D.Collision.Shapes {
import Physics.Box2D.Common.Math.*;
public class b2ConcaveArcDef extends b2PolyDef {
public var radius:Number;
public function b2ConcaveArcDef(){
type = b2Shape.e_concaveArcShape;
radius = 1;
}
override public function ComputeMass(_arg1:b2MassData):void{
var _local14:b2MassData;
var _local19:b2Vec2;
var _local2:Number = (radius * radius);
var _local3:b2Vec2 = vertices[0];
var _local4:b2Vec2 = vertices[1];
var _local5:Number = (_local3.x - _local4.x);
var _local6:Number = (_local3.y - _local4.y);
var _local7:Number = ((_local5 * _local5) + (_local6 * _local6));
var _local8:Number = Math.sqrt(_local7);
if ((_local7 / 4) > _local2){
_local2 = (_local7 / 4);
radius = (_local8 / 2);
};
var _local9:Number = Math.sqrt((_local2 - (_local7 * 0.25)));
var _local10:Number = (-(_local6) / _local8);
var _local11:Number = (_local5 / _local8);
var _local12:b2Vec2 = new b2Vec2((((_local3.x + _local4.x) / 2) + (_local9 * _local10)), (((_local3.y + _local4.y) / 2) + (_local9 * _local11)));
var _local13:b2MassData = new b2MassData();
b2Shape.PolyMass(_local13, vertices, vertexCount, density);
_local14 = new b2MassData();
var _local15:Array = [vertices[0], _local12, vertices[1]];
if (_local9 > Number.MIN_VALUE){
b2Shape.PolyMass(_local14, _local15, 3, density);
};
var _local16:b2MassData = new b2MassData();
var _local17:Number = (Math.acos((_local9 / radius)) * 2);
_local16.mass = (((0.5 * _local2) * _local17) * -(density));
var _local18:Number = (((2 / 3) * _local8) / _local17);
if (_local17 < Number.MIN_VALUE){
_local18 = ((2 / 3) * radius);
};
_local16.center = new b2Vec2((_local12.x - (_local10 * _local18)), (_local12.y - (_local11 * _local18)));
_local16.I = (((0.5 * _local16.mass) * _local2) - ((_local16.mass * _local18) * _local18));
_arg1.mass = ((_local13.mass + _local14.mass) + _local16.mass);
if (_arg1.mass > Number.MIN_VALUE){
_arg1.center.x = (((_local13.mass * _local13.center.x) + (_local14.mass * _local14.center.x)) + (_local16.mass * _local16.center.x));
_arg1.center.y = (((_local13.mass * _local13.center.y) + (_local14.mass * _local14.center.y)) + (_local16.mass * _local16.center.y));
_arg1.center.x = (_arg1.center.x / _arg1.mass);
_arg1.center.y = (_arg1.center.y / _arg1.mass);
_arg1.I = ((_local13.I + _local14.I) + _local16.I);
_local19 = b2Math.SubtractVV(_local13.center, _arg1.center);
_arg1.I = (_arg1.I + (_local13.mass * b2Math.b2Dot(_local19, _local19)));
_local19 = b2Math.SubtractVV(_local14.center, _arg1.center);
_arg1.I = (_arg1.I + (_local14.mass * b2Math.b2Dot(_local19, _local19)));
_local19 = b2Math.SubtractVV(_local16.center, _arg1.center);
_arg1.I = (_arg1.I + (_local16.mass * b2Math.b2Dot(_local19, _local19)));
};
}
}
}//package Physics.Box2D.Collision.Shapes
Section 94
//b2ConcaveArcShape (Physics.Box2D.Collision.Shapes.b2ConcaveArcShape)
package Physics.Box2D.Collision.Shapes {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Common.*;
public class b2ConcaveArcShape extends b2PolyShape {
public var m_radius2:Number;
public var m_radius:Number;
public var m_arcCenter:b2Vec2;
public var m_dot:Number;
public var m_norm:Number;
public function b2ConcaveArcShape(_arg1:b2ShapeDef, _arg2:b2Body, _arg3:b2Vec2){
super(_arg1, _arg2, _arg3);
var _local4:b2ConcaveArcDef = (_arg1 as b2ConcaveArcDef);
m_radius = _local4.radius;
m_radius2 = (m_radius * m_radius);
var _local5:b2Vec2 = m_vertices[0];
var _local6:b2Vec2 = m_vertices[1];
var _local7:Number = (_local5.x - _local6.x);
var _local8:Number = (_local5.y - _local6.y);
var _local9:Number = ((_local7 * _local7) + (_local8 * _local8));
var _local10:Number = Math.sqrt(_local9);
if ((_local9 / 4) > m_radius2){
m_radius2 = (_local9 / 4);
m_radius = (_local10 / 2);
};
var _local11:Number = Math.sqrt((m_radius2 - (_local9 * 0.25)));
m_arcCenter = new b2Vec2((((_local5.x + _local6.x) / 2) + (_local11 * m_normals[0].x)), (((_local5.y + _local6.y) / 2) + (_local11 * m_normals[0].y)));
m_dot = (_local11 / m_radius);
m_norm = ((_local10 / 2) / m_radius);
m_type = b2Shape.e_concaveArcShape;
}
override public function TestPoint(_arg1:b2Vec2):Boolean{
if (!super.TestPoint(_arg1)){
return (false);
};
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(_arg1);
_local2.Subtract(m_position);
_local2.MulTM(m_R);
_local2.Subtract(m_arcCenter);
return ((((_local2.x * _local2.x) + (_local2.y * _local2.y)) > m_radius2));
}
}
}//package Physics.Box2D.Collision.Shapes
Section 95
//b2MassData (Physics.Box2D.Collision.Shapes.b2MassData)
package Physics.Box2D.Collision.Shapes {
import Physics.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 Physics.Box2D.Collision.Shapes
Section 96
//b2PolyDef (Physics.Box2D.Collision.Shapes.b2PolyDef)
package Physics.Box2D.Collision.Shapes {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Common.*;
public class b2PolyDef extends b2ShapeDef {
public var vertices:Array;
public var vertexCount:int;
public function b2PolyDef(){
vertices = new Array(b2Settings.b2_maxPolyVertices);
super();
type = b2Shape.e_polyShape;
vertexCount = 0;
var _local1:int;
while (_local1 < b2Settings.b2_maxPolyVertices) {
vertices[_local1] = new b2Vec2();
_local1++;
};
}
}
}//package Physics.Box2D.Collision.Shapes
Section 97
//b2PolyShape (Physics.Box2D.Collision.Shapes.b2PolyShape)
package Physics.Box2D.Collision.Shapes {
import flash.display.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Common.*;
public class b2PolyShape extends b2Shape {
public var m_vertexCount:int;
private var syncMat:b2Mat22;
public var m_vertices:Array;
public var m_coreVertices:Array;
public var m_localCentroid:b2Vec2;
public var m_normals:Array;
private var syncAABB:b2AABB;
public var m_localOBB:b2OBB;
private static var tempVec:b2Vec2 = new b2Vec2();
private static var tAbsR:b2Mat22 = new b2Mat22();
public function b2PolyShape(_arg1:b2ShapeDef, _arg2:b2Body, _arg3:b2Vec2){
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:b2Vec2;
var _local8:b2AABB;
var _local14:int;
var _local15:int;
var _local19:b2BoxDef;
var _local20:Number;
var _local21:Number;
var _local22:b2PolyDef;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:b2Vec2;
syncAABB = new b2AABB();
syncMat = new b2Mat22();
m_localCentroid = new b2Vec2();
m_localOBB = new b2OBB();
super(_arg1, _arg2);
_local8 = new b2AABB();
m_vertices = new Array(b2Settings.b2_maxPolyVertices);
m_coreVertices = new Array(b2Settings.b2_maxPolyVertices);
m_normals = new Array(b2Settings.b2_maxPolyVertices);
m_type = b2Shape.e_polyShape;
var _local9:b2Mat22 = new b2Mat22(_arg1.localRotation);
if (_arg1.type == b2Shape.e_boxShape){
m_localCentroid.x = (_arg1.localPosition.x - _arg3.x);
m_localCentroid.y = (_arg1.localPosition.y - _arg3.y);
_local19 = (_arg1 as b2BoxDef);
m_vertexCount = 4;
_local5 = _local19.extents.x;
_local6 = _local19.extents.y;
_local20 = Math.max(0, (_local5 - (2 * b2Settings.b2_linearSlop)));
_local21 = Math.max(0, (_local6 - (2 * b2Settings.b2_linearSlop)));
_local7 = (m_vertices[0] = new b2Vec2());
_local7.x = ((_local9.col1.x * _local5) + (_local9.col2.x * _local6));
_local7.y = ((_local9.col1.y * _local5) + (_local9.col2.y * _local6));
_local7 = (m_vertices[1] = new b2Vec2());
_local7.x = ((_local9.col1.x * -(_local5)) + (_local9.col2.x * _local6));
_local7.y = ((_local9.col1.y * -(_local5)) + (_local9.col2.y * _local6));
_local7 = (m_vertices[2] = new b2Vec2());
_local7.x = ((_local9.col1.x * -(_local5)) + (_local9.col2.x * -(_local6)));
_local7.y = ((_local9.col1.y * -(_local5)) + (_local9.col2.y * -(_local6)));
_local7 = (m_vertices[3] = new b2Vec2());
_local7.x = ((_local9.col1.x * _local5) + (_local9.col2.x * -(_local6)));
_local7.y = ((_local9.col1.y * _local5) + (_local9.col2.y * -(_local6)));
_local7 = (m_coreVertices[0] = new b2Vec2());
_local7.x = ((_local9.col1.x * _local20) + (_local9.col2.x * _local21));
_local7.y = ((_local9.col1.y * _local20) + (_local9.col2.y * _local21));
_local7 = (m_coreVertices[1] = new b2Vec2());
_local7.x = ((_local9.col1.x * -(_local20)) + (_local9.col2.x * _local21));
_local7.y = ((_local9.col1.y * -(_local20)) + (_local9.col2.y * _local21));
_local7 = (m_coreVertices[2] = new b2Vec2());
_local7.x = ((_local9.col1.x * -(_local20)) + (_local9.col2.x * -(_local21)));
_local7.y = ((_local9.col1.y * -(_local20)) + (_local9.col2.y * -(_local21)));
_local7 = (m_coreVertices[3] = new b2Vec2());
_local7.x = ((_local9.col1.x * _local20) + (_local9.col2.x * -(_local21)));
_local7.y = ((_local9.col1.y * _local20) + (_local9.col2.y * -(_local21)));
} else {
m_type = _arg1.type;
_local22 = (_arg1 as b2PolyDef);
m_vertexCount = _local22.vertexCount;
PolyCentroid(_local22.vertices, _local22.vertexCount, tempVec);
_local23 = tempVec.x;
_local24 = tempVec.y;
m_localCentroid.x = ((_arg1.localPosition.x + ((_local9.col1.x * _local23) + (_local9.col2.x * _local24))) - _arg3.x);
m_localCentroid.y = ((_arg1.localPosition.y + ((_local9.col1.y * _local23) + (_local9.col2.y * _local24))) - _arg3.y);
_local4 = 0;
while (_local4 < m_vertexCount) {
m_vertices[_local4] = new b2Vec2();
m_coreVertices[_local4] = new b2Vec2();
_local5 = (_local22.vertices[_local4].x - _local23);
_local6 = (_local22.vertices[_local4].y - _local24);
m_vertices[_local4].x = ((_local9.col1.x * _local5) + (_local9.col2.x * _local6));
m_vertices[_local4].y = ((_local9.col1.y * _local5) + (_local9.col2.y * _local6));
_local25 = m_vertices[_local4].x;
_local26 = m_vertices[_local4].y;
_local27 = Math.sqrt(((_local25 * _local25) + (_local26 * _local26)));
if (_local27 > Number.MIN_VALUE){
_local25 = (_local25 * (1 / _local27));
_local26 = (_local26 * (1 / _local27));
};
m_coreVertices[_local4].x = (m_vertices[_local4].x - ((2 * b2Settings.b2_linearSlop) * _local25));
m_coreVertices[_local4].y = (m_vertices[_local4].y - ((2 * b2Settings.b2_linearSlop) * _local26));
_local4++;
};
};
var _local10:Number = Number.MAX_VALUE;
var _local11:Number = Number.MAX_VALUE;
var _local12:Number = -(Number.MAX_VALUE);
var _local13:Number = -(Number.MAX_VALUE);
m_maxRadius = 0;
_local4 = 0;
while (_local4 < m_vertexCount) {
_local28 = m_vertices[_local4];
_local10 = Math.min(_local10, _local28.x);
_local11 = Math.min(_local11, _local28.y);
_local12 = Math.max(_local12, _local28.x);
_local13 = Math.max(_local13, _local28.y);
m_maxRadius = Math.max(m_maxRadius, _local28.Length());
_local4++;
};
m_localOBB.R.SetIdentity();
m_localOBB.center.Set(((_local10 + _local12) * 0.5), ((_local11 + _local13) * 0.5));
m_localOBB.extents.Set(((_local12 - _local10) * 0.5), ((_local13 - _local11) * 0.5));
_local4 = 0;
while (_local4 < m_vertexCount) {
m_normals[_local4] = new b2Vec2();
_local14 = _local4;
_local15 = (((_local4 + 1) < m_vertexCount)) ? (_local4 + 1) : 0;
m_normals[_local4].x = (m_vertices[_local15].y - m_vertices[_local14].y);
m_normals[_local4].y = -((m_vertices[_local15].x - m_vertices[_local14].x));
m_normals[_local4].Normalize();
_local4++;
};
_local4 = 0;
while (_local4 < m_vertexCount) {
_local14 = _local4;
_local15 = (((_local4 + 1) < m_vertexCount)) ? (_local4 + 1) : 0;
_local4++;
};
m_R.SetM(m_body.m_R);
m_position.x = (m_body.m_position.x + ((m_R.col1.x * m_localCentroid.x) + (m_R.col2.x * m_localCentroid.y)));
m_position.y = (m_body.m_position.y + ((m_R.col1.y * m_localCentroid.x) + (m_R.col2.y * m_localCentroid.y)));
tAbsR.col1.x = ((m_R.col1.x * m_localOBB.R.col1.x) + (m_R.col2.x * m_localOBB.R.col1.y));
tAbsR.col1.y = ((m_R.col1.y * m_localOBB.R.col1.x) + (m_R.col2.y * m_localOBB.R.col1.y));
tAbsR.col2.x = ((m_R.col1.x * m_localOBB.R.col2.x) + (m_R.col2.x * m_localOBB.R.col2.y));
tAbsR.col2.y = ((m_R.col1.y * m_localOBB.R.col2.x) + (m_R.col2.y * m_localOBB.R.col2.y));
tAbsR.Abs();
_local5 = ((tAbsR.col1.x * m_localOBB.extents.x) + (tAbsR.col2.x * m_localOBB.extents.y));
_local6 = ((tAbsR.col1.y * m_localOBB.extents.x) + (tAbsR.col2.y * m_localOBB.extents.y));
var _local16:Number = (m_position.x + ((m_R.col1.x * m_localOBB.center.x) + (m_R.col2.x * m_localOBB.center.y)));
var _local17:Number = (m_position.y + ((m_R.col1.y * m_localOBB.center.x) + (m_R.col2.y * m_localOBB.center.y)));
_local8.minVertex.x = (_local16 - _local5);
_local8.minVertex.y = (_local17 - _local6);
_local8.maxVertex.x = (_local16 + _local5);
_local8.maxVertex.y = (_local17 + _local6);
var _local18:b2BroadPhase = m_body.m_world.m_broadPhase;
if (_local18.InRange(_local8)){
m_proxyId = _local18.CreateProxy(_local8, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
if (m_proxyId == b2Pair.b2_nullProxy){
m_body.Freeze();
};
}
override public function QuickSync(_arg1:b2Vec2, _arg2:b2Mat22):void{
m_R.SetM(_arg2);
m_position.x = (_arg1.x + ((_arg2.col1.x * m_localCentroid.x) + (_arg2.col2.x * m_localCentroid.y)));
m_position.y = (_arg1.y + ((_arg2.col1.y * m_localCentroid.x) + (_arg2.col2.y * m_localCentroid.y)));
}
override public function Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{
var _local9:Number;
var _local4:Number = ((_arg1 * m_R.col1.x) + (_arg2 * m_R.col1.y));
var _local5:Number = ((_arg1 * m_R.col2.x) + (_arg2 * m_R.col2.y));
var _local6:int;
var _local7:Number = ((m_coreVertices[0].x * _local4) + (m_coreVertices[0].y * _local5));
var _local8 = 1;
while (_local8 < m_vertexCount) {
_local9 = ((m_coreVertices[_local8].x * _local4) + (m_coreVertices[_local8].y * _local5));
if (_local9 > _local7){
_local6 = _local8;
_local7 = _local9;
};
_local8++;
};
_arg3.Set((m_position.x + ((m_R.col1.x * m_coreVertices[_local6].x) + (m_R.col2.x * m_coreVertices[_local6].y))), (m_position.y + ((m_R.col1.y * m_coreVertices[_local6].x) + (m_R.col2.y * m_coreVertices[_local6].y))));
}
override public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{
var _local5:Number;
var _local6:Number;
m_R.SetM(_arg4);
m_position.x = (m_body.m_position.x + ((_arg4.col1.x * m_localCentroid.x) + (_arg4.col2.x * m_localCentroid.y)));
m_position.y = (m_body.m_position.y + ((_arg4.col1.y * m_localCentroid.x) + (_arg4.col2.y * m_localCentroid.y)));
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
var _local7:b2Vec2 = _arg2.col1;
var _local8:b2Vec2 = _arg2.col2;
var _local9:b2Vec2 = m_localOBB.R.col1;
var _local10:b2Vec2 = m_localOBB.R.col2;
syncMat.col1.x = ((_local7.x * _local9.x) + (_local8.x * _local9.y));
syncMat.col1.y = ((_local7.y * _local9.x) + (_local8.y * _local9.y));
syncMat.col2.x = ((_local7.x * _local10.x) + (_local8.x * _local10.y));
syncMat.col2.y = ((_local7.y * _local10.x) + (_local8.y * _local10.y));
syncMat.Abs();
_local5 = (m_localCentroid.x + m_localOBB.center.x);
_local6 = (m_localCentroid.y + m_localOBB.center.y);
var _local11:Number = (_arg1.x + ((_arg2.col1.x * _local5) + (_arg2.col2.x * _local6)));
var _local12:Number = (_arg1.y + ((_arg2.col1.y * _local5) + (_arg2.col2.y * _local6)));
_local5 = ((syncMat.col1.x * m_localOBB.extents.x) + (syncMat.col2.x * m_localOBB.extents.y));
_local6 = ((syncMat.col1.y * m_localOBB.extents.x) + (syncMat.col2.y * m_localOBB.extents.y));
syncAABB.minVertex.x = (_local11 - _local5);
syncAABB.minVertex.y = (_local12 - _local6);
syncAABB.maxVertex.x = (_local11 + _local5);
syncAABB.maxVertex.y = (_local12 + _local6);
_local7 = _arg4.col1;
_local8 = _arg4.col2;
_local9 = m_localOBB.R.col1;
_local10 = m_localOBB.R.col2;
syncMat.col1.x = ((_local7.x * _local9.x) + (_local8.x * _local9.y));
syncMat.col1.y = ((_local7.y * _local9.x) + (_local8.y * _local9.y));
syncMat.col2.x = ((_local7.x * _local10.x) + (_local8.x * _local10.y));
syncMat.col2.y = ((_local7.y * _local10.x) + (_local8.y * _local10.y));
syncMat.Abs();
_local5 = (m_localCentroid.x + m_localOBB.center.x);
_local6 = (m_localCentroid.y + m_localOBB.center.y);
_local11 = (_arg3.x + ((_arg4.col1.x * _local5) + (_arg4.col2.x * _local6)));
_local12 = (_arg3.y + ((_arg4.col1.y * _local5) + (_arg4.col2.y * _local6)));
_local5 = ((syncMat.col1.x * m_localOBB.extents.x) + (syncMat.col2.x * m_localOBB.extents.y));
_local6 = ((syncMat.col1.y * m_localOBB.extents.x) + (syncMat.col2.y * m_localOBB.extents.y));
syncAABB.minVertex.x = Math.min(syncAABB.minVertex.x, (_local11 - _local5));
syncAABB.minVertex.y = Math.min(syncAABB.minVertex.y, (_local12 - _local6));
syncAABB.maxVertex.x = Math.max(syncAABB.maxVertex.x, (_local11 + _local5));
syncAABB.maxVertex.y = Math.max(syncAABB.maxVertex.y, (_local12 + _local6));
var _local13:b2BroadPhase = m_body.m_world.m_broadPhase;
if (_local13.InRange(syncAABB)){
_local13.MoveProxy(m_proxyId, syncAABB);
} else {
m_body.Freeze();
};
}
override public function TestPoint(_arg1:b2Vec2):Boolean{
var _local4:b2Vec2;
var _local5:Number;
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(_arg1);
_local2.Subtract(m_position);
_local2.MulTM(m_R);
var _local3:int;
while (_local3 < m_vertexCount) {
_local4 = new b2Vec2();
_local4.SetV(_local2);
_local4.Subtract(m_vertices[_local3]);
_local5 = b2Math.b2Dot(m_normals[_local3], _local4);
if (_local5 > 0){
return (false);
};
_local3++;
};
return (true);
}
override public function ResetProxy(_arg1:b2BroadPhase):void{
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
var _local2:b2Proxy = _arg1.GetProxy(m_proxyId);
_arg1.DestroyProxy(m_proxyId);
_local2 = null;
var _local3:b2Mat22 = b2Math.b2MulMM(m_R, m_localOBB.R);
var _local4:b2Mat22 = b2Math.b2AbsM(_local3);
var _local5:b2Vec2 = b2Math.b2MulMV(_local4, m_localOBB.extents);
var _local6:b2Vec2 = b2Math.b2MulMV(m_R, m_localOBB.center);
_local6.Add(m_position);
var _local7:b2AABB = new b2AABB();
_local7.minVertex.SetV(_local6);
_local7.minVertex.Subtract(_local5);
_local7.maxVertex.SetV(_local6);
_local7.maxVertex.Add(_local5);
if (_arg1.InRange(_local7)){
m_proxyId = _arg1.CreateProxy(_local7, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
if (m_proxyId == b2Pair.b2_nullProxy){
m_body.Freeze();
};
}
}
}//package Physics.Box2D.Collision.Shapes
Section 98
//b2Shape (Physics.Box2D.Collision.Shapes.b2Shape)
package Physics.Box2D.Collision.Shapes {
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Common.*;
public class b2Shape {
public var m_position:b2Vec2;
public var m_maxRadius:Number;
public var m_next:b2Shape;
public var m_type:int;
public var m_R:b2Mat22;
public var m_friction:Number;
public var m_sensor:Boolean;
public var m_proxyId:uint;
public var m_maskBits:uint;
public var m_groupIndex:int;
public var m_userData;// = null
public var m_body:b2Body;
public var m_restitution:Number;
public var m_categoryBits:uint;
public static const e_concaveArcShape:int = 4;
public static const e_boxShape:int = 1;
public static const e_unknownShape:int = -1;
public static const e_shapeTypeCount:int = 5;
public static const e_circleShape:int = 0;
public static const e_meshShape:int = 3;
public static const e_polyShape:int = 2;
public function b2Shape(_arg1:b2ShapeDef, _arg2:b2Body){
m_R = new b2Mat22();
m_position = new b2Vec2();
super();
m_userData = _arg1.userData;
m_friction = _arg1.friction;
m_restitution = _arg1.restitution;
m_sensor = _arg1.sensor;
m_body = _arg2;
m_proxyId = b2Pair.b2_nullProxy;
m_maxRadius = 0;
m_categoryBits = _arg1.categoryBits;
m_maskBits = _arg1.maskBits;
m_groupIndex = _arg1.groupIndex;
}
public function GetMaxRadius():Number{
return (m_maxRadius);
}
public function ResetProxy(_arg1:b2BroadPhase):void{
}
public function QuickSync(_arg1:b2Vec2, _arg2:b2Mat22):void{
}
public function GetNext():b2Shape{
return (m_next);
}
public function GetType():int{
return (m_type);
}
public function GetUserData(){
return (m_userData);
}
public function Support(_arg1:Number, _arg2:Number, _arg3:b2Vec2):void{
}
public function Synchronize(_arg1:b2Vec2, _arg2:b2Mat22, _arg3:b2Vec2, _arg4:b2Mat22):void{
}
public function GetRotationMatrix():b2Mat22{
return (m_R);
}
public function GetBody():b2Body{
return (m_body);
}
public function DestroyProxy():void{
if (m_proxyId != b2Pair.b2_nullProxy){
m_body.m_world.m_broadPhase.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function TestPoint(_arg1:b2Vec2):Boolean{
return (false);
}
public function GetPosition():b2Vec2{
return (m_position);
}
public static function Destroy(_arg1:b2Shape):void{
if (_arg1.m_proxyId != b2Pair.b2_nullProxy){
_arg1.m_body.m_world.m_broadPhase.DestroyProxy(_arg1.m_proxyId);
};
}
public static function PolyMass(_arg1:b2MassData, _arg2:Array, _arg3:int, _arg4:Number):void{
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local14:b2Vec2;
var _local15:b2Vec2;
var _local16:Number;
var _local17:Number;
var _local18:b2Vec2;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local5:b2Vec2 = new b2Vec2();
_local5.SetZero();
var _local6:Number = 0;
var _local7:Number = 0;
var _local8:b2Vec2 = new b2Vec2(0, 0);
var _local9:Number = (1 / 3);
var _local10:int;
while (_local10 < _arg3) {
_local11 = _local8;
_local12 = _arg2[_local10];
_local13 = (((_local10 + 1) < _arg3)) ? _arg2[(_local10 + 1)] : _arg2[0];
_local14 = b2Math.SubtractVV(_local12, _local11);
_local15 = b2Math.SubtractVV(_local13, _local11);
_local16 = b2Math.b2CrossVV(_local14, _local15);
_local17 = (0.5 * _local16);
_local6 = (_local6 + _local17);
_local18 = new b2Vec2();
_local18.SetV(_local11);
_local18.Add(_local12);
_local18.Add(_local13);
_local18.Multiply((_local9 * _local17));
_local5.Add(_local18);
_local19 = _local11.x;
_local20 = _local11.y;
_local21 = _local14.x;
_local22 = _local14.y;
_local23 = _local15.x;
_local24 = _local15.y;
_local25 = ((_local9 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local26 = ((_local9 * ((0.25 * (((_local22 * _local22) + (_local24 * _local22)) + (_local24 * _local24))) + ((_local20 * _local22) + (_local20 * _local24)))) + ((0.5 * _local20) * _local20));
_local7 = (_local7 + (_local16 * (_local25 + _local26)));
_local10++;
};
_arg1.mass = (_arg4 * _local6);
_local5.Multiply((1 / _local6));
_arg1.center = _local5;
_local7 = (_arg4 * (_local7 - (_local6 * b2Math.b2Dot(_local5, _local5))));
_arg1.I = _local7;
}
public static function PolyCentroid(_arg1:Array, _arg2:int, _arg3:b2Vec2):void{
var _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 _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
var _local7:Number = 0;
var _local8:Number = 0;
var _local9:Number = (1 / 3);
var _local10:int;
while (_local10 < _arg2) {
_local11 = _local7;
_local12 = _local8;
_local13 = _arg1[_local10].x;
_local14 = _arg1[_local10].y;
_local15 = (((_local10 + 1) < _arg2)) ? _arg1[(_local10 + 1)].x : _arg1[0].x;
_local16 = (((_local10 + 1) < _arg2)) ? _arg1[(_local10 + 1)].y : _arg1[0].y;
_local17 = (_local13 - _local11);
_local18 = (_local14 - _local12);
_local19 = (_local15 - _local11);
_local20 = (_local16 - _local12);
_local21 = ((_local17 * _local20) - (_local18 * _local19));
_local22 = (0.5 * _local21);
_local6 = (_local6 + _local22);
_local4 = (_local4 + ((_local22 * _local9) * ((_local11 + _local13) + _local15)));
_local5 = (_local5 + ((_local22 * _local9) * ((_local12 + _local14) + _local16)));
_local10++;
};
_local4 = (_local4 * (1 / _local6));
_local5 = (_local5 * (1 / _local6));
_arg3.Set(_local4, _local5);
}
public static function Create(_arg1:b2ShapeDef, _arg2:b2Body, _arg3:b2Vec2):b2Shape{
switch (_arg1.type){
case e_circleShape:
return (new b2CircleShape(_arg1, _arg2, _arg3));
case e_boxShape:
case e_polyShape:
return (new b2PolyShape(_arg1, _arg2, _arg3));
case e_concaveArcShape:
return (new b2ConcaveArcShape(_arg1, _arg2, _arg3));
};
return (null);
}
}
}//package Physics.Box2D.Collision.Shapes
Section 99
//b2ShapeDef (Physics.Box2D.Collision.Shapes.b2ShapeDef)
package Physics.Box2D.Collision.Shapes {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Common.*;
public class b2ShapeDef {
public var type:int;
public var groupIndex:int;
public var localPosition:b2Vec2;
public var categoryBits:int;
public var localRotation:Number;
public var density:Number;
public var restitution:Number;
public var userData;// = null
public var maskBits:int;
public var friction:Number;
public var sensor:Boolean;
public function b2ShapeDef(){
type = b2Shape.e_unknownShape;
userData = null;
localPosition = new b2Vec2(0, 0);
localRotation = 0;
friction = 0.2;
restitution = 0;
density = 0;
categoryBits = 1;
maskBits = 0xFFFF;
groupIndex = 0;
sensor = false;
}
public function ComputeMass(_arg1:b2MassData):void{
var _local2:b2CircleDef;
var _local3:b2BoxDef;
var _local4:b2PolyDef;
_arg1.center = new b2Vec2(0, 0);
if (density == 0){
_arg1.mass = 0;
_arg1.center.Set(0, 0);
_arg1.I = 0;
};
switch (type){
case b2Shape.e_circleShape:
_local2 = (this as b2CircleDef);
_arg1.mass = (((density * b2Settings.b2_pi) * _local2.radius) * _local2.radius);
_arg1.center.Set(0, 0);
_arg1.I = (((0.5 * _arg1.mass) * _local2.radius) * _local2.radius);
break;
case b2Shape.e_boxShape:
_local3 = (this as b2BoxDef);
_arg1.mass = (((4 * density) * _local3.extents.x) * _local3.extents.y);
_arg1.center.Set(0, 0);
_arg1.I = ((_arg1.mass / 3) * b2Math.b2Dot(_local3.extents, _local3.extents));
break;
case b2Shape.e_polyShape:
_local4 = (this as b2PolyDef);
b2Shape.PolyMass(_arg1, _local4.vertices, _local4.vertexCount, density);
break;
default:
_arg1.mass = 0;
_arg1.center.Set(0, 0);
_arg1.I = 0;
break;
};
}
}
}//package Physics.Box2D.Collision.Shapes
Section 100
//b2AABB (Physics.Box2D.Collision.b2AABB)
package Physics.Box2D.Collision {
import Physics.Box2D.Common.Math.*;
public class b2AABB {
public var minVertex:b2Vec2;
public var maxVertex:b2Vec2;
public function b2AABB(){
minVertex = new b2Vec2();
maxVertex = new b2Vec2();
super();
}
public function IsValid():Boolean{
var _local1:Number = maxVertex.x;
var _local2:Number = maxVertex.y;
_local1 = maxVertex.x;
_local2 = maxVertex.y;
_local1 = (_local1 - minVertex.x);
_local2 = (_local2 - minVertex.y);
var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (minVertex.IsValid()))) && (maxVertex.IsValid()));
return (_local3);
}
}
}//package Physics.Box2D.Collision
Section 101
//b2Bound (Physics.Box2D.Collision.b2Bound)
package Physics.Box2D.Collision {
public class b2Bound {
public var value:uint;
public var proxyId:uint;
public var stabbingCount:uint;
public function Swap(_arg1:b2Bound):void{
var _local2:uint = value;
var _local3:uint = proxyId;
var _local4:uint = stabbingCount;
value = _arg1.value;
proxyId = _arg1.proxyId;
stabbingCount = _arg1.stabbingCount;
_arg1.value = _local2;
_arg1.proxyId = _local3;
_arg1.stabbingCount = _local4;
}
public function IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
}
}//package Physics.Box2D.Collision
Section 102
//b2BoundValues (Physics.Box2D.Collision.b2BoundValues)
package Physics.Box2D.Collision {
public class b2BoundValues {
public var lowerValues:Array;
public var upperValues:Array;
public function b2BoundValues(){
lowerValues = [0, 0];
upperValues = [0, 0];
super();
}
}
}//package Physics.Box2D.Collision
Section 103
//b2BroadPhase (Physics.Box2D.Collision.b2BroadPhase)
package Physics.Box2D.Collision {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Common.*;
public class b2BroadPhase {
public var m_bounds:Array;
public var m_quantizationFactor:b2Vec2;
public var m_worldAABB:b2AABB;
public var m_freeProxy:uint;
public var m_proxyCount:int;
public var m_proxyPool:Array;
public var m_queryResultCount:int;
public var m_pairManager:b2PairManager;
public var m_timeStamp:uint;
public var m_queryResults:Array;
public static const b2_nullEdge:uint = 0xFFFF;
public static const b2_invalid:uint = 0xFFFF;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local5:Number;
var _local6:b2Proxy;
var _local7:int;
m_pairManager = new b2PairManager();
m_proxyPool = new Array(b2Settings.b2_maxPairs);
m_bounds = new Array((2 * b2Settings.b2_maxProxies));
m_queryResults = new Array(b2Settings.b2_maxProxies);
m_quantizationFactor = new b2Vec2();
super();
m_pairManager.Initialize(this, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
var _local4:Number = _arg1.maxVertex.x;
_local5 = _arg1.maxVertex.y;
_local4 = (_local4 - _arg1.minVertex.x);
_local5 = (_local5 - _arg1.minVertex.y);
m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4);
m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5);
_local3 = 0;
while (_local3 < (b2Settings.b2_maxProxies - 1)) {
_local6 = new b2Proxy();
m_proxyPool[_local3] = _local6;
_local6.SetNext((_local3 + 1));
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
_local3++;
};
_local6 = new b2Proxy();
m_proxyPool[(b2Settings.b2_maxProxies - 1)] = _local6;
_local6.SetNext(b2Pair.b2_nullProxy);
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
m_freeProxy = 0;
m_timeStamp = 1;
m_queryResultCount = 0;
}
public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _local6:uint;
var _local7:uint;
var _local12:b2Proxy;
var _local4:Array = new Array();
var _local5:Array = new Array();
ComputeBounds(_local4, _local5, _arg1);
var _local8:Array = [_local6];
var _local9:Array = [_local7];
Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0);
Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1);
var _local10:int;
var _local11:int;
while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = m_proxyPool[m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local10);
}
public function Commit():void{
m_pairManager.Commit();
}
public function GetProxy(_arg1:int):b2Proxy{
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((m_proxyPool[_arg1].IsValid() == false)))){
return (null);
};
return (m_proxyPool[_arg1]);
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
m_proxyPool[_local1].timeStamp = 0;
_local1++;
};
m_timeStamp = 1;
} else {
m_timeStamp++;
};
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local11:int;
var _local12:int;
var _local13:b2Proxy;
var _local8:uint = BinarySearch(_arg5, _arg6, _arg3);
var _local9:uint = BinarySearch(_arg5, _arg6, _arg4);
var _local10:uint = _local8;
while (_local10 < _local9) {
if (_arg5[_local10].IsLower()){
IncrementOverlapCount(_arg5[_local10].proxyId);
};
_local10++;
};
if (_local8 > 0){
_local11 = (_local8 - 1);
_local12 = _arg5[_local11].stabbingCount;
while (_local12) {
if (_arg5[_local11].IsLower()){
_local13 = m_proxyPool[_arg5[_local11].proxyId];
if (_local8 <= _local13.upperBounds[_arg7]){
IncrementOverlapCount(_arg5[_local11].proxyId);
_local12--;
};
};
_local11--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
if (_local4[_arg1.lowerBounds[_local3]].value > _local4[_arg2.upperBounds[_local3]].value){
return (false);
};
if (_local4[_arg1.upperBounds[_local3]].value < _local4[_arg2.lowerBounds[_local3]].value){
return (false);
};
_local3++;
};
return (true);
}
private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{
var _local4:Number = _arg3.minVertex.x;
var _local5:Number = _arg3.minVertex.y;
_local4 = b2Math.b2Min(_local4, m_worldAABB.maxVertex.x);
_local5 = b2Math.b2Min(_local5, m_worldAABB.maxVertex.y);
_local4 = b2Math.b2Max(_local4, m_worldAABB.minVertex.x);
_local5 = b2Math.b2Max(_local5, m_worldAABB.minVertex.y);
var _local6:Number = _arg3.maxVertex.x;
var _local7:Number = _arg3.maxVertex.y;
_local6 = b2Math.b2Min(_local6, m_worldAABB.maxVertex.x);
_local7 = b2Math.b2Min(_local7, m_worldAABB.maxVertex.y);
_local6 = b2Math.b2Max(_local6, m_worldAABB.minVertex.x);
_local7 = b2Math.b2Max(_local7, m_worldAABB.minVertex.y);
_arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.minVertex.x))) & (b2Settings.USHRT_MAX - 1));
_arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.minVertex.x))) & 0xFFFF) | 1);
_arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.minVertex.y))) & (b2Settings.USHRT_MAX - 1));
_arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.minVertex.y))) & 0xFFFF) | 1);
}
public function CreateProxy(_arg1:b2AABB, _arg2):uint{
var _local3:uint;
var _local4:b2Proxy;
var _local11:Array;
var _local12:uint;
var _local13:uint;
var _local14:Array;
var _local15:Array;
var _local16:Array;
var _local17:int;
var _local18:int;
var _local19:b2Bound;
var _local20:b2Bound;
var _local21:int;
var _local22:b2Proxy;
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[(_local13 + _local17)];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local21 = (_local13 + 2);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[(_local21 + _local17)];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local16 = new Array();
_local18 = (_local13 - _local12);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[(_local12 + _local17)];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local21 = (_local12 + 1);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[(_local21 + _local17)];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local13++;
_local11[_local12].value = _local7[_local9];
_local11[_local12].proxyId = _local5;
_local11[_local13].value = _local8[_local9];
_local11[_local13].proxyId = _local5;
_local11[_local12].stabbingCount = ((_local12 == 0)) ? 0 : _local11[(_local12 - 1)].stabbingCount;
_local11[_local13].stabbingCount = _local11[(_local13 - 1)].stabbingCount;
_local3 = _local12;
while (_local3 < _local13) {
_local11[_local3].stabbingCount++;
_local3++;
};
_local3 = _local12;
while (_local3 < (_local6 + 2)) {
_local22 = m_proxyPool[_local11[_local3].proxyId];
if (_local11[_local3].IsLower()){
_local22.lowerBounds[_local9] = _local3;
} else {
_local22.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
m_proxyCount++;
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 _local6:Array;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:Array;
var _local12:int;
var _local13:int;
var _local14:b2Bound;
var _local15:b2Bound;
var _local16:int;
var _local17:uint;
var _local18:int;
var _local19:b2Proxy;
var _local2:b2Proxy = m_proxyPool[_arg1];
var _local3:int = (2 * m_proxyCount);
var _local4:int;
while (_local4 < 2) {
_local6 = m_bounds[_local4];
_local7 = _local2.lowerBounds[_local4];
_local8 = _local2.upperBounds[_local4];
_local9 = _local6[_local7].value;
_local10 = _local6[_local8].value;
_local11 = new Array();
_local13 = ((_local8 - _local7) - 1);
_local12 = 0;
while (_local12 < _local13) {
_local11[_local12] = new b2Bound();
_local14 = _local11[_local12];
_local15 = _local6[((_local7 + 1) + _local12)];
_local14.value = _local15.value;
_local14.proxyId = _local15.proxyId;
_local14.stabbingCount = _local15.stabbingCount;
_local12++;
};
_local13 = _local11.length;
_local16 = _local7;
_local12 = 0;
while (_local12 < _local13) {
_local15 = _local11[_local12];
_local14 = _local6[(_local16 + _local12)];
_local14.value = _local15.value;
_local14.proxyId = _local15.proxyId;
_local14.stabbingCount = _local15.stabbingCount;
_local12++;
};
_local11 = new Array();
_local13 = ((_local3 - _local8) - 1);
_local12 = 0;
while (_local12 < _local13) {
_local11[_local12] = new b2Bound();
_local14 = _local11[_local12];
_local15 = _local6[((_local8 + 1) + _local12)];
_local14.value = _local15.value;
_local14.proxyId = _local15.proxyId;
_local14.stabbingCount = _local15.stabbingCount;
_local12++;
};
_local13 = _local11.length;
_local16 = (_local8 - 1);
_local12 = 0;
while (_local12 < _local13) {
_local15 = _local11[_local12];
_local14 = _local6[(_local16 + _local12)];
_local14.value = _local15.value;
_local14.proxyId = _local15.proxyId;
_local14.stabbingCount = _local15.stabbingCount;
_local12++;
};
_local13 = (_local3 - 2);
_local17 = _local7;
while (_local17 < _local13) {
_local19 = m_proxyPool[_local6[_local17].proxyId];
if (_local6[_local17].IsLower()){
_local19.lowerBounds[_local4] = _local17;
} else {
_local19.upperBounds[_local4] = _local17;
};
_local17++;
};
_local13 = (_local8 - 1);
_local18 = _local7;
while (_local18 < _local13) {
_local6[_local18].stabbingCount--;
_local18++;
};
Query([0], [0], _local9, _local10, _local6, (_local3 - 2), _local4);
_local4++;
};
var _local5:int;
while (_local5 < m_queryResultCount) {
m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local5]);
_local5++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
_local2.userData = null;
_local2.overlapCount = b2_invalid;
_local2.lowerBounds[0] = b2_invalid;
_local2.lowerBounds[1] = b2_invalid;
_local2.upperBounds[0] = b2_invalid;
_local2.upperBounds[1] = b2_invalid;
_local2.SetNext(m_freeProxy);
m_freeProxy = _arg1;
m_proxyCount--;
}
public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
if (_arg1.lowerValues[_local3] > _local4[_arg2.upperBounds[_local3]].value){
return (false);
};
if (_arg1.upperValues[_local3] < _local4[_arg2.lowerBounds[_local3]].value){
return (false);
};
_local3++;
};
return (true);
}
public function Validate():void{
var _local1:b2Pair;
var _local2:b2Proxy;
var _local3:b2Proxy;
var _local4:Boolean;
var _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
var _local5:int;
while (_local5 < 2) {
_local6 = m_bounds[_local5];
_local7 = (2 * m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy = m_proxyPool[_arg1];
if (_local2.timeStamp < m_timeStamp){
_local2.timeStamp = m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
m_queryResults[m_queryResultCount] = _arg1;
m_queryResultCount++;
};
}
public function InRange(_arg1:b2AABB):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.minVertex.x;
_local3 = _arg1.minVertex.y;
_local2 = (_local2 - m_worldAABB.maxVertex.x);
_local3 = (_local3 - m_worldAABB.maxVertex.y);
_local4 = m_worldAABB.minVertex.x;
_local5 = m_worldAABB.minVertex.y;
_local4 = (_local4 - _arg1.maxVertex.x);
_local5 = (_local5 - _arg1.maxVertex.y);
_local2 = b2Math.b2Max(_local2, _local4);
_local3 = b2Math.b2Max(_local3, _local5);
return ((b2Math.b2Max(_local2, _local3) < 0));
}
public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{
var _local3:uint;
var _local4:uint;
var _local5:b2Bound;
var _local6:b2Bound;
var _local7:b2Bound;
var _local8:uint;
var _local9:b2Proxy;
var _local14:Array;
var _local15:uint;
var _local16:uint;
var _local17:uint;
var _local18:uint;
var _local19:int;
var _local20:int;
var _local21:uint;
var _local22:b2Proxy;
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){
return;
};
if (_arg2.IsValid() == false){
return;
};
var _local10:uint = (2 * m_proxyCount);
var _local11:b2Proxy = m_proxyPool[_arg1];
var _local12:b2BoundValues = new b2BoundValues();
ComputeBounds(_local12.lowerValues, _local12.upperValues, _arg2);
var _local13:b2BoundValues = new b2BoundValues();
_local3 = 0;
while (_local3 < 2) {
_local13.lowerValues[_local3] = m_bounds[_local3][_local11.lowerBounds[_local3]].value;
_local13.upperValues[_local3] = m_bounds[_local3][_local11.upperBounds[_local3]].value;
_local3++;
};
_local3 = 0;
while (_local3 < 2) {
_local14 = m_bounds[_local3];
_local15 = _local11.lowerBounds[_local3];
_local16 = _local11.upperBounds[_local3];
_local17 = _local12.lowerValues[_local3];
_local18 = _local12.upperValues[_local3];
_local19 = (_local17 - _local14[_local15].value);
_local20 = (_local18 - _local14[_local16].value);
_local14[_local15].value = _local17;
_local14[_local16].value = _local18;
if (_local19 < 0){
_local4 = _local15;
while ((((_local4 > 0)) && ((_local17 < _local14[(_local4 - 1)].value)))) {
_local5 = _local14[_local4];
_local6 = _local14[(_local4 - 1)];
_local21 = _local6.proxyId;
_local22 = m_proxyPool[_local6.proxyId];
_local6.stabbingCount++;
if (_local6.IsUpper() == true){
if (TestOverlap(_local12, _local22)){
m_pairManager.AddBufferedPair(_arg1, _local21);
};
var _local23 = _local22.upperBounds;
var _local24 = _local3;
var _local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.stabbingCount++;
} else {
_local23 = _local22.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.stabbingCount--;
};
_local23 = _local11.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.Swap(_local6);
_local4--;
};
};
if (_local20 > 0){
_local4 = _local16;
while ((((_local4 < (_local10 - 1))) && ((_local14[(_local4 + 1)].value <= _local18)))) {
_local5 = _local14[_local4];
_local7 = _local14[(_local4 + 1)];
_local8 = _local7.proxyId;
_local9 = m_proxyPool[_local8];
_local7.stabbingCount++;
if (_local7.IsLower() == true){
if (TestOverlap(_local12, _local9)){
m_pairManager.AddBufferedPair(_arg1, _local8);
};
_local23 = _local9.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.stabbingCount++;
} else {
_local23 = _local9.upperBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.stabbingCount--;
};
_local23 = _local11.upperBounds;
_local24 = _local3;
_local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.Swap(_local7);
_local4++;
};
};
if (_local19 > 0){
_local4 = _local15;
while ((((_local4 < (_local10 - 1))) && ((_local14[(_local4 + 1)].value <= _local17)))) {
_local5 = _local14[_local4];
_local7 = _local14[(_local4 + 1)];
_local8 = _local7.proxyId;
_local9 = m_proxyPool[_local8];
_local7.stabbingCount--;
if (_local7.IsUpper()){
if (TestOverlap(_local13, _local9)){
m_pairManager.RemoveBufferedPair(_arg1, _local8);
};
_local23 = _local9.upperBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.stabbingCount--;
} else {
_local23 = _local9.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.stabbingCount++;
};
_local23 = _local11.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.Swap(_local7);
_local4++;
};
};
if (_local20 < 0){
_local4 = _local16;
while ((((_local4 > 0)) && ((_local18 < _local14[(_local4 - 1)].value)))) {
_local5 = _local14[_local4];
_local6 = _local14[(_local4 - 1)];
_local21 = _local6.proxyId;
_local22 = m_proxyPool[_local21];
_local6.stabbingCount--;
if (_local6.IsLower() == true){
if (TestOverlap(_local13, _local22)){
m_pairManager.RemoveBufferedPair(_arg1, _local21);
};
_local23 = _local22.lowerBounds;
_local24 = _local3;
_local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.stabbingCount--;
} else {
_local23 = _local22.upperBounds;
_local24 = _local3;
_local25 = (_local23[_local24] + 1);
_local23[_local24] = _local25;
_local5.stabbingCount++;
};
_local23 = _local11.upperBounds;
_local24 = _local3;
_local25 = (_local23[_local24] - 1);
_local23[_local24] = _local25;
_local5.Swap(_local6);
_local4--;
};
};
_local3++;
};
}
public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local6:int;
var _local4:int;
var _local5:int = (_arg2 - 1);
while (_local4 <= _local5) {
_local6 = ((_local4 + _local5) / 2);
if (_arg1[_local6].value > _arg3){
_local5 = (_local6 - 1);
} else {
if (_arg1[_local6].value < _arg3){
_local4 = (_local6 + 1);
} else {
return (uint(_local6));
};
};
};
return (uint(_local4));
}
}
}//package Physics.Box2D.Collision
Section 104
//b2BufferedPair (Physics.Box2D.Collision.b2BufferedPair)
package Physics.Box2D.Collision {
public class b2BufferedPair {
public var proxyId1:uint;
public var proxyId2:uint;
}
}//package Physics.Box2D.Collision
Section 105
//b2Collision (Physics.Box2D.Collision.b2Collision)
package Physics.Box2D.Collision {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.Box2D.Common.*;
public class b2Collision {
public static const b2_nullFeature:uint = 0xFF;
private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2();
public static function EdgeSeparation(_arg1:b2PolyShape, _arg2:int, _arg3:b2PolyShape):Number{
var _local21:b2Vec2;
var _local22:Number;
var _local4:Array = _arg1.m_vertices;
var _local5:int = _arg3.m_vertexCount;
var _local6:Array = _arg3.m_vertices;
var _local7:Number = _arg1.m_normals[_arg2].x;
var _local8:Number = _arg1.m_normals[_arg2].y;
var _local9:Number = _local7;
var _local10:b2Mat22 = _arg1.m_R;
_local7 = ((_local10.col1.x * _local9) + (_local10.col2.x * _local8));
_local8 = ((_local10.col1.y * _local9) + (_local10.col2.y * _local8));
var _local11:Number = _local7;
var _local12:Number = _local8;
_local10 = _arg3.m_R;
_local9 = ((_local11 * _local10.col1.x) + (_local12 * _local10.col1.y));
_local12 = ((_local11 * _local10.col2.x) + (_local12 * _local10.col2.y));
_local11 = _local9;
var _local13:int;
var _local14:Number = Number.MAX_VALUE;
var _local15:int;
while (_local15 < _local5) {
_local21 = _local6[_local15];
_local22 = ((_local21.x * _local11) + (_local21.y * _local12));
if (_local22 < _local14){
_local14 = _local22;
_local13 = _local15;
};
_local15++;
};
_local10 = _arg1.m_R;
var _local16:Number = (_arg1.m_position.x + ((_local10.col1.x * _local4[_arg2].x) + (_local10.col2.x * _local4[_arg2].y)));
var _local17:Number = (_arg1.m_position.y + ((_local10.col1.y * _local4[_arg2].x) + (_local10.col2.y * _local4[_arg2].y)));
_local10 = _arg3.m_R;
var _local18:Number = (_arg3.m_position.x + ((_local10.col1.x * _local6[_local13].x) + (_local10.col2.x * _local6[_local13].y)));
var _local19:Number = (_arg3.m_position.y + ((_local10.col1.y * _local6[_local13].x) + (_local10.col2.y * _local6[_local13].y)));
_local18 = (_local18 - _local16);
_local19 = (_local19 - _local17);
var _local20:Number = ((_local18 * _local7) + (_local19 * _local8));
return (_local20);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2 = _arg2.minVertex;
var _local4:b2Vec2 = _arg1.maxVertex;
var _local5:Number = (_local3.x - _local4.x);
var _local6:Number = (_local3.y - _local4.y);
_local3 = _arg1.minVertex;
_local4 = _arg2.maxVertex;
var _local7:Number = (_local3.x - _local4.x);
var _local8:Number = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolyShape, _arg3:int, _arg4:b2PolyShape):void{
var _local22:int;
var _local23:int;
var _local26:ClipVertex;
var _local27:int;
var _local28:int;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local5:int = _arg2.m_vertexCount;
var _local6:Array = _arg2.m_vertices;
var _local7:int = _arg4.m_vertexCount;
var _local8:Array = _arg4.m_vertices;
var _local9:Function = b2Math.b2Sqrt;
var _local10:int = _arg3;
var _local11:int = (((_arg3 + 1) == _local5)) ? 0 : (_arg3 + 1);
var _local12:b2Vec2 = _local6[_local11];
var _local13:Number = _local12.x;
var _local14:Number = _local12.y;
_local12 = _local6[_local10];
_local13 = (_local13 - _local12.x);
_local14 = (_local14 - _local12.y);
var _local15:Number = _local13;
_local13 = _local14;
_local14 = -(_local15);
var _local16:Number = (1 / _local9(((_local13 * _local13) + (_local14 * _local14))));
_local13 = (_local13 * _local16);
_local14 = (_local14 * _local16);
var _local17:Number = _local13;
var _local18:Number = _local14;
_local15 = _local17;
var _local19:b2Mat22 = _arg2.m_R;
_local17 = ((_local19.col1.x * _local15) + (_local19.col2.x * _local18));
_local18 = ((_local19.col1.y * _local15) + (_local19.col2.y * _local18));
var _local20:Number = _local17;
var _local21:Number = _local18;
_local19 = _arg4.m_R;
_local15 = ((_local20 * _local19.col1.x) + (_local21 * _local19.col1.y));
_local21 = ((_local20 * _local19.col2.x) + (_local21 * _local19.col2.y));
_local20 = _local15;
var _local24:Number = Number.MAX_VALUE;
var _local25:int;
while (_local25 < _local7) {
_local27 = _local25;
_local28 = (((_local25 + 1) < _local7)) ? (_local25 + 1) : 0;
_local12 = _local8[_local28];
_local29 = _local12.x;
_local30 = _local12.y;
_local12 = _local8[_local27];
_local29 = (_local29 - _local12.x);
_local30 = (_local30 - _local12.y);
_local15 = _local29;
_local29 = _local30;
_local30 = -(_local15);
_local16 = (1 / _local9(((_local29 * _local29) + (_local30 * _local30))));
_local29 = (_local29 * _local16);
_local30 = (_local30 * _local16);
_local31 = ((_local29 * _local20) + (_local30 * _local21));
if (_local31 < _local24){
_local24 = _local31;
_local22 = _local27;
_local23 = _local28;
};
_local25++;
};
_local26 = _arg1[0];
_local12 = _local26.v;
_local12.SetV(_local8[_local22]);
_local12.MulM(_arg4.m_R);
_local12.Add(_arg4.m_position);
_local26.id.features.referenceFace = _arg3;
_local26.id.features.incidentEdge = _local22;
_local26.id.features.incidentVertex = _local22;
_local26 = _arg1[1];
_local12 = _local26.v;
_local12.SetV(_local8[_local23]);
_local12.MulM(_arg4.m_R);
_local12.Add(_arg4.m_position);
_local26.id.features.referenceFace = _arg3;
_local26.id.features.incidentEdge = _local22;
_local26.id.features.incidentVertex = _local23;
}
public static function b2CollidePolyAndCircle(_arg1:b2Manifold, _arg2:b2PolyShape, _arg3:b2CircleShape, _arg4:Boolean):void{
var _local5:b2ContactPoint;
var _local6:Number;
var _local7:Number;
var _local12:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:b2Vec2;
_arg1.pointCount = 0;
var _local8:Number = (_arg3.m_position.x - _arg2.m_position.x);
var _local9:Number = (_arg3.m_position.y - _arg2.m_position.y);
var _local10:b2Mat22 = _arg2.m_R;
var _local11:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local9 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local8 = _local11;
var _local13:int;
var _local14:Number = -(Number.MAX_VALUE);
var _local15:Number = _arg3.m_radius;
var _local16:int;
while (_local16 < _arg2.m_vertexCount) {
_local26 = ((_arg2.m_normals[_local16].x * (_local8 - _arg2.m_vertices[_local16].x)) + (_arg2.m_normals[_local16].y * (_local9 - _arg2.m_vertices[_local16].y)));
if (_local26 > _local15){
return;
};
if (_local26 > _local14){
_local14 = _local26;
_local13 = _local16;
};
_local16++;
};
if (_local14 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local27 = _arg2.m_normals[_local13];
_arg1.normal.x = ((_local10.col1.x * _local27.x) + (_local10.col2.x * _local27.y));
_arg1.normal.y = ((_local10.col1.y * _local27.x) + (_local10.col2.y * _local27.y));
_local5 = _arg1.points[0];
_local5.id.features.incidentEdge = _local13;
_local5.id.features.incidentVertex = b2_nullFeature;
_local5.id.features.referenceFace = b2_nullFeature;
_local5.id.features.flip = 0;
_local5.position.x = (_arg3.m_position.x - (_local15 * _arg1.normal.x));
_local5.position.y = (_arg3.m_position.y - (_local15 * _arg1.normal.y));
_local5.separation = (_local14 - _local15);
return;
};
var _local17:Function = b2Math.b2Sqrt;
var _local18:int = _local13;
var _local19:int = (((_local18 + 1) < _arg2.m_vertexCount)) ? (_local18 + 1) : 0;
var _local20:Number = (_arg2.m_vertices[_local19].x - _arg2.m_vertices[_local18].x);
var _local21:Number = (_arg2.m_vertices[_local19].y - _arg2.m_vertices[_local18].y);
var _local22:Number = _local17(((_local20 * _local20) + (_local21 * _local21)));
_local20 = (_local20 / _local22);
_local21 = (_local21 / _local22);
if (_local22 < Number.MIN_VALUE){
_local6 = (_local8 - _arg2.m_vertices[_local18].x);
_local7 = (_local9 - _arg2.m_vertices[_local18].y);
_local12 = _local17(((_local6 * _local6) + (_local7 * _local7)));
_local6 = (_local6 / _local12);
_local7 = (_local7 / _local12);
if (_local12 > _local15){
return;
};
_arg1.pointCount = 1;
_arg1.normal.Set(((_local10.col1.x * _local6) + (_local10.col2.x * _local7)), ((_local10.col1.y * _local6) + (_local10.col2.y * _local7)));
_local5 = _arg1.points[0];
_local5.id.features.incidentEdge = b2_nullFeature;
_local5.id.features.incidentVertex = _local18;
_local5.id.features.referenceFace = b2_nullFeature;
_local5.id.features.flip = 0;
_local5.position.x = (_arg3.m_position.x - (_local15 * _arg1.normal.x));
_local5.position.y = (_arg3.m_position.y - (_local15 * _arg1.normal.y));
_local5.separation = (_local12 - _local15);
return;
};
var _local23:Number = (((_local8 - _arg2.m_vertices[_local18].x) * _local20) + ((_local9 - _arg2.m_vertices[_local18].y) * _local21));
_local5 = _arg1.points[0];
_local5.id.features.incidentEdge = b2_nullFeature;
_local5.id.features.incidentVertex = b2_nullFeature;
_local5.id.features.referenceFace = b2_nullFeature;
_local5.id.features.flip = 0;
if (_local23 <= 0){
_local24 = _arg2.m_vertices[_local18].x;
_local25 = _arg2.m_vertices[_local18].y;
_local5.id.features.incidentVertex = _local18;
} else {
if (_local23 >= _local22){
_local24 = _arg2.m_vertices[_local19].x;
_local25 = _arg2.m_vertices[_local19].y;
_local5.id.features.incidentVertex = _local19;
} else {
_local24 = ((_local20 * _local23) + _arg2.m_vertices[_local18].x);
_local25 = ((_local21 * _local23) + _arg2.m_vertices[_local18].y);
_local5.id.features.incidentEdge = _local18;
};
};
_local6 = (_local8 - _local24);
_local7 = (_local9 - _local25);
_local12 = _local17(((_local6 * _local6) + (_local7 * _local7)));
_local6 = (_local6 / _local12);
_local7 = (_local7 / _local12);
if (_local12 > _local15){
return;
};
_arg1.pointCount = 1;
_arg1.normal.Set(((_local10.col1.x * _local6) + (_local10.col2.x * _local7)), ((_local10.col1.y * _local6) + (_local10.col2.y * _local7)));
_local5.position.x = (_arg3.m_position.x - (_local15 * _arg1.normal.x));
_local5.position.y = (_arg3.m_position.y - (_local15 * _arg1.normal.y));
_local5.separation = (_local12 - _local15);
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolyShape, _arg3:b2PolyShape, _arg4:Boolean):Number{
var _local18:int;
var _local19:Number;
var _local20:int;
var _local21:Number;
var _local5:int = _arg2.m_vertexCount;
var _local6:Number = (_arg3.m_position.x - _arg2.m_position.x);
var _local7:Number = (_arg3.m_position.y - _arg2.m_position.y);
var _local8:Number = ((_local6 * _arg2.m_R.col1.x) + (_local7 * _arg2.m_R.col1.y));
var _local9:Number = ((_local6 * _arg2.m_R.col2.x) + (_local7 * _arg2.m_R.col2.y));
var _local10:int;
var _local11:Number = -(Number.MAX_VALUE);
var _local12:int;
while (_local12 < _local5) {
_local21 = ((_arg2.m_normals[_local12].x * _local8) + (_arg2.m_normals[_local12].y * _local9));
if (_local21 > _local11){
_local11 = _local21;
_local10 = _local12;
};
_local12++;
};
var _local13:Number = EdgeSeparation(_arg2, _local10, _arg3);
if ((((_local13 > 0)) && ((_arg4 == false)))){
return (_local13);
};
var _local14:int = (((_local10 - 1) >= 0)) ? (_local10 - 1) : (_local5 - 1);
var _local15:Number = EdgeSeparation(_arg2, _local14, _arg3);
if ((((_local15 > 0)) && ((_arg4 == false)))){
return (_local15);
};
var _local16:int = (((_local10 + 1) < _local5)) ? (_local10 + 1) : 0;
var _local17:Number = EdgeSeparation(_arg2, _local16, _arg3);
if ((((_local17 > 0)) && ((_arg4 == false)))){
return (_local17);
};
if ((((_local15 > _local13)) && ((_local15 > _local17)))){
_local20 = -1;
_local18 = _local14;
_local19 = _local15;
} else {
if (_local17 > _local13){
_local20 = 1;
_local18 = _local16;
_local19 = _local17;
} else {
_arg1[0] = _local10;
return (_local13);
};
};
while (true) {
if (_local20 == -1){
_local10 = (((_local18 - 1) >= 0)) ? (_local18 - 1) : (_local5 - 1);
} else {
_local10 = (((_local18 + 1) < _local5)) ? (_local18 + 1) : 0;
};
_local13 = EdgeSeparation(_arg2, _local10, _arg3);
if ((((_local13 > 0)) && ((_arg4 == false)))){
return (_local13);
};
if (_local13 > _local19){
_local18 = _local10;
_local19 = _local13;
} else {
break;
};
};
_arg1[0] = _local18;
return (_local19);
}
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local6:b2Vec2;
var _local8:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local5:int;
_local6 = _arg2[0].v;
var _local7:b2Vec2 = _arg2[1].v;
_local8 = (b2Math.b2Dot(_arg3, _arg2[0].v) - _arg4);
var _local9:Number = (b2Math.b2Dot(_arg3, _arg2[1].v) - _arg4);
if (_local8 <= 0){
var _temp1 = _local5;
_local5 = (_local5 + 1);
var _local12 = _temp1;
_arg1[_local12] = _arg2[0];
};
if (_local9 <= 0){
var _temp2 = _local5;
_local5 = (_local5 + 1);
_local12 = _temp2;
_arg1[_local12] = _arg2[1];
};
if ((_local8 * _local9) < 0){
_local10 = (_local8 / (_local8 - _local9));
_local11 = _arg1[_local5].v;
_local11.x = (_local6.x + (_local10 * (_local7.x - _local6.x)));
_local11.y = (_local6.y + (_local10 * (_local7.y - _local6.y)));
if (_local8 > 0){
_arg1[_local5].id = _arg2[0].id;
} else {
_arg1[_local5].id = _arg2[1].id;
};
_local5++;
};
return (_local5);
}
public static function b2CollidePoly(_arg1:b2Manifold, _arg2:b2PolyShape, _arg3:b2PolyShape, _arg4:Boolean):void{
var _local11:b2PolyShape;
var _local12:b2PolyShape;
var _local13:int;
var _local14:int;
var _local40:int;
var _local43:b2Vec2;
var _local44:Number;
var _local45:b2ContactPoint;
_arg1.pointCount = 0;
var _local5:int;
var _local6:Array = [_local5];
var _local7:Number = FindMaxSeparation(_local6, _arg2, _arg3, _arg4);
_local5 = _local6[0];
if ((((_local7 > 0)) && ((_arg4 == false)))){
return;
};
var _local8:int;
var _local9:Array = [_local8];
var _local10:Number = FindMaxSeparation(_local9, _arg3, _arg2, _arg4);
_local8 = _local9[0];
if ((((_local10 > 0)) && ((_arg4 == false)))){
return;
};
var _local15:Number = 0.98;
var _local16:Number = 0.001;
if (_local10 > ((_local15 * _local7) + _local16)){
_local11 = _arg3;
_local12 = _arg2;
_local13 = _local8;
_local14 = 1;
} else {
_local11 = _arg2;
_local12 = _arg3;
_local13 = _local5;
_local14 = 0;
};
var _local17:Array = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local17, _local11, _local13, _local12);
var _local18:int = _local11.m_vertexCount;
var _local19:Array = _local11.m_vertices;
var _local20:b2Vec2 = _local19[_local13];
var _local21:b2Vec2 = (((_local13 + 1) < _local18)) ? _local19[(_local13 + 1)] : _local19[0];
var _local22:Number = (_local21.x - _local20.x);
var _local23:Number = (_local21.y - _local20.y);
var _local24:Number = (_local21.x - _local20.x);
var _local25:Number = (_local21.y - _local20.y);
var _local26:Number = _local24;
var _local27:b2Mat22 = _local11.m_R;
_local24 = ((_local27.col1.x * _local26) + (_local27.col2.x * _local25));
_local25 = ((_local27.col1.y * _local26) + (_local27.col2.y * _local25));
var _local28:Number = (1 / Math.sqrt(((_local24 * _local24) + (_local25 * _local25))));
_local24 = (_local24 * _local28);
_local25 = (_local25 * _local28);
var _local29:Number = _local24;
var _local30:Number = _local25;
_local26 = _local29;
_local29 = _local30;
_local30 = -(_local26);
var _local31:Number = _local20.x;
var _local32:Number = _local20.y;
_local26 = _local31;
_local27 = _local11.m_R;
_local31 = ((_local27.col1.x * _local26) + (_local27.col2.x * _local32));
_local32 = ((_local27.col1.y * _local26) + (_local27.col2.y * _local32));
_local31 = (_local31 + _local11.m_position.x);
_local32 = (_local32 + _local11.m_position.y);
var _local33:Number = _local21.x;
var _local34:Number = _local21.y;
_local26 = _local33;
_local27 = _local11.m_R;
_local33 = ((_local27.col1.x * _local26) + (_local27.col2.x * _local34));
_local34 = ((_local27.col1.y * _local26) + (_local27.col2.y * _local34));
_local33 = (_local33 + _local11.m_position.x);
_local34 = (_local34 + _local11.m_position.y);
var _local35:Number = ((_local29 * _local31) + (_local30 * _local32));
var _local36:Number = -(((_local24 * _local31) + (_local25 * _local32)));
var _local37:Number = ((_local24 * _local33) + (_local25 * _local34));
var _local38:Array = [new ClipVertex(), new ClipVertex()];
var _local39:Array = [new ClipVertex(), new ClipVertex()];
b2CollidePolyTempVec.Set(-(_local24), -(_local25));
_local40 = ClipSegmentToLine(_local38, _local17, b2CollidePolyTempVec, _local36);
if (_local40 < 2){
return;
};
b2CollidePolyTempVec.Set(_local24, _local25);
_local40 = ClipSegmentToLine(_local39, _local38, b2CollidePolyTempVec, _local37);
if (_local40 < 2){
return;
};
if (_local14){
_arg1.normal.Set(-(_local29), -(_local30));
} else {
_arg1.normal.Set(_local29, _local30);
};
var _local41:int;
var _local42:int;
while (_local42 < b2Settings.b2_maxManifoldPoints) {
_local43 = _local39[_local42].v;
_local44 = (((_local29 * _local43.x) + (_local30 * _local43.y)) - _local35);
if ((((_local44 <= 0)) || ((_arg4 == true)))){
_local45 = _arg1.points[_local41];
_local45.separation = _local44;
_local45.position.SetV(_local39[_local42].v);
_local45.id.Set(_local39[_local42].id);
_local45.id.features.flip = _local14;
_local41++;
};
_local42++;
};
_arg1.pointCount = _local41;
}
public static function b2CollideCircle(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2CircleShape, _arg4:Boolean):void{
var _local9:Number;
var _local11:Number;
var _local12:Number;
_arg1.pointCount = 0;
var _local5:Number = (_arg3.m_position.x - _arg2.m_position.x);
var _local6:Number = (_arg3.m_position.y - _arg2.m_position.y);
var _local7:Number = ((_local5 * _local5) + (_local6 * _local6));
var _local8:Number = (_arg2.m_radius + _arg3.m_radius);
if ((((_local7 > (_local8 * _local8))) && ((_arg4 == false)))){
return;
};
if (_local7 < Number.MIN_VALUE){
_local9 = -(_local8);
_arg1.normal.Set(0, 1);
} else {
_local11 = b2Math.b2Sqrt(_local7);
_local9 = (_local11 - _local8);
_local12 = (1 / _local11);
_arg1.normal.x = (_local12 * _local5);
_arg1.normal.y = (_local12 * _local6);
};
_arg1.pointCount = 1;
var _local10:b2ContactPoint = _arg1.points[0];
_local10.id.key = 0;
_local10.separation = _local9;
_local10.position.x = (_arg3.m_position.x - (_arg3.m_radius * _arg1.normal.x));
_local10.position.y = (_arg3.m_position.y - (_arg3.m_radius * _arg1.normal.y));
}
}
}//package Physics.Box2D.Collision
Section 106
//b2ContactID (Physics.Box2D.Collision.b2ContactID)
package Physics.Box2D.Collision {
public class b2ContactID {
public var _key:uint;
public var features:Features;
public function b2ContactID(){
features = new Features();
super();
features._m_id = this;
}
public function Set(_arg1:b2ContactID):void{
key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function set key(_arg1:uint):void{
_key = _arg1;
features._referenceFace = (_key & 0xFF);
features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF);
features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF);
features._flip = (((_key & 4278190080) >> 24) & 0xFF);
}
public function get key():uint{
return (_key);
}
}
}//package Physics.Box2D.Collision
Section 107
//b2ContactPoint (Physics.Box2D.Collision.b2ContactPoint)
package Physics.Box2D.Collision {
import Physics.Box2D.Common.Math.*;
public class b2ContactPoint {
public var separation:Number;
public var position:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactPoint(){
position = new b2Vec2();
id = new b2ContactID();
super();
}
public function Copy():b2ContactPoint{
var _local1:b2ContactPoint = new b2ContactPoint();
_local1.position.SetV(position);
_local1.separation = separation;
_local1.normalImpulse = normalImpulse;
_local1.tangentImpulse = tangentImpulse;
_local1.id = id.Copy();
return (_local1);
}
}
}//package Physics.Box2D.Collision
Section 108
//b2Manifold (Physics.Box2D.Collision.b2Manifold)
package Physics.Box2D.Collision {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Common.*;
public class b2Manifold {
public var points:Array;
public var normal:b2Vec2;
public var pointCount:int;
public function b2Manifold(){
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactPoint();
_local1++;
};
normal = new b2Vec2();
}
}
}//package Physics.Box2D.Collision
Section 109
//b2OBB (Physics.Box2D.Collision.b2OBB)
package Physics.Box2D.Collision {
import Physics.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 Physics.Box2D.Collision
Section 110
//b2Pair (Physics.Box2D.Collision.b2Pair)
package Physics.Box2D.Collision {
import Physics.Box2D.Common.*;
public class b2Pair {
public var proxyId1:uint;
public var userData;// = null
public var proxyId2:uint;
public var status:uint;
public var next:uint;
public static var e_pairFinal:uint = 4;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairRemoved:uint = 2;
public static var b2_nullPair:uint = b2Settings.USHRT_MAX;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = b2Settings.USHRT_MAX;
public static var b2_tableCapacity:int = b2Settings.b2_maxPairs;
public function SetBuffered():void{
status = (status | e_pairBuffered);
}
public function IsBuffered():Boolean{
return (((status & e_pairBuffered) == e_pairBuffered));
}
public function IsFinal():Boolean{
return (((status & e_pairFinal) == e_pairFinal));
}
public function ClearRemoved():void{
status = (status & ~(e_pairRemoved));
}
public function SetFinal():void{
status = (status | e_pairFinal);
}
public function IsRemoved():Boolean{
return (((status & e_pairRemoved) == e_pairRemoved));
}
public function ClearBuffered():void{
status = (status & ~(e_pairBuffered));
}
public function SetRemoved():void{
status = (status | e_pairRemoved);
}
}
}//package Physics.Box2D.Collision
Section 111
//b2PairCallback (Physics.Box2D.Collision.b2PairCallback)
package Physics.Box2D.Collision {
public class b2PairCallback {
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
public function PairAdded(_arg1, _arg2){
return (null);
}
}
}//package Physics.Box2D.Collision
Section 112
//b2PairManager (Physics.Box2D.Collision.b2PairManager)
package Physics.Box2D.Collision {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Common.*;
public class b2PairManager {
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_hashTable:Array;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_pairBufferCount:int;
public var m_broadPhase:b2BroadPhase;
public var m_freePair:uint;
public function b2PairManager(){
var _local1:uint;
super();
m_hashTable = new Array(b2Pair.b2_tableCapacity);
_local1 = 0;
while (_local1 < b2Pair.b2_tableCapacity) {
m_hashTable[_local1] = b2Pair.b2_nullPair;
_local1++;
};
m_pairs = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1] = new b2Pair();
_local1++;
};
m_pairBuffer = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairBuffer[_local1] = new b2BufferedPair();
_local1++;
};
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy;
m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy;
m_pairs[_local1].userData = null;
m_pairs[_local1].status = 0;
m_pairs[_local1].next = (_local1 + 1);
_local1++;
};
m_pairs[(b2Settings.b2_maxPairs - 1)].next = b2Pair.b2_nullPair;
m_pairCount = 0;
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:uint = m_hashTable[_arg3];
while (((!((_local4 == b2Pair.b2_nullPair))) && ((Equals(m_pairs[_local4], _arg1, _arg2) == false)))) {
_local4 = m_pairs[_local4].next;
};
if (_local4 == b2Pair.b2_nullPair){
return (null);
};
return (m_pairs[_local4]);
}
private function Find(_arg1:uint, _arg2:uint):b2Pair{
var _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
return (FindHash(_arg1, _arg2, _local3));
}
private function ValidateBuffer():void{
}
public function Commit():void{
var _local1:int;
var _local4:b2Pair;
var _local5:b2Proxy;
var _local6:b2Proxy;
var _local2:int;
var _local3:Array = m_broadPhase.m_proxyPool;
_local1 = 0;
while (_local1 < m_pairBufferCount) {
_local4 = Find(m_pairBuffer[_local1].proxyId1, m_pairBuffer[_local1].proxyId2);
_local4.ClearBuffered();
_local5 = _local3[_local4.proxyId1];
_local6 = _local3[_local4.proxyId2];
if (_local4.IsRemoved()){
if (_local4.IsFinal() == true){
m_callback.PairRemoved(_local5.userData, _local6.userData, _local4.userData);
};
m_pairBuffer[_local2].proxyId1 = _local4.proxyId1;
m_pairBuffer[_local2].proxyId2 = _local4.proxyId2;
_local2++;
} else {
if (_local4.IsFinal() == false){
_local4.userData = m_callback.PairAdded(_local5.userData, _local6.userData);
_local4.SetFinal();
};
};
_local1++;
};
_local1 = 0;
while (_local1 < _local2) {
RemovePair(m_pairBuffer[_local1].proxyId1, m_pairBuffer[_local1].proxyId2);
_local1++;
};
m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
ValidateTable();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2Pair = Find(_arg1, _arg2);
if (_local3 == null){
return;
};
if (_local3.IsBuffered() == false){
_local3.SetBuffered();
m_pairBuffer[m_pairBufferCount].proxyId1 = _local3.proxyId1;
m_pairBuffer[m_pairBufferCount].proxyId2 = _local3.proxyId2;
m_pairBufferCount++;
};
_local3.SetRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local6:uint;
var _local7:uint;
var _local8:b2Pair;
var _local9:*;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local4:uint = m_hashTable[_local3];
var _local5:b2Pair;
while (_local4 != b2Pair.b2_nullPair) {
if (Equals(m_pairs[_local4], _arg1, _arg2)){
_local7 = _local4;
if (_local5){
_local5.next = m_pairs[_local4].next;
} else {
m_hashTable[_local3] = m_pairs[_local4].next;
};
_local8 = m_pairs[_local7];
_local9 = _local8.userData;
_local8.next = m_freePair;
_local8.proxyId1 = b2Pair.b2_nullProxy;
_local8.proxyId2 = b2Pair.b2_nullProxy;
_local8.userData = null;
_local8.status = 0;
m_freePair = _local7;
m_pairCount--;
return (_local9);
} else {
_local5 = m_pairs[_local4];
_local4 = _local5.next;
};
};
return (null);
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
m_broadPhase = _arg1;
m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2Pair = AddPair(_arg1, _arg2);
if (_local3.IsBuffered() == false){
_local3.SetBuffered();
m_pairBuffer[m_pairBufferCount].proxyId1 = _local3.proxyId1;
m_pairBuffer[m_pairBufferCount].proxyId2 = _local3.proxyId2;
m_pairBufferCount++;
};
_local3.ClearRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function AddPair(_arg1:uint, _arg2:uint):b2Pair{
var _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
var _local5:uint = m_freePair;
_local4 = m_pairs[_local5];
m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = m_hashTable[_local3];
m_hashTable[_local3] = _local5;
m_pairCount++;
return (_local4);
}
private function ValidateTable():void{
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
public static function Hash(_arg1:uint, _arg2:uint):uint{
var _local3:uint = (((_arg2 << 16) & 4294901760) | _arg1);
_local3 = (~(_local3) + ((_local3 << 15) & 4294934528));
_local3 = (_local3 ^ ((_local3 >> 12) & 1048575));
_local3 = (_local3 + ((_local3 << 2) & 4294967292));
_local3 = (_local3 ^ ((_local3 >> 4) & 268435455));
_local3 = (_local3 * 2057);
_local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF));
return (_local3);
}
public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{
return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3))));
}
}
}//package Physics.Box2D.Collision
Section 113
//b2Proxy (Physics.Box2D.Collision.b2Proxy)
package Physics.Box2D.Collision {
public class b2Proxy {
public var overlapCount:uint;
public var userData;// = null
public var lowerBounds:Array;
public var upperBounds:Array;
public var timeStamp:uint;
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
super();
}
public function GetNext():uint{
return (lowerBounds[0]);
}
public function IsValid():Boolean{
return (!((overlapCount == b2BroadPhase.b2_invalid)));
}
public function SetNext(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
}
}//package Physics.Box2D.Collision
Section 114
//ClipVertex (Physics.Box2D.Collision.ClipVertex)
package Physics.Box2D.Collision {
import Physics.Box2D.Common.Math.*;
public class ClipVertex {
public var id:b2ContactID;
public var v:b2Vec2;
public function ClipVertex(){
v = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Physics.Box2D.Collision
Section 115
//Features (Physics.Box2D.Collision.Features)
package Physics.Box2D.Collision {
public class Features {
public var _referenceFace:int;
public var _incidentEdge:int;
public var _flip:int;
public var _incidentVertex:int;
public var _m_id:b2ContactID;
public function get referenceFace():int{
return (_referenceFace);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (_flip);
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set referenceFace(_arg1:int):void{
_referenceFace = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceFace & 0xFF));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Physics.Box2D.Collision
Section 116
//b2Mat22 (Physics.Box2D.Common.Math.b2Mat22)
package Physics.Box2D.Common.Math {
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
col1.SetV(_arg2);
col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
col1.x = _local4;
col2.x = -(_local5);
col1.y = _local5;
col2.y = _local4;
};
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function Set(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local3:Number;
var _local6:Number;
_local2 = col1.x;
_local3 = col2.x;
var _local4:Number = 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);
}
}
}//package Physics.Box2D.Common.Math
Section 117
//b2Math (Physics.Box2D.Common.Math.b2Math)
package Physics.Box2D.Common.Math {
public final class b2Math {
private static var a:Number;
private static var c:Number;
private static var b:Number;
private static var w:Number;
private static var thresh:Number = 0.001;
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:* = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function 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 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 b2Sqrt(_arg1:Number):Number{
b = (_arg1 * 0.25);
do {
c = (_arg1 / b);
b = ((b + c) * 0.5);
a = (b - c);
if (a < 0){
a = -(a);
};
} while (a > thresh);
return (b);
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function b2NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function 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 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 b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
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 b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Physics.Box2D.Common.Math
Section 118
//b2Vec2 (Physics.Box2D.Common.Math.b2Vec2)
package Physics.Box2D.Common.Math {
public final class b2Vec2 {
private var b:Number;
private var c:Number;
private var a:Number;
public var y:Number;
private var thresh:Number;// = 0.001
private var w:Number;
public var x:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function Length():Number{
w = ((x * x) + (y * y));
b = (w * 0.25);
do {
c = (w / b);
b = ((b + c) * 0.5);
a = (b - c);
if (a < 0){
a = -(a);
};
} while (a > thresh);
if (isNaN(b)){
b = 0;
};
return (b);
}
public function SetZero():void{
x = 0;
y = 0;
}
public function CrossVF(_arg1:Number):void{
var _local2:Number = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function Normalize():Number{
var _local1:Number = Length();
if (_local1 < Number.MIN_VALUE){
return (0);
};
var _local2:Number = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Physics.Box2D.Common.Math
Section 119
//b2Settings (Physics.Box2D.Common.b2Settings)
package Physics.Box2D.Common {
import Physics.Box2D.Common.Math.*;
public class b2Settings {
public static const b2_lengthUnitsPerMeter:Number = 1;
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static const b2_linearSleepTolerance:Number = 0.01;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_linearSlop:Number = 0.005;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxShapesPerBody:int = 32;
public static const b2_maxProxies:int = 0x2000;
public static const b2_velocityThreshold:Number = 1;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_maxPairs:int = 65536;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const b2_massUnitsPerKilogram:Number = 1;
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_maxLinearCorrection:Number = 0.2;
public static const b2_maxPolyVertices:int = 8;
public static const b2_timeUnitsPerSecond:Number = 1;
public static function b2Assert(_arg1:Boolean):void{
var _local2:b2Vec2;
if (!_arg1){
_local2.x++;
};
}
}
}//package Physics.Box2D.Common
Section 120
//b2CircleContact (Physics.Box2D.Dynamics.Contacts.b2CircleContact)
package Physics.Box2D.Dynamics.Contacts {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.Box2D.Common.*;
public class b2CircleContact extends b2Contact {
public var m_manifold:Array;
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifold = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold[0].pointCount = 0;
m_manifold[0].points[0].normalImpulse = 0;
m_manifold[0].points[0].tangentImpulse = 0;
}
override public function Evaluate():void{
b2Collision.b2CollideCircle(m_manifold[0], (m_shape1 as b2CircleShape), (m_shape2 as b2CircleShape), false);
if (m_manifold[0].pointCount > 0){
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
}
override public function GetManifolds():Array{
return (m_manifold);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
}
}//package Physics.Box2D.Dynamics.Contacts
Section 121
//b2ConcaveArcAndCircleContact (Physics.Box2D.Dynamics.Contacts.b2ConcaveArcAndCircleContact)
package Physics.Box2D.Dynamics.Contacts {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.Box2D.Common.*;
public class b2ConcaveArcAndCircleContact extends b2PolyAndCircleContact {
public function b2ConcaveArcAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
super(_arg1, _arg2);
}
override public function Evaluate():void{
var _local2:b2ContactPoint;
var _local3:b2ContactPoint;
var _local4:Number;
var _local5:b2Manifold;
var _local11:int;
var _local13:*;
var _local14:*;
var _local15:*;
var _local16:*;
var _local17:*;
var _local18:*;
var _local19:*;
var _local20:*;
var _local21:*;
var _local22:*;
var _local23:*;
var _local24:*;
var _local25:*;
var _local26:*;
var _local27:*;
var _local28:*;
var _local29:*;
var _local30:*;
var _local31:*;
var _local32:*;
var _local33:*;
var _local34:*;
var _local35:*;
var _local36:*;
var _local37:*;
var _local38:*;
var _local39:*;
var _local40:int;
var _local1:Array = [];
_local11 = 0;
while (_local11 < m_manifoldCount) {
_local40 = 0;
while (_local40 < m_manifold[_local11].pointCount) {
_local3 = m_manifold[_local11].points[_local40];
_local2 = new b2ContactPoint();
_local1[_local3.id.key] = _local2;
_local2.normalImpulse = _local3.normalImpulse;
_local2.tangentImpulse = _local3.tangentImpulse;
_local40++;
};
_local11++;
};
if ((((m_manifoldCount == 1)) && ((m_manifold[0].pointCount == 1)))){
_local4 = m_manifold[0].points[0].id.key;
} else {
_local4 = -1;
};
_local5 = m_manifold[0];
var _local6:b2ConcaveArcShape = (m_shape1 as b2ConcaveArcShape);
var _local7:b2CircleShape = (m_shape2 as b2CircleShape);
var _local8:Boolean;
var _local9:uint = b2Collision.b2_nullFeature;
do {
_local5.pointCount = 0;
_local17 = (_local7.m_position.x - _local6.m_position.x);
_local18 = (_local7.m_position.y - _local6.m_position.y);
_local19 = _local6.m_R;
_local20 = ((_local17 * _local19.col1.x) + (_local18 * _local19.col1.y));
_local18 = ((_local17 * _local19.col2.x) + (_local18 * _local19.col2.y));
_local17 = _local20;
_local22 = 0;
_local23 = -(Number.MAX_VALUE);
_local24 = _local7.m_radius;
_local11 = 1;
while (_local11 < _local6.m_vertexCount) {
_local14 = ((_local6.m_normals[_local11].x * (_local17 - _local6.m_vertices[_local11].x)) + (_local6.m_normals[_local11].y * (_local18 - _local6.m_vertices[_local11].y)));
if (_local14 > _local24){
m_manifoldCount = 0;
return;
};
if (_local14 > _local23){
_local23 = _local14;
_local22 = _local11;
};
_local11++;
};
if (((((true) || ((_local22 == 1)))) || ((_local22 == (_local6.m_vertexCount - 1))))){
_local14 = ((_local6.m_normals[0].x * (_local17 - _local6.m_vertices[0].x)) + (_local6.m_normals[0].y * (_local18 - _local6.m_vertices[0].y)));
_local32 = (_local17 - _local6.m_arcCenter.x);
_local33 = (_local18 - _local6.m_arcCenter.y);
_local34 = Math.sqrt(((_local32 * _local32) + (_local33 * _local33)));
_local32 = (_local32 / _local34);
_local33 = (_local33 / _local34);
_local14 = Math.max(_local14, (_local6.m_radius - _local34));
if (_local14 > _local24){
m_manifoldCount = 0;
return;
};
if (_local14 > _local23){
_local23 = _local14;
_local22 = 0;
};
};
} while (!((((_local22 == 0)) && ((_local24 >= _local6.m_radius)))));
m_manifold[0].points[0].normalImpulse = 0;
m_manifold[0].points[0].tangentImpulse = 0;
var _local10:int;
_local11 = 0;
while (_local11 < m_manifoldCount) {
_local40 = 0;
while (_local40 < m_manifold[_local11].pointCount) {
_local2 = m_manifold[_local11].points[_local40];
_local3 = _local1[_local2.id.key];
if (_local3){
_local10++;
_local2.normalImpulse = _local3.normalImpulse;
_local2.tangentImpulse = _local3.tangentImpulse;
};
_local40++;
};
_local11++;
};
var _local12:Boolean;
if (((((!((_local4 == -1))) && ((m_manifoldCount == 1)))) && ((m_manifold[0].pointCount == 1)))){
_local2 = m_manifold[0].points[0];
_local3 = _local1[_local4];
if (_local3){
_local12 = true;
_local2.normalImpulse = _local3.normalImpulse;
_local2.tangentImpulse = _local3.tangentImpulse;
};
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2ConcaveArcAndCircleContact(_arg1, _arg2));
}
}
}//package Physics.Box2D.Dynamics.Contacts
Section 122
//b2Contact (Physics.Box2D.Dynamics.Contacts.b2Contact)
package Physics.Box2D.Dynamics.Contacts {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.Box2D.Common.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_next:b2Contact;
public var m_prev:b2Contact;
public var m_friction:Number;
public var m_manifoldCount:int;
public var m_node1:b2ContactNode;
public var m_node2:b2ContactNode;
public var m_restitution:Number;
public var m_flags:uint;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public static var e_islandFlag:uint = 1;
public static var e_destroyFlag:uint = 2;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
m_node1 = new b2ContactNode();
m_node2 = new b2ContactNode();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
m_shape1 = _arg1;
m_shape2 = _arg2;
m_manifoldCount = 0;
m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction));
m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution);
m_prev = null;
m_next = null;
m_node1.contact = null;
m_node1.prev = null;
m_node1.next = null;
m_node1.other = null;
m_node2.contact = null;
m_node2.prev = null;
m_node2.next = null;
m_node2.other = null;
}
public function GetShape1():b2Shape{
return (m_shape1);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetManifolds():Array{
return (null);
}
public function Evaluate():void{
}
public static function InitializeRegisters():void{
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
var _local1:int;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polyShape, b2Shape.e_circleShape);
AddType(b2PolyContact.Create, b2PolyContact.Destroy, b2Shape.e_polyShape, b2Shape.e_polyShape);
AddType(b2PolyAndConcaveArcContact.Create, b2PolyAndConcaveArcContact.Destroy, b2Shape.e_polyShape, b2Shape.e_concaveArcShape);
AddType(b2ConcaveArcAndCircleContact.Create, b2ConcaveArcAndCircleContact.Destroy, b2Shape.e_concaveArcShape, b2Shape.e_circleShape);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
if (_arg1.GetManifoldCount() > 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:* = s_registers[_local3][_local4].destroyFcn;
_local5(_arg1, _arg2);
}
public static function AddType(_arg1, _arg2, _arg3:int, _arg4:int):void{
s_registers[_arg3][_arg4].createFcn = _arg1;
s_registers[_arg3][_arg4].destroyFcn = _arg2;
s_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
s_registers[_arg4][_arg3].createFcn = _arg1;
s_registers[_arg4][_arg3].destroyFcn = _arg2;
s_registers[_arg4][_arg3].primary = false;
};
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local7:b2Contact;
var _local8:int;
var _local9:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
var _local4:int = _arg1.m_type;
var _local5:int = _arg2.m_type;
var _local6:* = s_registers[_local4][_local5].createFcn;
if (_local6){
if (s_registers[_local4][_local5].primary){
return (_local6(_arg1, _arg2, _arg3));
};
_local7 = _local6(_arg2, _arg1, _arg3);
_local8 = 0;
while (_local8 < _local7.GetManifoldCount()) {
_local9 = _local7.GetManifolds()[_local8];
_local7.GetManifolds()[_local8].normal = _local9.normal.Negative();
_local8++;
};
return (_local7);
//unresolved jump
};
return (null);
}
}
}//package Physics.Box2D.Dynamics.Contacts
Section 123
//b2ContactConstraint (Physics.Box2D.Dynamics.Contacts.b2ContactConstraint)
package Physics.Box2D.Dynamics.Contacts {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var normal:b2Vec2;
public var restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Physics.Box2D.Dynamics.Contacts
Section 124
//b2ContactConstraintPoint (Physics.Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Physics.Box2D.Dynamics.Contacts {
import Physics.Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var separation:Number;
public var positionImpulse:Number;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var tangentMass:Number;
public var normalMass:Number;
public var velocityBias:Number;
public function b2ContactConstraintPoint(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
}
}
}//package Physics.Box2D.Dynamics.Contacts
Section 125
//b2ContactNode (Physics.Box2D.Dynamics.Contacts.b2ContactNode)
package Physics.Box2D.Dynamics.Contacts {
import Physics.Box2D.Dynamics.*;
public class b2ContactNode {
public var other:b2Body;
public var prev:b2ContactNode;
public var contact:b2Contact;
public var next:b2ContactNode;
}
}//package Physics.Box2D.Dynamics.Contacts
Section 126
//b2ContactRegister (Physics.Box2D.Dynamics.Contacts.b2ContactRegister)
package Physics.Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn;
public var destroyFcn;
}
}//package Physics.Box2D.Dynamics.Contacts
Section 127
//b2ContactSolver (Physics.Box2D.Dynamics.Contacts.b2ContactSolver)
package Physics.Box2D.Dynamics.Contacts {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Common.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public function b2ContactSolver(_arg1:Array, _arg2:int, _arg3){
var _local4:int;
var _local5:b2Vec2;
var _local6:b2Mat22;
var _local8:b2Contact;
var _local9:b2Body;
var _local10:b2Body;
var _local11:int;
var _local12:Array;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:int;
var _local22:b2Manifold;
var _local23:Number;
var _local24:Number;
var _local25:b2ContactConstraint;
var _local26:uint;
var _local27:b2ContactPoint;
var _local28:b2ContactConstraintPoint;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
m_constraints = new Array();
super();
m_allocator = _arg3;
m_constraintCount = 0;
_local4 = 0;
while (_local4 < _arg2) {
m_constraintCount = (m_constraintCount + _arg1[_local4].GetManifoldCount());
_local4++;
};
_local4 = 0;
while (_local4 < m_constraintCount) {
m_constraints[_local4] = new b2ContactConstraint();
_local4++;
};
var _local7:int;
_local4 = 0;
while (_local4 < _arg2) {
_local8 = _arg1[_local4];
_local9 = _local8.m_shape1.m_body;
_local10 = _local8.m_shape2.m_body;
_local11 = _local8.GetManifoldCount();
_local12 = _local8.GetManifolds();
_local13 = _local8.m_friction;
_local14 = _local8.m_restitution;
_local15 = _local9.m_linearVelocity.x;
_local16 = _local9.m_linearVelocity.y;
_local17 = _local10.m_linearVelocity.x;
_local18 = _local10.m_linearVelocity.y;
_local19 = _local9.m_angularVelocity;
_local20 = _local10.m_angularVelocity;
_local21 = 0;
while (_local21 < _local11) {
_local22 = _local12[_local21];
_local23 = _local22.normal.x;
_local24 = _local22.normal.y;
_local25 = m_constraints[_local7];
_local25.body1 = _local9;
_local25.body2 = _local10;
_local25.manifold = _local22;
_local25.normal.x = _local23;
_local25.normal.y = _local24;
_local25.pointCount = _local22.pointCount;
_local25.friction = _local13;
_local25.restitution = _local14;
_local26 = 0;
while (_local26 < _local25.pointCount) {
_local27 = _local22.points[_local26];
_local28 = _local25.points[_local26];
_local28.normalImpulse = _local27.normalImpulse;
_local28.tangentImpulse = _local27.tangentImpulse;
_local28.separation = _local27.separation;
_local29 = (_local27.position.x - _local9.m_position.x);
_local30 = (_local27.position.y - _local9.m_position.y);
_local31 = (_local27.position.x - _local10.m_position.x);
_local32 = (_local27.position.y - _local10.m_position.y);
_local5 = _local28.localAnchor1;
_local6 = _local9.m_R;
_local5.x = ((_local29 * _local6.col1.x) + (_local30 * _local6.col1.y));
_local5.y = ((_local29 * _local6.col2.x) + (_local30 * _local6.col2.y));
_local5 = _local28.localAnchor2;
_local6 = _local10.m_R;
_local5.x = ((_local31 * _local6.col1.x) + (_local32 * _local6.col1.y));
_local5.y = ((_local31 * _local6.col2.x) + (_local32 * _local6.col2.y));
_local33 = ((_local29 * _local29) + (_local30 * _local30));
_local34 = ((_local31 * _local31) + (_local32 * _local32));
_local35 = ((_local29 * _local23) + (_local30 * _local24));
_local36 = ((_local31 * _local23) + (_local32 * _local24));
_local37 = (_local9.m_invMass + _local10.m_invMass);
_local37 = (_local37 + ((_local9.m_invI * (_local33 - (_local35 * _local35))) + (_local10.m_invI * (_local34 - (_local36 * _local36)))));
_local28.normalMass = (1 / _local37);
_local38 = _local24;
_local39 = -(_local23);
_local40 = ((_local29 * _local38) + (_local30 * _local39));
_local41 = ((_local31 * _local38) + (_local32 * _local39));
_local42 = (_local9.m_invMass + _local10.m_invMass);
_local42 = (_local42 + ((_local9.m_invI * (_local33 - (_local40 * _local40))) + (_local10.m_invI * (_local34 - (_local41 * _local41)))));
_local28.tangentMass = (1 / _local42);
_local28.velocityBias = 0;
if (_local28.separation > 0){
_local28.velocityBias = (-60 * _local28.separation);
};
_local43 = (((_local17 + (-(_local20) * _local32)) - _local15) - (-(_local19) * _local30));
_local44 = (((_local18 + (_local20 * _local31)) - _local16) - (_local19 * _local29));
_local45 = ((_local25.normal.x * _local43) + (_local25.normal.y * _local44));
if (_local45 < -(b2Settings.b2_velocityThreshold)){
_local28.velocityBias = (_local28.velocityBias + (-(_local25.restitution) * _local45));
};
_local26++;
};
_local7++;
_local21++;
};
_local4++;
};
}
public function SolveVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraintPoint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:b2Mat22;
var _local14:b2Vec2;
var _local16:b2ContactConstraint;
var _local17:b2Body;
var _local18:b2Body;
var _local19:Number;
var _local20:b2Vec2;
var _local21:Number;
var _local22:b2Vec2;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:int;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local15:int;
while (_local15 < m_constraintCount) {
_local16 = m_constraints[_local15];
_local17 = _local16.body1;
_local18 = _local16.body2;
_local19 = _local17.m_angularVelocity;
_local20 = _local17.m_linearVelocity;
_local21 = _local18.m_angularVelocity;
_local22 = _local18.m_linearVelocity;
_local23 = _local17.m_invMass;
_local24 = _local17.m_invI;
_local25 = _local18.m_invMass;
_local26 = _local18.m_invI;
_local27 = _local16.normal.x;
_local28 = _local16.normal.y;
_local29 = _local28;
_local30 = -(_local27);
_local31 = _local16.pointCount;
_local1 = 0;
while (_local1 < _local31) {
_local2 = _local16.points[_local1];
_local13 = _local17.m_R;
_local14 = _local2.localAnchor1;
_local3 = ((_local13.col1.x * _local14.x) + (_local13.col2.x * _local14.y));
_local4 = ((_local13.col1.y * _local14.x) + (_local13.col2.y * _local14.y));
_local13 = _local18.m_R;
_local14 = _local2.localAnchor2;
_local5 = ((_local13.col1.x * _local14.x) + (_local13.col2.x * _local14.y));
_local6 = ((_local13.col1.y * _local14.x) + (_local13.col2.y * _local14.y));
_local7 = (((_local22.x + (-(_local21) * _local6)) - _local20.x) - (-(_local19) * _local4));
_local8 = (((_local22.y + (_local21 * _local5)) - _local20.y) - (_local19 * _local3));
_local32 = ((_local7 * _local27) + (_local8 * _local28));
_local9 = (-(_local2.normalMass) * (_local32 - _local2.velocityBias));
_local10 = b2Math.b2Max((_local2.normalImpulse + _local9), 0);
_local9 = (_local10 - _local2.normalImpulse);
_local11 = (_local9 * _local27);
_local12 = (_local9 * _local28);
_local20.x = (_local20.x - (_local23 * _local11));
_local20.y = (_local20.y - (_local23 * _local12));
_local19 = (_local19 - (_local24 * ((_local3 * _local12) - (_local4 * _local11))));
_local22.x = (_local22.x + (_local25 * _local11));
_local22.y = (_local22.y + (_local25 * _local12));
_local21 = (_local21 + (_local26 * ((_local5 * _local12) - (_local6 * _local11))));
_local2.normalImpulse = _local10;
_local7 = (((_local22.x + (-(_local21) * _local6)) - _local20.x) - (-(_local19) * _local4));
_local8 = (((_local22.y + (_local21 * _local5)) - _local20.y) - (_local19 * _local3));
_local33 = ((_local7 * _local29) + (_local8 * _local30));
_local9 = (_local2.tangentMass * -(_local33));
_local34 = (_local16.friction * _local2.normalImpulse);
_local10 = b2Math.b2Clamp((_local2.tangentImpulse + _local9), -(_local34), _local34);
_local9 = (_local10 - _local2.tangentImpulse);
_local11 = (_local9 * _local29);
_local12 = (_local9 * _local30);
_local20.x = (_local20.x - (_local23 * _local11));
_local20.y = (_local20.y - (_local23 * _local12));
_local19 = (_local19 - (_local24 * ((_local3 * _local12) - (_local4 * _local11))));
_local22.x = (_local22.x + (_local25 * _local11));
_local22.y = (_local22.y + (_local25 * _local12));
_local21 = (_local21 + (_local26 * ((_local5 * _local12) - (_local6 * _local11))));
_local2.tangentImpulse = _local10;
_local1++;
};
_local17.m_angularVelocity = _local19;
_local18.m_angularVelocity = _local21;
_local15++;
};
}
public function PreSolve():void{
var _local1:b2Vec2;
var _local2:b2Vec2;
var _local3:b2Mat22;
var _local5:b2ContactConstraint;
var _local6:b2Body;
var _local7:b2Body;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:int;
var _local17:int;
var _local18:b2ContactConstraintPoint;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2ContactConstraintPoint;
var _local4:int;
while (_local4 < m_constraintCount) {
_local5 = m_constraints[_local4];
_local6 = _local5.body1;
_local7 = _local5.body2;
_local8 = _local6.m_invMass;
_local9 = _local6.m_invI;
_local10 = _local7.m_invMass;
_local11 = _local7.m_invI;
_local12 = _local5.normal.x;
_local13 = _local5.normal.y;
_local14 = _local13;
_local15 = -(_local12);
if (b2World.s_enableWarmStarting){
_local17 = _local5.pointCount;
_local16 = 0;
while (_local16 < _local17) {
_local18 = _local5.points[_local16];
_local19 = ((_local18.normalImpulse * _local12) + (_local18.tangentImpulse * _local14));
_local20 = ((_local18.normalImpulse * _local13) + (_local18.tangentImpulse * _local15));
_local3 = _local6.m_R;
_local1 = _local18.localAnchor1;
_local21 = ((_local3.col1.x * _local1.x) + (_local3.col2.x * _local1.y));
_local22 = ((_local3.col1.y * _local1.x) + (_local3.col2.y * _local1.y));
_local3 = _local7.m_R;
_local1 = _local18.localAnchor2;
_local23 = ((_local3.col1.x * _local1.x) + (_local3.col2.x * _local1.y));
_local24 = ((_local3.col1.y * _local1.x) + (_local3.col2.y * _local1.y));
_local6.m_angularVelocity = (_local6.m_angularVelocity - (_local9 * ((_local21 * _local20) - (_local22 * _local19))));
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x - (_local8 * _local19));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y - (_local8 * _local20));
_local7.m_angularVelocity = (_local7.m_angularVelocity + (_local11 * ((_local23 * _local20) - (_local24 * _local19))));
_local7.m_linearVelocity.x = (_local7.m_linearVelocity.x + (_local10 * _local19));
_local7.m_linearVelocity.y = (_local7.m_linearVelocity.y + (_local10 * _local20));
_local18.positionImpulse = 0;
_local16++;
};
} else {
_local17 = _local5.pointCount;
_local16 = 0;
while (_local16 < _local17) {
_local25 = _local5.points[_local16];
_local25.normalImpulse = 0;
_local25.tangentImpulse = 0;
_local25.positionImpulse = 0;
_local16++;
};
};
_local4++;
};
}
public function 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:Number;
var _local20:Number;
var _local21:int;
var _local22:int;
var _local23:b2ContactConstraintPoint;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local2:Number = 0;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_position;
_local10 = _local7.m_rotation;
_local11 = _local8.m_position;
_local12 = _local8.m_rotation;
_local13 = _local7.m_invMass;
_local14 = _local7.m_invI;
_local15 = _local8.m_invMass;
_local16 = _local8.m_invI;
_local17 = _local6.normal.x;
_local18 = _local6.normal.y;
_local19 = _local18;
_local20 = -(_local17);
_local21 = _local6.pointCount;
_local22 = 0;
while (_local22 < _local21) {
_local23 = _local6.points[_local22];
_local3 = _local7.m_R;
_local4 = _local23.localAnchor1;
_local24 = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local25 = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local3 = _local8.m_R;
_local4 = _local23.localAnchor2;
_local26 = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local27 = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local28 = (_local9.x + _local24);
_local29 = (_local9.y + _local25);
_local30 = (_local11.x + _local26);
_local31 = (_local11.y + _local27);
_local32 = (_local30 - _local28);
_local33 = (_local31 - _local29);
_local34 = (((_local32 * _local17) + (_local33 * _local18)) + _local23.separation);
_local2 = b2Math.b2Min(_local2, _local34);
_local35 = (_arg1 * b2Math.b2Clamp((_local34 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0));
_local36 = (-(_local23.normalMass) * _local35);
_local37 = _local23.positionImpulse;
_local23.positionImpulse = b2Math.b2Max((_local37 + _local36), 0);
_local36 = (_local23.positionImpulse - _local37);
_local38 = (_local36 * _local17);
_local39 = (_local36 * _local18);
_local9.x = (_local9.x - (_local13 * _local38));
_local9.y = (_local9.y - (_local13 * _local39));
_local10 = (_local10 - (_local14 * ((_local24 * _local39) - (_local25 * _local38))));
_local7.m_R.Set(_local10);
_local11.x = (_local11.x + (_local15 * _local38));
_local11.y = (_local11.y + (_local15 * _local39));
_local12 = (_local12 + (_local16 * ((_local26 * _local39) - (_local27 * _local38))));
_local8.m_R.Set(_local12);
_local22++;
};
_local7.m_rotation = _local10;
_local8.m_rotation = _local12;
_local5++;
};
return ((_local2 >= -(b2Settings.b2_linearSlop)));
}
public function PostSolve():void{
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ContactPoint;
var _local6:b2ContactConstraintPoint;
var _local1:int;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Physics.Box2D.Dynamics.Contacts
Section 128
//b2NullContact (Physics.Box2D.Dynamics.Contacts.b2NullContact)
package Physics.Box2D.Dynamics.Contacts {
public class b2NullContact extends b2Contact {
public function b2NullContact():void{
}
override public function Evaluate():void{
}
override public function GetManifolds():Array{
return (null);
}
}
}//package Physics.Box2D.Dynamics.Contacts
Section 129
//b2PolyAndCircleContact (Physics.Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Physics.Box2D.Dynamics.Contacts {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
public var m_manifold:Array;
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifold = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold[0].pointCount = 0;
m_manifold[0].points[0].normalImpulse = 0;
m_manifold[0].points[0].tangentImpulse = 0;
}
override public function Evaluate():void{
b2Collision.b2CollidePolyAndCircle(m_manifold[0], (m_shape1 as b2PolyShape), (m_shape2 as b2CircleShape), false);
if (m_manifold[0].pointCount > 0){
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
}
override public function GetManifolds():Array{
return (m_manifold);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
}
}//package Physics.Box2D.Dynamics.Contacts
Section 130
//b2PolyAndConcaveArcContact (Physics.Box2D.Dynamics.Contacts.b2PolyAndConcaveArcContact)
package Physics.Box2D.Dynamics.Contacts {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.Box2D.Common.*;
public class b2PolyAndConcaveArcContact extends b2PolyContact {
private var m_arcManifolds:Array;
private var m_arcColl:Boolean;
public function b2PolyAndConcaveArcContact(_arg1:b2Shape, _arg2:b2Shape){
m_arcManifolds = [];
super(_arg1, _arg2);
}
private function enlargeManifolds(_arg1:Number):void{
var _local2:b2Manifold;
while (m_arcManifolds.length < _arg1) {
_local2 = new b2Manifold();
_local2.pointCount = 0;
_local2.points[0].normalImpulse = 0;
_local2.points[0].tangentImpulse = 0;
m_arcManifolds.push(_local2);
};
}
override public function Evaluate():void{
var _local1:uint;
var _local2:int;
var _local3:int;
var _local4:b2Manifold;
var _local6:b2ContactPoint;
var _local7:b2ContactPoint;
var _local8:Number;
var _local9:Number;
var _local11:Number;
var _local13:b2PolyShape;
var _local14:b2ConcaveArcShape;
var _local26:Boolean;
var _local27:b2Vec2;
var _local28:Number;
var _local30:Number;
var _local31:Number;
var _local32:b2Vec2;
var _local33:Number;
var _local34:b2Vec2;
var _local35:b2Vec2;
var _local36:b2Vec2;
var _local37:b2Vec2;
var _local38:Number;
var _local39:Number;
var _local40:b2Vec2;
var _local41:Number;
var _local42:Number;
var _local43:b2Vec2;
var _local44:Number;
var _local45:Number;
var _local46:Number;
var _local47:Number;
var _local48:b2ContactPoint;
var _local49:Number;
var _local50:Number;
var _local51:Number;
var _local52:b2Mat22;
_local1 = b2Collision.b2_nullFeature;
var _local5:Array = [];
if (!m_arcColl){
_local2 = 0;
while (_local2 < m_manifoldCount) {
_local3 = 0;
while (_local3 < m_manifold[_local2].pointCount) {
_local7 = m_manifold[_local2].points[_local3];
_local6 = new b2ContactPoint();
_local5[_local7.id.key] = _local6;
_local6.normalImpulse = _local7.normalImpulse;
_local6.tangentImpulse = _local7.tangentImpulse;
_local3++;
};
_local2++;
};
if ((((m_manifoldCount == 1)) && ((m_manifold[0].pointCount == 1)))){
_local8 = m_manifold[0].points[0].id.key;
} else {
_local8 = -1;
};
} else {
_local2 = 0;
while (_local2 < m_manifoldCount) {
_local3 = 0;
while (_local3 < m_arcManifolds[_local2].pointCount) {
_local7 = m_arcManifolds[_local2].points[_local3];
_local6 = new b2ContactPoint();
_local5[_local7.id.key] = _local6;
_local6.normalImpulse = _local7.normalImpulse;
_local6.tangentImpulse = _local7.tangentImpulse;
_local3++;
};
_local2++;
};
if ((((m_manifoldCount == 1)) && ((m_arcManifolds[0].pointCount == 1)))){
_local8 = m_arcManifolds[0].points[0].id.key;
} else {
_local8 = -1;
};
};
super.Evaluate();
_local9 = m_manifoldCount;
if (m_manifoldCount == 0){
return;
};
_local6 = m_manifold[0].points[0];
var _local10:Features = _local6.id.features;
_local11 = (_local10.flip) ? _local10.referenceFace : _local10.incidentEdge;
var _local12:Number = -(Number.MAX_VALUE);
if ((((((m_manifoldCount == 1)) && (!((_local11 == 0))))) && ((_local6.separation < 0)))){
_local12 = _local6.separation;
};
_local13 = (m_shape1 as b2PolyShape);
_local14 = (m_shape2 as b2ConcaveArcShape);
var _local15:Number = Number.MAX_VALUE;
var _local16:b2Vec2 = b2Math.b2MulMV(_local14.m_R, _local14.m_arcCenter.Copy());
_local16.Add(_local14.m_position);
_local16.Subtract(_local13.m_position);
_local16 = b2Math.b2MulTMV(_local13.m_R, _local16);
var _local17:b2Vec2 = b2Math.b2MulMV(_local14.m_R, _local14.m_vertices[0].Copy());
_local17.Add(_local14.m_position);
var _local18:b2Vec2 = _local17.Copy();
_local17.Subtract(_local13.m_position);
_local17 = b2Math.b2MulTMV(_local13.m_R, _local17);
var _local19:b2Vec2 = b2Math.b2MulMV(_local14.m_R, _local14.m_vertices[1].Copy());
_local19.Add(_local14.m_position);
var _local20:b2Vec2 = _local19.Copy();
_local19.Subtract(_local13.m_position);
_local19 = b2Math.b2MulTMV(_local13.m_R, _local19);
var _local21:b2Vec2 = b2Math.b2MulTMV(_local13.m_R, b2Math.b2MulMV(_local14.m_R, _local14.m_normals[0].Copy()));
var _local22:Array = [_local18, _local20];
var _local23:Array = [_local17, _local19];
var _local24:Boolean;
m_manifoldCount = 0;
var _local25:Array = [-1, -1];
if (_local11 == 0){
_local2 = 0;
while (_local2 < 2) {
_local30 = -(Number.MAX_VALUE);
_local31 = -1;
_local32 = _local23[_local2];
if (_local2 == 0){
_local34 = b2Math.b2MulTMV(_local13.m_R, b2Math.b2MulMV(_local14.m_R, _local14.m_normals[(_local14.m_vertexCount - 1)]));
_local35 = b2Math.SubtractVV(_local16, _local32);
_local35.Normalize();
} else {
_local35 = b2Math.b2MulTMV(_local13.m_R, b2Math.b2MulMV(_local14.m_R, _local14.m_normals[1]));
_local34 = b2Math.SubtractVV(_local16, _local32);
_local34.Normalize();
};
_local3 = 0;
while (_local3 < _local13.m_vertexCount) {
_local36 = _local13.m_vertices[_local3];
_local37 = _local13.m_normals[_local3];
if (((_local37.x * _local34.y) - (_local37.y * _local34.x)) < 0){
} else {
if (((_local37.x * _local35.y) - (_local37.y * _local35.x)) > 0){
} else {
_local38 = (_local32.x - _local36.x);
_local39 = (_local32.y - _local36.y);
_local33 = ((_local38 * _local37.x) + (_local39 * _local37.y));
if (_local33 > 0){
_local31 = -1;
break;
};
if (_local33 > _local30){
_local30 = _local33;
_local31 = _local3;
};
};
};
_local3++;
};
if (_local31 != -1){
_local37 = _local13.m_normals[_local31];
_local36 = _local13.m_vertices[_local31];
_local40 = _local13.m_vertices[(((_local31 + 1) < _local13.m_vertexCount)) ? (_local31 + 1) : 0];
_local41 = ((_local37.x * _local34.x) + (_local37.y * _local34.y));
_local42 = ((_local37.x * _local35.x) + (_local37.y * _local35.y));
if (_local41 < _local42){
_local43 = b2Math.b2CrossVF(_local34, 1);
} else {
_local43 = b2Math.b2CrossVF(_local35, -1);
};
_local44 = (((_local32.x - _local36.x) * _local37.x) + ((_local32.y - _local36.y) * _local37.y));
_local45 = ((_local43.x * _local37.x) + (_local43.y * _local37.y));
_local46 = (-(_local44) / _local45);
_local38 = (_local40.x - _local36.x);
_local39 = (_local40.y - _local36.y);
_local47 = ((((_local32.x + (_local46 * _local43.x)) - _local36.x) * _local38) + (((_local32.y + (_local46 * _local43.y)) - _local36.y) * _local39));
if ((((_local47 < 0)) || ((_local47 > ((_local38 * _local38) + (_local39 * _local39)))))){
_local31 = -1;
};
};
if (_local31 != -1){
if (_local2 == 0){
_local33 = (((_local40.x - _local32.x) * _local35.x) + ((_local40.y - _local32.y) * _local35.y));
if ((((_local30 < _local33)) && ((_local33 < 0)))){
_local25[_local2] = (((_local31 + 1) < _local13.m_vertexCount)) ? (_local31 + 1) : 0;
_local31 = -1;
};
} else {
_local33 = (((_local36.x - _local32.x) * _local34.x) + ((_local36.y - _local32.y) * _local34.y));
if ((((_local30 < _local33)) && ((_local33 < 0)))){
_local25[_local2] = _local31;
_local31 = -1;
};
};
};
if (_local31 != -1){
m_manifoldCount++;
enlargeManifolds(m_manifoldCount);
_local4 = m_arcManifolds[(m_manifoldCount - 1)];
_local4.pointCount = 1;
_local48 = _local4.points[0];
_local48.position.SetV(_local22[_local2]);
_local48.id.features.incidentEdge = _local1;
_local48.id.features.incidentVertex = _local2;
_local48.id.features.referenceFace = _local31;
_local48.id.features.flip = 0;
_local48.separation = _local30;
_local48.normalImpulse = 0;
_local48.tangentImpulse = 0;
_local15 = Math.min(_local15, _local48.separation);
_local4.normal = b2Math.b2MulMV(_local13.m_R, _local13.m_normals[_local31]);
};
_local2++;
};
};
_local2 = 0;
while (_local2 < _local13.m_vertexCount) {
_local27 = b2Math.AddVV(b2Math.b2MulMV(_local13.m_R, _local13.m_vertices[_local2]), _local13.m_position);
_local26 = _local14.TestPoint(_local27);
_local27 = new b2Vec2((_local13.m_vertices[_local2].x - _local16.x), (_local13.m_vertices[_local2].y - _local16.y));
_local28 = ((_local27.x * _local27.x) + (_local27.y * _local27.y));
_local49 = Math.sqrt(_local28);
_local50 = (_local14.m_radius - _local49);
_local51 = (((_local13.m_vertices[_local2].x - _local17.x) * _local21.x) + ((_local13.m_vertices[_local2].y - _local17.y) * _local21.y));
_local15 = Math.min(_local15, Math.max(_local50, _local51));
if (((((_local26) || ((_local2 == _local25[0])))) || ((_local2 == _local25[1])))){
m_manifoldCount++;
enlargeManifolds(m_manifoldCount);
_local4 = m_arcManifolds[(m_manifoldCount - 1)];
_local4.pointCount = 1;
_local48 = _local4.points[0];
_local48.id.features.incidentEdge = _local1;
_local48.id.features.incidentVertex = _local2;
_local48.id.features.referenceFace = 0;
_local48.id.features.flip = 0;
_local48.normalImpulse = 0;
_local48.tangentImpulse = 0;
_local27.x = (_local27.x / _local49);
_local27.y = (_local27.y / _local49);
_local52 = _local13.m_R;
_local4.normal.x = ((_local52.col1.x * _local27.x) + (_local52.col2.x * _local27.y));
_local4.normal.y = ((_local52.col1.y * _local27.x) + (_local52.col2.y * _local27.y));
_local27 = _local13.m_vertices[_local2];
_local48.position.x = (((_local52.col1.x * _local27.x) + (_local52.col2.x * _local27.y)) + _local13.m_position.x);
_local48.position.y = (((_local52.col1.y * _local27.x) + (_local52.col2.y * _local27.y)) + _local13.m_position.y);
_local48.separation = (_local14.m_radius - _local49);
};
_local2++;
};
var _local29:int = m_manifoldCount;
if (_local12 > _local15){
m_arcColl = false;
m_manifoldCount = _local9;
_local2 = 0;
while (_local2 < m_manifoldCount) {
_local3 = 0;
while (_local3 < m_manifold[_local2].pointCount) {
_local6 = m_manifold[_local2].points[_local3];
_local7 = _local5[_local6.id.key];
if (_local7){
_local6.normalImpulse = _local7.normalImpulse;
_local6.tangentImpulse = _local7.tangentImpulse;
};
_local3++;
};
_local2++;
};
if (((((!((_local8 == -1))) && ((m_manifoldCount == 1)))) && ((m_manifold[0].pointCount == 1)))){
_local6 = m_manifold[0].points[0];
_local7 = _local5[_local8];
if (_local7){
_local6.normalImpulse = _local7.normalImpulse;
_local6.tangentImpulse = _local7.tangentImpulse;
};
};
} else {
m_arcColl = true;
m_manifoldCount = _local29;
_local2 = 0;
while (_local2 < m_manifoldCount) {
_local3 = 0;
while (_local3 < m_arcManifolds[_local2].pointCount) {
_local6 = m_arcManifolds[_local2].points[_local3];
_local7 = _local5[_local6.id.key];
if (_local7){
_local6.normalImpulse = _local7.normalImpulse;
_local6.tangentImpulse = _local7.tangentImpulse;
};
_local3++;
};
_local2++;
};
if (((((!((_local8 == -1))) && ((m_manifoldCount == 1)))) && ((m_arcManifolds[0].pointCount == 1)))){
_local6 = m_arcManifolds[0].points[0];
_local7 = _local5[_local8];
if (_local7){
_local6.normalImpulse = _local7.normalImpulse;
_local6.tangentImpulse = _local7.tangentImpulse;
};
};
};
}
override public function GetManifolds():Array{
if (m_arcColl){
return (m_arcManifolds);
};
return (m_manifold);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndConcaveArcContact(_arg1, _arg2));
}
}
}//package Physics.Box2D.Dynamics.Contacts
Section 131
//b2PolyContact (Physics.Box2D.Dynamics.Contacts.b2PolyContact)
package Physics.Box2D.Dynamics.Contacts {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.Box2D.Common.*;
public class b2PolyContact extends b2Contact {
public var m_manifold:Array;
private var m0:b2Manifold;
public function b2PolyContact(_arg1:b2Shape, _arg2:b2Shape):void{
m0 = new b2Manifold();
m_manifold = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold[0].pointCount = 0;
}
override public function Evaluate():void{
var _local4:b2ContactPoint;
var _local5:b2ContactPoint;
var _local6:Array;
var _local7:int;
var _local8:b2ContactPoint;
var _local9:uint;
var _local10:int;
var _local11:b2ContactPoint;
var _local12:b2ContactID;
var _local1:b2Manifold = m_manifold[0];
var _local2:Array = m0.points;
var _local3:int;
while (_local3 < _local1.pointCount) {
_local4 = _local2[_local3];
_local5 = _local1.points[_local3];
_local4.normalImpulse = _local5.normalImpulse;
_local4.tangentImpulse = _local5.tangentImpulse;
_local4.id = _local5.id.Copy();
_local3++;
};
m0.pointCount = _local1.pointCount;
b2Collision.b2CollidePoly(_local1, (m_shape1 as b2PolyShape), (m_shape2 as b2PolyShape), false);
if (_local1.pointCount > 0){
_local6 = [false, false];
_local7 = 0;
while (_local7 < _local1.pointCount) {
_local8 = _local1.points[_local7];
_local8.normalImpulse = 0;
_local8.tangentImpulse = 0;
_local9 = _local8.id.key;
_local10 = 0;
while (_local10 < m0.pointCount) {
if (_local6[_local10] == true){
} else {
_local11 = m0.points[_local10];
_local12 = _local11.id;
if (_local12.key == _local9){
_local6[_local10] = true;
_local8.normalImpulse = _local11.normalImpulse;
_local8.tangentImpulse = _local11.tangentImpulse;
break;
};
};
_local10++;
};
_local7++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
}
override public function GetManifolds():Array{
return (m_manifold);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyContact(_arg1, _arg2));
}
}
}//package Physics.Box2D.Dynamics.Contacts
Section 132
//b2DistanceJoint (Physics.Box2D.Dynamics.Joints.b2DistanceJoint)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.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_impulse:Number;
public var m_length:Number;
public var m_mass:Number;
public function b2DistanceJoint(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u = new b2Vec2();
super(_arg1);
_local2 = m_body1.m_R;
_local3 = (_arg1.anchorPoint1.x - m_body1.m_position.x);
_local4 = (_arg1.anchorPoint1.y - m_body1.m_position.y);
m_localAnchor1.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor1.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
_local2 = m_body2.m_R;
_local3 = (_arg1.anchorPoint2.x - m_body2.m_position.x);
_local4 = (_arg1.anchorPoint2.y - m_body2.m_position.y);
m_localAnchor2.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor2.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
_local3 = (_arg1.anchorPoint2.x - _arg1.anchorPoint1.x);
_local4 = (_arg1.anchorPoint2.y - _arg1.anchorPoint1.y);
m_length = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
m_impulse = 0;
}
override public function GetAnchor1():b2Vec2{
return (b2Math.AddVV(m_body1.m_position, b2Math.b2MulMV(m_body1.m_R, m_localAnchor1)));
}
override public function GetAnchor2():b2Vec2{
return (b2Math.AddVV(m_body2.m_position, b2Math.b2MulMV(m_body2.m_R, m_localAnchor2)));
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(m_u);
_local2.Multiply((m_impulse * _arg1));
return (_local2);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
_local1 = m_body1.m_R;
var _local2:Number = ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y));
var _local3:Number = ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y));
_local1 = m_body2.m_R;
var _local4:Number = ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y));
var _local5:Number = ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y));
var _local6:Number = (((m_body2.m_position.x + _local4) - m_body1.m_position.x) - _local2);
var _local7:Number = (((m_body2.m_position.y + _local5) - m_body1.m_position.y) - _local3);
var _local8:Number = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
_local6 = (_local6 / _local8);
_local7 = (_local7 / _local8);
var _local9:Number = (_local8 - m_length);
_local9 = b2Math.b2Clamp(_local9, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local10:Number = (-(m_mass) * _local9);
m_u.Set(_local6, _local7);
var _local11:Number = (_local10 * m_u.x);
var _local12:Number = (_local10 * m_u.y);
m_body1.m_position.x = (m_body1.m_position.x - (m_body1.m_invMass * _local11));
m_body1.m_position.y = (m_body1.m_position.y - (m_body1.m_invMass * _local12));
m_body1.m_rotation = (m_body1.m_rotation - (m_body1.m_invI * ((_local2 * _local12) - (_local3 * _local11))));
m_body2.m_position.x = (m_body2.m_position.x + (m_body2.m_invMass * _local11));
m_body2.m_position.y = (m_body2.m_position.y + (m_body2.m_invMass * _local12));
m_body2.m_rotation = (m_body2.m_rotation + (m_body2.m_invI * ((_local4 * _local12) - (_local5 * _local11))));
m_body1.m_R.Set(m_body1.m_rotation);
m_body2.m_R.Set(m_body2.m_rotation);
return ((b2Math.b2Abs(_local9) < b2Settings.b2_linearSlop));
}
override public function PrepareVelocitySolver():void{
var _local1:b2Mat22;
var _local3:Number;
var _local5:Number;
var _local9:Number;
var _local10:Number;
_local1 = m_body1.m_R;
var _local2:Number = ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y));
_local3 = ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y));
_local1 = m_body2.m_R;
var _local4:Number = ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y));
_local5 = ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y));
m_u.x = (((m_body2.m_position.x + _local4) - m_body1.m_position.x) - _local2);
m_u.y = (((m_body2.m_position.y + _local5) - m_body1.m_position.y) - _local3);
var _local6:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local6 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local6));
} else {
m_u.SetZero();
};
var _local7:Number = ((_local2 * m_u.y) - (_local3 * m_u.x));
var _local8:Number = ((_local4 * m_u.y) - (_local5 * m_u.x));
m_mass = (((m_body1.m_invMass + ((m_body1.m_invI * _local7) * _local7)) + m_body2.m_invMass) + ((m_body2.m_invI * _local8) * _local8));
m_mass = (1 / m_mass);
if (b2World.s_enableWarmStarting){
_local9 = (m_impulse * m_u.x);
_local10 = (m_impulse * m_u.y);
m_body1.m_linearVelocity.x = (m_body1.m_linearVelocity.x - (m_body1.m_invMass * _local9));
m_body1.m_linearVelocity.y = (m_body1.m_linearVelocity.y - (m_body1.m_invMass * _local10));
m_body1.m_angularVelocity = (m_body1.m_angularVelocity - (m_body1.m_invI * ((_local2 * _local10) - (_local3 * _local9))));
m_body2.m_linearVelocity.x = (m_body2.m_linearVelocity.x + (m_body2.m_invMass * _local9));
m_body2.m_linearVelocity.y = (m_body2.m_linearVelocity.y + (m_body2.m_invMass * _local10));
m_body2.m_angularVelocity = (m_body2.m_angularVelocity + (m_body2.m_invI * ((_local4 * _local10) - (_local5 * _local9))));
} else {
m_impulse = 0;
};
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local5:Number;
_local2 = m_body1.m_R;
var _local3:Number = ((_local2.col1.x * m_localAnchor1.x) + (_local2.col2.x * m_localAnchor1.y));
var _local4:Number = ((_local2.col1.y * m_localAnchor1.x) + (_local2.col2.y * m_localAnchor1.y));
_local2 = m_body2.m_R;
_local5 = ((_local2.col1.x * m_localAnchor2.x) + (_local2.col2.x * m_localAnchor2.y));
var _local6:Number = ((_local2.col1.y * m_localAnchor2.x) + (_local2.col2.y * m_localAnchor2.y));
var _local7:Number = (m_body1.m_linearVelocity.x + (-(m_body1.m_angularVelocity) * _local4));
var _local8:Number = (m_body1.m_linearVelocity.y + (m_body1.m_angularVelocity * _local3));
var _local9:Number = (m_body2.m_linearVelocity.x + (-(m_body2.m_angularVelocity) * _local6));
var _local10:Number = (m_body2.m_linearVelocity.y + (m_body2.m_angularVelocity * _local5));
var _local11:Number = ((m_u.x * (_local9 - _local7)) + (m_u.y * (_local10 - _local8)));
var _local12:Number = (-(m_mass) * _local11);
m_impulse = (m_impulse + _local12);
var _local13:Number = (_local12 * m_u.x);
var _local14:Number = (_local12 * m_u.y);
m_body1.m_linearVelocity.x = (m_body1.m_linearVelocity.x - (m_body1.m_invMass * _local13));
m_body1.m_linearVelocity.y = (m_body1.m_linearVelocity.y - (m_body1.m_invMass * _local14));
m_body1.m_angularVelocity = (m_body1.m_angularVelocity - (m_body1.m_invI * ((_local3 * _local14) - (_local4 * _local13))));
m_body2.m_linearVelocity.x = (m_body2.m_linearVelocity.x + (m_body2.m_invMass * _local13));
m_body2.m_linearVelocity.y = (m_body2.m_linearVelocity.y + (m_body2.m_invMass * _local14));
m_body2.m_angularVelocity = (m_body2.m_angularVelocity + (m_body2.m_invI * ((_local5 * _local14) - (_local6 * _local13))));
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 133
//b2DistanceJointDef (Physics.Box2D.Dynamics.Joints.b2DistanceJointDef)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
public class b2DistanceJointDef extends b2JointDef {
public var anchorPoint1:b2Vec2;
public var anchorPoint2:b2Vec2;
public function b2DistanceJointDef(){
anchorPoint1 = new b2Vec2();
anchorPoint2 = new b2Vec2();
super();
type = b2Joint.e_distanceJoint;
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 134
//b2GearJoint (Physics.Box2D.Dynamics.Joints.b2GearJoint)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Common.*;
public class b2GearJoint extends b2Joint {
public var m_ground2:b2Body;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_revolute2:b2RevoluteJoint;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_ratio:Number;
public var m_mass:Number;
public var m_impulse:Number;
public var m_prismatic2:b2PrismaticJoint;
public var m_ground1:b2Body;
public var m_revolute1:b2RevoluteJoint;
public var m_prismatic1:b2PrismaticJoint;
public var m_constant:Number;
public var m_J:b2Jacobian;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local2:Number;
var _local3:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.m_body1;
m_body1 = _arg1.joint1.m_body2;
if (_arg1.joint1.m_type == b2Joint.e_revoluteJoint){
m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
m_groundAnchor1.SetV(m_revolute1.m_localAnchor1);
m_localAnchor1.SetV(m_revolute1.m_localAnchor2);
_local2 = m_revolute1.GetJointAngle();
} else {
m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1);
m_localAnchor1.SetV(m_prismatic1.m_localAnchor2);
_local2 = m_prismatic1.GetJointTranslation();
};
m_ground2 = _arg1.joint2.m_body1;
m_body2 = _arg1.joint2.m_body2;
if (_arg1.joint2.m_type == b2Joint.e_revoluteJoint){
m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
m_groundAnchor2.SetV(m_revolute2.m_localAnchor1);
m_localAnchor2.SetV(m_revolute2.m_localAnchor2);
_local3 = m_revolute2.GetJointAngle();
} else {
m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1);
m_localAnchor2.SetV(m_prismatic2.m_localAnchor2);
_local3 = m_prismatic2.GetJointTranslation();
};
m_ratio = _arg1.ratio;
m_constant = (_local2 + (m_ratio * _local3));
m_impulse = 0;
}
override public function GetAnchor1():b2Vec2{
var _local1:b2Mat22 = m_body1.m_R;
return (new b2Vec2((m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y))), (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y)))));
}
override public function GetAnchor2():b2Vec2{
var _local1:b2Mat22 = m_body2.m_R;
return (new b2Vec2((m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y))), (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y)))));
}
override public function PrepareVelocitySolver():void{
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:b2Mat22;
var _local10:b2Vec2;
var _local11:Number;
var _local1:b2Body = m_ground1;
var _local2:b2Body = m_ground2;
_local3 = m_body1;
_local4 = m_body2;
var _local12:Number = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angular1 = -1;
_local12 = (_local12 + _local3.m_invI);
} else {
_local9 = _local1.m_R;
_local10 = m_prismatic1.m_localXAxis1;
_local5 = ((_local9.col1.x * _local10.x) + (_local9.col2.x * _local10.y));
_local6 = ((_local9.col1.y * _local10.x) + (_local9.col2.y * _local10.y));
_local9 = _local3.m_R;
_local7 = ((_local9.col1.x * m_localAnchor1.x) + (_local9.col2.x * m_localAnchor1.y));
_local8 = ((_local9.col1.y * m_localAnchor1.x) + (_local9.col2.y * m_localAnchor1.y));
_local11 = ((_local7 * _local6) - (_local8 * _local5));
m_J.linear1.Set(-(_local5), -(_local6));
m_J.angular1 = -(_local11);
_local12 = (_local12 + (_local3.m_invMass + ((_local3.m_invI * _local11) * _local11)));
};
if (m_revolute2){
m_J.angular2 = -(m_ratio);
_local12 = (_local12 + ((m_ratio * m_ratio) * _local4.m_invI));
} else {
_local9 = _local2.m_R;
_local10 = m_prismatic2.m_localXAxis1;
_local5 = ((_local9.col1.x * _local10.x) + (_local9.col2.x * _local10.y));
_local6 = ((_local9.col1.y * _local10.x) + (_local9.col2.y * _local10.y));
_local9 = _local4.m_R;
_local7 = ((_local9.col1.x * m_localAnchor2.x) + (_local9.col2.x * m_localAnchor2.y));
_local8 = ((_local9.col1.y * m_localAnchor2.x) + (_local9.col2.y * m_localAnchor2.y));
_local11 = ((_local7 * _local6) - (_local8 * _local5));
m_J.linear2.Set((-(m_ratio) * _local5), (-(m_ratio) * _local6));
m_J.angular2 = (-(m_ratio) * _local11);
_local12 = (_local12 + ((m_ratio * m_ratio) * (_local4.m_invMass + ((_local4.m_invI * _local11) * _local11))));
};
m_mass = (1 / _local12);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * m_impulse) * m_J.linear1.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * m_impulse) * m_J.linear1.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * m_impulse) * m_J.angular1));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * m_impulse) * m_J.linear2.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * m_impulse) * m_J.linear2.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * m_impulse) * m_J.angular2));
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2());
}
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_position.x = (_local2.m_position.x + ((_local2.m_invMass * _local7) * m_J.linear1.x));
_local2.m_position.y = (_local2.m_position.y + ((_local2.m_invMass * _local7) * m_J.linear1.y));
_local2.m_rotation = (_local2.m_rotation + ((_local2.m_invI * _local7) * m_J.angular1));
_local3.m_position.x = (_local3.m_position.x + ((_local3.m_invMass * _local7) * m_J.linear2.x));
_local3.m_position.y = (_local3.m_position.y + ((_local3.m_invMass * _local7) * m_J.linear2.y));
_local3.m_rotation = (_local3.m_rotation + ((_local3.m_invI * _local7) * m_J.angular2));
_local2.m_R.Set(_local2.m_rotation);
_local3.m_R.Set(_local3.m_rotation);
return ((_local1 < b2Settings.b2_linearSlop));
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local5:Number = (-(m_mass) * _local4);
m_impulse = (m_impulse + _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local5) * m_J.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local5) * m_J.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local5) * m_J.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local5) * m_J.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local5) * m_J.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local5) * m_J.angular2));
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 135
//b2GearJointDef (Physics.Box2D.Dynamics.Joints.b2GearJointDef)
package Physics.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 Physics.Box2D.Dynamics.Joints
Section 136
//b2Jacobian (Physics.Box2D.Dynamics.Joints.b2Jacobian)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
public class b2Jacobian {
public var linear1:b2Vec2;
public var linear2:b2Vec2;
public var angular1:Number;
public var angular2:Number;
public function b2Jacobian(){
linear1 = new b2Vec2();
linear2 = new b2Vec2();
super();
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4)));
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 137
//b2Joint (Physics.Box2D.Dynamics.Joints.b2Joint)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
public class b2Joint {
public var m_islandFlag:Boolean;
public var m_collideConnected:Boolean;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_type:int;
public var m_node1:b2JointNode;
public var m_node2:b2JointNode;
public var m_userData;
public var m_body1:b2Body;
public var m_body2:b2Body;
public static const e_unknownJoint:int = 0;
public static const e_inactiveLimit:int = 0;
public static const e_atUpperLimit:int = 2;
public static const e_atLowerLimit:int = 1;
public static const e_gearJoint:int = 6;
public static const e_revoluteJoint:int = 1;
public static const e_equalLimits:int = 3;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_prismaticJoint:int = 2;
public static const e_mouseJoint:int = 5;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new b2JointNode();
m_node2 = new b2JointNode();
super();
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_body1 = _arg1.body1;
m_body2 = _arg1.body2;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetType():int{
return (m_type);
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function PrepareVelocitySolver():void{
}
public function PreparePositionSolver():void{
}
public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetUserData(){
return (m_userData);
}
public function GetReactionForce(_arg1:Number):b2Vec2{
return (null);
}
public function SolvePositionConstraints():Boolean{
return (false);
}
public function GetBody1():b2Body{
return (m_body1);
}
public function GetBody2():b2Body{
return (m_body2);
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
default:
break;
};
return (_local3);
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 138
//b2JointDef (Physics.Box2D.Dynamics.Joints.b2JointDef)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Dynamics.*;
public class b2JointDef {
public var body2:b2Body;
public var type:int;
public var userData;
public var collideConnected:Boolean;
public var body1:b2Body;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 139
//b2JointNode (Physics.Box2D.Dynamics.Joints.b2JointNode)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Dynamics.*;
public class b2JointNode {
public var other:b2Body;
public var next:b2JointNode;
public var prev:b2JointNode;
public var joint:b2Joint;
}
}//package Physics.Box2D.Dynamics.Joints
Section 140
//b2MouseJoint (Physics.Box2D.Dynamics.Joints.b2MouseJoint)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
private var K1:b2Mat22;
public var m_beta:Number;
private var K:b2Mat22;
private var K2:b2Mat22;
public var m_target:b2Vec2;
public var m_gamma:Number;
public var m_impulse:b2Vec2;
public var m_ptpMass:b2Mat22;
public var m_C:b2Vec2;
public var m_maxForce:Number;
public var m_localAnchor:b2Vec2;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local2:Number;
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
m_localAnchor = new b2Vec2();
m_target = new b2Vec2();
m_impulse = new b2Vec2();
m_ptpMass = new b2Mat22();
m_C = new b2Vec2();
super(_arg1);
m_target.SetV(_arg1.target);
_local2 = (m_target.x - m_body2.m_position.x);
var _local3:Number = (m_target.y - m_body2.m_position.y);
m_localAnchor.x = ((_local2 * m_body2.m_R.col1.x) + (_local3 * m_body2.m_R.col1.y));
m_localAnchor.y = ((_local2 * m_body2.m_R.col2.x) + (_local3 * m_body2.m_R.col2.y));
m_maxForce = _arg1.maxForce;
m_impulse.SetZero();
var _local4:Number = m_body2.m_mass;
var _local5:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
var _local6:Number = (((2 * _local4) * _arg1.dampingRatio) * _local5);
var _local7:Number = ((_local4 * _local5) * _local5);
m_gamma = (1 / (_local6 + (_arg1.timeStep * _local7)));
m_beta = ((_arg1.timeStep * _local7) / (_local6 + (_arg1.timeStep * _local7)));
}
public function SetTarget(_arg1:b2Vec2):void{
m_body2.WakeUp();
m_target = _arg1;
}
override public function GetAnchor2():b2Vec2{
var _local1:b2Vec2 = b2Math.b2MulMV(m_body2.m_R, m_localAnchor);
_local1.Add(m_body2.m_position);
return (_local1);
}
override public function GetAnchor1():b2Vec2{
return (m_target);
}
override public function PrepareVelocitySolver():void{
var _local1:b2Body;
var _local2:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local8:Number;
_local1 = m_body2;
_local2 = _local1.m_R;
var _local3:Number = ((_local2.col1.x * m_localAnchor.x) + (_local2.col2.x * m_localAnchor.y));
_local4 = ((_local2.col1.y * m_localAnchor.x) + (_local2.col2.y * m_localAnchor.y));
_local5 = _local1.m_invMass;
_local6 = _local1.m_invI;
K1.col1.x = _local5;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local5;
K2.col1.x = ((_local6 * _local4) * _local4);
K2.col2.x = ((-(_local6) * _local3) * _local4);
K2.col1.y = ((-(_local6) * _local3) * _local4);
K2.col2.y = ((_local6 * _local3) * _local3);
K.SetM(K1);
K.AddM(K2);
K.col1.x = (K.col1.x + m_gamma);
K.col2.y = (K.col2.y + m_gamma);
K.Invert(m_ptpMass);
m_C.x = ((_local1.m_position.x + _local3) - m_target.x);
m_C.y = ((_local1.m_position.y + _local4) - m_target.y);
_local1.m_angularVelocity = (_local1.m_angularVelocity * 0.98);
var _local7:Number = m_impulse.x;
_local8 = m_impulse.y;
_local1.m_linearVelocity.x = (_local1.m_linearVelocity.x + (_local5 * _local7));
_local1.m_linearVelocity.y = (_local1.m_linearVelocity.y + (_local5 * _local8));
_local1.m_angularVelocity = (_local1.m_angularVelocity + (_local6 * ((_local3 * _local8) - (_local4 * _local7))));
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(m_impulse);
_local2.Multiply(_arg1);
return (_local2);
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local3:b2Mat22;
var _local2:b2Body = m_body2;
_local3 = _local2.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor.x) + (_local3.col2.x * m_localAnchor.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor.x) + (_local3.col2.y * m_localAnchor.y));
var _local6:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local5));
var _local7:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local4));
_local3 = m_ptpMass;
var _local8:Number = ((_local6 + ((m_beta * _arg1.inv_dt) * m_C.x)) + (m_gamma * m_impulse.x));
var _local9:Number = ((_local7 + ((m_beta * _arg1.inv_dt) * m_C.y)) + (m_gamma * m_impulse.y));
var _local10:Number = -(((_local3.col1.x * _local8) + (_local3.col2.x * _local9)));
var _local11:Number = -(((_local3.col1.y * _local8) + (_local3.col2.y * _local9)));
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 > (_arg1.dt * m_maxForce)){
m_impulse.Multiply(((_arg1.dt * m_maxForce) / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local10));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local11));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local4 * _local11) - (_local5 * _local10))));
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 141
//b2MouseJointDef (Physics.Box2D.Dynamics.Joints.b2MouseJointDef)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var timeStep:Number;
public var target:b2Vec2;
public var maxForce:Number;
public var dampingRatio:Number;
public var frequencyHz:Number;
public function b2MouseJointDef(){
target = new b2Vec2();
super();
type = b2Joint.e_mouseJoint;
maxForce = 0;
frequencyHz = 5;
dampingRatio = 0.7;
timeStep = (1 / 60);
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 142
//b2PrismaticJoint (Physics.Box2D.Dynamics.Joints.b2PrismaticJoint)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Common.*;
public class b2PrismaticJoint extends b2Joint {
public var m_initialAngle:Number;
public var m_localXAxis1:b2Vec2;
public var m_lowerTranslation:Number;
public var m_angularMass:Number;
public var m_enableLimit:Boolean;
public var m_maxMotorForce:Number;
public var m_limitState:int;
public var m_localYAxis1:b2Vec2;
public var m_motorMass:Number;
public var m_linearImpulse:Number;
public var m_upperTranslation:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_angularImpulse:Number;
public var m_linearMass:Number;
public var m_motorImpulse:Number;
public var m_limitImpulse:Number;
public var m_motorJacobian:b2Jacobian;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_enableMotor:Boolean;
public var m_linearJacobian:b2Jacobian;
public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_localXAxis1 = new b2Vec2();
m_localYAxis1 = new b2Vec2();
m_linearJacobian = new b2Jacobian();
m_motorJacobian = new b2Jacobian();
super(_arg1);
_local2 = m_body1.m_R;
_local3 = (_arg1.anchorPoint.x - m_body1.m_position.x);
_local4 = (_arg1.anchorPoint.y - m_body1.m_position.y);
m_localAnchor1.Set(((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)), ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)));
_local2 = m_body2.m_R;
_local3 = (_arg1.anchorPoint.x - m_body2.m_position.x);
_local4 = (_arg1.anchorPoint.y - m_body2.m_position.y);
m_localAnchor2.Set(((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)), ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)));
_local2 = m_body1.m_R;
_local3 = _arg1.axis.x;
_local4 = _arg1.axis.y;
m_localXAxis1.Set(((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y)), ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y)));
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_initialAngle = (m_body2.m_rotation - m_body1.m_rotation);
m_linearJacobian.SetZero();
m_linearMass = 0;
m_linearImpulse = 0;
m_angularMass = 0;
m_angularImpulse = 0;
m_motorJacobian.SetZero();
m_motorMass = 0;
m_motorImpulse = 0;
m_limitImpulse = 0;
m_limitPositionImpulse = 0;
m_lowerTranslation = _arg1.lowerTranslation;
m_upperTranslation = _arg1.upperTranslation;
m_maxMotorForce = _arg1.motorForce;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
var _local1:b2Body = m_body1;
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(m_localAnchor1);
_local2.MulM(_local1.m_R);
_local2.Add(_local1.m_position);
return (_local2);
}
override public function GetAnchor2():b2Vec2{
var _local1:b2Body = m_body2;
var _local2:b2Vec2 = new b2Vec2();
_local2.SetV(m_localAnchor2);
_local2.MulM(_local1.m_R);
_local2.Add(_local1.m_position);
return (_local2);
}
override public function PrepareVelocitySolver():void{
var _local3:b2Mat22;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
var _local6:Number = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
var _local7:Number = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
var _local8:Number = _local1.m_invMass;
var _local9:Number = _local2.m_invMass;
var _local10:Number = _local1.m_invI;
var _local11:Number = _local2.m_invI;
_local3 = _local1.m_R;
var _local12:Number = ((_local3.col1.x * m_localYAxis1.x) + (_local3.col2.x * m_localYAxis1.y));
var _local13:Number = ((_local3.col1.y * m_localYAxis1.x) + (_local3.col2.y * m_localYAxis1.y));
var _local14:Number = ((_local2.m_position.x + _local6) - _local1.m_position.x);
var _local15:Number = ((_local2.m_position.y + _local7) - _local1.m_position.y);
m_linearJacobian.linear1.x = -(_local12);
m_linearJacobian.linear1.y = -(_local13);
m_linearJacobian.linear2.x = _local12;
m_linearJacobian.linear2.y = _local13;
m_linearJacobian.angular1 = -(((_local14 * _local13) - (_local15 * _local12)));
m_linearJacobian.angular2 = ((_local6 * _local13) - (_local7 * _local12));
m_linearMass = (((_local8 + ((_local10 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local9) + ((_local11 * m_linearJacobian.angular2) * m_linearJacobian.angular2));
m_linearMass = (1 / m_linearMass);
m_angularMass = (1 / (_local10 + _local11));
if (((m_enableLimit) || (m_enableMotor))){
_local3 = _local1.m_R;
_local16 = ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y));
_local17 = ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y));
m_motorJacobian.linear1.x = -(_local16);
m_motorJacobian.linear1.y = -(_local17);
m_motorJacobian.linear2.x = _local16;
m_motorJacobian.linear2.y = _local17;
m_motorJacobian.angular1 = -(((_local14 * _local17) - (_local15 * _local16)));
m_motorJacobian.angular2 = ((_local6 * _local17) - (_local7 * _local16));
m_motorMass = (((_local8 + ((_local10 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local9) + ((_local11 * m_motorJacobian.angular2) * m_motorJacobian.angular2));
m_motorMass = (1 / m_motorMass);
if (m_enableLimit){
_local18 = (_local14 - _local4);
_local19 = (_local15 - _local5);
_local20 = ((_local16 * _local18) + (_local17 * _local19));
if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local20 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitImpulse = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local20 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitImpulse = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitImpulse = 0;
};
};
};
};
};
if (m_enableMotor == false){
m_motorImpulse = 0;
};
if (m_enableLimit == false){
m_limitImpulse = 0;
};
if (b2World.s_enableWarmStarting){
_local21 = ((m_linearImpulse * m_linearJacobian.linear1.x) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear1.x));
_local22 = ((m_linearImpulse * m_linearJacobian.linear1.y) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear1.y));
_local23 = ((m_linearImpulse * m_linearJacobian.linear2.x) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear2.x));
_local24 = ((m_linearImpulse * m_linearJacobian.linear2.y) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.linear2.y));
_local25 = (((m_linearImpulse * m_linearJacobian.angular1) - m_angularImpulse) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.angular1));
_local26 = (((m_linearImpulse * m_linearJacobian.angular2) + m_angularImpulse) + ((m_motorImpulse + m_limitImpulse) * m_motorJacobian.angular2));
_local1.m_linearVelocity.x = (_local1.m_linearVelocity.x + (_local8 * _local21));
_local1.m_linearVelocity.y = (_local1.m_linearVelocity.y + (_local8 * _local22));
_local1.m_angularVelocity = (_local1.m_angularVelocity + (_local10 * _local25));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local9 * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local9 * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local11 * _local26));
} else {
m_linearImpulse = 0;
m_angularImpulse = 0;
m_limitImpulse = 0;
m_motorImpulse = 0;
};
m_limitPositionImpulse = 0;
}
public function GetJointTranslation():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
var _local6:Number = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
var _local7:Number = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
var _local8:Number = (_local1.m_position.x + _local4);
var _local9:Number = (_local1.m_position.y + _local5);
var _local10:Number = (_local2.m_position.x + _local6);
var _local11:Number = (_local2.m_position.y + _local7);
var _local12:Number = (_local10 - _local8);
var _local13:Number = (_local11 - _local9);
_local3 = _local1.m_R;
var _local14:Number = ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y));
var _local15:Number = ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y));
var _local16:Number = ((_local14 * _local12) + (_local15 * _local13));
return (_local16);
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
var _local3:b2Mat22;
var _local2:Number = (_arg1 * m_limitImpulse);
_local3 = m_body1.m_R;
var _local4:Number = (_local2 * ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y)));
var _local5:Number = (_local2 * ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y)));
var _local6:Number = (_local2 * ((_local3.col1.x * m_localYAxis1.x) + (_local3.col2.x * m_localYAxis1.y)));
var _local7:Number = (_local2 * ((_local3.col1.y * m_localYAxis1.x) + (_local3.col2.y * m_localYAxis1.y)));
return (new b2Vec2((_local4 + _local6), (_local5 + _local7)));
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local9:b2Mat22;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31: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_R;
var _local10:Number = ((_local9.col1.x * m_localAnchor1.x) + (_local9.col2.x * m_localAnchor1.y));
var _local11:Number = ((_local9.col1.y * m_localAnchor1.x) + (_local9.col2.y * m_localAnchor1.y));
_local9 = _local4.m_R;
var _local12:Number = ((_local9.col1.x * m_localAnchor2.x) + (_local9.col2.x * m_localAnchor2.y));
var _local13:Number = ((_local9.col1.y * m_localAnchor2.x) + (_local9.col2.y * m_localAnchor2.y));
var _local14:Number = (_local3.m_position.x + _local10);
var _local15:Number = (_local3.m_position.y + _local11);
var _local16:Number = (_local4.m_position.x + _local12);
var _local17:Number = (_local4.m_position.y + _local13);
var _local18:Number = (_local16 - _local14);
var _local19:Number = (_local17 - _local15);
_local9 = _local3.m_R;
var _local20:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
var _local21:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
var _local22:Number = ((_local20 * _local18) + (_local21 * _local19));
_local22 = b2Math.b2Clamp(_local22, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local23:Number = (-(m_linearMass) * _local22);
_local3.m_position.x = (_local3.m_position.x + ((_local5 * _local23) * m_linearJacobian.linear1.x));
_local3.m_position.y = (_local3.m_position.y + ((_local5 * _local23) * m_linearJacobian.linear1.y));
_local3.m_rotation = (_local3.m_rotation + ((_local7 * _local23) * m_linearJacobian.angular1));
_local4.m_position.x = (_local4.m_position.x + ((_local6 * _local23) * m_linearJacobian.linear2.x));
_local4.m_position.y = (_local4.m_position.y + ((_local6 * _local23) * m_linearJacobian.linear2.y));
_local4.m_rotation = (_local4.m_rotation + ((_local8 * _local23) * m_linearJacobian.angular2));
var _local24:Number = b2Math.b2Abs(_local22);
var _local25:Number = ((_local4.m_rotation - _local3.m_rotation) - m_initialAngle);
_local25 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
var _local26:Number = (-(m_angularMass) * _local25);
_local3.m_rotation = (_local3.m_rotation - (_local3.m_invI * _local26));
_local3.m_R.Set(_local3.m_rotation);
_local4.m_rotation = (_local4.m_rotation + (_local4.m_invI * _local26));
_local4.m_R.Set(_local4.m_rotation);
var _local27:Number = b2Math.b2Abs(_local25);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_R;
_local10 = ((_local9.col1.x * m_localAnchor1.x) + (_local9.col2.x * m_localAnchor1.y));
_local11 = ((_local9.col1.y * m_localAnchor1.x) + (_local9.col2.y * m_localAnchor1.y));
_local9 = _local4.m_R;
_local12 = ((_local9.col1.x * m_localAnchor2.x) + (_local9.col2.x * m_localAnchor2.y));
_local13 = ((_local9.col1.y * m_localAnchor2.x) + (_local9.col2.y * m_localAnchor2.y));
_local14 = (_local3.m_position.x + _local10);
_local15 = (_local3.m_position.y + _local11);
_local16 = (_local4.m_position.x + _local12);
_local17 = (_local4.m_position.y + _local13);
_local18 = (_local16 - _local14);
_local19 = (_local17 - _local15);
_local9 = _local3.m_R;
_local28 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y));
_local29 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y));
_local30 = ((_local28 * _local18) + (_local29 * _local19));
_local31 = 0;
if (m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local30, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local31 = (-(m_motorMass) * _local1);
_local24 = b2Math.b2Max(_local24, b2Math.b2Abs(_local25));
} else {
if (m_limitState == e_atLowerLimit){
_local1 = (_local30 - m_lowerTranslation);
_local24 = b2Math.b2Max(_local24, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local31 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local31), 0);
_local31 = (m_limitPositionImpulse - _local2);
} else {
if (m_limitState == e_atUpperLimit){
_local1 = (_local30 - m_upperTranslation);
_local24 = b2Math.b2Max(_local24, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local31 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local31), 0);
_local31 = (m_limitPositionImpulse - _local2);
};
};
};
_local3.m_position.x = (_local3.m_position.x + ((_local5 * _local31) * m_motorJacobian.linear1.x));
_local3.m_position.y = (_local3.m_position.y + ((_local5 * _local31) * m_motorJacobian.linear1.y));
_local3.m_rotation = (_local3.m_rotation + ((_local7 * _local31) * m_motorJacobian.angular1));
_local3.m_R.Set(_local3.m_rotation);
_local4.m_position.x = (_local4.m_position.x + ((_local6 * _local31) * m_motorJacobian.linear2.x));
_local4.m_position.y = (_local4.m_position.y + ((_local6 * _local31) * m_motorJacobian.linear2.y));
_local4.m_rotation = (_local4.m_rotation + ((_local8 * _local31) * m_motorJacobian.angular2));
_local4.m_R.Set(_local4.m_rotation);
};
return ((((_local24 <= b2Settings.b2_linearSlop)) && ((_local27 <= b2Settings.b2_angularSlop))));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetJointSpeed():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
var _local6:Number = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
var _local7:Number = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
var _local8:Number = (_local1.m_position.x + _local4);
var _local9:Number = (_local1.m_position.y + _local5);
var _local10:Number = (_local2.m_position.x + _local6);
var _local11:Number = (_local2.m_position.y + _local7);
var _local12:Number = (_local10 - _local8);
var _local13:Number = (_local11 - _local9);
_local3 = _local1.m_R;
var _local14:Number = ((_local3.col1.x * m_localXAxis1.x) + (_local3.col2.x * m_localXAxis1.y));
var _local15:Number = ((_local3.col1.y * m_localXAxis1.x) + (_local3.col2.y * m_localXAxis1.y));
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 = (((_local12 * (-(_local18) * _local15)) + (_local13 * (_local18 * _local14))) + ((_local14 * (((_local17.x + (-(_local19) * _local7)) - _local16.x) - (-(_local18) * _local5))) + (_local15 * (((_local17.y + (_local19 * _local6)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
public function GetMotorForce(_arg1:Number):Number{
return ((_arg1 * m_motorImpulse));
}
public function SetMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
override public function GetReactionTorque(_arg1:Number):Number{
return ((_arg1 * m_angularImpulse));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local8:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = _local2.m_invMass;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local2.m_invI;
var _local7:Number = _local3.m_invI;
var _local9:Number = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local10:Number = (-(m_linearMass) * _local9);
m_linearImpulse = (m_linearImpulse + _local10);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local10) * m_linearJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local10) * m_linearJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local10) * m_linearJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local10) * m_linearJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local10) * m_linearJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local10) * m_linearJacobian.angular2));
var _local11:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity);
var _local12:Number = (-(m_angularMass) * _local11);
m_angularImpulse = (m_angularImpulse + _local12);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local12));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local12));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local13 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed);
_local14 = (-(m_motorMass) * _local13);
_local15 = m_motorImpulse;
m_motorImpulse = b2Math.b2Clamp((m_motorImpulse + _local14), (-(_arg1.dt) * m_maxMotorForce), (_arg1.dt * m_maxMotorForce));
_local14 = (m_motorImpulse - _local15);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local14) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local14) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local14) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local14) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local14) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local14) * m_motorJacobian.angular2));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local16 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local17 = (-(m_motorMass) * _local16);
if (m_limitState == e_equalLimits){
m_limitImpulse = (m_limitImpulse + _local17);
} else {
if (m_limitState == e_atLowerLimit){
_local8 = m_limitImpulse;
m_limitImpulse = b2Math.b2Max((m_limitImpulse + _local17), 0);
_local17 = (m_limitImpulse - _local8);
} else {
if (m_limitState == e_atUpperLimit){
_local8 = m_limitImpulse;
m_limitImpulse = b2Math.b2Min((m_limitImpulse + _local17), 0);
_local17 = (m_limitImpulse - _local8);
};
};
};
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local17) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local17) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local17) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local17) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local17) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local17) * m_motorJacobian.angular2));
};
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 143
//b2PrismaticJointDef (Physics.Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
public class b2PrismaticJointDef extends b2JointDef {
public var axis:b2Vec2;
public var upperTranslation:Number;
public var lowerTranslation:Number;
public var motorSpeed:Number;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public var anchorPoint:b2Vec2;
public var motorForce:Number;
public function b2PrismaticJointDef(){
type = b2Joint.e_prismaticJoint;
anchorPoint = new b2Vec2(0, 0);
axis = new b2Vec2(0, 0);
lowerTranslation = 0;
upperTranslation = 0;
motorForce = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 144
//b2PulleyJoint (Physics.Box2D.Dynamics.Joints.b2PulleyJoint)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Common.*;
public class b2PulleyJoint extends b2Joint {
public var m_limitState1:int;
public var m_limitState2:int;
public var m_ground:b2Body;
public var m_maxLength2:Number;
public var m_maxLength1:Number;
public var m_limitPositionImpulse1:Number;
public var m_limitPositionImpulse2:Number;
public var m_pulleyImpulse:Number;
public var m_constant:Number;
public var m_ratio:Number;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_limitMass1:Number;
public var m_limitMass2:Number;
public var m_limitImpulse1:Number;
public var m_pulleyMass:Number;
public var m_u1:b2Vec2;
public var m_u2:b2Vec2;
public var m_limitImpulse2:Number;
public static var b2_minPulleyLength:Number = 1;
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.groundPoint1.x - m_ground.m_position.x);
m_groundAnchor1.y = (_arg1.groundPoint1.y - m_ground.m_position.y);
m_groundAnchor2.x = (_arg1.groundPoint2.x - m_ground.m_position.x);
m_groundAnchor2.y = (_arg1.groundPoint2.y - m_ground.m_position.y);
_local2 = m_body1.m_R;
_local3 = (_arg1.anchorPoint1.x - m_body1.m_position.x);
_local4 = (_arg1.anchorPoint1.y - m_body1.m_position.y);
m_localAnchor1.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor1.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
_local2 = m_body2.m_R;
_local3 = (_arg1.anchorPoint2.x - m_body2.m_position.x);
_local4 = (_arg1.anchorPoint2.y - m_body2.m_position.y);
m_localAnchor2.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor2.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
m_ratio = _arg1.ratio;
_local3 = (_arg1.groundPoint1.x - _arg1.anchorPoint1.x);
_local4 = (_arg1.groundPoint1.y - _arg1.anchorPoint1.y);
var _local5:Number = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
_local3 = (_arg1.groundPoint2.x - _arg1.anchorPoint2.x);
_local4 = (_arg1.groundPoint2.y - _arg1.anchorPoint2.y);
var _local6:Number = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
var _local7:Number = b2Math.b2Max((0.5 * b2_minPulleyLength), _local5);
var _local8:Number = b2Math.b2Max((0.5 * b2_minPulleyLength), _local6);
m_constant = (_local7 + (m_ratio * _local8));
m_maxLength1 = b2Math.b2Clamp(_arg1.maxLength1, _local7, (m_constant - (m_ratio * b2_minPulleyLength)));
m_maxLength2 = b2Math.b2Clamp(_arg1.maxLength2, _local8, ((m_constant - b2_minPulleyLength) / m_ratio));
m_pulleyImpulse = 0;
m_limitImpulse1 = 0;
m_limitImpulse2 = 0;
}
public function GetLength1():Number{
var _local1:b2Mat22;
_local1 = m_body1.m_R;
var _local2:Number = (m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y)));
var _local3:Number = (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y)));
var _local4:Number = (_local2 - (m_ground.m_position.x + m_groundAnchor1.x));
var _local5:Number = (_local3 - (m_ground.m_position.y + m_groundAnchor1.y));
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
override public function GetAnchor1():b2Vec2{
var _local1:b2Mat22 = m_body1.m_R;
return (new b2Vec2((m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y))), (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y)))));
}
override public function GetAnchor2():b2Vec2{
var _local1:b2Mat22 = m_body2.m_R;
return (new b2Vec2((m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y))), (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y)))));
}
override public function PrepareVelocitySolver():void{
var _local3:b2Mat22;
var _local23:Number;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
var _local6:Number = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
var _local7:Number = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
var _local8:Number = (_local1.m_position.x + _local4);
var _local9:Number = (_local1.m_position.y + _local5);
var _local10:Number = (_local2.m_position.x + _local6);
var _local11:Number = (_local2.m_position.y + _local7);
var _local12:Number = (m_ground.m_position.x + m_groundAnchor1.x);
var _local13:Number = (m_ground.m_position.y + m_groundAnchor1.y);
var _local14:Number = (m_ground.m_position.x + m_groundAnchor2.x);
var _local15:Number = (m_ground.m_position.y + m_groundAnchor2.y);
m_u1.Set((_local8 - _local12), (_local9 - _local13));
m_u2.Set((_local10 - _local14), (_local11 - _local15));
var _local16:Number = m_u1.Length();
var _local17:Number = m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local16));
} else {
m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local17));
} else {
m_u2.SetZero();
};
if (_local16 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitImpulse1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
m_limitPositionImpulse1 = 0;
};
if (_local17 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitImpulse2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
m_limitPositionImpulse2 = 0;
};
var _local18:Number = ((_local4 * m_u1.y) - (_local5 * m_u1.x));
var _local19:Number = ((_local6 * m_u2.y) - (_local7 * m_u2.x));
m_limitMass1 = (_local1.m_invMass + ((_local1.m_invI * _local18) * _local18));
m_limitMass2 = (_local2.m_invMass + ((_local2.m_invI * _local19) * _local19));
m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2));
m_limitMass1 = (1 / m_limitMass1);
m_limitMass2 = (1 / m_limitMass2);
m_pulleyMass = (1 / m_pulleyMass);
var _local20:Number = ((-(m_pulleyImpulse) - m_limitImpulse1) * m_u1.x);
var _local21:Number = ((-(m_pulleyImpulse) - m_limitImpulse1) * m_u1.y);
var _local22:Number = (((-(m_ratio) * m_pulleyImpulse) - m_limitImpulse2) * m_u2.x);
_local23 = (((-(m_ratio) * m_pulleyImpulse) - m_limitImpulse2) * m_u2.y);
_local1.m_linearVelocity.x = (_local1.m_linearVelocity.x + (_local1.m_invMass * _local20));
_local1.m_linearVelocity.y = (_local1.m_linearVelocity.y + (_local1.m_invMass * _local21));
_local1.m_angularVelocity = (_local1.m_angularVelocity + (_local1.m_invI * ((_local4 * _local21) - (_local5 * _local20))));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local22));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local23));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local23) - (_local7 * _local22))));
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
return (new b2Vec2());
}
override public function SolvePositionConstraints():Boolean{
var _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 _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:Number = (m_ground.m_position.x + m_groundAnchor1.x);
var _local5:Number = (m_ground.m_position.y + m_groundAnchor1.y);
var _local6:Number = (m_ground.m_position.x + m_groundAnchor2.x);
var _local7:Number = (m_ground.m_position.y + m_groundAnchor2.y);
var _local21:Number = 0;
_local3 = _local1.m_R;
_local8 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
_local9 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
_local10 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
_local11 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
_local12 = (_local1.m_position.x + _local8);
_local13 = (_local1.m_position.y + _local9);
_local14 = (_local2.m_position.x + _local10);
_local15 = (_local2.m_position.y + _local11);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local16 = m_u1.Length();
_local17 = m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local16));
} else {
m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = ((m_constant - _local16) - (m_ratio * _local17));
_local21 = b2Math.b2Max(_local21, Math.abs(_local18));
_local18 = b2Math.b2Clamp(_local18, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local19 = (-(m_pulleyMass) * _local18);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local14 = ((-(m_ratio) * _local19) * m_u2.x);
_local15 = ((-(m_ratio) * _local19) * m_u2.y);
_local1.m_position.x = (_local1.m_position.x + (_local1.m_invMass * _local12));
_local1.m_position.y = (_local1.m_position.y + (_local1.m_invMass * _local13));
_local1.m_rotation = (_local1.m_rotation + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local2.m_position.x = (_local2.m_position.x + (_local2.m_invMass * _local14));
_local2.m_position.y = (_local2.m_position.y + (_local2.m_invMass * _local15));
_local2.m_rotation = (_local2.m_rotation + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local1.m_R.Set(_local1.m_rotation);
_local2.m_R.Set(_local2.m_rotation);
if (m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_R;
_local8 = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
_local9 = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local12 = (_local1.m_position.x + _local8);
_local13 = (_local1.m_position.y + _local9);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
_local16 = m_u1.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.x = (m_u1.x * (1 / _local16));
m_u1.y = (m_u1.y * (1 / _local16));
} else {
m_u1.SetZero();
};
_local18 = (m_maxLength1 - _local16);
_local21 = b2Math.b2Max(_local21, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass1) * _local18);
_local20 = m_limitPositionImpulse1;
m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19));
_local19 = (m_limitPositionImpulse1 - _local20);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local1.m_position.x = (_local1.m_position.x + (_local1.m_invMass * _local12));
_local1.m_position.y = (_local1.m_position.y + (_local1.m_invMass * _local13));
_local1.m_rotation = (_local1.m_rotation + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local1.m_R.Set(_local1.m_rotation);
};
if (m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_R;
_local10 = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
_local11 = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
_local14 = (_local2.m_position.x + _local10);
_local15 = (_local2.m_position.y + _local11);
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local17 = m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u2.x = (m_u2.x * (1 / _local17));
m_u2.y = (m_u2.y * (1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = (m_maxLength2 - _local17);
_local21 = b2Math.b2Max(_local21, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass2) * _local18);
_local20 = m_limitPositionImpulse2;
m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19));
_local19 = (m_limitPositionImpulse2 - _local20);
_local14 = (-(_local19) * m_u2.x);
_local15 = (-(_local19) * m_u2.y);
_local2.m_position.x = (_local2.m_position.x + (_local2.m_invMass * _local14));
_local2.m_position.y = (_local2.m_position.y + (_local2.m_invMass * _local15));
_local2.m_rotation = (_local2.m_rotation + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local2.m_R.Set(_local2.m_rotation);
};
return ((_local21 < b2Settings.b2_linearSlop));
}
public function GetGroundPoint2():b2Vec2{
return (new b2Vec2((m_ground.m_position.x + m_groundAnchor2.x), (m_ground.m_position.y + m_groundAnchor2.y)));
}
override public function GetReactionTorque(_arg1:Number):Number{
return (0);
}
public function GetGroundPoint1():b2Vec2{
return (new b2Vec2((m_ground.m_position.x + m_groundAnchor1.x), (m_ground.m_position.y + m_groundAnchor1.y)));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
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 _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_R;
var _local5:Number = ((_local4.col1.x * m_localAnchor1.x) + (_local4.col2.x * m_localAnchor1.y));
var _local6:Number = ((_local4.col1.y * m_localAnchor1.x) + (_local4.col2.y * m_localAnchor1.y));
_local4 = _local3.m_R;
var _local7:Number = ((_local4.col1.x * m_localAnchor2.x) + (_local4.col2.x * m_localAnchor2.y));
var _local8:Number = ((_local4.col1.y * m_localAnchor2.x) + (_local4.col2.y * m_localAnchor2.y));
_local9 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local10 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local11 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local8));
_local12 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local7));
_local17 = (-(((m_u1.x * _local9) + (m_u1.y * _local10))) - (m_ratio * ((m_u2.x * _local11) + (m_u2.y * _local12))));
_local18 = (-(m_pulleyMass) * _local17);
m_pulleyImpulse = (m_pulleyImpulse + _local18);
_local13 = (-(_local18) * m_u1.x);
_local14 = (-(_local18) * m_u1.y);
_local15 = ((-(m_ratio) * _local18) * m_u2.x);
_local16 = ((-(m_ratio) * _local18) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local13));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local14));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local14) - (_local6 * _local13))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local7 * _local16) - (_local8 * _local15))));
if (m_limitState1 == e_atUpperLimit){
_local9 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local10 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local17 = -(((m_u1.x * _local9) + (m_u1.y * _local10)));
_local18 = (-(m_limitMass1) * _local17);
_local19 = m_limitImpulse1;
m_limitImpulse1 = b2Math.b2Max(0, (m_limitImpulse1 + _local18));
_local18 = (m_limitImpulse1 - _local19);
_local13 = (-(_local18) * m_u1.x);
_local14 = (-(_local18) * m_u1.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local13));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local14));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local14) - (_local6 * _local13))));
};
if (m_limitState2 == e_atUpperLimit){
_local11 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local8));
_local12 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local7));
_local17 = -(((m_u2.x * _local11) + (m_u2.y * _local12)));
_local18 = (-(m_limitMass2) * _local17);
_local19 = m_limitImpulse2;
m_limitImpulse2 = b2Math.b2Max(0, (m_limitImpulse2 + _local18));
_local18 = (m_limitImpulse2 - _local19);
_local15 = (-(_local18) * m_u2.x);
_local16 = (-(_local18) * m_u2.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local7 * _local16) - (_local8 * _local15))));
};
}
public function GetRatio():Number{
return (m_ratio);
}
public function GetLength2():Number{
var _local1:b2Mat22;
_local1 = m_body2.m_R;
var _local2:Number = (m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y)));
var _local3:Number = (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y)));
var _local4:Number = (_local2 - (m_ground.m_position.x + m_groundAnchor2.x));
var _local5:Number = (_local3 - (m_ground.m_position.y + m_groundAnchor2.y));
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 145
//b2PulleyJointDef (Physics.Box2D.Dynamics.Joints.b2PulleyJointDef)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
public class b2PulleyJointDef extends b2JointDef {
public var maxLength1:Number;
public var groundPoint1:b2Vec2;
public var groundPoint2:b2Vec2;
public var ratio:Number;
public var maxLength2:Number;
public var anchorPoint1:b2Vec2;
public var anchorPoint2:b2Vec2;
public function b2PulleyJointDef(){
groundPoint1 = new b2Vec2();
groundPoint2 = new b2Vec2();
anchorPoint1 = new b2Vec2();
anchorPoint2 = new b2Vec2();
super();
type = b2Joint.e_pulleyJoint;
groundPoint1.Set(-1, 1);
groundPoint2.Set(1, 1);
anchorPoint1.Set(-1, 0);
anchorPoint2.Set(1, 0);
maxLength1 = (0.5 * b2PulleyJoint.b2_minPulleyLength);
maxLength2 = (0.5 * b2PulleyJoint.b2_minPulleyLength);
ratio = 1;
collideConnected = true;
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 146
//b2RevoluteJoint (Physics.Box2D.Dynamics.Joints.b2RevoluteJoint)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Common.*;
public class b2RevoluteJoint extends b2Joint {
public var m_enableLimit:Boolean;
public var m_limitState:int;
public var m_ptpMass:b2Mat22;
public var m_motorMass:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K:b2Mat22;
public var m_limitImpulse:Number;
private var K3:b2Mat22;
public var m_motorImpulse:Number;
public var m_enableMotor:Boolean;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_upperAngle:Number;
public var m_lowerAngle:Number;
public var m_maxMotorTorque:Number;
public var m_ptpImpulse:b2Vec2;
public var m_intialAngle:Number;
public static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
K3 = new b2Mat22();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_ptpImpulse = new b2Vec2();
m_ptpMass = new b2Mat22();
super(_arg1);
_local2 = m_body1.m_R;
_local3 = (_arg1.anchorPoint.x - m_body1.m_position.x);
_local4 = (_arg1.anchorPoint.y - m_body1.m_position.y);
m_localAnchor1.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor1.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
_local2 = m_body2.m_R;
_local3 = (_arg1.anchorPoint.x - m_body2.m_position.x);
_local4 = (_arg1.anchorPoint.y - m_body2.m_position.y);
m_localAnchor2.x = ((_local3 * _local2.col1.x) + (_local4 * _local2.col1.y));
m_localAnchor2.y = ((_local3 * _local2.col2.x) + (_local4 * _local2.col2.y));
m_intialAngle = (m_body2.m_rotation - m_body1.m_rotation);
m_ptpImpulse.Set(0, 0);
m_motorImpulse = 0;
m_limitImpulse = 0;
m_limitPositionImpulse = 0;
m_lowerAngle = _arg1.lowerAngle;
m_upperAngle = _arg1.upperAngle;
m_maxMotorTorque = _arg1.motorTorque;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
var _local1:b2Mat22 = m_body1.m_R;
return (new b2Vec2((m_body1.m_position.x + ((_local1.col1.x * m_localAnchor1.x) + (_local1.col2.x * m_localAnchor1.y))), (m_body1.m_position.y + ((_local1.col1.y * m_localAnchor1.x) + (_local1.col2.y * m_localAnchor1.y)))));
}
override public function GetAnchor2():b2Vec2{
var _local1:b2Mat22 = m_body2.m_R;
return (new b2Vec2((m_body2.m_position.x + ((_local1.col1.x * m_localAnchor2.x) + (_local1.col2.x * m_localAnchor2.y))), (m_body2.m_position.y + ((_local1.col1.y * m_localAnchor2.x) + (_local1.col2.y * m_localAnchor2.y)))));
}
override public function PrepareVelocitySolver():void{
var _local3:b2Mat22;
var _local8:Number;
var _local9:Number;
var _local12:Number;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_R;
var _local4:Number = ((_local3.col1.x * m_localAnchor1.x) + (_local3.col2.x * m_localAnchor1.y));
var _local5:Number = ((_local3.col1.y * m_localAnchor1.x) + (_local3.col2.y * m_localAnchor1.y));
_local3 = _local2.m_R;
var _local6:Number = ((_local3.col1.x * m_localAnchor2.x) + (_local3.col2.x * m_localAnchor2.y));
var _local7:Number = ((_local3.col1.y * m_localAnchor2.x) + (_local3.col2.y * m_localAnchor2.y));
_local8 = _local1.m_invMass;
_local9 = _local2.m_invMass;
var _local10:Number = _local1.m_invI;
var _local11:Number = _local2.m_invI;
K1.col1.x = (_local8 + _local9);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local8 + _local9);
K2.col1.x = ((_local10 * _local5) * _local5);
K2.col2.x = ((-(_local10) * _local4) * _local5);
K2.col1.y = ((-(_local10) * _local4) * _local5);
K2.col2.y = ((_local10 * _local4) * _local4);
K3.col1.x = ((_local11 * _local7) * _local7);
K3.col2.x = ((-(_local11) * _local6) * _local7);
K3.col1.y = ((-(_local11) * _local6) * _local7);
K3.col2.y = ((_local11 * _local6) * _local6);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Invert(m_ptpMass);
m_motorMass = (1 / (_local10 + _local11));
if (m_enableMotor == false){
m_motorImpulse = 0;
};
if (m_enableLimit){
_local12 = ((_local2.m_rotation - _local1.m_rotation) - m_intialAngle);
if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local12 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_limitImpulse = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local12 >= m_upperAngle){
if (m_limitState != e_atUpperLimit){
m_limitImpulse = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitImpulse = 0;
};
};
};
} else {
m_limitImpulse = 0;
};
if (b2World.s_enableWarmStarting){
_local1.m_linearVelocity.x = (_local1.m_linearVelocity.x - (_local8 * m_ptpImpulse.x));
_local1.m_linearVelocity.y = (_local1.m_linearVelocity.y - (_local8 * m_ptpImpulse.y));
_local1.m_angularVelocity = (_local1.m_angularVelocity - (_local10 * ((((_local4 * m_ptpImpulse.y) - (_local5 * m_ptpImpulse.x)) + m_motorImpulse) + m_limitImpulse)));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local9 * m_ptpImpulse.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local9 * m_ptpImpulse.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local11 * ((((_local6 * m_ptpImpulse.y) - (_local7 * m_ptpImpulse.x)) + m_motorImpulse) + m_limitImpulse)));
} else {
m_ptpImpulse.SetZero();
m_motorImpulse = 0;
m_limitImpulse = 0;
};
m_limitPositionImpulse = 0;
}
override public function GetReactionForce(_arg1:Number):b2Vec2{
var _local2:b2Vec2 = m_ptpImpulse.Copy();
_local2.Multiply(_arg1);
return (_local2);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local6:b2Mat22;
var _local24:Number;
var _local25:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = 0;
_local6 = _local3.m_R;
var _local7:Number = ((_local6.col1.x * m_localAnchor1.x) + (_local6.col2.x * m_localAnchor1.y));
var _local8:Number = ((_local6.col1.y * m_localAnchor1.x) + (_local6.col2.y * m_localAnchor1.y));
_local6 = _local4.m_R;
var _local9:Number = ((_local6.col1.x * m_localAnchor2.x) + (_local6.col2.x * m_localAnchor2.y));
var _local10:Number = ((_local6.col1.y * m_localAnchor2.x) + (_local6.col2.y * m_localAnchor2.y));
var _local11:Number = (_local3.m_position.x + _local7);
var _local12:Number = (_local3.m_position.y + _local8);
var _local13:Number = (_local4.m_position.x + _local9);
var _local14:Number = (_local4.m_position.y + _local10);
var _local15:Number = (_local13 - _local11);
var _local16:Number = (_local14 - _local12);
_local5 = Math.sqrt(((_local15 * _local15) + (_local16 * _local16)));
var _local17:Number = _local3.m_invMass;
var _local18:Number = _local4.m_invMass;
var _local19:Number = _local3.m_invI;
var _local20:Number = _local4.m_invI;
K1.col1.x = (_local17 + _local18);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local17 + _local18);
K2.col1.x = ((_local19 * _local8) * _local8);
K2.col2.x = ((-(_local19) * _local7) * _local8);
K2.col1.y = ((-(_local19) * _local7) * _local8);
K2.col2.y = ((_local19 * _local7) * _local7);
K3.col1.x = ((_local20 * _local10) * _local10);
K3.col2.x = ((-(_local20) * _local9) * _local10);
K3.col1.y = ((-(_local20) * _local9) * _local10);
K3.col2.y = ((_local20 * _local9) * _local9);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local15), -(_local16));
var _local21:Number = tImpulse.x;
var _local22:Number = tImpulse.y;
_local3.m_position.x = (_local3.m_position.x - (_local3.m_invMass * _local21));
_local3.m_position.y = (_local3.m_position.y - (_local3.m_invMass * _local22));
_local3.m_rotation = (_local3.m_rotation - (_local3.m_invI * ((_local7 * _local22) - (_local8 * _local21))));
_local3.m_R.Set(_local3.m_rotation);
_local4.m_position.x = (_local4.m_position.x + (_local4.m_invMass * _local21));
_local4.m_position.y = (_local4.m_position.y + (_local4.m_invMass * _local22));
_local4.m_rotation = (_local4.m_rotation + (_local4.m_invI * ((_local9 * _local22) - (_local10 * _local21))));
_local4.m_R.Set(_local4.m_rotation);
var _local23:Number = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local24 = ((_local4.m_rotation - _local3.m_rotation) - m_intialAngle);
_local25 = 0;
if (m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local24, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local25 = (-(m_motorMass) * _local2);
_local23 = b2Math.b2Abs(_local2);
} else {
if (m_limitState == e_atLowerLimit){
_local2 = (_local24 - m_lowerAngle);
_local23 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local25 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local25), 0);
_local25 = (m_limitPositionImpulse - _local1);
} else {
if (m_limitState == e_atUpperLimit){
_local2 = (_local24 - m_upperAngle);
_local23 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local25 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local25), 0);
_local25 = (m_limitPositionImpulse - _local1);
};
};
};
_local3.m_rotation = (_local3.m_rotation - (_local3.m_invI * _local25));
_local3.m_R.Set(_local3.m_rotation);
_local4.m_rotation = (_local4.m_rotation + (_local4.m_invI * _local25));
_local4.m_R.Set(_local4.m_rotation);
};
return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local23 <= b2Settings.b2_angularSlop))));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function SetMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
public function GetJointAngle():Number{
return ((m_body2.m_rotation - m_body1.m_rotation));
}
public function GetMotorTorque(_arg1:Number):Number{
return ((_arg1 * m_motorImpulse));
}
override public function GetReactionTorque(_arg1:Number):Number{
return ((_arg1 * m_limitImpulse));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local9:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_R;
var _local5:Number = ((_local4.col1.x * m_localAnchor1.x) + (_local4.col2.x * m_localAnchor1.y));
var _local6:Number = ((_local4.col1.y * m_localAnchor1.x) + (_local4.col2.y * m_localAnchor1.y));
_local4 = _local3.m_R;
var _local7:Number = ((_local4.col1.x * m_localAnchor2.x) + (_local4.col2.x * m_localAnchor2.y));
var _local8:Number = ((_local4.col1.y * m_localAnchor2.x) + (_local4.col2.y * m_localAnchor2.y));
var _local10:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local8)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local6));
var _local11:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local7)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local5));
var _local12:Number = -(((m_ptpMass.col1.x * _local10) + (m_ptpMass.col2.x * _local11)));
var _local13:Number = -(((m_ptpMass.col1.y * _local10) + (m_ptpMass.col2.y * _local11)));
m_ptpImpulse.x = (m_ptpImpulse.x + _local12);
m_ptpImpulse.y = (m_ptpImpulse.y + _local13);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local12));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local13));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local5 * _local13) - (_local6 * _local12))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local12));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local13));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local7 * _local13) - (_local8 * _local12))));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local14 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed);
_local15 = (-(m_motorMass) * _local14);
_local16 = m_motorImpulse;
m_motorImpulse = b2Math.b2Clamp((m_motorImpulse + _local15), (-(_arg1.dt) * m_maxMotorTorque), (_arg1.dt * m_maxMotorTorque));
_local15 = (m_motorImpulse - _local16);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * _local15));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * _local15));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local17 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local18 = (-(m_motorMass) * _local17);
if (m_limitState == e_equalLimits){
m_limitImpulse = (m_limitImpulse + _local18);
} else {
if (m_limitState == e_atLowerLimit){
_local9 = m_limitImpulse;
m_limitImpulse = b2Math.b2Max((m_limitImpulse + _local18), 0);
_local18 = (m_limitImpulse - _local9);
} else {
if (m_limitState == e_atUpperLimit){
_local9 = m_limitImpulse;
m_limitImpulse = b2Math.b2Min((m_limitImpulse + _local18), 0);
_local18 = (m_limitImpulse - _local9);
};
};
};
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * _local18));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * _local18));
};
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 147
//b2RevoluteJointDef (Physics.Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Physics.Box2D.Dynamics.Joints {
import Physics.Box2D.Common.Math.*;
public class b2RevoluteJointDef extends b2JointDef {
public var enableMotor:Boolean;
public var upperAngle:Number;
public var lowerAngle:Number;
public var enableLimit:Boolean;
public var motorSpeed:Number;
public var anchorPoint:b2Vec2;
public var motorTorque:Number;
public function b2RevoluteJointDef(){
type = b2Joint.e_revoluteJoint;
anchorPoint = new b2Vec2(0, 0);
lowerAngle = 0;
upperAngle = 0;
motorTorque = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
}
}//package Physics.Box2D.Dynamics.Joints
Section 148
//b2Body (Physics.Box2D.Dynamics.b2Body)
package Physics.Box2D.Dynamics {
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.Box2D.Common.*;
public class b2Body {
public var m_next:b2Body;
public var m_R:b2Mat22;
public var m_contactList:b2ContactNode;
public var m_angularVelocity:Number;
public var m_rotation:Number;
public var m_shapeList:b2Shape;
public var m_force:b2Vec2;
public var m_torque:Number;
public var m_mass:Number;
public var m_actor:IActor;
public var m_rotation0:Number;
public var m_invI:Number;
public var m_shapeCount:int;
public var m_userData;
public var m_linearVelocity:b2Vec2;
public var m_flags:uint;
public var m_invMass:Number;
public var m_position:b2Vec2;
public var m_linearDamping:Number;
public var m_prev:b2Body;
public var m_world:b2World;
public var m_angularDamping:Number;
public var m_position0:b2Vec2;
private var sMat0:b2Mat22;
public var m_center:b2Vec2;
public var m_sleepTime:Number;
public var m_I:Number;
public var m_jointList:b2JointNode;
public static var e_frozenFlag:uint = 2;
public static var e_sleepFlag:uint = 8;
public static var e_islandFlag:uint = 4;
public static var e_destroyFlag:uint = 32;
public static var e_allowSleepFlag:uint = 16;
public static var e_staticFlag:uint = 1;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
var _local3:int;
var _local4:b2ShapeDef;
var _local5:b2MassData;
var _local7:b2Vec2;
var _local8:b2Shape;
sMat0 = new b2Mat22();
m_position = new b2Vec2();
m_R = new b2Mat22(0);
m_position0 = new b2Vec2();
super();
m_flags = 0;
m_position.SetV(_arg1.position);
m_rotation = _arg1.rotation;
m_R.Set(m_rotation);
m_position0.SetV(m_position);
m_rotation0 = m_rotation;
m_world = _arg2;
m_linearDamping = b2Math.b2Clamp((1 - _arg1.linearDamping), 0, 1);
m_angularDamping = b2Math.b2Clamp((1 - _arg1.angularDamping), 0, 1);
m_force = new b2Vec2(0, 0);
m_torque = 0;
m_mass = 0;
var _local6:Array = new Array(b2Settings.b2_maxShapesPerBody);
_local3 = 0;
while (_local3 < b2Settings.b2_maxShapesPerBody) {
_local6[_local3] = new b2MassData();
_local3++;
};
m_shapeCount = 0;
m_center = new b2Vec2(0, 0);
_local3 = 0;
while (_local3 < b2Settings.b2_maxShapesPerBody) {
_local4 = _arg1.shapes[_local3];
if (_local4 == null){
break;
};
_local5 = _local6[_local3];
_local4.ComputeMass(_local5);
m_mass = (m_mass + _local5.mass);
m_center.x = (m_center.x + (_local5.mass * (_local4.localPosition.x + _local5.center.x)));
m_center.y = (m_center.y + (_local5.mass * (_local4.localPosition.y + _local5.center.y)));
m_shapeCount++;
_local3++;
};
if (m_mass > 0){
m_center.Multiply((1 / m_mass));
m_position.Add(b2Math.b2MulMV(m_R, m_center));
} else {
m_flags = (m_flags | e_staticFlag);
};
m_I = 0;
_local3 = 0;
while (_local3 < m_shapeCount) {
_local4 = _arg1.shapes[_local3];
_local5 = _local6[_local3];
m_I = (m_I + _local5.I);
_local7 = b2Math.SubtractVV(b2Math.AddVV(_local4.localPosition, _local5.center), m_center);
m_I = (m_I + (_local5.mass * b2Math.b2Dot(_local7, _local7)));
_local3++;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
} else {
m_invMass = 0;
};
if ((((m_I > 0)) && ((_arg1.preventRotation == false)))){
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_linearVelocity = b2Math.AddVV(_arg1.linearVelocity, b2Math.b2CrossFV(_arg1.angularVelocity, m_center));
m_angularVelocity = _arg1.angularVelocity;
m_jointList = null;
m_contactList = null;
m_prev = null;
m_next = null;
m_shapeList = null;
_local3 = 0;
while (_local3 < m_shapeCount) {
_local4 = _arg1.shapes[_local3];
_local8 = b2Shape.Create(_local4, this, m_center);
_local8.m_next = m_shapeList;
m_shapeList = _local8;
_local3++;
};
m_sleepTime = 0;
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
if ((((m_flags & e_sleepFlag)) || ((m_invMass == 0)))){
m_linearVelocity.Set(0, 0);
m_angularVelocity = 0;
};
m_userData = _arg1.userData;
}
public function SetCenterPosition(_arg1:b2Vec2, _arg2:Number):void{
if (IsFrozen()){
return;
};
m_rotation = _arg2;
m_R.Set(m_rotation);
m_position.SetV(_arg1);
m_position0.SetV(m_position);
m_rotation0 = m_rotation;
var _local3:b2Shape = m_shapeList;
while (_local3 != null) {
_local3.Synchronize(m_position, m_R, m_position, m_R);
_local3 = _local3.m_next;
};
m_world.m_broadPhase.Commit();
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.AddVV(m_position, b2Math.b2MulMV(m_R, _arg1)));
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_R, _arg1));
}
public function QuickSyncShapes():void{
var _local1:b2Shape = m_shapeList;
while (_local1 != null) {
_local1.QuickSync(m_position, m_R);
_local1 = _local1.m_next;
};
}
public function GetInertia():Number{
return (m_I);
}
public function GetJointList():b2JointNode{
return (m_jointList);
}
public function Freeze():void{
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
var _local1:b2Shape = m_shapeList;
while (_local1 != null) {
_local1.DestroyProxy();
_local1 = _local1.m_next;
};
}
public function GetRotationMatrix():b2Mat22{
return (m_R);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SynchronizeShapes():void{
sMat0.Set(m_rotation0);
var _local1:b2Shape = m_shapeList;
while (_local1 != null) {
_local1.Synchronize(m_position0, sMat0, m_position, m_R);
_local1 = _local1.m_next;
};
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping() == false){
m_force.Add(_arg1);
m_torque = (m_torque + b2Math.b2CrossVV(b2Math.SubtractVV(_arg2, m_position), _arg1));
};
}
public function GetOriginPosition():b2Vec2{
return (b2Math.SubtractVV(m_position, b2Math.b2MulMV(m_R, m_center)));
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping() == false){
m_linearVelocity.Add(b2Math.MulFV(m_invMass, _arg1));
m_angularVelocity = (m_angularVelocity + (m_invI * b2Math.b2CrossVV(b2Math.SubtractVV(_arg2, m_position), _arg1)));
};
}
public function GetContactList():b2ContactNode{
return (m_contactList);
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function GetMass():Number{
return (m_mass);
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetOriginPosition(_arg1:b2Vec2, _arg2:Number):void{
if (IsFrozen()){
return;
};
m_rotation = _arg2;
m_R.Set(m_rotation);
m_position = b2Math.AddVV(_arg1, b2Math.b2MulMV(m_R, m_center));
m_position0.SetV(m_position);
m_rotation0 = m_rotation;
var _local3:b2Shape = m_shapeList;
while (_local3 != null) {
_local3.Synchronize(m_position, m_R, m_position, m_R);
_local3 = _local3.m_next;
};
m_world.m_broadPhase.Commit();
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_R, b2Math.SubtractVV(_arg1, m_position)));
}
public function GetRotation():Number{
return (m_rotation);
}
public function IsStatic():Boolean{
return (((m_flags & e_staticFlag) == e_staticFlag));
}
public function Destroy():void{
var _local2:b2Shape;
var _local1:b2Shape = m_shapeList;
while (_local1) {
_local2 = _local1;
_local1 = _local1.m_next;
b2Shape.Destroy(_local2);
};
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_R, _arg1));
}
public function GetNext():b2Body{
return (m_next);
}
public function GetActor():IActor{
return (m_actor);
}
public function GetUserData(){
return (m_userData);
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointNode = m_jointList;
while (_local2 != null) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping() == false){
m_torque = (m_torque + _arg1);
};
}
public function GetCenterPosition():b2Vec2{
return (m_position);
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
}
}//package Physics.Box2D.Dynamics
Section 149
//b2BodyDef (Physics.Box2D.Dynamics.b2BodyDef)
package Physics.Box2D.Dynamics {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.Box2D.Common.*;
public class b2BodyDef {
public var angularDamping:Number;
public var linearVelocity:b2Vec2;
public var position:b2Vec2;
public var isSleeping:Boolean;
public var allowSleep:Boolean;
public var userData;
public var preventRotation:Boolean;
public var shapes:Array;
public var linearDamping:Number;
public var rotation:Number;
public var angularVelocity:Number;
public function b2BodyDef(){
shapes = new Array();
super();
userData = null;
var _local1:int;
while (_local1 < b2Settings.b2_maxShapesPerBody) {
shapes[_local1] = null;
_local1++;
};
position = new b2Vec2(0, 0);
rotation = 0;
linearVelocity = new b2Vec2(0, 0);
angularVelocity = 0;
linearDamping = 0;
angularDamping = 0;
allowSleep = true;
isSleeping = false;
preventRotation = false;
}
public function AddShape(_arg1:b2ShapeDef):void{
var _local2:int;
while (_local2 < b2Settings.b2_maxShapesPerBody) {
if (shapes[_local2] == null){
shapes[_local2] = _arg1;
break;
};
_local2++;
};
}
}
}//package Physics.Box2D.Dynamics
Section 150
//b2CollisionFilter (Physics.Box2D.Dynamics.b2CollisionFilter)
package Physics.Box2D.Dynamics {
import Physics.Box2D.Collision.Shapes.*;
public class b2CollisionFilter {
public static var b2_defaultFilter:b2CollisionFilter = new (b2CollisionFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
if ((((_arg1.m_groupIndex == _arg2.m_groupIndex)) && (!((_arg1.m_groupIndex == 0))))){
return ((_arg1.m_groupIndex > 0));
};
var _local3:Boolean = ((!(((_arg1.m_maskBits & _arg2.m_categoryBits) == 0))) && (!(((_arg1.m_categoryBits & _arg2.m_maskBits) == 0))));
return (_local3);
}
}
}//package Physics.Box2D.Dynamics
Section 151
//b2ContactManager (Physics.Box2D.Dynamics.b2ContactManager)
package Physics.Box2D.Dynamics {
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_destroyImmediate:Boolean;
public var m_nullContact:b2NullContact;
public function b2ContactManager(){
m_nullContact = new b2NullContact();
super();
m_world = null;
m_destroyImmediate = false;
}
public function Collide():void{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2ContactNode;
var _local4:b2ContactNode;
var _local6:int;
var _local7:int;
var _local5:b2Contact = m_world.m_contactList;
while (_local5 != null) {
if (((_local5.m_shape1.m_body.IsSleeping()) && (_local5.m_shape2.m_body.IsSleeping()))){
} else {
_local6 = _local5.GetManifoldCount();
_local5.Evaluate();
_local7 = _local5.GetManifoldCount();
if ((((_local6 == 0)) && ((_local7 > 0)))){
_local1 = _local5.m_shape1.m_body;
_local2 = _local5.m_shape2.m_body;
_local3 = _local5.m_node1;
_local4 = _local5.m_node2;
_local3.contact = _local5;
_local3.other = _local2;
_local3.prev = null;
_local3.next = _local1.m_contactList;
if (_local3.next != null){
_local3.next.prev = _local5.m_node1;
};
_local1.m_contactList = _local5.m_node1;
_local4.contact = _local5;
_local4.other = _local1;
_local4.prev = null;
_local4.next = _local2.m_contactList;
if (_local4.next != null){
_local4.next.prev = _local4;
};
_local2.m_contactList = _local4;
} else {
if ((((_local6 > 0)) && ((_local7 == 0)))){
_local1 = _local5.m_shape1.m_body;
_local2 = _local5.m_shape2.m_body;
_local3 = _local5.m_node1;
_local4 = _local5.m_node2;
if (_local3.prev){
_local3.prev.next = _local3.next;
};
if (_local3.next){
_local3.next.prev = _local3.prev;
};
if (_local3 == _local1.m_contactList){
_local1.m_contactList = _local3.next;
};
_local3.prev = null;
_local3.next = null;
if (_local4.prev){
_local4.prev.next = _local4.next;
};
if (_local4.next){
_local4.next.prev = _local4.prev;
};
if (_local4 == _local2.m_contactList){
_local2.m_contactList = _local4.next;
};
_local4.prev = null;
_local4.next = null;
};
};
};
_local5 = _local5.m_next;
};
}
public function CleanContactList():void{
var _local2:b2Contact;
var _local1:b2Contact = m_world.m_contactList;
while (_local1 != null) {
_local2 = _local1;
_local1 = _local1.m_next;
if ((_local2.m_flags & b2Contact.e_destroyFlag)){
DestroyContact(_local2);
_local2 = null;
};
};
}
public function DestroyContact(_arg1:b2Contact):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2ContactNode;
var _local5:b2ContactNode;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_world.m_contactList){
m_world.m_contactList = _arg1.m_next;
};
if (_arg1.GetManifoldCount() > 0){
_local2 = _arg1.m_shape1.m_body;
_local3 = _arg1.m_shape2.m_body;
_local4 = _arg1.m_node1;
_local5 = _arg1.m_node2;
_local2.WakeUp();
_local3.WakeUp();
if (_local4.prev){
_local4.prev.next = _local4.next;
};
if (_local4.next){
_local4.next.prev = _local4.prev;
};
if (_local4 == _local2.m_contactList){
_local2.m_contactList = _local4.next;
};
_local4.prev = null;
_local4.next = null;
if (_local5.prev){
_local5.prev.next = _local5.next;
};
if (_local5.next){
_local5.next.prev = _local5.prev;
};
if (_local5 == _local3.m_contactList){
_local3.m_contactList = _local5.next;
};
_local5.prev = null;
_local5.next = null;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
if (_arg3 == null){
return;
};
var _local4:b2Contact = (_arg3 as b2Contact);
if (_local4 != m_nullContact){
if (m_destroyImmediate == true){
DestroyContact(_local4);
_local4 = null;
} else {
_local4.m_flags = (_local4.m_flags | b2Contact.e_destroyFlag);
};
};
}
override public function PairAdded(_arg1, _arg2){
var _local8:b2Shape;
var _local9:b2Body;
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_filter == null))) && ((m_world.m_filter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
if (_local6.m_invMass == 0){
_local8 = _local3;
_local3 = _local4;
_local4 = _local8;
_local9 = _local5;
_local5 = _local6;
_local6 = _local9;
};
var _local7:b2Contact = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_local7.m_prev = null;
_local7.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local7;
};
m_world.m_contactList = _local7;
m_world.m_contactCount++;
return (_local7);
}
}
}//package Physics.Box2D.Dynamics
Section 152
//b2Island (Physics.Box2D.Dynamics.b2Island)
package Physics.Box2D.Dynamics {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Common.*;
public class b2Island {
public var m_positionError:Number;
public var m_bodyCapacity:int;
public var m_bodies:Array;
public var m_joints:Array;
public var m_jointCapacity:int;
public var m_contactCount:int;
public var m_contacts:Array;
public var m_contactCapacity:int;
public var m_jointCount:int;
public var m_allocator;
public var m_bodyCount:int;
public static var m_positionIterationCount:uint;
public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4):void{
var _local5:int;
super();
m_bodyCapacity = _arg1;
m_contactCapacity = _arg2;
m_jointCapacity = _arg3;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_bodies = new Array(_arg1);
_local5 = 0;
while (_local5 < _arg1) {
m_bodies[_local5] = null;
_local5++;
};
m_contacts = new Array(_arg2);
_local5 = 0;
while (_local5 < _arg2) {
m_contacts[_local5] = null;
_local5++;
};
m_joints = new Array(_arg3);
_local5 = 0;
while (_local5 < _arg3) {
m_joints[_local5] = null;
_local5++;
};
m_allocator = _arg4;
}
public function AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2):void{
var _local3:int;
var _local4:b2Body;
var _local6:int;
var _local7:Boolean;
var _local8:Boolean;
var _local9:Boolean;
_local3 = 0;
while (_local3 < m_bodyCount) {
_local4 = m_bodies[_local3];
if (_local4.m_invMass == 0){
} else {
_local4.m_linearVelocity.Add(b2Math.MulFV(_arg1.dt, b2Math.AddVV(_arg2, b2Math.MulFV(_local4.m_invMass, _local4.m_force))));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_arg1.dt * _local4.m_invI) * _local4.m_torque));
_local4.m_linearVelocity.Multiply(_local4.m_linearDamping);
_local4.m_angularVelocity = (_local4.m_angularVelocity * _local4.m_angularDamping);
_local4.m_position0.SetV(_local4.m_position);
_local4.m_rotation0 = _local4.m_rotation;
};
_local3++;
};
var _local5:b2ContactSolver = new b2ContactSolver(m_contacts, m_contactCount, m_allocator);
_local5.PreSolve();
_local3 = 0;
while (_local3 < m_jointCount) {
m_joints[_local3].PrepareVelocitySolver();
_local3++;
};
_local3 = 0;
while (_local3 < _arg1.iterations) {
_local5.SolveVelocityConstraints();
_local6 = 0;
while (_local6 < m_jointCount) {
m_joints[_local6].SolveVelocityConstraints(_arg1);
_local6++;
};
_local3++;
};
_local3 = 0;
while (_local3 < m_bodyCount) {
_local4 = m_bodies[_local3];
if (_local4.m_invMass == 0){
} else {
_local4.m_position.x = (_local4.m_position.x + (_arg1.dt * _local4.m_linearVelocity.x));
_local4.m_position.y = (_local4.m_position.y + (_arg1.dt * _local4.m_linearVelocity.y));
_local4.m_rotation = (_local4.m_rotation + (_arg1.dt * _local4.m_angularVelocity));
_local4.m_R.Set(_local4.m_rotation);
};
_local3++;
};
_local3 = 0;
while (_local3 < m_jointCount) {
m_joints[_local3].PreparePositionSolver();
_local3++;
};
if (b2World.s_enablePositionCorrection){
m_positionIterationCount = 0;
while (m_positionIterationCount < _arg1.iterations) {
_local7 = _local5.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local8 = true;
_local3 = 0;
while (_local3 < m_jointCount) {
_local9 = m_joints[_local3].SolvePositionConstraints();
_local8 = ((_local8) && (_local9));
_local3++;
};
if (((_local7) && (_local8))){
break;
};
m_positionIterationCount++;
};
};
_local5.PostSolve();
_local3 = 0;
while (_local3 < m_bodyCount) {
_local4 = m_bodies[_local3];
if (_local4.m_invMass == 0){
} else {
_local4.m_R.Set(_local4.m_rotation);
_local4.SynchronizeShapes();
_local4.m_force.Set(0, 0);
_local4.m_torque = 0;
};
_local3++;
};
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function UpdateSleep(_arg1:Number):void{
var _local2:int;
var _local3:b2Body;
var _local4:Number = Number.MAX_VALUE;
var _local5:Number = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
var _local6:Number = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local2 = 0;
while (_local2 < m_bodyCount) {
_local3 = m_bodies[_local2];
if (_local3.m_invMass == 0){
} else {
if ((_local3.m_flags & b2Body.e_allowSleepFlag) == 0){
_local3.m_sleepTime = 0;
_local4 = 0;
};
if (((((((_local3.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local3.m_angularVelocity * _local3.m_angularVelocity) > _local6)))) || ((b2Math.b2Dot(_local3.m_linearVelocity, _local3.m_linearVelocity) > _local5)))){
_local3.m_sleepTime = 0;
_local4 = 0;
} else {
_local3.m_sleepTime = (_local3.m_sleepTime + _arg1);
_local4 = b2Math.b2Min(_local4, _local3.m_sleepTime);
};
};
_local2++;
};
if (_local4 >= b2Settings.b2_timeToSleep){
_local2 = 0;
while (_local2 < m_bodyCount) {
_local3 = m_bodies[_local2];
_local3.m_flags = (_local3.m_flags | b2Body.e_sleepFlag);
_local2++;
};
};
}
}
}//package Physics.Box2D.Dynamics
Section 153
//b2TimeStep (Physics.Box2D.Dynamics.b2TimeStep)
package Physics.Box2D.Dynamics {
public class b2TimeStep {
public var dt:Number;
public var iterations:int;
public var inv_dt:Number;
}
}//package Physics.Box2D.Dynamics
Section 154
//b2World (Physics.Box2D.Dynamics.b2World)
package Physics.Box2D.Dynamics {
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import flash.system.*;
public class b2World {
public var m_bodyCount:int;
public var m_gravity:b2Vec2;
public var m_listener:b2WorldListener;
public var m_filter:b2CollisionFilter;
private var step:b2TimeStep;
public var m_positionIterationCount:int;
public var m_contactList:b2Contact;
public var m_blockAllocator;
public var m_groundBody:b2Body;
public var m_contactCount:int;
public var m_broadPhase:b2BroadPhase;
public var m_allowSleep:Boolean;
public var m_stackAllocator;
public var m_jointCount:int;
public var m_bodyList:b2Body;
public var m_bodyDestroyList:b2Body;
public var m_jointList:b2Joint;
public var m_contactManager:b2ContactManager;
public static var s_enableWarmStarting:int = 1;
public static var s_enablePositionCorrection:int = 1;
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
step = new b2TimeStep();
m_contactManager = new b2ContactManager();
super();
m_listener = null;
m_filter = b2CollisionFilter.b2_defaultFilter;
m_bodyList = null;
m_contactList = null;
m_jointList = null;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_bodyDestroyList = null;
m_allowSleep = _arg3;
m_gravity = _arg2;
m_contactManager.m_world = this;
m_broadPhase = new b2BroadPhase(_arg1, m_contactManager);
showMemory("b2World: init BroadPhase");
var _local4:b2BodyDef = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function GetContactList():b2Contact{
return (m_contactList);
}
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.ResetProxy(m_broadPhase);
_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.ResetProxy(m_broadPhase);
_local6 = _local6.m_next;
};
};
}
public function SetFilter(_arg1:b2CollisionFilter):void{
m_filter = _arg1;
}
public function DestroyBody(_arg1:b2Body):void{
if ((_arg1.m_flags & b2Body.e_destroyFlag)){
return;
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_bodyList){
m_bodyList = _arg1.m_next;
};
_arg1.m_flags = (_arg1.m_flags | b2Body.e_destroyFlag);
m_bodyCount--;
_arg1.m_prev = null;
_arg1.m_next = m_bodyDestroyList;
m_bodyDestroyList = _arg1;
}
public function SetListener(_arg1:b2WorldListener):void{
m_listener = _arg1;
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
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 GetGroundBody():b2Body{
return (m_groundBody);
}
public function showMemory(_arg1:String):void{
var _local2:String = new String();
_local2 = (((_arg1 + ": ") + String(Math.round((System.totalMemory / 0x100000)))) + " MB used");
trace(_local2);
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array = new Array();
var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
var _local6:int;
while (_local6 < _local5) {
_arg2[_local6] = (_local4[_local6] as b2Shape);
_local6++;
};
return (_local5);
}
public function CleanBodyList():void{
var _local2:b2Body;
var _local3:b2JointNode;
var _local4:b2JointNode;
m_contactManager.m_destroyImmediate = true;
var _local1:b2Body = m_bodyDestroyList;
while (_local1) {
_local2 = _local1;
_local1 = _local1.m_next;
_local3 = _local2.m_jointList;
while (_local3) {
_local4 = _local3;
_local3 = _local3.next;
if (m_listener){
m_listener.NotifyJointDestroyed(_local4.joint);
};
DestroyJoint(_local4.joint);
};
_local2.Destroy();
};
m_bodyDestroyList = null;
m_contactManager.m_destroyImmediate = false;
}
public function Step(_arg1:Number, _arg2:int):void{
var _local3:b2Body;
var _local4:b2Body;
var _local12:int;
var _local13:int;
var _local14:b2ContactNode;
var _local15:b2JointNode;
var _local16:uint;
step.dt = _arg1;
step.iterations = _arg2;
if (_arg1 > 0){
step.inv_dt = (1 / _arg1);
} else {
step.inv_dt = 0;
};
m_positionIterationCount = 0;
m_contactManager.CleanContactList();
CleanBodyList();
m_contactManager.Collide();
var _local5:b2Island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator);
_local3 = m_bodyList;
while (_local3 != null) {
_local3.m_flags = (_local3.m_flags & ~(b2Body.e_islandFlag));
_local3 = _local3.m_next;
};
var _local6:b2Contact = m_contactList;
while (_local6 != null) {
_local6.m_flags = (_local6.m_flags & ~(b2Contact.e_islandFlag));
_local6 = _local6.m_next;
};
var _local7:b2Joint = m_jointList;
while (_local7 != null) {
_local7.m_islandFlag = false;
_local7 = _local7.m_next;
};
var _local8:int = m_bodyCount;
var _local9:Array = new Array(m_bodyCount);
var _local10:int;
while (_local10 < m_bodyCount) {
_local9[_local10] = null;
_local10++;
};
var _local11:b2Body = m_bodyList;
while (_local11 != null) {
if ((_local11.m_flags & (((b2Body.e_staticFlag | b2Body.e_islandFlag) | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){
} else {
_local5.Clear();
_local12 = 0;
var _temp1 = _local12;
_local12 = (_local12 + 1);
var _local17 = _temp1;
_local9[_local17] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
while (_local12 > 0) {
--_local12;
_local3 = _local9[_local12];
_local5.AddBody(_local3);
_local3.m_flags = (_local3.m_flags & ~(b2Body.e_sleepFlag));
if ((_local3.m_flags & b2Body.e_staticFlag)){
} else {
_local14 = _local3.m_contactList;
while (_local14 != null) {
if ((_local14.contact.m_flags & b2Contact.e_islandFlag)){
} else {
if ((((_local14.contact.m_shape1.m_sensor == true)) || ((_local14.contact.m_shape2.m_sensor == true)))){
} else {
if (_local14.contact.GetManifoldCount() == 0){
} else {
_local5.AddContact(_local14.contact);
_local14.contact.m_flags = (_local14.contact.m_flags | b2Contact.e_islandFlag);
_local4 = _local14.other;
if ((_local4.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local12;
_local12 = (_local12 + 1);
var _local18 = _temp2;
_local9[_local18] = _local4;
_local4.m_flags = (_local4.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local14 = _local14.next;
};
_local15 = _local3.m_jointList;
while (_local15 != null) {
if (_local15.joint.m_islandFlag == true){
} else {
_local5.AddJoint(_local15.joint);
_local15.joint.m_islandFlag = true;
_local4 = _local15.other;
if ((_local4.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local12;
_local12 = (_local12 + 1);
_local18 = _temp3;
_local9[_local18] = _local4;
_local4.m_flags = (_local4.m_flags | b2Body.e_islandFlag);
};
};
_local15 = _local15.next;
};
};
};
_local5.Solve(step, m_gravity);
m_positionIterationCount = b2Math.b2Max(m_positionIterationCount, b2Island.m_positionIterationCount);
if (m_allowSleep){
_local5.UpdateSleep(_arg1);
};
_local13 = 0;
while (_local13 < _local5.m_bodyCount) {
_local3 = _local5.m_bodies[_local13];
if ((_local3.m_flags & b2Body.e_staticFlag)){
_local3.m_flags = (_local3.m_flags & ~(b2Body.e_islandFlag));
};
if (((_local3.IsFrozen()) && (m_listener))){
_local16 = m_listener.NotifyBoundaryViolated(_local3);
if (_local16 == b2WorldListener.b2_destroyBody){
DestroyBody(_local3);
_local3 = null;
_local5.m_bodies[_local13] = null;
};
};
_local13++;
};
};
_local11 = _local11.m_next;
};
m_broadPhase.Commit();
}
public function GetJointList():b2Joint{
return (m_jointList);
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
}
}//package Physics.Box2D.Dynamics
Section 155
//b2WorldListener (Physics.Box2D.Dynamics.b2WorldListener)
package Physics.Box2D.Dynamics {
import Physics.Box2D.Dynamics.Joints.*;
public class b2WorldListener {
public static var b2_freezeBody:uint = 0;
public static var b2_destroyBody:uint = 1;
public function NotifyJointDestroyed(_arg1:b2Joint):void{
}
public function NotifyBoundaryViolated(_arg1:b2Body):uint{
return (b2_freezeBody);
}
}
}//package Physics.Box2D.Dynamics
Section 156
//GameJoint (Physics.GameJoint)
package Physics {
import flash.display.*;
import General.Utility.*;
import Actors.*;
import mx.core.*;
import Physics.Box2D.Dynamics.Joints.*;
import Graphics.Style.*;
public class GameJoint {
public var m_enable_render:Boolean;
public var m_bitmap:BitmapData;
private var m_rotations_cached:Boolean;
public var joint:b2Joint;
public var m_rotated_bitmap_list:Array;
private var m_render_cached:Boolean;
public var m_name:String;
public var m_style:ShapeStyle;
public var m_actor:IActor;
public var m_sound_volume:Number;
public var m_enable_sounds:Boolean;
public var m_group_list:GroupList;
public var m_render_type:int;
public var m_current_sound:SoundAsset;
public var m_layer:int;
public function GameJoint(_arg1:Object){
if (_arg1["name"] != null){
m_name = _arg1["name"];
};
if (_arg1["style"] != null){
m_style = _arg1["style"];
};
if (_arg1["layer"] != null){
m_layer = _arg1["layer"];
};
if (_arg1["render"] != null){
m_render_type = _arg1["render"];
};
if (_arg1["grouplist"] != null){
m_group_list = _arg1["grouplist"];
};
}
}
}//package Physics
Section 157
//GameShape (Physics.GameShape)
package Physics {
import flash.display.*;
import General.Utility.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import mx.core.*;
import Physics.Box2D.Collision.Shapes.*;
import Graphics.Style.*;
import Graphics.Particle.*;
import World.Stamps.*;
public class GameShape {
public var m_bitmap:BitmapData;
public var m_particle_emitter:ParticleEmitter;
public var m_last_offset:b2Vec2;
public var m_rotated_bitmap_list:Array;
public var m_enable_render:Boolean;// = true
public var m_render_type:int;// = 2
public var m_category_bits:uint;
private var m_rotations_cached:Boolean;
public var m_rotated_bitmap:BitmapData;
private var m_render_cached:Boolean;
public var m_style:ShapeStyle;
public var shape:b2Shape;
public var m_actor:IActor;
public var m_visible:Boolean;// = true
public var m_sound_volume:Number;
public var m_group_list:GroupList;
public var m_last_rotation:Number;
public var m_current_sound:SoundAsset;
public var m_stamp:Stamp;
public var m_enable_sounds:Boolean;// = true
public var m_layer:int;// = 0
public function GameShape(_arg1:Object){
m_group_list = new GroupList(GroupManager.getInstance());
super();
if (_arg1["style"] != null){
m_style = _arg1["style"];
};
if (_arg1["layer"] != null){
m_layer = _arg1["layer"];
};
if (_arg1["render"] != null){
m_render_type = _arg1["render"];
};
if (_arg1["visible"] != null){
m_visible = _arg1["visible"];
};
if (_arg1["grouplist"] != null){
m_group_list = _arg1["grouplist"];
};
if (_arg1["bitmap"] != null){
m_bitmap = _arg1["bitmap"];
};
if (_arg1["emitter"] != null){
m_particle_emitter = _arg1["emitter"];
};
}
}
}//package Physics
Section 158
//SoundManager (Sound.SoundManager)
package Sound {
import flash.events.*;
import flash.display.*;
import Physics.Box2D.Common.Math.*;
import mx.core.*;
import flash.media.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import General.DataStructure.*;
import flash.utils.*;
import World.AssetManager.*;
import General.Math.*;
import flash.text.*;
import Physics.Box2D.Common.*;
public class SoundManager {
public var music_timing:uint;
public var music_start:uint;
public var music_count:uint;
public var active_count:int;
public var active_sounds:Dictionary;
public static var music_volume:Number = 1;
private static var _instance:SoundManager;
public static var _free_channels:ArrayedStack;
public static var musicmuted:Boolean = false;
private static var _music_channel:SoundChannel;
public static var soundfxmuted:Boolean = false;
public static var soundfx_volume:Number = 1;
private static var _priority_list:Array = new Array();
private static var _max_sounds:int = 6;
public static var earshot:Number = 600;
public function SoundManager(){
_free_channels = new ArrayedStack(_max_sounds);
var _local1:int;
while (_local1 < _max_sounds) {
_free_channels.push(new SoundChannel());
_local1++;
};
active_sounds = new Dictionary(false);
active_count = 0;
music_timing = 9000;
music_count = music_timing;
music_start = getTimer();
}
public function StopMusic():void{
if (_music_channel != null){
_music_channel.stop();
_music_channel = null;
};
}
public function isFXEnabled():Boolean{
return (!(soundfxmuted));
}
public function isMusicEnabled():Boolean{
return (!(musicmuted));
}
public function ToggleFX():void{
if (soundfxmuted){
soundfxmuted = false;
} else {
soundfxmuted = true;
};
}
public function ToggleMusic():void{
if (musicmuted){
musicmuted = false;
} else {
musicmuted = true;
StopMusic();
};
}
public function TransformSounds():void{
}
public function PlayMusic():void{
var _local1:uint;
var _local2:SoundAsset;
var _local3:int;
var _local4:SoundTransform;
if (!musicmuted){
_local1 = (getTimer() - music_start);
if (getTimer() != music_start){
music_start = getTimer();
};
music_count = (music_count + _local1);
if (music_count >= music_timing){
music_count = 0;
_local3 = RNG.nextIntRange(1, 8);
if (_local3 == 1){
_local2 = SoundAssets.sounds["testmusic1"];
} else {
if (_local3 == 2){
_local2 = SoundAssets.sounds["testmusic3"];
} else {
if (_local3 == 3){
_local2 = SoundAssets.sounds["testmusic5"];
} else {
if (_local3 == 4){
_local2 = SoundAssets.sounds["testmusic6"];
} else {
if (_local3 == 5){
_local2 = SoundAssets.sounds["testmusic7"];
} else {
if (_local3 == 6){
_local2 = SoundAssets.sounds["testmusic8"];
} else {
if (_local3 == 7){
_local2 = SoundAssets.sounds["testmusic9"];
} else {
if (_local3 == 8){
_local2 = SoundAssets.sounds["testmusic10"];
};
};
};
};
};
};
};
};
_local4 = new SoundTransform(1.5, 0);
_music_channel = _local2.play(0, 0, _local4);
};
};
}
public function playsound(_arg1:SoundAsset, _arg2:int=0, _arg3:Number=1, _arg4:Number=0):void{
if (_priority_list[_arg2] == null){
_priority_list[_arg2] = new Array();
};
var _local5:SoundObject = new SoundObject(_arg1, _arg3, _arg4);
_priority_list[_arg2].push(_local5);
}
public function QueueSound(_arg1:SoundAsset, _arg2:Number, _arg3:b2Vec2, _arg4:int, _arg5:Number):void{
var _local6:Number;
var _local7:Number;
var _local8:SoundObject;
if (!soundfxmuted){
if (_priority_list[_arg4] == null){
_priority_list[_arg4] = new Array();
};
_local6 = ((earshot * _arg5) - _arg2);
if (_local6 < 0){
_local6 = 0;
} else {
_local6 = (_local6 / earshot);
};
if (_local6 > 0){
_local7 = _arg3.x;
if (_local7 > earshot){
_local7 = earshot;
} else {
if (_local7 < -(earshot)){
_local7 = -(earshot);
};
};
_local7 = (_local7 / earshot);
_local8 = new SoundObject(_arg1, _local6, _local7);
_priority_list[_arg4].push(_local8);
};
};
}
public function PlaySounds():void{
var _local1:*;
var _local2:*;
var _local3:SoundChannel;
if (!soundfxmuted){
for (_local1 in _priority_list) {
_priority_list[_local1].sortOn("volume", (Array.NUMERIC | Array.DESCENDING));
};
for (_local1 in _priority_list) {
for (_local2 in _priority_list[_local1]) {
if (!_free_channels.isEmpty()){
_local3 = _free_channels.pop();
_priority_list[_local1][_local2].play(_local3);
} else {
//unresolved jump
};
};
};
_priority_list = new Array();
};
}
public static function getInstance():SoundManager{
if (SoundManager._instance == null){
SoundManager._instance = new (SoundManager);
};
return (SoundManager._instance);
}
}
}//package Sound
import flash.events.*;
import mx.core.*;
import flash.media.*;
class SoundObject {
public var panning:Number;
public var channel:SoundChannel;
public var volume:Number;
public var sound:SoundAsset;
private function SoundObject(_arg1:SoundAsset, _arg2:Number, _arg3:Number){
sound = _arg1;
volume = _arg2;
panning = _arg3;
}
public function soundComplete(_arg1:Event):void{
SoundManager._free_channels.push(new SoundChannel());
var _local2:SoundManager = SoundManager.getInstance();
delete _local2.active_sounds[int(_local2.active_count)];
_local2.active_count--;
}
public function play(_arg1:SoundChannel):void{
channel = _arg1;
var _local2:SoundTransform = new SoundTransform(volume, panning);
channel = sound.play(0, 0, _local2);
channel.addEventListener(Event.SOUND_COMPLETE, soundComplete);
var _local3:SoundManager = SoundManager.getInstance();
_local3.active_count++;
_local3.active_sounds[_local3.active_count] = this;
}
}
Section 159
//CollisionTriggerHash (Triggers.CollisionTriggerHash)
package Triggers {
import Actions.*;
import flash.utils.*;
public final class CollisionTriggerHash {
private var map:Dictionary;
public function CollisionTriggerHash(_arg1:Boolean=false){
map = new Dictionary(_arg1);
}
public function getTriggers(_arg1:String, _arg2:String):Array{
if (map[_arg1] != null){
if (map[_arg1][_arg2] != null){
return (map[_arg1][_arg2]);
};
};
return (null);
}
public function removeTrigger(_arg1:String, _arg2:String):void{
if (map[_arg1][_arg2] != null){
delete map[_arg1][_arg2];
if (map[_arg1] == null){
delete map[_arg1];
};
};
if (map[_arg2][_arg1] != null){
delete map[_arg2][_arg1];
if (map[_arg2] == null){
delete map[_arg2];
};
};
}
public function addTrigger(_arg1:String, _arg2:String, _arg3:ICollisionAction):void{
if (map[_arg1] == null){
map[_arg1] = new Dictionary(false);
};
if (map[_arg1][_arg2] == null){
map[_arg1][_arg2] = new Array();
};
map[_arg1][_arg2].push(_arg3);
if (map[_arg2] == null){
map[_arg2] = new Dictionary(false);
};
if (map[_arg2][_arg1] == null){
map[_arg2][_arg1] = new Array();
};
map[_arg2][_arg1].push(_arg3);
}
public function clear():void{
map = null;
map = new Dictionary(false);
}
}
}//package Triggers
Section 160
//EnterFrameTriggerHash (Triggers.EnterFrameTriggerHash)
package Triggers {
import Actors.*;
import Actions.*;
import flash.utils.*;
public final class EnterFrameTriggerHash {
private var map:Dictionary;
public function EnterFrameTriggerHash(_arg1:Boolean=false){
map = new Dictionary(_arg1);
}
public function removeTrigger(_arg1:IActor, _arg2:IAction):void{
if (map[_arg1][_arg2] != null){
delete map[_arg1][_arg2];
if (map[_arg1] == null){
delete map[_arg1];
};
};
}
public function runTriggers():void{
var _local1:*;
var _local2:*;
for (_local1 in map) {
for (_local2 in map[_local1]) {
_local2.run();
};
};
}
public function addTrigger(_arg1:IActor, _arg2:IAction):void{
if (map[_arg1] == null){
map[_arg1] = new Dictionary(false);
map[_arg1][_arg2] = _arg2;
} else {
map[_arg1][_arg2] = _arg2;
};
}
public function clear():void{
map = new Dictionary(false);
}
}
}//package Triggers
Section 161
//TriggerManager (Triggers.TriggerManager)
package Triggers {
import flash.events.*;
import General.*;
import flash.display.*;
import General.Utility.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import Actions.*;
import flash.utils.*;
import flash.text.*;
import Physics.Box2D.Common.*;
public class TriggerManager {
private var timerTriggers:Array;
private var collisionTriggers:CollisionTriggerHash;
private var enterFrameTriggers:EnterFrameTriggerHash;
private static var _instance:TriggerManager;
public function TriggerManager(_arg1:SingletonEnforcer){
collisionTriggers = new CollisionTriggerHash(false);
enterFrameTriggers = new EnterFrameTriggerHash(false);
timerTriggers = new Array();
}
public function addEnterFrameTrigger(_arg1:IActor, _arg2:IAction):void{
enterFrameTriggers.addTrigger(_arg1, _arg2);
}
public function ClearTriggers():void{
var _local1:*;
collisionTriggers.clear();
enterFrameTriggers.clear();
for (_local1 in timerTriggers) {
if (timerTriggers[_local1] != null){
timerTriggers[_local1].stop();
timerTriggers[_local1] = null;
};
};
timerTriggers = null;
timerTriggers = new Array();
_instance = null;
}
public function CheckCollisions():void{
var _local2:b2Manifold;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:Dictionary;
var _local6:Dictionary;
var _local7:Function;
var _local8:*;
var _local9:*;
var _local10:Array;
var _local11:ICollisionAction;
var _local12:*;
var _local1:b2Contact = Environment.world.m_contactList;
while (_local1) {
if (_local1.GetManifoldCount() > 0){
_local3 = _local1.GetShape1();
_local4 = _local1.GetShape2();
if (((!((_local3.m_userData == null))) && (!((_local4.m_userData == null))))){
_local5 = _local3.m_userData.m_group_list.GetGroups();
_local6 = _local4.m_userData.m_group_list.GetGroups();
_local2 = (_local1.GetManifolds()[0] as b2Manifold);
_local7 = GroupManager.getInstance().Name;
for (_local8 in _local5) {
for (_local9 in _local6) {
_local10 = collisionTriggers.getTriggers(_local7(_local8), _local7(_local9));
for (_local12 in _local10) {
_local11 = _local10[_local12];
if (_local11 != null){
_local11.run(_local3, _local4, _local2);
};
};
};
};
};
};
_local1 = _local1.m_next;
};
}
public function addCollisionTrigger(_arg1:String, _arg2:String, _arg3:ICollisionAction):void{
collisionTriggers.addTrigger(_arg1, _arg2, _arg3);
}
public function addTimerTrigger(_arg1:Number, _arg2:IAction):Timer{
var _local3:Timer = new Timer(_arg1);
_local3.start();
_local3.addEventListener(TimerEvent.TIMER, _arg2.run);
return (_local3);
}
public function EnterFrame():void{
enterFrameTriggers.runTriggers();
}
public function removeTimerTrigger(_arg1:Timer):void{
_arg1.stop();
_arg1 = null;
}
public static function getInstance():TriggerManager{
if (TriggerManager._instance == null){
TriggerManager._instance = new TriggerManager(new SingletonEnforcer());
};
return (TriggerManager._instance);
}
}
}//package Triggers
class SingletonEnforcer {
private function SingletonEnforcer(){
}
}
Section 162
//ImageAssets (World.AssetManager.ImageAssets)
package World.AssetManager {
import flash.display.*;
import flash.utils.*;
public class ImageAssets {
private static var freeblockhorizontal:Class = ImageAssets_freeblockhorizontal;
private static var rotatingdoor:Class = ImageAssets_rotatingdoor;
private static var smallpushblock:Class = ImageAssets_smallpushblock;
private static var movingblock:Class = ImageAssets_movingblock;
private static var wasdkeys:Class = ImageAssets_wasdkeys;
private static var flipper:Class = ImageAssets_flipper;
private static var glassblock:Class = ImageAssets_glassblock;
private static var peg:Class = ImageAssets_peg;
private static var freeblockvertical:Class = ImageAssets_freeblockvertical;
private static var bubbleparticle:Class = ImageAssets_bubbleparticle;
private static var blockparticle:Class = ImageAssets_blockparticle;
private static var lockbutton:Class = ImageAssets_lockbutton;
private static var smallbuttonon:Class = ImageAssets_smallbuttonon;
private static var gamebackground:Class = ImageAssets_gamebackground;
private static var buttonlefthover:Class = ImageAssets_buttonlefthover;
private static var agitator:Class = ImageAssets_agitator;
private static var box2dlogo:Class = ImageAssets_box2dlogo;
private static var buttonright:Class = ImageAssets_buttonright;
private static var cloglogo:Class = ImageAssets_cloglogo;
private static var yellowbutton:Class = ImageAssets_yellowbutton;
private static var braincloglogo:Class = ImageAssets_braincloglogo;
private static var pushblock:Class = ImageAssets_pushblock;
private static var buttonleft:Class = ImageAssets_buttonleft;
private static var testblock:Class = ImageAssets_testblock;
private static var escapekey:Class = ImageAssets_escapekey;
private static var pausekey:Class = ImageAssets_pausekey;
private static var buttonrighthover:Class = ImageAssets_buttonrighthover;
private static var breakableblock:Class = ImageAssets_breakableblock;
private static var smallbuttonoff:Class = ImageAssets_smallbuttonoff;
private static var linkcursor:Class = ImageAssets_linkcursor;
private static var starparticle:Class = ImageAssets_starparticle;
private static var bubbleparticle2:Class = ImageAssets_bubbleparticle2;
private static var player:Class = ImageAssets_player;
private static var testcircle:Class = ImageAssets_testcircle;
private static var smallbuttonup:Class = ImageAssets_smallbuttonup;
private static var gamebar:Class = ImageAssets_gamebar;
private static var curvedcorner:Class = ImageAssets_curvedcorner;
private static var goodexit:Class = ImageAssets_goodexit;
private static var greenbutton:Class = ImageAssets_greenbutton;
public static var images:Dictionary = new Dictionary(false);
private static var testbox:Class = ImageAssets_testbox;
private static var smallbuttonhover:Class = ImageAssets_smallbuttonhover;
private static var arrowkeys:Class = ImageAssets_arrowkeys;
private static var fadebullet:Class = ImageAssets_fadebullet;
private static var redbackground:Class = ImageAssets_redbackground;
public static function init():void{
var _local1:Bitmap = new testbox();
images["testbox"] = _local1.bitmapData;
_local1 = new testcircle();
images["testcircle"] = _local1.bitmapData;
_local1 = new testblock();
images["testblock"] = _local1.bitmapData;
_local1 = new glassblock();
images["glassblock"] = _local1.bitmapData;
_local1 = new player();
images["player"] = _local1.bitmapData;
_local1 = new pushblock();
images["pushblock"] = _local1.bitmapData;
_local1 = new smallpushblock();
images["smallpushblock"] = _local1.bitmapData;
_local1 = new flipper();
images["flipper"] = _local1.bitmapData;
_local1 = new rotatingdoor();
images["rotatingdoor"] = _local1.bitmapData;
_local1 = new curvedcorner();
images["curvedcorner"] = _local1.bitmapData;
_local1 = new goodexit();
images["goodexit"] = _local1.bitmapData;
_local1 = new breakableblock();
images["breakableblock"] = _local1.bitmapData;
_local1 = new movingblock();
images["movingblock"] = _local1.bitmapData;
_local1 = new agitator();
images["agitator"] = _local1.bitmapData;
_local1 = new fadebullet();
images["fadebullet"] = _local1.bitmapData;
_local1 = new peg();
images["peg"] = _local1.bitmapData;
_local1 = new freeblockhorizontal();
images["freeblockx"] = _local1.bitmapData;
_local1 = new freeblockvertical();
images["freeblocky"] = _local1.bitmapData;
_local1 = new gamebackground();
images["gamebackground"] = _local1.bitmapData;
_local1 = new cloglogo();
images["cloglogo"] = _local1.bitmapData;
_local1 = new redbackground();
images["redbackground"] = _local1.bitmapData;
_local1 = new braincloglogo();
images["braincloglogo"] = _local1.bitmapData;
_local1 = new box2dlogo();
images["box2d"] = _local1.bitmapData;
_local1 = new bubbleparticle();
images["bubbleparticle"] = _local1.bitmapData;
_local1 = new bubbleparticle2();
images["bubbleparticle2"] = _local1.bitmapData;
_local1 = new starparticle();
images["starparticle"] = _local1.bitmapData;
_local1 = new blockparticle();
images["blockparticle"] = _local1.bitmapData;
_local1 = new linkcursor();
images["linkcursor"] = _local1.bitmapData;
_local1 = new smallbuttonup();
images["smallbuttonup"] = _local1.bitmapData;
_local1 = new smallbuttonhover();
images["smallbuttonhover"] = _local1.bitmapData;
_local1 = new smallbuttonoff();
images["smallbuttonoff"] = _local1.bitmapData;
_local1 = new buttonright();
images["buttonright"] = _local1.bitmapData;
_local1 = new buttonleft();
images["buttonleft"] = _local1.bitmapData;
_local1 = new buttonrighthover();
images["buttonrighthover"] = _local1.bitmapData;
_local1 = new buttonlefthover();
images["buttonlefthover"] = _local1.bitmapData;
_local1 = new lockbutton();
images["lockbutton"] = _local1.bitmapData;
_local1 = new greenbutton();
images["greenbutton"] = _local1.bitmapData;
_local1 = new yellowbutton();
images["yellowbutton"] = _local1.bitmapData;
_local1 = new pausekey();
images["pausekey"] = _local1.bitmapData;
_local1 = new arrowkeys();
images["arrowkeys"] = _local1.bitmapData;
_local1 = new escapekey();
images["escapekey"] = _local1.bitmapData;
_local1 = new wasdkeys();
images["wasdkeys"] = _local1.bitmapData;
_local1 = new gamebar();
images["gamebar"] = _local1.bitmapData;
}
}
}//package World.AssetManager
Section 163
//ImageAssets_agitator (World.AssetManager.ImageAssets_agitator)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_agitator extends BitmapAsset {
}
}//package World.AssetManager
Section 164
//ImageAssets_arrowkeys (World.AssetManager.ImageAssets_arrowkeys)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_arrowkeys extends BitmapAsset {
}
}//package World.AssetManager
Section 165
//ImageAssets_blockparticle (World.AssetManager.ImageAssets_blockparticle)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_blockparticle extends BitmapAsset {
}
}//package World.AssetManager
Section 166
//ImageAssets_box2dlogo (World.AssetManager.ImageAssets_box2dlogo)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_box2dlogo extends BitmapAsset {
}
}//package World.AssetManager
Section 167
//ImageAssets_braincloglogo (World.AssetManager.ImageAssets_braincloglogo)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_braincloglogo extends BitmapAsset {
}
}//package World.AssetManager
Section 168
//ImageAssets_breakableblock (World.AssetManager.ImageAssets_breakableblock)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_breakableblock extends BitmapAsset {
}
}//package World.AssetManager
Section 169
//ImageAssets_bubbleparticle (World.AssetManager.ImageAssets_bubbleparticle)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_bubbleparticle extends BitmapAsset {
}
}//package World.AssetManager
Section 170
//ImageAssets_bubbleparticle2 (World.AssetManager.ImageAssets_bubbleparticle2)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_bubbleparticle2 extends BitmapAsset {
}
}//package World.AssetManager
Section 171
//ImageAssets_buttonleft (World.AssetManager.ImageAssets_buttonleft)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_buttonleft extends BitmapAsset {
}
}//package World.AssetManager
Section 172
//ImageAssets_buttonlefthover (World.AssetManager.ImageAssets_buttonlefthover)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_buttonlefthover extends BitmapAsset {
}
}//package World.AssetManager
Section 173
//ImageAssets_buttonright (World.AssetManager.ImageAssets_buttonright)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_buttonright extends BitmapAsset {
}
}//package World.AssetManager
Section 174
//ImageAssets_buttonrighthover (World.AssetManager.ImageAssets_buttonrighthover)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_buttonrighthover extends BitmapAsset {
}
}//package World.AssetManager
Section 175
//ImageAssets_cloglogo (World.AssetManager.ImageAssets_cloglogo)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_cloglogo extends BitmapAsset {
}
}//package World.AssetManager
Section 176
//ImageAssets_curvedcorner (World.AssetManager.ImageAssets_curvedcorner)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_curvedcorner extends BitmapAsset {
}
}//package World.AssetManager
Section 177
//ImageAssets_escapekey (World.AssetManager.ImageAssets_escapekey)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_escapekey extends BitmapAsset {
}
}//package World.AssetManager
Section 178
//ImageAssets_fadebullet (World.AssetManager.ImageAssets_fadebullet)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_fadebullet extends BitmapAsset {
}
}//package World.AssetManager
Section 179
//ImageAssets_flipper (World.AssetManager.ImageAssets_flipper)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_flipper extends BitmapAsset {
}
}//package World.AssetManager
Section 180
//ImageAssets_freeblockhorizontal (World.AssetManager.ImageAssets_freeblockhorizontal)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_freeblockhorizontal extends BitmapAsset {
}
}//package World.AssetManager
Section 181
//ImageAssets_freeblockvertical (World.AssetManager.ImageAssets_freeblockvertical)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_freeblockvertical extends BitmapAsset {
}
}//package World.AssetManager
Section 182
//ImageAssets_gamebackground (World.AssetManager.ImageAssets_gamebackground)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_gamebackground extends BitmapAsset {
}
}//package World.AssetManager
Section 183
//ImageAssets_gamebar (World.AssetManager.ImageAssets_gamebar)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_gamebar extends BitmapAsset {
}
}//package World.AssetManager
Section 184
//ImageAssets_glassblock (World.AssetManager.ImageAssets_glassblock)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_glassblock extends BitmapAsset {
}
}//package World.AssetManager
Section 185
//ImageAssets_goodexit (World.AssetManager.ImageAssets_goodexit)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_goodexit extends BitmapAsset {
}
}//package World.AssetManager
Section 186
//ImageAssets_greenbutton (World.AssetManager.ImageAssets_greenbutton)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_greenbutton extends BitmapAsset {
}
}//package World.AssetManager
Section 187
//ImageAssets_linkcursor (World.AssetManager.ImageAssets_linkcursor)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_linkcursor extends BitmapAsset {
}
}//package World.AssetManager
Section 188
//ImageAssets_lockbutton (World.AssetManager.ImageAssets_lockbutton)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_lockbutton extends BitmapAsset {
}
}//package World.AssetManager
Section 189
//ImageAssets_movingblock (World.AssetManager.ImageAssets_movingblock)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_movingblock extends BitmapAsset {
}
}//package World.AssetManager
Section 190
//ImageAssets_pausekey (World.AssetManager.ImageAssets_pausekey)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_pausekey extends BitmapAsset {
}
}//package World.AssetManager
Section 191
//ImageAssets_peg (World.AssetManager.ImageAssets_peg)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_peg extends BitmapAsset {
}
}//package World.AssetManager
Section 192
//ImageAssets_player (World.AssetManager.ImageAssets_player)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_player extends BitmapAsset {
}
}//package World.AssetManager
Section 193
//ImageAssets_pushblock (World.AssetManager.ImageAssets_pushblock)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_pushblock extends BitmapAsset {
}
}//package World.AssetManager
Section 194
//ImageAssets_redbackground (World.AssetManager.ImageAssets_redbackground)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_redbackground extends BitmapAsset {
}
}//package World.AssetManager
Section 195
//ImageAssets_rotatingdoor (World.AssetManager.ImageAssets_rotatingdoor)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_rotatingdoor extends BitmapAsset {
}
}//package World.AssetManager
Section 196
//ImageAssets_smallbuttonhover (World.AssetManager.ImageAssets_smallbuttonhover)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_smallbuttonhover extends BitmapAsset {
}
}//package World.AssetManager
Section 197
//ImageAssets_smallbuttonoff (World.AssetManager.ImageAssets_smallbuttonoff)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_smallbuttonoff extends BitmapAsset {
}
}//package World.AssetManager
Section 198
//ImageAssets_smallbuttonon (World.AssetManager.ImageAssets_smallbuttonon)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_smallbuttonon extends BitmapAsset {
}
}//package World.AssetManager
Section 199
//ImageAssets_smallbuttonup (World.AssetManager.ImageAssets_smallbuttonup)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_smallbuttonup extends BitmapAsset {
}
}//package World.AssetManager
Section 200
//ImageAssets_smallpushblock (World.AssetManager.ImageAssets_smallpushblock)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_smallpushblock extends BitmapAsset {
}
}//package World.AssetManager
Section 201
//ImageAssets_starparticle (World.AssetManager.ImageAssets_starparticle)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_starparticle extends BitmapAsset {
}
}//package World.AssetManager
Section 202
//ImageAssets_testblock (World.AssetManager.ImageAssets_testblock)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_testblock extends BitmapAsset {
}
}//package World.AssetManager
Section 203
//ImageAssets_testbox (World.AssetManager.ImageAssets_testbox)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_testbox extends BitmapAsset {
}
}//package World.AssetManager
Section 204
//ImageAssets_testcircle (World.AssetManager.ImageAssets_testcircle)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_testcircle extends BitmapAsset {
}
}//package World.AssetManager
Section 205
//ImageAssets_wasdkeys (World.AssetManager.ImageAssets_wasdkeys)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_wasdkeys extends BitmapAsset {
}
}//package World.AssetManager
Section 206
//ImageAssets_yellowbutton (World.AssetManager.ImageAssets_yellowbutton)
package World.AssetManager {
import mx.core.*;
public class ImageAssets_yellowbutton extends BitmapAsset {
}
}//package World.AssetManager
Section 207
//SoundAssets (World.AssetManager.SoundAssets)
package World.AssetManager {
import mx.core.*;
import flash.utils.*;
public class SoundAssets {
private static var testmusic3:Class = SoundAssets_testmusic3;
private static var testmusic5:Class = SoundAssets_testmusic5;
private static var testmusic6:Class = SoundAssets_testmusic6;
private static var testmusic8:Class = SoundAssets_testmusic8;
private static var bounce:Class = SoundAssets_bounce;
private static var endlevel:Class = SoundAssets_endlevel;
private static var testmusic7:Class = SoundAssets_testmusic7;
private static var testmusic9:Class = SoundAssets_testmusic9;
public static var sounds:Dictionary = new Dictionary(false);
private static var shapebump:Class = SoundAssets_shapebump;
private static var pushergun:Class = SoundAssets_pushergun;
private static var spawn1:Class = SoundAssets_spawn1;
private static var score1:Class = SoundAssets_score1;
private static var playercollision:Class = SoundAssets_playercollision;
private static var breakhit:Class = SoundAssets_breakhit;
private static var testmusic10:Class = SoundAssets_testmusic10;
private static var testsound:Class = SoundAssets_testsound;
private static var testmusic1:Class = SoundAssets_testmusic1;
public static function init():void{
var _local1:SoundAsset;
_local1 = (new testsound() as SoundAsset);
sounds["testsound"] = _local1;
_local1 = (new shapebump() as SoundAsset);
sounds["shapebump"] = _local1;
_local1 = (new pushergun() as SoundAsset);
sounds["pushergun"] = _local1;
_local1 = (new testmusic1() as SoundAsset);
sounds["testmusic1"] = _local1;
_local1 = (new testmusic3() as SoundAsset);
sounds["testmusic3"] = _local1;
_local1 = (new testmusic5() as SoundAsset);
sounds["testmusic5"] = _local1;
_local1 = (new testmusic6() as SoundAsset);
sounds["testmusic6"] = _local1;
_local1 = (new testmusic7() as SoundAsset);
sounds["testmusic7"] = _local1;
_local1 = (new testmusic8() as SoundAsset);
sounds["testmusic8"] = _local1;
_local1 = (new testmusic9() as SoundAsset);
sounds["testmusic9"] = _local1;
_local1 = (new testmusic10() as SoundAsset);
sounds["testmusic10"] = _local1;
_local1 = (new score1() as SoundAsset);
sounds["score1"] = _local1;
_local1 = (new spawn1() as SoundAsset);
sounds["spawn1"] = _local1;
_local1 = (new breakhit() as SoundAsset);
sounds["breakhit"] = _local1;
_local1 = (new playercollision() as SoundAsset);
sounds["playercollision"] = _local1;
_local1 = (new bounce() as SoundAsset);
sounds["bounce"] = _local1;
_local1 = (new endlevel() as SoundAsset);
sounds["endlevel"] = _local1;
}
}
}//package World.AssetManager
Section 208
//SoundAssets_bounce (World.AssetManager.SoundAssets_bounce)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_bounce extends SoundAsset {
}
}//package World.AssetManager
Section 209
//SoundAssets_breakhit (World.AssetManager.SoundAssets_breakhit)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_breakhit extends SoundAsset {
}
}//package World.AssetManager
Section 210
//SoundAssets_endlevel (World.AssetManager.SoundAssets_endlevel)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_endlevel extends SoundAsset {
}
}//package World.AssetManager
Section 211
//SoundAssets_playercollision (World.AssetManager.SoundAssets_playercollision)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_playercollision extends SoundAsset {
}
}//package World.AssetManager
Section 212
//SoundAssets_pushergun (World.AssetManager.SoundAssets_pushergun)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_pushergun extends SoundAsset {
}
}//package World.AssetManager
Section 213
//SoundAssets_score1 (World.AssetManager.SoundAssets_score1)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_score1 extends SoundAsset {
}
}//package World.AssetManager
Section 214
//SoundAssets_shapebump (World.AssetManager.SoundAssets_shapebump)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_shapebump extends SoundAsset {
}
}//package World.AssetManager
Section 215
//SoundAssets_spawn1 (World.AssetManager.SoundAssets_spawn1)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_spawn1 extends SoundAsset {
}
}//package World.AssetManager
Section 216
//SoundAssets_testmusic1 (World.AssetManager.SoundAssets_testmusic1)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_testmusic1 extends SoundAsset {
}
}//package World.AssetManager
Section 217
//SoundAssets_testmusic10 (World.AssetManager.SoundAssets_testmusic10)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_testmusic10 extends SoundAsset {
}
}//package World.AssetManager
Section 218
//SoundAssets_testmusic3 (World.AssetManager.SoundAssets_testmusic3)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_testmusic3 extends SoundAsset {
}
}//package World.AssetManager
Section 219
//SoundAssets_testmusic5 (World.AssetManager.SoundAssets_testmusic5)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_testmusic5 extends SoundAsset {
}
}//package World.AssetManager
Section 220
//SoundAssets_testmusic6 (World.AssetManager.SoundAssets_testmusic6)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_testmusic6 extends SoundAsset {
}
}//package World.AssetManager
Section 221
//SoundAssets_testmusic7 (World.AssetManager.SoundAssets_testmusic7)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_testmusic7 extends SoundAsset {
}
}//package World.AssetManager
Section 222
//SoundAssets_testmusic8 (World.AssetManager.SoundAssets_testmusic8)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_testmusic8 extends SoundAsset {
}
}//package World.AssetManager
Section 223
//SoundAssets_testmusic9 (World.AssetManager.SoundAssets_testmusic9)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_testmusic9 extends SoundAsset {
}
}//package World.AssetManager
Section 224
//SoundAssets_testsound (World.AssetManager.SoundAssets_testsound)
package World.AssetManager {
import mx.core.*;
public class SoundAssets_testsound extends SoundAsset {
}
}//package World.AssetManager
Section 225
//FinalLevel1 (World.Levels.FinalLevel1)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel1 extends Level {
public function FinalLevel1(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 30;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 7, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 8, 8, 8, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 8, 0, 0, 0, 8, 1, 0, 0, 0, 0, 0, 0, 1, 8, 0, 0, 0, 8, 1, 0, 0, 0, 0, 0, 0, 1, 8, 0, 8, 0, 8, 1, 0, 0, 0, 0, 0, 0, 1, 8, 0, 8, 0, 8, 1, 0, 0, 0, 0, 0, 0, 1, 8, 0, 8, 0, 8, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 8, 8, 8, 8, 8, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 8, 0, 8, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 8, 0, 8, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 5, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 226
//FinalLevel10 (World.Levels.FinalLevel10)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel10 extends Level {
public function FinalLevel10(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 35;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 7, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 1, 4, 0, 0, 14, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 18, 18, 0, 1, 18, 0, 1, 18, 2, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 0, 0, 14, 0, 0, 0, 0, 0, 4, 1, 1, 0, 2, 17, 1, 0, 17, 1, 0, 17, 17, 0, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 13, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 1, 0, 18, 18, 18, 18, 2, 0, 1, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 1, 0, 2, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 5, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 227
//FinalLevel11 (World.Levels.FinalLevel11)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel11 extends Level {
public function FinalLevel11(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 100;
level_dimensions = new Point(19, 25);
level_matrix = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 4, 1, 4, 0, 13, 0, 0, 0, 0, 4, 1, 1, 13, 0, 0, 0, 0, 0, 0, 0, 1, 13, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 13, 0, 0, 0, 0, 0, 0, 1, 1, 0, 15, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 4, 0, 0, 4, 1, 4, 0, 0, 4, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 4, 0, 0, 4, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 15, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 4, 0, 0, 0, 1, 0, 0, 15, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 4, 1, 0, 15, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 13, 0, 0, 1, 0, 0, 4, 1, 1, 0, 15, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 15, 0, 1, 0, 0, 0, 1, 1, 0, 0, 13, 1, 0, 19, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 15, 0, 1, 0, 0, 0, 1, 1, 13, 0, 0, 1, 0, 0, 0, 1, 1, 0, 15, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 19, 0, 1, 1, 0, 0, 15, 0, 1, 0, 0, 0, 1, 1, 0, 0, 13, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 19, 0, 1, 0, 0, 0, 1, 1, 13, 0, 0, 1, 4, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 9, 0, 9, 4, 1, 4, 0, 4, 1, 4, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 6, 5, 1, 7, 0, 0, 0, 0, 0, 0, 1, 1, 4, 9, 0, 9, 4, 1, 4, 0, 4, 1, 4, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 228
//FinalLevel12 (World.Levels.FinalLevel12)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel12 extends Level {
public function FinalLevel12(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 135;
level_dimensions = new Point(19, 25);
level_matrix = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 8, 8, 8, 8, 4, 1, 4, 0, 0, 0, 1, 0, 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 8, 8, 8, 8, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 13, 0, 0, 1, 1, 0, 11, 1, 1, 4, 0, 0, 0, 1, 0, 0, 0, 4, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 8, 8, 8, 8, 1, 1, 0, 0, 1, 1, 11, 11, 0, 1, 0, 8, 8, 8, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 11, 1, 0, 0, 0, 0, 1, 0, 9, 9, 0, 1, 0, 0, 0, 1, 1, 0, 12, 12, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 11, 11, 0, 1, 8, 8, 8, 8, 1, 0, 9, 9, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 8, 0, 0, 8, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 8, 0, 0, 8, 1, 0, 9, 9, 0, 1, 1, 0, 0, 1, 1, 8, 8, 8, 1, 8, 0, 0, 8, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 9, 0, 1, 8, 8, 8, 8, 1, 0, 9, 9, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 8, 0, 0, 8, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 3, 1, 1, 8, 19, 0, 8, 1, 19, 0, 19, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 8, 0, 0, 8, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 8, 0, 0, 8, 0, 8, 8, 8, 8, 1, 0, 0, 0, 1, 1, 1, 19, 0, 1, 8, 8, 8, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 4, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0, 16, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 16, 0, 1, 1, 1, 19, 0, 0, 19, 0, 0, 0, 4, 1, 4, 0, 0, 0, 0, 16, 0, 1, 1, 1, 4, 0, 0, 0, 0, 0, 6, 5, 1, 7, 0, 0, 0, 17, 17, 0, 1, 1, 1, 1, 1, 1, 1, 1, 4, 0, 4, 1, 4, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 229
//FinalLevel13 (World.Levels.FinalLevel13)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel13 extends Level {
public function FinalLevel13(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 70;
level_dimensions = new Point(19, 25);
level_matrix = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 5, 6, 0, 4, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 4, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 19, 0, 1, 0, 0, 1, 1, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 4, 1, 0, 0, 0, 1, 0, 2, 0, 0, 1, 2, 2, 1, 0, 0, 1, 0, 4, 1, 1, 0, 0, 0, 1, 2, 2, 2, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 4, 0, 1, 0, 0, 0, 1, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 2, 2, 2, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 1, 13, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 2, 2, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 2, 2, 1, 1, 0, 0, 1, 0, 0, 1, 4, 7, 4, 1, 0, 0, 0, 1, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 4, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 4, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 60);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 230
//FinalLevel14 (World.Levels.FinalLevel14)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel14 extends Level {
public function FinalLevel14(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 110;
level_dimensions = new Point(19, 25);
level_matrix = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 8, 0, 19, 0, 0, 0, 1, 0, 0, 0, 0, 0, 4, 1, 1, 0, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 4, 0, 0, 0, 0, 4, 1, 4, 0, 0, 4, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 7, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0, 4, 1, 0, 0, 1, 1, 0, 0, 1, 4, 15, 0, 0, 15, 4, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 4, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 4, 0, 0, 0, 0, 4, 1, 0, 0, 1, 0, 1, 12, 12, 1, 1, 0, 0, 1, 0, 13, 0, 0, 13, 0, 1, 19, 0, 1, 0, 1, 9, 9, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 13, 0, 13, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 14, 14, 1, 0, 1, 4, 0, 1, 1, 0, 0, 1, 0, 13, 0, 0, 13, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 4, 1, 0, 1, 1, 0, 0, 1, 13, 0, 0, 13, 0, 0, 1, 8, 8, 1, 4, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 8, 8, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 11, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 4, 0, 0, 4, 1, 0, 11, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 6, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 4, 0, 0, 0, 0, 4, 1, 1, 5, 1, 0, 0, 0, 1, 4, 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 231
//FinalLevel15 (World.Levels.FinalLevel15)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel15 extends Level {
public function FinalLevel15(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 100;
level_dimensions = new Point(19, 25);
level_matrix = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 4, 0, 4, 1, 4, 0, 4, 1, 4, 0, 0, 0, 0, 0, 4, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 19, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 11, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 4, 0, 0, 4, 1, 1, 0, 0, 4, 1, 4, 0, 4, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 4, 0, 0, 4, 1, 1, 0, 1, 4, 0, 0, 0, 0, 0, 4, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 8, 8, 8, 8, 1, 1, 0, 1, 0, 1, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 14, 14, 1, 9, 0, 9, 0, 1, 1, 0, 1, 0, 0, 4, 1, 4, 0, 4, 1, 14, 14, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 12, 12, 12, 12, 1, 1, 0, 0, 0, 1, 4, 0, 4, 1, 4, 0, 0, 0, 0, 11, 11, 11, 11, 1, 1, 0, 0, 0, 1, 3, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 4, 1, 14, 1, 1, 1, 1, 0, 1, 1, 4, 0, 4, 1, 0, 9, 0, 9, 0, 0, 1, 1, 1, 0, 14, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 4, 4, 1, 1, 1, 0, 1, 1, 1, 14, 0, 0, 0, 1, 1, 6, 1, 0, 1, 1, 1, 1, 15, 1, 1, 1, 15, 1, 1, 1, 0, 0, 1, 1, 5, 1, 4, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 232
//FinalLevel16 (World.Levels.FinalLevel16)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel16 extends Level {
public function FinalLevel16(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 100;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 7, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 8, 8, 0, 8, 8, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 8, 0, 8, 0, 8, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 8, 8, 0, 8, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 8, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 8, 8, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, 0, 0, 1, 8, 8, 8, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, 0, 0, 1, 0, 8, 8, 0, 8, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 19, 0, 1, 19, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 5, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 233
//FinalLevel17 (World.Levels.FinalLevel17)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel17 extends Level {
public function FinalLevel17(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 50;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 7, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 12, 12, 12, 12, 12, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 9, 9, 9, 9, 9, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 9, 9, 9, 9, 9, 1, 0, 0, 0, 0, 0, 0, 1, 12, 12, 12, 12, 12, 1, 0, 0, 0, 0, 0, 0, 1, 12, 12, 12, 12, 12, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 9, 9, 9, 9, 9, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 12, 12, 12, 12, 12, 1, 0, 0, 0, 0, 0, 0, 1, 12, 12, 12, 12, 12, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 5, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 234
//FinalLevel18 (World.Levels.FinalLevel18)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel18 extends Level {
public function FinalLevel18(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 115;
level_dimensions = new Point(19, 25);
level_matrix = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 0, 0, 1, 1, 19, 0, 1, 0, 0, 14, 0, 0, 0, 14, 0, 0, 1, 4, 0, 0, 0, 1, 1, 2, 2, 1, 14, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 4, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 2, 2, 1, 0, 0, 0, 0, 1, 4, 0, 0, 7, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 19, 0, 1, 0, 1, 1, 2, 1, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 13, 0, 1, 2, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 2, 2, 2, 2, 0, 0, 1, 0, 0, 1, 0, 1, 1, 2, 2, 1, 0, 1, 0, 0, 0, 13, 0, 0, 0, 1, 4, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 2, 2, 2, 0, 1, 1, 0, 4, 1, 1, 1, 1, 2, 1, 1, 4, 0, 0, 13, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 4, 0, 0, 0, 0, 13, 0, 0, 1, 0, 4, 1, 1, 1, 2, 2, 1, 0, 0, 1, 4, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 4, 0, 0, 0, 0, 13, 1, 0, 4, 1, 1, 1, 2, 2, 1, 0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 1, 4, 0, 4, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 4, 0, 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 0, 1, 1, 6, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 60);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 235
//FinalLevel19 (World.Levels.FinalLevel19)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel19 extends Level {
public function FinalLevel19(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 100;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 7, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 17, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 8, 1, 8, 8, 0, 1, 0, 0, 0, 0, 0, 0, 1, 18, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 8, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 8, 8, 0, 8, 8, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 18, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 8, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 8, 8, 9, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 17, 8, 8, 8, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 8, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 8, 8, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 8, 8, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 8, 8, 1, 0, 0, 0, 0, 0, 0, 1, 8, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 5, 6, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 236
//FinalLevel2 (World.Levels.FinalLevel2)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel2 extends Level {
public function FinalLevel2(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 15;
level_dimensions = new Point(13, 13);
level_matrix = [0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 7, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 19, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 19, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 19, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 5, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 237
//FinalLevel20 (World.Levels.FinalLevel20)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel20 extends Level {
public function FinalLevel20(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 100;
level_dimensions = new Point(25, 10);
level_matrix = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 19, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 9, 9, 9, 1, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 7, 0, 0, 0, 0, 0, 15, 0, 0, 17, 9, 17, 9, 17, 9, 17, 9, 17, 9, 17, 0, 0, 0, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 15, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 0, 0, 1, 1, 1, 1, 4, 0, 0, 0, 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 60);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 238
//FinalLevel21 (World.Levels.FinalLevel21)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel21 extends Level {
public function FinalLevel21(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 25;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 5, 6, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 1, 4, 2, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 19, 0, 19, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 7, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 60);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 239
//FinalLevel22 (World.Levels.FinalLevel22)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel22 extends Level {
public function FinalLevel22(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 100;
level_dimensions = new Point(19, 25);
level_matrix = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 7, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 4, 1, 1, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 1, 2, 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 16, 0, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 16, 0, 0, 19, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 16, 0, 0, 0, 2, 2, 0, 1, 1, 0, 13, 0, 0, 0, 0, 0, 13, 0, 0, 16, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 16, 14, 0, 0, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 18, 18, 18, 18, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 2, 2, 2, 13, 0, 2, 2, 0, 0, 13, 0, 0, 0, 0, 0, 13, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 2, 0, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 60);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 240
//FinalLevel3 (World.Levels.FinalLevel3)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel3 extends Level {
public function FinalLevel3(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 20;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 7, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 18, 18, 18, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 16, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 16, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 17, 17, 17, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 18, 0, 17, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 17, 0, 18, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 18, 0, 17, 0, 18, 1, 0, 0, 0, 0, 0, 0, 1, 17, 0, 18, 0, 17, 1, 0, 0, 0, 0, 0, 0, 1, 18, 0, 17, 0, 18, 1, 0, 0, 0, 0, 0, 0, 1, 17, 0, 18, 0, 17, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 1, 18, 18, 18, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 5, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 241
//FinalLevel4 (World.Levels.FinalLevel4)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel4 extends Level {
public function FinalLevel4(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 35;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 7, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 9, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 4, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 4, 1, 1, 1, 4, 0, 4, 1, 1, 0, 0, 9, 0, 0, 4, 1, 4, 0, 0, 0, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 4, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 4, 0, 0, 1, 0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 4, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 5, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 242
//FinalLevel5 (World.Levels.FinalLevel5)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel5 extends Level {
public function FinalLevel5(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 30;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 4, 8, 7, 8, 4, 1, 0, 0, 0, 0, 0, 0, 1, 0, 8, 8, 8, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 8, 8, 8, 8, 8, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 8, 8, 8, 8, 8, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 4, 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 13, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 9, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 4, 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 5, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 243
//FinalLevel6 (World.Levels.FinalLevel6)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel6 extends Level {
public function FinalLevel6(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 60;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 7, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 12, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 12, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 11, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 11, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 12, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 5, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 244
//FinalLevel7 (World.Levels.FinalLevel7)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel7 extends Level {
public function FinalLevel7(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 36;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 7, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 15, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 15, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 15, 15, 1, 4, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 19, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 15, 15, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 0, 5, 0, 4, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 245
//FinalLevel8 (World.Levels.FinalLevel8)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel8 extends Level {
public function FinalLevel8(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 50;
level_dimensions = new Point(13, 25);
level_matrix = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 7, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 4, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 19, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 19, 0, 0, 19, 0, 0, 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 19, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 4, 0, 0, 19, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 4, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 5, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 246
//FinalLevel9 (World.Levels.FinalLevel9)
package World.Levels {
import flash.geom.*;
import Physics.Box2D.Common.Math.*;
import World.AssetManager.*;
public class FinalLevel9 extends Level {
public function FinalLevel9(){
level_background = ImageAssets.images["gamebackground"];
benchmark = 10;
level_dimensions = new Point(13, 13);
level_matrix = [0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 7, 4, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 13, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 13, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 5, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0];
tile_map = new TileMap(tile_set, level_dimensions, level_matrix);
gravity = new b2Vec2(0, 0);
}
override public function Update():void{
super.Update();
}
}
}//package World.Levels
Section 247
//GridStamp (World.Levels.GridStamp)
package World.Levels {
import Actors.*;
import Physics.Box2D.Common.Math.*;
public class GridStamp {
public var offset:b2Vec2;
public var actor:IActor;
public function GridStamp(_arg1:IActor, _arg2:b2Vec2){
actor = _arg1;
offset = _arg2;
}
}
}//package World.Levels
Section 248
//Level (World.Levels.Level)
package World.Levels {
import flash.events.*;
import General.*;
import flash.geom.*;
import flash.display.*;
import General.Utility.*;
import Graphics.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import Sound.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import Graphics.Style.*;
import Triggers.*;
import Actions.*;
import flash.utils.*;
import Graphics.Particle.*;
import Graphics.Engine.*;
import General.Control.*;
import World.AssetManager.*;
import flash.text.*;
import Actors.StaticStructure.*;
import Physics.Box2D.Common.*;
import flash.net.*;
import flash.system.*;
public class Level {
public var m_physScale:Number;// = 30
public var physics_accumulator:int;// = 0
public var pause_bitmap:BitmapData;
public var view:View;
public var game_timer:GameTimer;
public var shapes_collected:int;
public var m_mouseAdjust:b2Vec2;
public var physics_step:int;// = 35
public var physics_time:int;
public var m_iterations:int;// = 10
public var level_background:BitmapData;
public var m_timeStep:Number;// = 0.0133333333333333
public var startPoint:b2Vec2;
public var tile_set:TileSet;
public var levelInfo:LevelCompleteInfo;
public var launchVector:b2Vec2;
public var m_sprite:Sprite;
public var shapes_lost:int;
public var cullAABB:b2AABB;
public var tile_map:TileMap;
public var level_matrix:Array;
public var gravity:b2Vec2;
private var mousePVec:b2Vec2;
public var m_fpsCounter:FpsCounter;
public var m_mouseLaunch:Boolean;
public var m_spriteChange:b2Vec2;
public var level_dimensions:Point;
public var m_renderList:RenderList;
public var endPoint:b2Vec2;
public var m_profiler:Profiler;
public var benchmark:int;
public static var mouseYWorldPhys:Number;
public static var mouseXWorldPhys:Number;
public static var mouseYWorld:Number;
public static var mouseXWorld:Number;
public function Level(){
cullAABB = new b2AABB();
mousePVec = new b2Vec2();
super();
var _local1:ShapeStyle = new ShapeStyle();
_local1.SetSprite(ImageAssets.images["glassblock"]);
var _local2:ShapeStyle = new ShapeStyle();
_local2.SetSprite(ImageAssets.images["smallpushblock"]);
var _local3:ShapeStyle = new ShapeStyle();
_local3.SetColor(new Color(0xFF, 50, 50));
var _local4:ShapeStyle = new ShapeStyle();
_local4.SetSprite(ImageAssets.images["flipper"]);
var _local5:ShapeStyle = new ShapeStyle();
_local5.SetSprite(ImageAssets.images["curvedcorner"]);
var _local6:ShapeStyle = new ShapeStyle();
_local6.SetSprite(ImageAssets.images["player"]);
var _local7:ShapeStyle = new ShapeStyle();
_local7.SetSprite(ImageAssets.images["testcircle"]);
var _local8:ShapeStyle = new ShapeStyle();
_local8.SetSprite(ImageAssets.images["goodexit"]);
var _local9:ShapeStyle = new ShapeStyle();
_local9.SetSprite(ImageAssets.images["breakableblock"]);
var _local10:ShapeStyle = new ShapeStyle();
_local10.SetSprite(ImageAssets.images["agitator"]);
var _local11:ShapeStyle = new ShapeStyle();
_local11.SetSprite(ImageAssets.images["peg"]);
var _local12:ShapeStyle = new ShapeStyle();
_local12.SetSprite(ImageAssets.images["freeblockx"]);
var _local13:ShapeStyle = new ShapeStyle();
_local13.SetSprite(ImageAssets.images["freeblocky"]);
var _local14:ShapeStyle = new ShapeStyle();
_local14.SetSprite(ImageAssets.images["movingblock"]);
var _local15:ShapeStyle = new ShapeStyle();
_local15.SetSprite(ImageAssets.images["rotatingdoor"]);
tile_set = new TileSet();
tile_set.AddTile(new GridStamp(new AbstractActor(), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new Box(new b2Vec2(0, 0), 50, 50, 0, 0, _local1, 0.2, 0.5), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new PushZone(new b2Vec2(0, 0), 50, 50, new b2Vec2(0, -1.5), 0, _local2), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new FlipperDoor(new b2Vec2(0, 0), 90, 15, 1, 0, -90, 90, 0, 0, 0.2, 0.2, _local3, _local4), new b2Vec2(-37, 40)));
tile_set.AddTile(new GridStamp(new CurvedCorner(new b2Vec2(0, 0), 50, 50, 0, 1.5, _local5, 0.2, 0.2), new b2Vec2(-50, -50)));
tile_set.AddTile(new GridStamp(new Ship(new b2Vec2(200, 90), 15, 3, 0.06, 150, 14, 8, _local6), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new Circle(new b2Vec2(0, 0), 15, 1.75, 0.2, 0.7, _local7), new b2Vec2(-50, -50)));
tile_set.AddTile(new GridStamp(new ShapeExit(new b2Vec2(0, 0), 50, 50, 0, _local8), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new BreakableBlock(new b2Vec2(0, 0), 25, 25, 0, 0, _local9, 0.2, 0.7), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new Agitator(new b2Vec2(0, 0), 20, 4, 0.1, 0.2, _local10), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new Peg(new b2Vec2(0, 0), 25, 0.2, 0.3, _local11), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new FreeBlock(new b2Vec2(0, 0), 50, 50, 0.6, 0, _local12, 0, 0.2, 0.2, true), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new FreeBlock(new b2Vec2(0, 0), 50, 50, 0.6, 0, _local13, 0, 0.2, 0.2, false), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new MovingBlock(new b2Vec2(0, 0), 50, 50, 0.6, 0, _local14, 0, 0.4, 0.2, true), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new MovingBlock(new b2Vec2(0, 0), 50, 50, 0.6, 0, _local14, 0, 0.4, 0.2, false), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new SentryGun(new b2Vec2(0, 0), 15, 0.2, 0.5, _local11), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new PushZone(new b2Vec2(0, 0), 50, 50, new b2Vec2(0, 1.5), 180, _local2), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new PushZone(new b2Vec2(0, 0), 50, 50, new b2Vec2(-1.5, 0), 270, _local2), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new PushZone(new b2Vec2(0, 0), 50, 50, new b2Vec2(1.5, 0), 90, _local2), new b2Vec2(0, 0)));
tile_set.AddTile(new GridStamp(new RotatingDoor(new b2Vec2(0, 0), 90, 20, 5, 0, 0, 0, 200, 1000, 0.2, 0.2, _local15, _local15), new b2Vec2(50, 50)));
}
public function Cleanup():void{
var current:b2Body;
var next:b2Body = Environment.world.m_bodyList;
while (next != null) {
current = next;
next = next.m_next;
Environment.world.DestroyBody(current);
current = null;
};
Environment.world.m_broadPhase = null;
Environment.world.m_contactManager = null;
Environment.world.m_bodyList = null;
Environment.world.m_contactList = null;
Environment.world.m_filter = null;
Environment.world.m_jointList = null;
ActorManager.Clear();
TriggerManager.getInstance().ClearTriggers();
tile_map = null;
tile_set = null;
GameState.controllableActor = null;
Command.unpause();
ParticleManager.Clear();
m_renderList.Clear();
m_renderList = null;
GroupManager.Clear();
View.Clear();
Environment.Clear();
GameState.paused = false;
Command.unpause();
Environment.world = null;
try {
new LocalConnection().connect("foo");
new LocalConnection().connect("foo");
} catch(e) {
};
}
public function DelayedLoop(_arg1:Function, _arg2:int, _arg3:int):void{
var _local4:Timer = new Timer(_arg2, _arg3);
_local4.addEventListener(TimerEvent.TIMER, _arg1);
_local4.start();
}
public function init():void{
var _local7:ICollisionAction;
view = View.getInstance();
m_profiler = new Profiler();
m_fpsCounter = new FpsCounter();
m_fpsCounter.x = 7;
m_fpsCounter.y = 24;
m_renderList = new RenderList();
m_mouseLaunch = false;
m_spriteChange = new b2Vec2(0, 0);
m_mouseAdjust = new b2Vec2(0, 0);
var _local1:b2AABB = new b2AABB();
_local1.minVertex.Set(-5000, -5000);
_local1.maxVertex.Set(5000, 5000);
Environment.world = new b2World(_local1, gravity, true);
Environment.physScale = m_physScale;
shapes_collected = 0;
shapes_lost = 0;
game_timer = new GameTimer();
GameState.totalshapes = 0;
levelInfo = new LevelCompleteInfo();
tile_set.Cache();
tile_map.Create();
tile_set.Clear();
var _local2:ICollisionAction = new PusherImpulse("Pusher");
TriggerManager.getInstance().addCollisionTrigger("Pusher", "Box", _local2);
TriggerManager.getInstance().addCollisionTrigger("Pusher", "Circle", _local2);
TriggerManager.getInstance().addCollisionTrigger("Pusher", "Poly", _local2);
TriggerManager.getInstance().addCollisionTrigger("Pusher", "Flipper", _local2);
TriggerManager.getInstance().addCollisionTrigger("Pusher", "MovingBlock", _local2);
TriggerManager.getInstance().addCollisionTrigger("Pusher", "BreakableBlock", _local2);
TriggerManager.getInstance().addCollisionTrigger("Pusher", "Peg", _local2);
var _local3:CollectShape = new CollectShape("Circle");
TriggerManager.getInstance().addCollisionTrigger("ShapeExit", "Circle", _local3);
var _local4:BreakBlock = new BreakBlock("Circle");
TriggerManager.getInstance().addCollisionTrigger("BreakableBlock", "Circle", _local4);
var _local5:SentryFire = new SentryFire("SentryVision");
TriggerManager.getInstance().addCollisionTrigger("SentryVision", "Circle", _local5);
var _local6:RepelImpulse = new RepelImpulse("CircleAttractor", "CircleAttractor", -0.06);
TriggerManager.getInstance().addCollisionTrigger("CircleAttractor", "CircleAttractor", _local6);
_local7 = new PlaySound(SoundAssets.sounds["pushergun"], 0.35, 0, 500, false);
TriggerManager.getInstance().addCollisionTrigger("Pusher", "Circle", _local7);
_local7 = new PlaySound(SoundAssets.sounds["shapebump"], 0.5, 1, 0, true);
TriggerManager.getInstance().addCollisionTrigger("Circle", "Circle", _local7);
_local7 = new PlaySound(SoundAssets.sounds["score1"], 0.4, 0, 0, false);
TriggerManager.getInstance().addCollisionTrigger("ShapeExit", "Circle", _local7);
_local7 = new PlaySound(SoundAssets.sounds["breakhit"], 0.5, 0, 0, false);
TriggerManager.getInstance().addCollisionTrigger("BreakableBlock", "Circle", _local7);
_local7 = new PlaySound(SoundAssets.sounds["playercollision"], 0.3, 0, 0, true);
TriggerManager.getInstance().addCollisionTrigger("Ship", "Box", _local7);
TriggerManager.getInstance().addCollisionTrigger("Ship", "BreakableBlock", _local7);
TriggerManager.getInstance().addCollisionTrigger("Ship", "CurvedCorner", _local7);
TriggerManager.getInstance().addCollisionTrigger("Ship", "Circle", _local7);
_local7 = new PlaySound(SoundAssets.sounds["playercollision"], 0.3, 2, 0, true);
TriggerManager.getInstance().addCollisionTrigger("FadeBullet", "Circle", _local7);
TriggerManager.getInstance().addCollisionTrigger("FadeBullet", "Box", _local7);
TriggerManager.getInstance().addCollisionTrigger("FadeBullet", "CurvedCorner", _local7);
TriggerManager.getInstance().addCollisionTrigger("FadeBullet", "BreakableBlock", _local7);
TriggerManager.getInstance().addCollisionTrigger("FadeBullet", "Ship", _local7);
TriggerManager.getInstance().addCollisionTrigger("FadeBullet", "Peg", _local7);
TriggerManager.getInstance().addCollisionTrigger("FadeBullet", "MovingBlock", _local7);
_local7 = new PlaySound(SoundAssets.sounds["bounce"], 0.2, 2, 0, true);
TriggerManager.getInstance().addCollisionTrigger("Agitator", "Box", _local7);
TriggerManager.getInstance().addCollisionTrigger("Agitator", "CurvedCorner", _local7);
TriggerManager.getInstance().addCollisionTrigger("Agitator", "Circle", _local7);
TriggerManager.getInstance().addCollisionTrigger("Agitator", "BreakableBlock", _local7);
TriggerManager.getInstance().addCollisionTrigger("Agitator", "Peg", _local7);
TriggerManager.getInstance().addCollisionTrigger("Agitator", "MovingBlock", _local7);
TriggerManager.getInstance().addCollisionTrigger("MovingBlock", "Box", _local7);
TriggerManager.getInstance().addCollisionTrigger("MovingBlock", "CurvedCorner", _local7);
TriggerManager.getInstance().addCollisionTrigger("MovingBlock", "Peg", _local7);
TriggerManager.getInstance().addCollisionTrigger("MovingBlock", "MovingBlock", _local7);
SoundManager.getInstance().playsound(SoundAssets.sounds["spawn1"], 0, 0.75, 0);
GameState.levelactive = true;
levelInfo.collected = 0;
physics_time = getTimer();
}
public function GetBodyAtMouse(_arg1:Boolean=false):b2Body{
var _local8:Boolean;
mousePVec.Set(mouseXWorldPhys, mouseYWorldPhys);
var _local2:b2AABB = new b2AABB();
_local2.minVertex.Set((mouseXWorldPhys - 0.001), (mouseYWorldPhys - 0.001));
_local2.maxVertex.Set((mouseXWorldPhys + 0.001), (mouseYWorldPhys + 0.001));
var _local3 = 10;
var _local4:Array = new Array();
var _local5:int = Environment.world.Query(_local2, _local4, _local3);
var _local6:b2Body;
var _local7:int;
while (_local7 < _local5) {
if ((((_local4[_local7].m_body.IsStatic() == false)) || (_arg1))){
_local8 = _local4[_local7].TestPoint(mousePVec);
if (_local8){
_local6 = _local4[_local7].m_body;
break;
};
};
_local7++;
};
return (_local6);
}
public function IsPaused():Boolean{
return (GameState.paused);
}
public function UpdateMouseWorld():void{
mouseXWorldPhys = ((Input.mouseX + View.viewLocation.x) / m_physScale);
mouseYWorldPhys = ((Input.mouseY + View.viewLocation.y) / m_physScale);
mouseXWorld = (Input.mouseX + View.viewLocation.x);
mouseYWorld = (Input.mouseY + View.viewLocation.y);
}
public function End():LevelCompleteInfo{
GameState.paused = true;
GameState.levelactive = false;
levelInfo.totalshapes = GameState.totalshapes;
levelInfo.time = game_timer.time;
levelInfo.benchmark = benchmark;
levelInfo.levelnumber = Environment.playerInfo.currentlevel;
Cleanup();
return (levelInfo);
}
public function showMemory(_arg1:String):void{
var _local2:String = new String();
_local2 = (((_arg1 + ": ") + String(Math.round((System.totalMemory / 0x100000)))) + " MB used");
trace(_local2);
}
public function Draw():void{
var _local5:String;
var _local6:int;
var _local7:int;
var _local8:int;
cullAABB = new b2AABB();
cullAABB.minVertex.x = (View.viewLocation.x / m_physScale);
cullAABB.minVertex.y = (View.viewLocation.y / m_physScale);
cullAABB.maxVertex.x = ((View.viewLocation.x + Environment.stageObject.stageWidth) / m_physScale);
cullAABB.maxVertex.y = ((View.viewLocation.y + Environment.stageObject.stageHeight) / m_physScale);
var _local1:Array = new Array();
var _local2:int = Environment.world.Query(cullAABB, _local1, 1000);
var _local3:int;
while (_local3 < _local2) {
m_renderList.AddShape(_local1[_local3]);
_local3++;
};
View.DrawBitmap(level_background, level_background.rect, new Point(0, 0), null, null, false);
ParticleManager.update();
m_renderList.Render();
m_renderList.Clear();
var _local4:uint = (game_timer.time / 1000);
_local6 = Math.floor((_local4 / 3600));
_local4 = (_local4 - (3600 * _local6));
_local7 = Math.floor((_local4 / 60));
_local4 = (_local4 - (60 * _local7));
_local8 = _local4;
var _local9:String = _local8.toString();
if (_local9.length == 1){
_local9 = ("0" + _local9);
};
if (_local6 != 0){
_local5 = (_local6 + ":");
} else {
_local5 = "";
};
_local5 = (_local5 + ((_local7 + ":") + _local9));
var _local10:String = ((("Shapes: " + levelInfo.collected.toString()) + " of ") + String(GameState.totalshapes));
var _local11:String = ("Time: " + _local5);
var _local12:BitmapData = ImageAssets.images["gamebar"];
View.DrawBitmap(_local12, _local12.rect, new Point(6, 442), null, null, true);
View.DrawText(new Point(20, 450), _local10, 12303359, 16);
View.DrawText(new Point(200, 450), _local11, 12303359, 16);
CustomCursor.draw();
}
public function Update():void{
var _local1:int;
var _local2:int;
if (!GameState.paused){
game_timer.update();
UpdateMouseWorld();
View.Center();
_local1 = getTimer();
Profiler.physics.start();
_local2 = (getTimer() - physics_time);
physics_time = getTimer();
physics_accumulator = (physics_accumulator + _local2);
Environment.world.Step(m_timeStep, m_iterations);
Profiler.physics.end();
TriggerManager.getInstance().CheckCollisions();
TriggerManager.getInstance().EnterFrame();
Profiler.sound.start();
SoundManager.getInstance().PlaySounds();
SoundManager.getInstance().PlayMusic();
Profiler.sound.end();
};
}
public function Pause():void{
if (GameState.paused == true){
game_timer.resume();
CustomCursor.setCursor("default");
GameState.paused = false;
} else {
game_timer.pause();
GameState.paused = true;
};
}
public function blit():void{
View.getInstance().swapbuffer();
}
}
}//package World.Levels
Section 249
//LevelCollection (World.Levels.LevelCollection)
package World.Levels {
public class LevelCollection {
private var levels:Array;
public function LevelCollection(){
levels = new Array();
init();
}
private function init():void{
levels.push(FinalLevel1);
levels.push(FinalLevel2);
levels.push(FinalLevel3);
levels.push(FinalLevel4);
levels.push(FinalLevel5);
levels.push(FinalLevel6);
levels.push(FinalLevel7);
levels.push(FinalLevel8);
levels.push(FinalLevel9);
levels.push(FinalLevel10);
levels.push(FinalLevel11);
levels.push(FinalLevel12);
levels.push(FinalLevel13);
levels.push(FinalLevel14);
levels.push(FinalLevel15);
levels.push(FinalLevel16);
levels.push(FinalLevel17);
levels.push(FinalLevel18);
levels.push(FinalLevel19);
levels.push(FinalLevel20);
levels.push(FinalLevel21);
levels.push(FinalLevel22);
}
public function getSize():int{
return (levels.length);
}
public function getLevel(_arg1:int):Level{
var _local3:Object;
var _local2:Class = levels[(_arg1 - 1)];
if (_local2){
_local3 = new (_local2);
return ((_local3 as Level));
};
return (null);
}
}
}//package World.Levels
Section 250
//LevelCompleteInfo (World.Levels.LevelCompleteInfo)
package World.Levels {
public class LevelCompleteInfo {
public var completed:Boolean;// = false
public var lost:int;// = 0
public var collected:int;// = 0
public var time:uint;// = 0
public var levelnumber:int;// = 0
public var benchmark:int;// = 0
public var totalshapes:int;// = 0
public var score:int;// = 0
public var blocksbroken:int;// = 0
public function LevelCompleteInfo(){
collected = 0;
}
}
}//package World.Levels
Section 251
//TileMap (World.Levels.TileMap)
package World.Levels {
import flash.geom.*;
import Graphics.*;
import Actors.*;
import Physics.Box2D.Common.Math.*;
import General.Math.*;
import Actors.StaticStructure.*;
public class TileMap {
private var tile_set:TileSet;
private var tile_array:Array;
private var set_dimensions:Point;
public function TileMap(_arg1:TileSet, _arg2:Point, _arg3:Array=null){
tile_set = _arg1;
set_dimensions = _arg2;
if (_arg3 != null){
tile_array = _arg3;
} else {
tile_array = new Array();
};
}
public function SetTile(_arg1:int, _arg2:int, _arg3:int):void{
}
public function ClearTile(_arg1:int, _arg2:int):void{
}
public function GetTile(_arg1:int, _arg2:int):int{
var _local3:int;
_local3 = ((_arg2 * set_dimensions.x) + _arg1);
return (tile_array[_local3]);
}
public function Create():void{
var _local1:int;
var _local2:int;
var _local3:*;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:int;
var _local7:GridStamp;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:Point;
var _local13:Number;
var _local14:Box;
var _local15:Box;
var _local16:PushZone;
var _local17:PushZone;
var _local18:FlipperDoor;
var _local19:FlipperDoor;
var _local20:CurvedCorner;
var _local21:CurvedCorner;
var _local22:Ship;
var _local23:Ship;
var _local24:Circle;
var _local25:Circle;
var _local26:b2Vec2;
var _local27:b2Vec2;
var _local28:int;
var _local29:ShapeExit;
var _local30:ShapeExit;
var _local31:BreakableBlock;
var _local32:b2Vec2;
var _local33:BreakableBlock;
var _local34:Agitator;
var _local35:Agitator;
var _local36:Peg;
var _local37:Peg;
var _local38:FreeBlock;
var _local39:FreeBlock;
var _local40:FreeBlock;
var _local41:FreeBlock;
var _local42:MovingBlock;
var _local43:MovingBlock;
var _local44:MovingBlock;
var _local45:MovingBlock;
var _local46:SentryGun;
var _local47:SentryGun;
var _local48:RotatingDoor;
var _local49:RotatingDoor;
for (_local3 in tile_array) {
_local1 = (int(_local3) % int(set_dimensions.x));
_local2 = (Math.ceil(((_local3 + 1) / set_dimensions.x)) - 1);
_local4 = new b2Vec2();
_local4.x = (_local1 * 100);
_local4.y = (_local2 * 100);
_local6 = tile_array[_local3];
_local7 = tile_set.GetTile(_local6);
_local5 = _local7.offset;
_local4.Add(_local5);
_local12 = new Point();
_local12.x = (_local3 % set_dimensions.x);
_local12.y = Math.floor((_local3 / set_dimensions.x));
_local8 = GetTile(_local12.x, (_local12.y - 1));
_local9 = GetTile(_local12.x, (_local12.y + 1));
_local10 = GetTile((_local12.x - 1), _local12.y);
_local11 = GetTile((_local12.x + 1), _local12.y);
if (tile_array[_local3] == 1){
_local14 = (_local7.actor as Box);
_local15 = (_local14.Clone(_local4) as Box);
} else {
if (tile_array[_local3] == 2){
_local16 = (_local7.actor as PushZone);
_local17 = (_local16.Clone(_local4) as PushZone);
} else {
if (tile_array[_local3] == 3){
_local18 = (_local7.actor as FlipperDoor);
_local19 = (_local18.Clone(_local4) as FlipperDoor);
_local19.SEEK_ANGLE(0, 50, 300, -90, 90);
} else {
if (tile_array[_local3] == 4){
if (_local8 == 1){
if (_local10 == 1){
_local13 = (0 * (Math.PI / 180));
} else {
if (_local11 == 1){
_local13 = (90 * (Math.PI / 180));
_local4.x = (_local4.x + 100);
};
};
} else {
if (_local9 == 1){
if (_local10 == 1){
_local13 = (270 * (Math.PI / 180));
_local4.y = (_local4.y + 100);
} else {
if (_local11 == 1){
_local13 = (180 * (Math.PI / 180));
_local4.x = (_local4.x + 100);
_local4.y = (_local4.y + 100);
};
};
};
};
_local20 = (_local7.actor as CurvedCorner);
_local21 = (_local20.Clone(_local4, _local13) as CurvedCorner);
} else {
if (tile_array[_local3] == 5){
_local22 = (_local7.actor as Ship);
_local23 = (_local22.Clone(_local4) as Ship);
_local23.LIMIT_VELOCITY(18);
_local23.KEYBOARD_SHOOT();
GameState.controllableActor = _local23;
View.SetActor(_local23);
} else {
if (tile_array[_local3] == 6){
_local24 = (_local7.actor as Circle);
_local27 = new b2Vec2();
_local27.x = (_local4.x + 50);
_local27.y = (_local4.y + 50);
_local28 = 0;
while (_local28 < 5) {
_local26 = GameMath.RandRect(_local27, new b2Vec2(25, 25));
_local25 = (_local24.Clone(_local26) as Circle);
_local25.LIMIT_VELOCITY(18);
GameState.totalshapes = (GameState.totalshapes + 1);
_local28++;
};
} else {
if (tile_array[_local3] == 7){
_local29 = (_local7.actor as ShapeExit);
_local30 = (_local29.Clone(_local4) as ShapeExit);
} else {
if (tile_array[_local3] == 8){
_local31 = (_local7.actor as BreakableBlock);
_local32 = _local4.Copy();
_local4.Copy().x = (_local32.x - 25);
_local32.y = (_local32.y - 25);
_local33 = (_local31.Clone(_local32) as BreakableBlock);
_local32 = _local4.Copy();
_local4.Copy().x = (_local32.x + 25);
_local32.y = (_local32.y + 25);
_local33 = (_local31.Clone(_local32) as BreakableBlock);
_local32 = _local4.Copy();
_local4.Copy().x = (_local32.x - 25);
_local32.y = (_local32.y + 25);
_local33 = (_local31.Clone(_local32) as BreakableBlock);
_local32 = _local4.Copy();
_local4.Copy().x = (_local32.x + 25);
_local32.y = (_local32.y - 25);
_local33 = (_local31.Clone(_local32) as BreakableBlock);
} else {
if (tile_array[_local3] == 9){
_local34 = (_local7.actor as Agitator);
_local35 = (_local34.Clone(_local4) as Agitator);
} else {
if (tile_array[_local3] == 10){
_local36 = (_local7.actor as Peg);
_local37 = (_local36.Clone(_local4) as Peg);
} else {
if (tile_array[_local3] == 11){
_local38 = (_local7.actor as FreeBlock);
_local39 = (_local38.Clone(_local4) as FreeBlock);
} else {
if (tile_array[_local3] == 12){
_local40 = (_local7.actor as FreeBlock);
_local41 = (_local40.Clone(_local4) as FreeBlock);
} else {
if (tile_array[_local3] == 13){
_local42 = (_local7.actor as MovingBlock);
_local43 = (_local42.Clone(_local4) as MovingBlock);
} else {
if (tile_array[_local3] == 14){
_local44 = (_local7.actor as MovingBlock);
_local45 = (_local44.Clone(_local4) as MovingBlock);
} else {
if (tile_array[_local3] == 15){
_local46 = (_local7.actor as SentryGun);
_local47 = (_local46.Clone(_local4) as SentryGun);
} else {
if (tile_array[_local3] == 16){
_local16 = (_local7.actor as PushZone);
_local17 = (_local16.Clone(_local4) as PushZone);
} else {
if (tile_array[_local3] == 17){
_local16 = (_local7.actor as PushZone);
_local17 = (_local16.Clone(_local4) as PushZone);
} else {
if (tile_array[_local3] == 18){
_local16 = (_local7.actor as PushZone);
_local17 = (_local16.Clone(_local4) as PushZone);
} else {
if (tile_array[_local3] == 19){
_local48 = (_local7.actor as RotatingDoor);
_local49 = (_local48.Clone(_local4) as RotatingDoor);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
}
public function SetArea(_arg1:Rectangle, _arg2:int):void{
}
}
}//package World.Levels
Section 252
//TileSet (World.Levels.TileSet)
package World.Levels {
import Actors.*;
public class TileSet {
private var tile_list:Array;
public function TileSet(){
tile_list = new Array();
}
public function Cache():void{
var _local1:*;
var _local2:IActor;
for (_local1 in tile_list) {
_local2 = tile_list[_local1].actor;
_local2.setMask(0);
_local2.Create();
_local2.Cache();
};
}
public function GetTile(_arg1:int):GridStamp{
return (tile_list[_arg1]);
}
public function Clear():void{
var _local1:*;
var _local2:IActor;
for (_local1 in tile_list) {
_local2 = tile_list[_local1].actor;
_local2.Destroy();
_local2.StopTimers();
_local2 = null;
};
}
public function AddTile(_arg1:GridStamp):void{
tile_list.push(_arg1);
}
}
}//package World.Levels
Section 253
//ShapeFactory (World.Shapes.ShapeFactory)
package World.Shapes {
import General.*;
import Physics.Box2D.Common.Math.*;
import Physics.Box2D.Collision.Shapes.*;
import Physics.Box2D.Common.*;
public class ShapeFactory {
private static var m_physScale:Number = Environment.physScale;
public static function Circle(_arg1:Object):b2CircleDef{
var _local2:b2CircleDef = new b2CircleDef();
if (_arg1["radius"] != null){
_local2.radius = (_arg1["radius"] / m_physScale);
};
if (_arg1["density"] != null){
_local2.density = _arg1["density"];
};
if (_arg1["friction"] != null){
_local2.friction = _arg1["friction"];
};
if (_arg1["restitution"] != null){
_local2.restitution = _arg1["restitution"];
};
if (_arg1["sensor"] != null){
_local2.sensor = _arg1["sensor"];
};
if (_arg1["localPosition"] != null){
_local2.localPosition = _arg1["localPosition"];
};
if (_arg1["localRotation"] != null){
_local2.localRotation = _arg1["localRotation"];
};
if (_arg1["groupIndex"] != null){
_local2.groupIndex = _arg1["groupIndex"];
};
if (_arg1["categoryBits"] != null){
_local2.categoryBits = _arg1["categoryBits"];
};
if (_arg1["maskBits"] != null){
_local2.maskBits = _arg1["maskBits"];
};
return (_local2);
}
public static function ConcaveArc(_arg1:Object):b2ConcaveArcDef{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local2:b2ConcaveArcDef = new b2ConcaveArcDef();
var _local3:b2Vec2 = new b2Vec2();
if (_arg1["extents"] != null){
_local3.Set((_arg1["extents"].x / m_physScale), (_arg1["extents"].y / m_physScale));
};
if (_arg1["curve"] != null){
_local4 = _arg1["curve"];
};
_local5 = (_local3.x * 2);
_local6 = (_local3.y * 2);
_local2.vertexCount = 3;
_local2.vertices[0].Set(_local5, 0);
_local2.vertices[1].Set(0, _local6);
_local2.vertices[2].Set(0, 0);
if (_local4 < 1){
_local4 = 1;
};
var _local7:Number = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
_local2.radius = ((_local7 / 2) * _local4);
if (_arg1["density"] != null){
_local2.density = _arg1["density"];
};
if (_arg1["friction"] != null){
_local2.friction = _arg1["friction"];
};
if (_arg1["restitution"] != null){
_local2.restitution = _arg1["restitution"];
};
if (_arg1["sensor"] != null){
_local2.sensor = _arg1["sensor"];
};
if (_arg1["localPosition"] != null){
_local2.localPosition = _arg1["localPosition"];
};
if (_arg1["localRotation"] != null){
_local2.localRotation = _arg1["localRotation"];
};
if (_arg1["groupIndex"] != null){
_local2.groupIndex = _arg1["groupIndex"];
};
if (_arg1["categoryBits"] != null){
_local2.categoryBits = _arg1["categoryBits"];
};
if (_arg1["maskBits"] != null){
_local2.maskBits = _arg1["maskBits"];
};
return (_local2);
}
public static function Polygon(_arg1:Object):b2PolyDef{
var _local6:int;
var _local7:Number;
var _local2:b2PolyDef = new b2PolyDef();
if (_arg1["sides"] != null){
_local6 = _arg1["sides"];
};
if (_arg1["radius"] != null){
_local7 = (_arg1["radius"] / m_physScale);
};
if (_arg1["density"] != null){
_local2.density = _arg1["density"];
};
if (_arg1["friction"] != null){
_local2.friction = _arg1["friction"];
};
if (_arg1["restitution"] != null){
_local2.restitution = _arg1["restitution"];
};
if (_arg1["sensor"] != null){
_local2.sensor = _arg1["sensor"];
};
if (_arg1["localPosition"] != null){
_local2.localPosition = _arg1["localPosition"];
};
if (_arg1["localRotation"] != null){
_local2.localRotation = _arg1["localRotation"];
};
if (_arg1["groupIndex"] != null){
_local2.groupIndex = _arg1["groupIndex"];
};
if (_arg1["categoryBits"] != null){
_local2.categoryBits = _arg1["categoryBits"];
};
if (_arg1["maskBits"] != null){
_local2.maskBits = _arg1["maskBits"];
};
_local2.vertexCount = _local6;
if ((((_local6 < 3)) || ((_local6 > b2Settings.b2_maxPolyVertices)))){
return (null);
};
var _local3:Number = (2 * Math.PI);
var _local4:Number = (_local3 / _local6);
var _local5:int;
while (_local5 < _local6) {
_local2.vertices[_local5].Set((Math.cos((_local3 - (_local4 * _local5))) * _local7), (Math.sin((_local3 - (_local4 * _local5))) * _local7));
_local5++;
};
return (_local2);
}
public static function Rectangle(_arg1:Object):b2BoxDef{
var _local2:b2BoxDef = new b2BoxDef();
if (_arg1["extents"] != null){
_local2.extents.Set((_arg1["extents"].x / m_physScale), (_arg1["extents"].y / m_physScale));
};
if (_arg1["density"] != null){
_local2.density = _arg1["density"];
};
if (_arg1["friction"] != null){
_local2.friction = _arg1["friction"];
};
if (_arg1["restitution"] != null){
_local2.restitution = _arg1["restitution"];
};
if (_arg1["sensor"] != null){
_local2.sensor = _arg1["sensor"];
};
if (_arg1["localPosition"] != null){
_local2.localPosition = _arg1["localPosition"];
};
if (_arg1["localRotation"] != null){
_local2.localRotation = _arg1["localRotation"];
};
if (_arg1["groupIndex"] != null){
_local2.groupIndex = _arg1["groupIndex"];
};
if (_arg1["categoryBits"] != null){
_local2.categoryBits = _arg1["categoryBits"];
};
if (_arg1["maskBits"] != null){
_local2.maskBits = _arg1["maskBits"];
};
return (_local2);
}
}
}//package World.Shapes
Section 254
//Stamp (World.Stamps.Stamp)
package World.Stamps {
public class Stamp {
}
}//package World.Stamps
Section 255
//PlayerInformation (World.PlayerInformation)
package World {
public class PlayerInformation {
public var scores:Array;
public var unlocked:int;
public var times:Array;
public var currentlevel:int;
public var playerName:String;
public var gamepoints:int;
public var difficulty:int;
public var mousecontrol:Boolean;
public function PlayerInformation(){
unlocked = 1;
gamepoints = 0;
scores = new Array();
times = new Array();
difficulty = 0;
currentlevel = 1;
mousecontrol = true;
}
}
}//package World
Section 256
//Clog (Clog)
package {
import flash.events.*;
import General.*;
import flash.geom.*;
import flash.display.*;
import General.Utility.*;
import Graphics.*;
import Physics.Box2D.Common.Math.*;
import General.GUI.*;
import World.Levels.*;
import Sound.*;
import Physics.Box2D.Collision.*;
import Physics.Box2D.Dynamics.*;
import Physics.Box2D.Dynamics.Joints.*;
import Physics.Box2D.Dynamics.Contacts.*;
import Physics.Box2D.Collision.Shapes.*;
import flash.utils.*;
import General.Control.*;
import World.AssetManager.*;
import World.*;
import flash.text.*;
import mochi.*;
import flash.net.*;
import flash.system.*;
public class Clog extends Sprite {
public var m_physScale:Number;// = 30
public var menu_background:BitmapData;
public var m_screen_bitmap:Bitmap;
public var game_background:BitmapData;
public var m_screen_buffer:BitmapData;
public var view:View;
public var m_clear_screen:BitmapData;
public var m_screen_buffer2:BitmapData;
public var testbutton:Button;
public var levelCollection:LevelCollection;
public var mouseSprite:Sprite;
public var cursor:CustomCursor;
public var m_sprite:Sprite;
public var key:KeyObject;
public var m_fpsCounter:FpsCounter;
public var frame_timer:Timer;
public var menus:MenuCollection;
public var m_input:Input;
public var m_profiler:Profiler;
public function Clog(){
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function disablesync():void{
removeEventListener(Event.ENTER_FRAME, invalidateFrame);
removeEventListener(Event.ENTER_FRAME, updateGame);
removeEventListener(Event.RENDER, drawFrame);
}
public function drawFrame(_arg1:Event):void{
if (((!(GameState.paused)) && (!((Environment.level == null))))){
Environment.level.blit();
};
}
public function CancelLevel():void{
Environment.cancelgame = false;
SoundManager.getInstance().StopMusic();
Environment.level.End();
disablesync();
Environment.level = null;
CustomCursor.disable();
addEventListener(Event.ENTER_FRAME, update);
}
public function init():void{
try {
MochiBot.track(this, "2b6c5c9e");
} catch(e:Error) {
};
key = new KeyObject(stage);
levelCollection = new LevelCollection();
Environment.levelCollection = levelCollection;
LoadPlayerInfo();
m_profiler = new Profiler();
FRateLimiter.fTime = (1000 / 28);
Environment.stageObject = stage;
m_screen_buffer = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0);
m_screen_buffer2 = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0);
m_screen_bitmap = new Bitmap(m_screen_buffer);
var screen_sprite:Sprite = new Sprite();
screen_sprite.addChild(m_screen_bitmap);
addChild(screen_sprite);
View.viewBuffer = m_screen_buffer;
View.viewBuffer2 = m_screen_buffer2;
View.viewBitmap = m_screen_bitmap;
view = View.getInstance();
m_fpsCounter = new FpsCounter();
m_fpsCounter.x = 7;
m_fpsCounter.y = 24;
addChildAt(m_fpsCounter, 0);
m_sprite = (this as Sprite);
m_input = new Input(m_sprite);
Environment.keyObject = key;
Environment.stage = m_sprite;
View.viewSprite = m_sprite;
ImageAssets.init();
SoundAssets.init();
menu_background = ImageAssets.images["cloglogo"];
game_background = ImageAssets.images["gamebackground"];
CustomCursor.init(false);
menus = new MenuCollection();
menus.init();
Environment.current_menu = menus.main_menu;
Environment.mouseControl = true;
}
public function EndLevel():void{
var _local14:BitmapData;
var _local16:String;
disablesync();
Environment.endgame = false;
SoundManager.getInstance().StopMusic();
var _local1:LevelCompleteInfo = Environment.level.End();
Environment.level = null;
var _local2:int = (_local1.time / 100);
var _local3:int = (_local1.benchmark - Environment.playerInfo.difficulty);
_local3 = (_local3 * 10);
var _local4:int;
var _local5:int;
var _local6:Boolean;
if (_local2 > _local3){
_local4 = (10000 - (((_local2 / _local3) - 1) * 1000));
} else {
if (_local2 == _local3){
_local4 = 10000;
} else {
_local4 = (10000 + ((_local3 / _local2) * 1000));
};
};
if (_local4 < 0){
_local4 = 100;
};
if (Environment.playerInfo.scores[_local1.levelnumber] == null){
Environment.playerInfo.scores[_local1.levelnumber] = 0;
};
if (_local4 > Environment.playerInfo.scores[_local1.levelnumber]){
Environment.playerInfo.scores[_local1.levelnumber] = _local4;
menus.levelcompleteunlocked.update("New best score!");
menus.submitscorebutton.active = true;
menus.newscore = _local4;
Environment.playerInfo.times[_local1.levelnumber] = _local2;
_local6 = true;
};
var _local7:int;
_local7 = getTotalScore();
_local7 = (_local7 / 100);
Environment.playerInfo.gamepoints = _local7;
var _local8:int = ((Environment.playerInfo.gamepoints / 100) + 1);
var _local9:Boolean;
if (_local8 > Environment.playerInfo.unlocked){
_local9 = true;
};
var _local10:int = ((Environment.playerInfo.gamepoints / 100) + 1);
var _local11:Boolean;
if (_local10 > Environment.playerInfo.unlocked){
Environment.playerInfo.unlocked = _local10;
_local11 = true;
};
var _local12:int = Environment.playerInfo.currentlevel;
var _local13 = (("Level " + _local12.toString()) + " Complete");
menus.levelcompletelabel.update(_local13);
menus.levelcompletetime.update(formatTime(_local2));
menus.levelcompletescore.update(String(_local4));
menus.levelcompletepoints.update(String(Environment.playerInfo.gamepoints));
if ((((_local6 == false)) && ((_local11 == false)))){
_local16 = ("Your best time: " + formatTime(Environment.playerInfo.times[_local1.levelnumber]));
menus.levelcompleteunlocked.update(_local16);
};
SavePlayerInfo();
_local1 = null;
CustomCursor.disable();
_local14 = View.getbuffer().clone();
var _local15:Menu = new Menu(new Point(0, 0));
_local15.Push(new Background(new Point(0, 0), _local14));
_local15.Push(menus.next_level_menu);
Environment.current_menu = _local15;
addEventListener(Event.ENTER_FRAME, update);
}
public function enablesync():void{
addEventListener(Event.ENTER_FRAME, invalidateFrame);
addEventListener(Event.ENTER_FRAME, updateGame);
addEventListener(Event.RENDER, drawFrame);
}
public function getTotalScore():int{
var _local3:*;
var _local1:Array = Environment.playerInfo.scores;
var _local2:int;
for (_local3 in _local1) {
if (_local1[_local3] != null){
_local2 = (_local2 + _local1[_local3]);
};
};
return (_local2);
}
public function SavePlayerInfo():void{
registerClassAlias("World.PlayerInformation", PlayerInformation);
var _local1:SharedObject = SharedObject.getLocal("clogsave");
_local1.data.playerinfo = Environment.playerInfo;
_local1.flush();
}
public function onEnterFrame(_arg1:Event):void{
if (root != null){
init();
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
addEventListener(Event.ENTER_FRAME, update);
};
}
public function update(_arg1:Event):void{
if (Environment.cancelgame == true){
CancelLevel();
};
if (Environment.startgame){
Environment.startgame = false;
StartLevel(Environment.playerInfo.currentlevel);
};
if (((!((Environment.level == null))) && (!(Environment.level.IsPaused())))){
removeEventListener(Event.ENTER_FRAME, update);
enablesync();
CustomCursor.enable();
};
if (Environment.exitgame == true){
ExitLevel();
};
Input.update();
if (menus.initialized == false){
menus.init();
};
if (Environment.current_menu != null){
Environment.current_menu.update(new Point(Input.screenX, Input.screenY));
};
CustomCursor.draw();
view.swapbuffer();
Input.mouseClear();
}
public function LoadPlayerInfo():void{
registerClassAlias("World.PlayerInformation", PlayerInformation);
var _local1:SharedObject = SharedObject.getLocal("clogsave");
if (_local1.data.savecount != null){
Environment.savecount = _local1.data.savecount;
Environment.playerInfo = (_local1.data.playerinfo as PlayerInformation);
} else {
Environment.playerInfo = new PlayerInformation();
_local1.data.savecount = 1;
_local1.data.playerinfo = Environment.playerInfo;
_local1.flush();
};
}
public function updateGame(_arg1:Event):void{
var _local3:BitmapData;
var _local4:Menu;
var _local2:int = getTimer();
if (!Environment.level.IsPaused()){
Environment.level.Update();
FRateLimiter.limitFrame();
if (Environment.mouseControl == true){
CustomCursor.setCursor("default");
} else {
CustomCursor.disable();
};
} else {
_local3 = View.getbuffer().clone();
_local4 = new Menu(new Point(0, 0));
_local4.Push(new Background(new Point(0, 0), _local3));
_local4.Push(menus.pause_menu);
Environment.current_menu = _local4;
CustomCursor.setCursor("arrow");
showmenu();
};
if (Environment.endgame == true){
EndLevel();
};
}
public function showmenu():void{
CustomCursor.disable();
disablesync();
addEventListener(Event.ENTER_FRAME, update);
}
public function showMemory(_arg1:String):void{
var _local2:String = new String();
_local2 = (((_arg1 + ": ") + String(Math.round((System.totalMemory / 0x100000)))) + " MB used");
trace(_local2);
}
public function formatTime(_arg1:uint):String{
var _local3:String;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local2:uint = _arg1;
_local4 = Math.floor((_local2 / 36000));
_local2 = (_local2 - (36000 * _local4));
_local5 = Math.floor((_local2 / 600));
_local2 = (_local2 - (600 * _local5));
_local6 = Math.floor((_local2 / 10));
_local2 = (_local2 - (10 * _local6));
_local7 = _local2;
var _local8:String = _local6.toString();
if (_local8.length == 1){
_local8 = ("0" + _local8);
};
if (_local4 != 0){
_local3 = (_local4 + ":");
} else {
_local3 = "";
};
_local3 = (_local3 + ((((_local5 + ":") + _local8) + ".") + _local7));
return (_local3);
}
public function StartLevel(_arg1:int):void{
removeEventListener(Event.ENTER_FRAME, update);
menus.submitscorebutton.active = false;
Environment.current_menu = null;
Environment.level = levelCollection.getLevel(_arg1);
Environment.level.init();
CustomCursor.enable();
if (Environment.mouseControl == true){
CustomCursor.setCursor("default");
} else {
CustomCursor.disable();
};
enablesync();
}
public function ExitLevel():void{
Environment.exitgame = false;
SoundManager.getInstance().StopMusic();
disablesync();
Environment.level = null;
Environment.current_menu = menus.main_menu;
addEventListener(Event.ENTER_FRAME, update);
}
public function invalidateFrame(_arg1:Event):void{
Command.GetKeys();
Input.update();
if (((!(GameState.paused)) && (!((Environment.level == null))))){
Environment.level.Draw();
stage.invalidate();
};
Input.mouseClear();
}
}
}//package
Section 257
//GameState (GameState)
package {
import flash.events.*;
import Actors.*;
import flash.utils.*;
public class GameState implements IEventDispatcher {
private var _boolean_vars:Dictionary;
private var _int_vars:Dictionary;
private var _string_vars:Dictionary;
private var _number_vars:Dictionary;
private var dispatcher:EventDispatcher;
public static var level:int = 0;
public static var levelactive:Boolean = false;
public static var controllableActor:IActor;
public static var paused:Boolean = false;
public static var graphicsQuality:int;
public static var totalshapes:int = 0;
public function dispatchEvent(_arg1:Event):Boolean{
return (dispatcher.dispatchEvent(_arg1));
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
dispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
public function SetBool(_arg1:String, _arg2:Boolean):void{
_boolean_vars[_arg1] = _arg2;
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4);
}
public function GetBool(_arg1:String):Boolean{
if (_boolean_vars[_arg1] != null){
return (_boolean_vars[_arg1]);
};
return (false);
}
public function willTrigger(_arg1:String):Boolean{
return (dispatcher.willTrigger(_arg1));
}
public function GetInt(_arg1:String):int{
if (_int_vars[_arg1] != null){
return (_int_vars[_arg1]);
};
return (-1);
}
public function SetInt(_arg1:String, _arg2:int):void{
_int_vars[_arg1] = _arg2;
}
public function GetNumber(_arg1:String):Number{
if (_number_vars[_arg1] != null){
return (_number_vars[_arg1]);
};
return (-1);
}
public function SetNumber(_arg1:String, _arg2:Number):void{
_int_vars[_arg1] = _arg2;
}
public function GetString(_arg1:String):String{
if (_string_vars[_arg1] != null){
return (_string_vars[_arg1]);
};
return (null);
}
public function SetString(_arg1:String, _arg2:String):void{
_string_vars[_arg1] = _arg2;
}
public function hasEventListener(_arg1:String):Boolean{
return (dispatcher.hasEventListener(_arg1));
}
}
}//package
Section 258
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.2");
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var clip:Object;
var mc:MovieClip;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
var depth:Number = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
var lv:URLVariables = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _cleanup(_arg1:Object):void{
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
var idx:Number = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local6:Array;
var _local3:Object = _arg2.getBounds(_arg2.root);
var _local4:Number = 0;
var _local5:Number = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var mc:MovieClip;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
var DEFAULTS:Object = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
var clip:Object = options.clip;
var clipname:String = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
var server:String = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
var depth:Number = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
var lv:URLVariables = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
_arg1 = parseInt(_arg1.toString());
var _local3:Array = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
var _local4:Array = [];
var _local5:Number = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
var _local6:Object = _local3[1];
var _local7:Object = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local5:Array;
mc._endpoint = _arg1;
var _local2:Array = mc._queue;
delete mc._queue;
var _local3:Function = mc.doSend;
var _local4:Number = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
var _local5:Number = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
var _local6:LocalConnection = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var complete:Boolean;
var unloaded:Boolean;
var r:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
var fn:Function = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
var f:Function = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local11:Number;
if (!this.parent.parent){
delete this["onEnterFrame"];
return;
};
var _local1:Object = this.parent.parent.root;
var _local2:Object = this.parent._mochiad_ctr;
var _local3:Number = (getTimer() - this.started);
var _local4:Boolean;
var _local5:Number = _local1.loaderInfo.bytesTotal;
var _local6:Number = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
var _local7:Number = ((100 * _local6) / _local5);
var _local8:Number = ((100 * _local3) / chk.ad_msec);
var _local9:Object = this._mochiad_bar._inside;
var _local10:Number = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var mc = _arg1;
var f:Function = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package