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

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

Ski Maniacs - ski down the hill as you preform jumps and smash objects.swf

This is the info page for
Flash #89493

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


Text
CLICK HERE TO PLAY

longanimals

programming director

robotJAM

artdirector

click to continue...

MORE GAMES

ACHIEVEMENT UNLOCKED

MORE GAMES

GUIDE / HINTS

ANDKON ARCADE

22

NEXT

<p align="center"><font face="Anime Ace 2.0 BB" size="12" color="#ffffff" letterSpacing="0.000000" kerning="1">Level Complete</font></p>

badge

I remember
now, skiers are
faster with
badges !

Achievements

<p align="left"><font face="Anime Ace 2.0 BB" size="10" color="#000000" letterSpacing="0.000000" kerning="1">some text telling you what achievements are available and your fastest time on this level etc.</font></p>

test name

back

MORE GAMES

END MOVIE

<p align="center"><font face="Anime Ace 2.0 BB" size="12" color="#000000" letterSpacing="0.000000" kerning="1">CLICK to PLAY THIS LEVEL </font></p>

YOU FINISHED IN LAST PLACE

OK

SORRY, BUT YOU DON't GET
ACHIEVEMENTS IF YOU COME
LAST

CHARACTER SELECT

S
K
I

S
E
L
E
C
T

<p align="left"><font face="Anime Ace 2.0 BB" size="14" color="#ffffff" letterSpacing="0.000000" kerning="1">THE MAN WITH NO BRAKES</font></p>

<p align="left"><font face="Anime Ace 2.0 BB" size="9" color="#ffffff" letterSpacing="0.400000" kerning="1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eget nunc lorem. Sed posuere euismod purus eget placerat. Sed ac nulla mauris, vel malesuada nunc. Quisque pulvinar mauris id odio aliquet interdum. Sed tempor accumsan nisi, eu molestie &nbsp;</font></p>

<p align="left"><font face="Anime Ace 2.0 BB" size="9" color="#ffffff" letterSpacing="0.400000" kerning="1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eget nunc lorem. Sed </font></p>

ACHIEVEMENTS

<p align="left"><font face="Anime Ace 2.0 BB" size="6" color="#000000" letterSpacing="0.300000" kerning="1">pepe veloocity</font></p>

PAUSE / MUTE

PUSH

CROUCH (to jump)

lean
forward

lean
back

W

a

S

D

X

POSE (in air)

SPACE

OR

CONTINUE

No more help

NO MORE HELP

SUPER START

TAP UP FAST AT THE START FOR
EXTRA BOOST AND A SUPER START.

IN THE AIR

PERFORM Forward or Backward
SOMERSAULTS TO GAIN BOOST
DO A POSE (X or SPACE) for
more boost

forward

BACKward

POSE

BOOST!

AS YOUR BOOST BAR INCREASES SO
DOES YOUR TOP SPEED
BUILD BOOST TO GET A GOOD TIME

boost METER

STUNT COMBOS

SOMETIMES YOU'RE ASKED TO
PERFORM COMBOS.
COMPLETE THESE SUCCESSFULLY FOR
BIG BOOST

p

i

l

f

k

c

a

b

T

N

O

R

F

E

S

P

COMBO START ICON

COMBOs

HOOPS

JUMP THROUGH HOOPS
PERFORM A POSE THROUGH A HOOP FOR
EXTRA BOOST

OBSTACLES

SMASH OBSTACLES FOR POINTS
CROUCH WHILE SMASHING
OBSTACLES FOR MORE POINTS!

JUMP!

HOLD DOWN THE DOWN ARROW (OR S)
TO BUILD UP JUMP HEIGHT
RELEASE IT TO JUMP.

BONUS ICONS

THESE ARE HIDDEN ON MOST LEVELS
COLLECT THEM FOR BONUS REWARDS

S

U

N

O

B

aaaaaaaa

1

2

3

4

5

POSE

boost METER

<p align="center"><font face="Anime Ace 2.0 BB" size="49" color="#ffffff" letterSpacing="0.000000" kerning="1">1</font></p>

<p align="left"><font face="Anime Ace 2.0 BB" size="11" color="#000000" letterSpacing="0.000000" kerning="1">some text telling you what achievements are available and your fastest time on this level etc.</font></p>

<p align="center"><font face="Anime Ace 2.0 BB" size="25" color="#ffffff" letterSpacing="0.000000" kerning="1">Level start</font></p>

CONTINUE

Complete achievements to unlock stuff:

meanwhile back on
planetoid....

YOU COMPLETED THE GAME AND
ALL YOU GET IS A SINGING
HADDOCK !!!
CONGRATULATIONS
YOU ARE THE CYCLOMANIAC KING.
THANKS FOR PLAYING !

click to continue

RACE SELECT

<p align="left"><font face="Anime Ace 2.0 BB" size="14" color="#ffffff" letterSpacing="0.000000" kerning="1">RACE SELECT</font></p>

<p align="left"><font face="Anime Ace 2.0 BB" size="7" color="#000000" letterSpacing="0.300000" kerning="1">TRACK 1</font></p>

Are you sure you would
like to clear your saved
data?

CANCEL

RETRY

SUBMIT DATA

you sure?

CYCLOMANIACS

ALIENS
MUST DIE

WATERWERKS

HEAVY WEAPONS

our other games:-

SCORE: 12345678

submit score

submit score

TIME: 12345678

PLAY WITH HIGHSCORES AND
ACHIEVEMENTS AT KONGREGATE

longanimals

DDICTING

AM

E

S

SHOP

available cash

ENTER CHEAT CODES:

<p align="center"><font face="Anime Ace 2.0 BB" size="25" color="#000000" letterSpacing="0.000000" kerning="1"><b>Code here</b></font></p>

<p align="center"><font face="Anime Ace 2.0 BB" size="16" color="#ffffff" letterSpacing="0.000000" kerning="1"><b>unlocked</b></font></p>

once you've activated them, CLICK
TICKS/crosses to enable cheats

ACHIEVEMENTS ARE NOT
AWARDED WHEN CHEATS ARE
ACTIVE!

HINTS

The MINES

CUSTARDIO

THE CABLES

PLANETARIUM

PIRATELAND

THE COASTER

QUIT

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

world select

PAUSED

SFX

Music

RESTART

RESTART

HELP

LOADING

www.kongregate.com

back flip

FRONT flip

ARGGHH, THE
PARTY BALLOON.

THE REASON DINOSAURS
BECAME EXTINCT - THEY JUST
DIDNT HAVE FAST ENOUGH
BIKES.

ANOTHER NICE MESS YOU'VE
GOTTEN ME IN TO!

HMMM...
TASTY.

EATEN BY A SKATEBOARDING
SPACE HADDOCK WHAT A WAY TO
GO !

CLEAR SAVE DATA

CLEAR SAVE DATA

CHEATS

CHEATS

<p align="left"><font face="Anime Ace 2.0 BB" size="8" color="#000000" letterSpacing="0.000000" kerning="1"><b>v 1.0</b></font></p>

PLAY GAME

PLAY GAME

PRESENTS

ActionScript [AS3]

Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2CircleDef extends b2ShapeDef { public var radius:Number; public var localPosition:b2Vec2; public function b2CircleDef(){ localPosition = new b2Vec2(0, 0); super(); type = b2Shape.e_circleShape; radius = 1; } } }//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape) package Box2D.Collision.Shapes { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2CircleShape extends b2Shape { public var m_localPosition:b2Vec2; public var m_radius:Number; public function b2CircleShape(_arg1:b2ShapeDef){ m_localPosition = new b2Vec2(); super(_arg1); var _local2:b2CircleDef = (_arg1 as b2CircleDef); m_type = e_circleShape; m_localPosition.SetV(_local2.localPosition); m_radius = _local2.radius; } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{ var _local10:Number; var _local6:b2Mat22 = _arg1.R; var _local7:Number = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y))); var _local8:Number = (_arg1.position.y + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y))); var _local9:Number = (_arg4.p1.x - _local7); _local10 = (_arg4.p1.y - _local8); var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius)); if (_local11 < 0){ _arg2[0] = 0; return (e_startsInsideCollide); }; var _local12:Number = (_arg4.p2.x - _arg4.p1.x); var _local13:Number = (_arg4.p2.y - _arg4.p1.y); var _local14:Number = ((_local9 * _local12) + (_local10 * _local13)); var _local15:Number = ((_local12 * _local12) + (_local13 * _local13)); var _local16:Number = ((_local14 * _local14) - (_local15 * _local11)); if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){ return (e_missCollide); }; var _local17:Number = -((_local14 + Math.sqrt(_local16))); if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){ _local17 = (_local17 / _local15); _arg2[0] = _local17; _arg3.x = (_local9 + (_local17 * _local12)); _arg3.y = (_local10 + (_local17 * _local13)); _arg3.Normalize(); return (e_hitCollide); }; return (e_missCollide); } public function GetLocalPosition():b2Vec2{ return (m_localPosition); } public function GetRadius():Number{ return (m_radius); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2Mat22; _local4 = _arg2.R; var _local5:Number = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); var _local6:Number = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _local4 = _arg3.R; var _local7:Number = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); var _local8:Number = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius)); _arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius)); } override public function ComputeMass(_arg1:b2MassData):void{ _arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius); _arg1.center.SetV(m_localPosition); _arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y)))); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:Number = (m_localPosition.x - _arg1.x); var _local3:Number = (m_localPosition.y - _arg1.y); _local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3))); m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop); } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22 = _arg2.R; var _local4:Number = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); var _local5:Number = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius)); _arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius)); } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Mat22 = _arg1.R; var _local4:Number = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); var _local5:Number = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _local4 = (_arg2.x - _local4); _local5 = (_arg2.y - _local5); return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius))); } } }//package Box2D.Collision.Shapes
Section 3
//b2FilterData (Box2D.Collision.Shapes.b2FilterData) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2FilterData { public var maskBits:uint;// = 0xFFFF public var groupIndex:int;// = 0 public var categoryBits:uint;// = 1 public function Copy():b2FilterData{ var _local1:b2FilterData = new b2FilterData(); _local1.categoryBits = categoryBits; _local1.maskBits = maskBits; _local1.groupIndex = groupIndex; return (_local1); } } }//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2MassData { public var mass:Number;// = 0 public var center:b2Vec2; public var I:Number;// = 0 public function b2MassData(){ center = new b2Vec2(0, 0); super(); } } }//package Box2D.Collision.Shapes
Section 5
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PolygonDef extends b2ShapeDef { public var vertices:Array; public var vertexCount:int; private static var s_mat:b2Mat22 = new b2Mat22(); public function b2PolygonDef(){ vertices = new Array(b2Settings.b2_maxPolygonVertices); super(); type = b2Shape.e_polygonShape; vertexCount = 0; var _local1:int; while (_local1 < b2Settings.b2_maxPolygonVertices) { vertices[_local1] = new b2Vec2(); _local1++; }; } public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{ var _local5:b2Vec2; var _local6:b2Mat22; var _local7:int; vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); if (_arg3){ _local5 = _arg3; _local6 = s_mat; _local6.Set(_arg4); _local7 = 0; while (_local7 < vertexCount) { _arg3 = vertices[_local7]; _arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y))); _arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y))); _arg3.x = _arg1; _local7++; }; }; } public function SetAsBox(_arg1:Number, _arg2:Number):void{ vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); } } }//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape) package Box2D.Collision.Shapes { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolygonShape extends b2Shape { public var m_coreVertices:Array; public var m_vertices:Array; private var s_supportVec:b2Vec2; public var m_centroid:b2Vec2; public var m_normals:Array; public var m_obb:b2OBB; public var m_vertexCount:int; private static var s_computeMat:b2Mat22 = new b2Mat22(); private static var s_sweptAABB1:b2AABB = new b2AABB(); private static var s_sweptAABB2:b2AABB = new b2AABB(); public function b2PolygonShape(_arg1:b2ShapeDef){ var _local3:int; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; s_supportVec = new b2Vec2(); m_obb = new b2OBB(); m_vertices = new Array(b2Settings.b2_maxPolygonVertices); m_normals = new Array(b2Settings.b2_maxPolygonVertices); m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices); super(_arg1); m_type = e_polygonShape; var _local2:b2PolygonDef = (_arg1 as b2PolygonDef); m_vertexCount = _local2.vertexCount; var _local4:int = _local3; var _local5:int = _local3; _local3 = 0; while (_local3 < m_vertexCount) { m_vertices[_local3] = _local2.vertices[_local3].Copy(); _local3++; }; _local3 = 0; while (_local3 < m_vertexCount) { _local4 = _local3; _local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0; _local6 = (m_vertices[_local5].x - m_vertices[_local4].x); _local7 = (m_vertices[_local5].y - m_vertices[_local4].y); _local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8)); _local3++; }; m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount); ComputeOBB(m_obb, m_vertices, m_vertexCount); _local3 = 0; while (_local3 < m_vertexCount) { _local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1); _local5 = _local3; _local9 = m_normals[_local4].x; _local10 = m_normals[_local4].y; _local11 = m_normals[_local5].x; _local12 = m_normals[_local5].y; _local13 = (m_vertices[_local3].x - m_centroid.x); _local14 = (m_vertices[_local3].y - m_centroid.y); _local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop); _local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop); _local17 = (1 / ((_local9 * _local12) - (_local10 * _local11))); m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y)); _local3++; }; } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2AABB = s_sweptAABB1; var _local5:b2AABB = s_sweptAABB2; ComputeAABB(_local4, _arg2); ComputeAABB(_local5, _arg3); _arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y); _arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y); } public function GetVertices():Array{ return (m_vertices); } public function GetCoreVertices():Array{ return (m_coreVertices); } public function GetCentroid():b2Vec2{ return (m_centroid); } public function GetOBB():b2OBB{ return (m_obb); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_coreVertices[0])); } public function Centroid(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_centroid)); } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{ var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:b2Vec2; var _local20:Number; var _local21:Number; var _local6:Number = 0; var _local7:Number = _arg5; _local8 = (_arg4.p1.x - _arg1.position.x); _local9 = (_arg4.p1.y - _arg1.position.y); _local10 = _arg1.R; var _local12:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); var _local13:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); _local8 = (_arg4.p2.x - _arg1.position.x); _local9 = (_arg4.p2.y - _arg1.position.y); _local10 = _arg1.R; var _local14:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); var _local15:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); var _local16:Number = (_local14 - _local12); var _local17:Number = (_local15 - _local13); var _local18 = -1; var _local19:int; while (_local19 < m_vertexCount) { _local11 = m_vertices[_local19]; _local8 = (_local11.x - _local12); _local9 = (_local11.y - _local13); _local11 = m_normals[_local19]; _local20 = ((_local11.x * _local8) + (_local11.y * _local9)); _local21 = ((_local11.x * _local16) + (_local11.y * _local17)); if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){ _local6 = (_local20 / _local21); _local18 = _local19; } else { if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){ _local7 = (_local20 / _local21); }; }; if (_local7 < _local6){ return (e_missCollide); }; _local19++; }; if (_local18 >= 0){ _arg2[0] = _local6; _local10 = _arg1.R; _local11 = m_normals[_local18]; _arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); return (e_hitCollide); }; _arg2[0] = 0; return (e_startsInsideCollide); } override public function ComputeMass(_arg1:b2MassData):void{ var _local10:b2Vec2; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local2:Number = 0; var _local3:Number = 0; var _local4:Number = 0; var _local5:Number = 0; var _local6:Number = 0; var _local7:Number = 0; var _local8:Number = (1 / 3); var _local9:int; while (_local9 < m_vertexCount) { _local10 = m_vertices[_local9]; _local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0]; _local12 = (_local10.x - _local6); _local13 = (_local10.y - _local7); _local14 = (_local11.x - _local6); _local15 = (_local11.y - _local7); _local16 = ((_local12 * _local15) - (_local13 * _local14)); _local17 = (0.5 * _local16); _local4 = (_local4 + _local17); _local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x))); _local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y))); _local18 = _local6; _local19 = _local7; _local20 = _local12; _local21 = _local13; _local22 = _local14; _local23 = _local15; _local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18)); _local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19)); _local5 = (_local5 + (_local16 * (_local24 + _local25))); _local9++; }; _arg1.mass = (m_density * _local4); _local2 = (_local2 * (1 / _local4)); _local3 = (_local3 * (1 / _local4)); _arg1.center.Set(_local2, _local3); _arg1.I = (m_density * _local5); } public function GetNormals():Array{ return (m_normals); } public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:b2Vec2; var _local5:b2Mat22; var _local11:Number; _local5 = _arg1.R; var _local6:Number = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y)); var _local7:Number = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y)); var _local8:int; _local4 = m_coreVertices[0]; var _local9:Number = ((_local4.x * _local6) + (_local4.y * _local7)); var _local10 = 1; while (_local10 < m_vertexCount) { _local4 = m_coreVertices[_local10]; _local11 = ((_local4.x * _local6) + (_local4.y * _local7)); if (_local11 > _local9){ _local8 = _local10; _local9 = _local11; }; _local10++; }; _local5 = _arg1.R; _local4 = m_coreVertices[_local8]; s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y))); s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y))); return (s_supportVec); } public function GetVertexCount():int{ return (m_vertexCount); } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22; var _local4:b2Vec2; var _local5:b2Mat22 = s_computeMat; _local3 = _arg2.R; _local4 = m_obb.R.col1; _local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local4 = m_obb.R.col2; _local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local5.Abs(); var _local6:b2Mat22 = _local5; _local4 = m_obb.extents; var _local7:Number = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y)); var _local8:Number = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y)); _local3 = _arg2.R; _local4 = m_obb.center; var _local9:Number = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y))); var _local10:Number = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y))); _arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8)); _arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8)); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:b2Vec2; var _local4:Number; var _local5:Number; m_sweepRadius = 0; var _local3:int; while (_local3 < m_vertexCount) { _local2 = m_coreVertices[_local3]; _local4 = (_local2.x - _arg1.x); _local5 = (_local2.y - _arg1.y); _local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5))); if (_local4 > m_sweepRadius){ m_sweepRadius = _local4; }; _local3++; }; } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Vec2; var _local10:Number; var _local4:b2Mat22 = _arg1.R; var _local5:Number = (_arg2.x - _arg1.position.x); var _local6:Number = (_arg2.y - _arg1.position.y); var _local7:Number = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y)); var _local8:Number = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y)); var _local9:int; while (_local9 < m_vertexCount) { _local3 = m_vertices[_local9]; _local5 = (_local7 - _local3.x); _local6 = (_local8 - _local3.y); _local3 = m_normals[_local9]; _local10 = ((_local3.x * _local5) + (_local3.y * _local6)); if (_local10 > 0){ return (false); }; _local9++; }; return (true); } public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{ var _local3:b2Vec2; var _local7:Number; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; _local3 = new b2Vec2(); var _local4:Number = 0; var _local5:Number = 0; var _local6:Number = 0; _local7 = (1 / 3); var _local8:int; while (_local8 < _arg2) { _local9 = _arg1[_local8]; _local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0]; _local11 = (_local9.x - _local5); _local12 = (_local9.y - _local6); _local13 = (_local10.x - _local5); _local14 = (_local10.y - _local6); _local15 = ((_local11 * _local14) - (_local12 * _local13)); _local16 = (0.5 * _local15); _local4 = (_local4 + _local16); _local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x))); _local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y))); _local8++; }; _local3.x = (_local3.x * (1 / _local4)); _local3.y = (_local3.y * (1 / _local4)); return (_local3); } public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{ var _local4:int; var _local7:b2Vec2; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:int; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:b2Mat22; var _local5:Array = new Array((b2Settings.b2_maxPolygonVertices + 1)); _local4 = 0; while (_local4 < _arg3) { _local5[_local4] = _arg2[_local4]; _local4++; }; _local5[_arg3] = _local5[0]; var _local6:Number = Number.MAX_VALUE; _local4 = 1; while (_local4 <= _arg3) { _local7 = _local5[int((_local4 - 1))]; _local8 = (_local5[_local4].x - _local7.x); _local9 = (_local5[_local4].y - _local7.y); _local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); _local8 = (_local8 / _local10); _local9 = (_local9 / _local10); _local11 = -(_local9); _local12 = _local8; _local13 = Number.MAX_VALUE; _local14 = Number.MAX_VALUE; _local15 = -(Number.MAX_VALUE); _local16 = -(Number.MAX_VALUE); _local17 = 0; while (_local17 < _arg3) { _local19 = (_local5[_local17].x - _local7.x); _local20 = (_local5[_local17].y - _local7.y); _local21 = ((_local8 * _local19) + (_local9 * _local20)); _local22 = ((_local11 * _local19) + (_local12 * _local20)); if (_local21 < _local13){ _local13 = _local21; }; if (_local22 < _local14){ _local14 = _local22; }; if (_local21 > _local15){ _local15 = _local21; }; if (_local22 > _local16){ _local16 = _local22; }; _local17++; }; _local18 = ((_local15 - _local13) * (_local16 - _local14)); if (_local18 < (0.95 * _local6)){ _local6 = _local18; _arg1.R.col1.x = _local8; _arg1.R.col1.y = _local9; _arg1.R.col2.x = _local11; _arg1.R.col2.y = _local12; _local23 = (0.5 * (_local13 + _local15)); _local24 = (0.5 * (_local14 + _local16)); _local25 = _arg1.R; _arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24))); _arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24))); _arg1.extents.x = (0.5 * (_local15 - _local13)); _arg1.extents.y = (0.5 * (_local16 - _local14)); }; _local4++; }; } } }//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape) package Box2D.Collision.Shapes { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2Shape { public var m_next:b2Shape; public var m_type:int; public var m_sweepRadius:Number; public var m_density:Number; public var m_filter:b2FilterData; public var m_friction:Number; public var m_isSensor:Boolean; public var m_restitution:Number; public var m_userData; public var m_proxyId:uint; public var m_body:b2Body; public static const e_polygonShape:int = 1; public static const e_hitCollide:int = 1; public static const e_missCollide:int = 0; public static const e_unknownShape:int = -1; public static const e_circleShape:int = 0; public static const e_shapeTypeCount:int = 2; public static const e_startsInsideCollide:int = -1; private static var s_resetAABB:b2AABB = new b2AABB(); private static var s_syncAABB:b2AABB = new b2AABB(); private static var s_proxyAABB:b2AABB = new b2AABB(); public function b2Shape(_arg1:b2ShapeDef){ m_userData = _arg1.userData; m_friction = _arg1.friction; m_restitution = _arg1.restitution; m_density = _arg1.density; m_body = null; m_sweepRadius = 0; m_next = null; m_proxyId = b2Pair.b2_nullProxy; m_filter = _arg1.filter.Copy(); m_isSensor = _arg1.isSensor; } public function SetUserData(_arg1):void{ m_userData = _arg1; } public function GetSweepRadius():Number{ return (m_sweepRadius); } public function GetNext():b2Shape{ return (m_next); } public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ } public function GetType():int{ return (m_type); } public function GetRestitution():Number{ return (m_restitution); } public function GetFriction():Number{ return (m_friction); } public function GetFilterData():b2FilterData{ return (m_filter.Copy()); } public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{ return (e_missCollide); } public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ if (m_proxyId == b2Pair.b2_nullProxy){ return; }; _arg1.DestroyProxy(m_proxyId); var _local3:b2AABB = s_resetAABB; ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function SetFilterData(_arg1:b2FilterData):void{ m_filter = _arg1.Copy(); } public function GetUserData(){ return (m_userData); } public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{ if (m_proxyId == b2Pair.b2_nullProxy){ return (false); }; var _local4:b2AABB = s_syncAABB; ComputeSweptAABB(_local4, _arg2, _arg3); if (_arg1.InRange(_local4)){ _arg1.MoveProxy(m_proxyId, _local4); return (true); }; return (false); } public function ComputeMass(_arg1:b2MassData):void{ } public function IsSensor():Boolean{ return (m_isSensor); } public function DestroyProxy(_arg1:b2BroadPhase):void{ if (m_proxyId != b2Pair.b2_nullProxy){ _arg1.DestroyProxy(m_proxyId); m_proxyId = b2Pair.b2_nullProxy; }; } public function UpdateSweepRadius(_arg1:b2Vec2):void{ } public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ } public function GetBody():b2Body{ return (m_body); } public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ var _local3:b2AABB = s_proxyAABB; ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ return (false); } public static function Destroy(_arg1:b2Shape, _arg2):void{ } public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{ switch (_arg1.type){ case e_circleShape: return (new b2CircleShape(_arg1)); case e_polygonShape: return (new b2PolygonShape(_arg1)); default: return (null); }; } } }//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2ShapeDef { public var friction:Number;// = 0.2 public var isSensor:Boolean;// = false public var density:Number;// = 0 public var restitution:Number;// = 0 public var userData;// = null public var filter:b2FilterData; public var type:int; public function b2ShapeDef(){ type = b2Shape.e_unknownShape; filter = new b2FilterData(); super(); } } }//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2AABB { public var upperBound:b2Vec2; public var lowerBound:b2Vec2; public function b2AABB(){ lowerBound = new b2Vec2(); upperBound = new b2Vec2(); super(); } public function IsValid():Boolean{ var _local1:Number = (upperBound.x - lowerBound.x); var _local2:Number = (upperBound.y - lowerBound.y); var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0))); _local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid())); return (_local3); } } }//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound) package Box2D.Collision { public class b2Bound { public var value:uint; public var proxyId:uint; public var stabbingCount:uint; public function Swap(_arg1:b2Bound):void{ var _local2:uint = value; var _local3:uint = proxyId; var _local4:uint = stabbingCount; value = _arg1.value; proxyId = _arg1.proxyId; stabbingCount = _arg1.stabbingCount; _arg1.value = _local2; _arg1.proxyId = _local3; _arg1.stabbingCount = _local4; } public function IsLower():Boolean{ return (((value & 1) == 0)); } public function IsUpper():Boolean{ return (((value & 1) == 1)); } } }//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues) package Box2D.Collision { public class b2BoundValues { public var lowerValues:Array; public var upperValues:Array; public function b2BoundValues(){ lowerValues = [0, 0]; upperValues = [0, 0]; super(); } } }//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2BroadPhase { public var m_bounds:Array; public var m_worldAABB:b2AABB; public var m_querySortKeys:Array; public var m_freeProxy:uint; public var m_quantizationFactor:b2Vec2; public var m_proxyCount:int; public var m_proxyPool:Array; public var m_queryResultCount:int; public var m_pairManager:b2PairManager; public var m_timeStamp:uint; public var m_queryResults:Array; public static const b2_nullEdge:uint = b2Settings.USHRT_MAX; public static const b2_invalid:uint = b2Settings.USHRT_MAX; public static var s_validate:Boolean = false; public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){ var _local3:int; var _local6:b2Proxy; var _local7:int; m_pairManager = new b2PairManager(); m_proxyPool = new Array(b2Settings.b2_maxPairs); m_bounds = new Array((2 * b2Settings.b2_maxProxies)); m_querySortKeys = new Array(b2Settings.b2_maxProxies); m_queryResults = new Array(b2Settings.b2_maxProxies); m_quantizationFactor = new b2Vec2(); super(); m_pairManager.Initialize(this, _arg2); m_worldAABB = _arg1; m_proxyCount = 0; _local3 = 0; while (_local3 < b2Settings.b2_maxProxies) { m_queryResults[_local3] = 0; m_querySortKeys[_local3] = 0; _local3++; }; m_bounds = new Array(2); _local3 = 0; while (_local3 < 2) { m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies)); _local7 = 0; while (_local7 < (2 * b2Settings.b2_maxProxies)) { m_bounds[_local3][_local7] = new b2Bound(); _local7++; }; _local3++; }; var _local4:Number = (_arg1.upperBound.x - _arg1.lowerBound.x); var _local5:Number = (_arg1.upperBound.y - _arg1.lowerBound.y); m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4); m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5); _local3 = 0; while (_local3 < (b2Settings.b2_maxProxies - 1)) { _local6 = new b2Proxy(); m_proxyPool[_local3] = _local6; _local6.SetNext((_local3 + 1)); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; _local3++; }; _local6 = new b2Proxy(); m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6; _local6.SetNext(b2Pair.b2_nullProxy); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; m_freeProxy = 0; m_timeStamp = 1; m_queryResultCount = 0; } public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{ var _local6:uint; var _local7:uint; var _local12:b2Proxy; var _local4:Array = new Array(); var _local5:Array = new Array(); ComputeBounds(_local4, _local5, _arg1); var _local8:Array = [_local6]; var _local9:Array = [_local7]; Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0); Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1); var _local10:int; var _local11:int; while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) { _local12 = m_proxyPool[m_queryResults[_local11]]; _arg2[_local11] = _local12.userData; _local11++; _local10++; }; m_queryResultCount = 0; IncrementTimeStamp(); return (_local10); } public function Commit():void{ m_pairManager.Commit(); } public function GetProxy(_arg1:int):b2Proxy{ var _local2:b2Proxy = m_proxyPool[_arg1]; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){ return (null); }; return (_local2); } private function IncrementTimeStamp():void{ var _local1:uint; if (m_timeStamp == b2Settings.USHRT_MAX){ _local1 = 0; while (_local1 < b2Settings.b2_maxProxies) { (m_proxyPool[_local1] as b2Proxy).timeStamp = 0; _local1++; }; m_timeStamp = 1; } else { m_timeStamp++; }; } private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{ var _local10:b2Bound; var _local12:int; var _local13:int; var _local14:b2Proxy; var _local8:uint = BinarySearch(_arg5, _arg6, _arg3); var _local9:uint = BinarySearch(_arg5, _arg6, _arg4); var _local11:uint = _local8; while (_local11 < _local9) { _local10 = _arg5[_local11]; if (_local10.IsLower()){ IncrementOverlapCount(_local10.proxyId); }; _local11++; }; if (_local8 > 0){ _local12 = (_local8 - 1); _local10 = _arg5[_local12]; _local13 = _local10.stabbingCount; while (_local13) { _local10 = _arg5[_local12]; if (_local10.IsLower()){ _local14 = m_proxyPool[_local10.proxyId]; if (_local8 <= _local14.upperBounds[_arg7]){ IncrementOverlapCount(_local10.proxyId); _local13--; }; }; _local12--; }; }; _arg1[0] = _local8; _arg2[0] = _local9; } private function AddProxyResult(_arg1:uint, _arg2:b2Proxy, _arg3:Number, _arg4:Function):void{ var _local9:Number; var _local10:uint; var _local5:Number = _arg4(_arg2.userData); if (_local5 < 0){ return; }; var _local6:Number = 0; while ((((_local6 < m_queryResultCount)) && ((m_querySortKeys[_local6] < _local5)))) { _local6++; }; var _local7:Number = _local5; var _local8:uint = _arg1; m_queryResultCount = (m_queryResultCount + 1); if (m_queryResultCount > _arg3){ m_queryResultCount = _arg3; }; while (_local6 < m_queryResultCount) { _local9 = m_querySortKeys[_local6]; _local10 = m_queryResults[_local6]; m_querySortKeys[_local6] = _local7; m_queryResults[_local6] = _local8; _local7 = _local9; _local8 = _local10; _local6++; }; } private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local5:b2Bound; var _local6:b2Bound; var _local3:int; while (_local3 < 2) { _local4 = m_bounds[_local3]; _local5 = _local4[_arg1.lowerBounds[_local3]]; _local6 = _local4[_arg2.upperBounds[_local3]]; if (_local5.value > _local6.value){ return (false); }; _local5 = _local4[_arg1.upperBounds[_local3]]; _local6 = _local4[_arg2.lowerBounds[_local3]]; if (_local5.value < _local6.value){ return (false); }; _local3++; }; return (true); } private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{ var _local4:Number = _arg3.lowerBound.x; var _local5:Number = _arg3.lowerBound.y; _local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x); _local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y); _local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x); _local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y); var _local6:Number = _arg3.upperBound.x; var _local7:Number = _arg3.upperBound.y; _local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x); _local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y); _local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x); _local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y); _arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1)); _arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1); _arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1)); _arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1); } public function CreateProxy(_arg1:b2AABB, _arg2):uint{ var _local3:uint; var _local4:b2Proxy; var _local11:Array; var _local12:uint; var _local13:uint; var _local14:Array; var _local15:Array; var _local16:Array; var _local17:int; var _local18:int; var _local19:b2Bound; var _local20:b2Bound; var _local21:b2Bound; var _local22:int; var _local23:b2Proxy; var _local5:uint = m_freeProxy; _local4 = m_proxyPool[_local5]; m_freeProxy = _local4.GetNext(); _local4.overlapCount = 0; _local4.userData = _arg2; var _local6:uint = (2 * m_proxyCount); var _local7:Array = new Array(); var _local8:Array = new Array(); ComputeBounds(_local7, _local8, _arg1); var _local9:int; while (_local9 < 2) { _local11 = m_bounds[_local9]; _local14 = [_local12]; _local15 = [_local13]; Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9); _local12 = _local14[0]; _local13 = _local15[0]; _local16 = new Array(); _local18 = (_local6 - _local13); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[int((_local13 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local22 = (_local13 + 2); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[int((_local22 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local16 = new Array(); _local18 = (_local13 - _local12); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[int((_local12 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local22 = (_local12 + 1); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[int((_local22 + _local17))]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local13++; _local19 = _local11[_local12]; _local20 = _local11[_local13]; _local19.value = _local7[_local9]; _local19.proxyId = _local5; _local20.value = _local8[_local9]; _local20.proxyId = _local5; _local21 = _local11[int((_local12 - 1))]; _local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount; _local21 = _local11[int((_local13 - 1))]; _local20.stabbingCount = _local21.stabbingCount; _local3 = _local12; while (_local3 < _local13) { _local21 = _local11[_local3]; _local21.stabbingCount++; _local3++; }; _local3 = _local12; while (_local3 < (_local6 + 2)) { _local19 = _local11[_local3]; _local23 = m_proxyPool[_local19.proxyId]; if (_local19.IsLower()){ _local23.lowerBounds[_local9] = _local3; } else { _local23.upperBounds[_local9] = _local3; }; _local3++; }; _local9++; }; m_proxyCount++; var _local10:int; while (_local10 < m_queryResultCount) { m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]); _local10++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); return (_local5); } public function DestroyProxy(_arg1:uint):void{ var _local2:b2Bound; var _local3:b2Bound; var _local8:Array; var _local9:uint; var _local10:uint; var _local11:uint; var _local12:uint; var _local13:Array; var _local14:int; var _local15:int; var _local16:int; var _local17:uint; var _local18:int; var _local19:b2Proxy; var _local4:b2Proxy = m_proxyPool[_arg1]; var _local5:int = (2 * m_proxyCount); var _local6:int; while (_local6 < 2) { _local8 = m_bounds[_local6]; _local9 = _local4.lowerBounds[_local6]; _local10 = _local4.upperBounds[_local6]; _local2 = _local8[_local9]; _local11 = _local2.value; _local3 = _local8[_local10]; _local12 = _local3.value; _local13 = new Array(); _local15 = ((_local10 - _local9) - 1); _local14 = 0; while (_local14 < _local15) { _local13[_local14] = new b2Bound(); _local2 = _local13[_local14]; _local3 = _local8[int(((_local9 + 1) + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = _local13.length; _local16 = _local9; _local14 = 0; while (_local14 < _local15) { _local3 = _local13[_local14]; _local2 = _local8[int((_local16 + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local13 = new Array(); _local15 = ((_local5 - _local10) - 1); _local14 = 0; while (_local14 < _local15) { _local13[_local14] = new b2Bound(); _local2 = _local13[_local14]; _local3 = _local8[int(((_local10 + 1) + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = _local13.length; _local16 = (_local10 - 1); _local14 = 0; while (_local14 < _local15) { _local3 = _local13[_local14]; _local2 = _local8[int((_local16 + _local14))]; _local2.value = _local3.value; _local2.proxyId = _local3.proxyId; _local2.stabbingCount = _local3.stabbingCount; _local14++; }; _local15 = (_local5 - 2); _local17 = _local9; while (_local17 < _local15) { _local2 = _local8[_local17]; _local19 = m_proxyPool[_local2.proxyId]; if (_local2.IsLower()){ _local19.lowerBounds[_local6] = _local17; } else { _local19.upperBounds[_local6] = _local17; }; _local17++; }; _local15 = (_local10 - 1); _local18 = _local9; while (_local18 < _local15) { _local2 = _local8[_local18]; _local2.stabbingCount--; _local18++; }; Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6); _local6++; }; var _local7:int; while (_local7 < m_queryResultCount) { m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]); _local7++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); _local4.userData = null; _local4.overlapCount = b2_invalid; _local4.lowerBounds[0] = b2_invalid; _local4.lowerBounds[1] = b2_invalid; _local4.upperBounds[0] = b2_invalid; _local4.upperBounds[1] = b2_invalid; _local4.SetNext(m_freeProxy); m_freeProxy = _arg1; m_proxyCount--; } public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local5:b2Bound; var _local3:int; while (_local3 < 2) { _local4 = m_bounds[_local3]; _local5 = _local4[_arg2.upperBounds[_local3]]; if (_arg1.lowerValues[_local3] > _local5.value){ return (false); }; _local5 = _local4[_arg2.lowerBounds[_local3]]; if (_arg1.upperValues[_local3] < _local5.value){ return (false); }; _local3++; }; return (true); } public function Validate():void{ var _local1:b2Pair; var _local2:b2Proxy; var _local3:b2Proxy; var _local4:Boolean; var _local6:b2Bound; var _local7:uint; var _local8:uint; var _local9:uint; var _local10:b2Bound; var _local5:int; while (_local5 < 2) { _local6 = m_bounds[_local5]; _local7 = (2 * m_proxyCount); _local8 = 0; _local9 = 0; while (_local9 < _local7) { _local10 = _local6[_local9]; if (_local10.IsLower() == true){ _local8++; } else { _local8--; }; _local9++; }; _local5++; }; } private function IncrementOverlapCount(_arg1:uint):void{ var _local2:b2Proxy = m_proxyPool[_arg1]; if (_local2.timeStamp < m_timeStamp){ _local2.timeStamp = m_timeStamp; _local2.overlapCount = 1; } else { _local2.overlapCount = 2; m_queryResults[m_queryResultCount] = _arg1; m_queryResultCount++; }; } public function InRange(_arg1:b2AABB):Boolean{ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local2 = _arg1.lowerBound.x; _local3 = _arg1.lowerBound.y; _local2 = (_local2 - m_worldAABB.upperBound.x); _local3 = (_local3 - m_worldAABB.upperBound.y); _local4 = m_worldAABB.lowerBound.x; _local5 = m_worldAABB.lowerBound.y; _local4 = (_local4 - _arg1.upperBound.x); _local5 = (_local5 - _arg1.upperBound.y); _local2 = b2Math.b2Max(_local2, _local4); _local3 = b2Math.b2Max(_local3, _local5); return ((b2Math.b2Max(_local2, _local3) < 0)); } public function QuerySegment(_arg1:b2Segment, _arg2, _arg3:int, _arg4:Function):int{ var _local15:int; var _local16:int; var _local17:uint; var _local18:b2Proxy; var _local19:uint; var _local20:uint; var _local24:Number; var _local25:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:uint; var _local5:Number = 1; var _local6:Number = ((_arg1.p2.x - _arg1.p1.x) * m_quantizationFactor.x); var _local7:Number = ((_arg1.p2.y - _arg1.p1.y) * m_quantizationFactor.y); var _local8:int = ((_local6 < -(Number.MIN_VALUE))) ? -1 : ((_local6 > Number.MIN_VALUE)) ? 1 : 0; var _local9:int = ((_local7 < -(Number.MIN_VALUE))) ? -1 : ((_local7 > Number.MIN_VALUE)) ? 1 : 0; var _local10:Number = (m_quantizationFactor.x * (_arg1.p1.x - m_worldAABB.lowerBound.x)); var _local11:Number = (m_quantizationFactor.y * (_arg1.p1.y - m_worldAABB.lowerBound.y)); var _local12:Array = new Array(); var _local13:Array = new Array(); _local12[0] = (uint(_local10) & (b2Settings.USHRT_MAX - 1)); _local12[1] = (uint(_local11) & (b2Settings.USHRT_MAX - 1)); _local13[0] = (_local12[0] + 1); _local13[1] = (_local12[1] + 1); var _local14:Array = new Array(); var _local21:Array = [_local19]; var _local22:Array = [_local20]; Query(_local21, _local22, _local12[0], _local13[0], m_bounds[0], (2 * m_proxyCount), 0); if (_local8 >= 0){ _local15 = (_local22[0] - 1); } else { _local15 = _local21[0]; }; Query(_local21, _local22, _local12[1], _local13[1], m_bounds[1], (2 * m_proxyCount), 1); if (_local9 >= 0){ _local16 = (_local22[0] - 1); } else { _local16 = _local21[0]; }; if (_arg4 != null){ _local27 = 0; while (_local27 < m_queryResultCount) { m_querySortKeys[_local27] = _arg4(m_proxyPool[m_queryResults[_local27]].userData); _local27++; }; _local27 = 0; while (_local27 < (m_queryResultCount - 1)) { _local28 = m_querySortKeys[_local27]; _local29 = m_querySortKeys[(_local27 + 1)]; if (((_local28)<0) ? (_local29 >= 0) : (((_local28 > _local29)) && ((_local29 >= 0)))){ m_querySortKeys[(_local27 + 1)] = _local28; m_querySortKeys[_local27] = _local29; _local30 = m_queryResults[(_local27 + 1)]; m_queryResults[(_local27 + 1)] = m_queryResults[_local27]; m_queryResults[_local27] = _local30; --_local27; if (_local27 == -1){ _local27 = 1; }; } else { _local27++; }; }; while ((((m_queryResultCount > 0)) && ((m_querySortKeys[(m_queryResultCount - 1)] < 0)))) { m_queryResultCount--; }; }; var _local23:Boolean; if ((((_local15 < 0)) || ((_local15 >= (m_proxyCount * 2))))){ _local23 = false; }; if ((((_local16 < 0)) || ((_local16 >= (m_proxyCount * 2))))){ _local23 = false; }; if (_local23){ if (_local8 != 0){ if (_local8 > 0){ _local15++; if (_local15 == (m_proxyCount * 2)){ _local23 = false; }; } else { --_local15; if (_local15 < 0){ _local23 = false; }; }; _local24 = ((m_bounds[0][_local15].value - _local10) / _local6); }; if (_local9 != 0){ if (_local9 > 0){ _local16++; if (_local16 == (m_proxyCount * 2)){ _local23 = false; }; } else { --_local16; if (_local16 < 0){ _local23 = false; }; }; _local25 = ((m_bounds[1][_local16].value - _local11) / _local7); }; }; while (_local23) { if ((((_local9 == 0)) || (((!((_local8 == 0))) && ((_local24 < _local25)))))){ if (_local24 > _local5){ break; }; if (((_local8 > 0)) ? m_bounds[0][_local15].IsLower() : m_bounds[0][_local15].IsUpper()){ _local17 = m_bounds[0][_local15].proxyId; _local18 = m_proxyPool[_local17]; if (_local9 >= 0){ if ((((_local18.lowerBounds[1] <= (_local16 - 1))) && ((_local18.upperBounds[1] >= _local16)))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; } else { if ((((_local18.lowerBounds[1] <= _local16)) && ((_local18.upperBounds[1] >= (_local16 + 1))))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; }; }; if (((((((!((_arg4 == null))) && ((m_queryResultCount == _arg3)))) && ((m_queryResultCount > 0)))) && ((_local24 > m_querySortKeys[(m_queryResultCount - 1)])))){ break; }; if (_local8 > 0){ _local15++; if (_local15 == (m_proxyCount * 2)){ break; }; } else { --_local15; if (_local15 < 0){ break; }; }; _local24 = ((m_bounds[0][_local15].value - _local10) / _local6); } else { if (_local25 > _local5){ break; }; if (((_local9 > 0)) ? m_bounds[1][_local16].IsLower() : m_bounds[1][_local16].IsUpper()){ _local17 = m_bounds[1][_local16].proxyId; _local18 = m_proxyPool[_local17]; if (_local8 >= 0){ if ((((_local18.lowerBounds[0] <= (_local15 - 1))) && ((_local18.upperBounds[0] >= _local15)))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; } else { if ((((_local18.lowerBounds[0] <= _local15)) && ((_local18.upperBounds[0] >= (_local15 + 1))))){ if (_arg4 != null){ AddProxyResult(_local17, _local18, _arg3, _arg4); } else { m_queryResults[m_queryResultCount] = _local17; m_queryResultCount++; }; }; }; }; if (((((((!((_arg4 == null))) && ((m_queryResultCount == _arg3)))) && ((m_queryResultCount > 0)))) && ((_local25 > m_querySortKeys[(m_queryResultCount - 1)])))){ break; }; if (_local9 > 0){ _local16++; if (_local16 == (m_proxyCount * 2)){ break; }; } else { --_local16; if (_local16 < 0){ break; }; }; _local25 = ((m_bounds[1][_local16].value - _local11) / _local7); }; }; var _local26:int; _local27 = 0; while ((((_local27 < m_queryResultCount)) && ((_local26 < _arg3)))) { _local18 = m_proxyPool[m_queryResults[_local27]]; _arg2[_local27] = _local18.userData; _local27++; _local26++; }; m_queryResultCount = 0; IncrementTimeStamp(); return (_local26); } public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{ var _local3:Array; var _local4:int; var _local5:uint; var _local6:uint; var _local7:b2Bound; var _local8:b2Bound; var _local9:b2Bound; var _local10:uint; var _local11:b2Proxy; var _local16:Array; var _local17:uint; var _local18:uint; var _local19:uint; var _local20:uint; var _local21:int; var _local22:int; var _local23:uint; var _local24:b2Proxy; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){ return; }; if (_arg2.IsValid() == false){ return; }; var _local12:uint = (2 * m_proxyCount); var _local13:b2Proxy = m_proxyPool[_arg1]; var _local14:b2BoundValues = new b2BoundValues(); ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2); var _local15:b2BoundValues = new b2BoundValues(); _local5 = 0; while (_local5 < 2) { _local7 = m_bounds[_local5][_local13.lowerBounds[_local5]]; _local15.lowerValues[_local5] = _local7.value; _local7 = m_bounds[_local5][_local13.upperBounds[_local5]]; _local15.upperValues[_local5] = _local7.value; _local5++; }; _local5 = 0; while (_local5 < 2) { _local16 = m_bounds[_local5]; _local17 = _local13.lowerBounds[_local5]; _local18 = _local13.upperBounds[_local5]; _local19 = _local14.lowerValues[_local5]; _local20 = _local14.upperValues[_local5]; _local7 = _local16[_local17]; _local21 = (_local19 - _local7.value); _local7.value = _local19; _local7 = _local16[_local18]; _local22 = (_local20 - _local7.value); _local7.value = _local20; if (_local21 < 0){ _local6 = _local17; while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) { _local7 = _local16[_local6]; _local8 = _local16[int((_local6 - 1))]; _local23 = _local8.proxyId; _local24 = m_proxyPool[_local8.proxyId]; _local8.stabbingCount++; if (_local8.IsUpper() == true){ if (TestOverlap(_local14, _local24)){ m_pairManager.AddBufferedPair(_arg1, _local23); }; _local3 = _local24.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount++; } else { _local3 = _local24.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount--; }; _local3 = _local13.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.Swap(_local8); _local6--; }; }; if (_local22 > 0){ _local6 = _local18; while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) { _local7 = _local16[_local6]; _local9 = _local16[int((_local6 + 1))]; _local10 = _local9.proxyId; _local11 = m_proxyPool[_local10]; _local9.stabbingCount++; if (_local9.IsLower() == true){ if (TestOverlap(_local14, _local11)){ m_pairManager.AddBufferedPair(_arg1, _local10); }; _local3 = _local11.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount++; } else { _local3 = _local11.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount--; }; _local3 = _local13.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.Swap(_local9); _local6++; }; }; if (_local21 > 0){ _local6 = _local17; while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) { _local7 = _local16[_local6]; _local9 = _local16[int((_local6 + 1))]; _local10 = _local9.proxyId; _local11 = m_proxyPool[_local10]; _local9.stabbingCount--; if (_local9.IsUpper()){ if (TestOverlap(_local15, _local11)){ m_pairManager.RemoveBufferedPair(_arg1, _local10); }; _local3 = _local11.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount--; } else { _local3 = _local11.lowerBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.stabbingCount++; }; _local3 = _local13.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.Swap(_local9); _local6++; }; }; if (_local22 < 0){ _local6 = _local18; while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) { _local7 = _local16[_local6]; _local8 = _local16[int((_local6 - 1))]; _local23 = _local8.proxyId; _local24 = m_proxyPool[_local23]; _local8.stabbingCount--; if (_local8.IsLower() == true){ if (TestOverlap(_local15, _local24)){ m_pairManager.RemoveBufferedPair(_arg1, _local23); }; _local3 = _local24.lowerBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount--; } else { _local3 = _local24.upperBounds; _local4 = _local3[_local5]; _local4++; _local3[_local5] = _local4; _local7.stabbingCount++; }; _local3 = _local13.upperBounds; _local4 = _local3[_local5]; _local4--; _local3[_local5] = _local4; _local7.Swap(_local8); _local6--; }; }; _local5++; }; } public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{ var _local6:int; var _local7:b2Bound; var _local4:int; var _local5:int = (_arg2 - 1); while (_local4 <= _local5) { _local6 = ((_local4 + _local5) / 2); _local7 = _arg1[_local6]; if (_local7.value > _arg3){ _local5 = (_local6 - 1); } else { if (_local7.value < _arg3){ _local4 = (_local6 + 1); } else { return (uint(_local6)); }; }; }; return (uint(_local4)); } } }//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair) package Box2D.Collision { public class b2BufferedPair { public var proxyId1:uint; public var proxyId2:uint; } }//package Box2D.Collision
Section 14
//b2Collision (Box2D.Collision.b2Collision) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Collision { public static const b2_nullFeature:uint = 0xFF; private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2(); public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{ var _local11:b2Mat22; var _local12:b2Vec2; var _local25:Number; var _local6:int = _arg1.m_vertexCount; var _local7:Array = _arg1.m_vertices; var _local8:Array = _arg1.m_normals; var _local9:int = _arg4.m_vertexCount; var _local10:Array = _arg4.m_vertices; _local11 = _arg2.R; _local12 = _local8[_arg3]; var _local13:Number = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)); var _local14:Number = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)); _local11 = _arg5.R; var _local15:Number = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14)); var _local16:Number = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14)); var _local17:int; var _local18:Number = Number.MAX_VALUE; var _local19:int; while (_local19 < _local9) { _local12 = _local10[_local19]; _local25 = ((_local12.x * _local15) + (_local12.y * _local16)); if (_local25 < _local18){ _local18 = _local25; _local17 = _local19; }; _local19++; }; _local12 = _local7[_arg3]; _local11 = _arg2.R; var _local20:Number = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y))); var _local21:Number = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y))); _local12 = _local10[_local17]; _local11 = _arg5.R; var _local22:Number = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y))); var _local23:Number = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y))); _local22 = (_local22 - _local20); _local23 = (_local23 - _local21); var _local24:Number = ((_local22 * _local13) + (_local23 * _local14)); return (_local24); } public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{ var _local3:b2Vec2 = _arg2.lowerBound; var _local4:b2Vec2 = _arg1.upperBound; var _local5:Number = (_local3.x - _local4.x); var _local6:Number = (_local3.y - _local4.y); _local3 = _arg1.lowerBound; _local4 = _arg2.upperBound; var _local7:Number = (_local3.x - _local4.x); var _local8:Number = (_local3.y - _local4.y); if ((((_local5 > 0)) || ((_local6 > 0)))){ return (false); }; if ((((_local7 > 0)) || ((_local8 > 0)))){ return (false); }; return (true); } public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{ var _local12:b2Mat22; var _local13:b2Vec2; var _local20:ClipVertex; var _local23:Number; var _local7:int = _arg2.m_vertexCount; var _local8:Array = _arg2.m_normals; var _local9:int = _arg5.m_vertexCount; var _local10:Array = _arg5.m_vertices; var _local11:Array = _arg5.m_normals; _local12 = _arg3.R; _local13 = _local8[_arg4]; var _local14:Number = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)); var _local15:Number = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)); _local12 = _arg6.R; var _local16:Number = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15)); _local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15)); _local14 = _local16; var _local17:int; var _local18:Number = Number.MAX_VALUE; var _local19:int; while (_local19 < _local9) { _local13 = _local11[_local19]; _local23 = ((_local14 * _local13.x) + (_local15 * _local13.y)); if (_local23 < _local18){ _local18 = _local23; _local17 = _local19; }; _local19++; }; var _local21:int = _local17; var _local22:int = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0; _local20 = _arg1[0]; _local13 = _local10[_local21]; _local12 = _arg6.R; _local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y))); _local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y))); _local20.id.features.referenceEdge = _arg4; _local20.id.features.incidentEdge = _local21; _local20.id.features.incidentVertex = 0; _local20 = _arg1[1]; _local13 = _local10[_local22]; _local12 = _arg6.R; _local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y))); _local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y))); _local20.id.features.referenceEdge = _arg4; _local20.id.features.incidentEdge = _local22; _local20.id.features.incidentVertex = 1; } public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{ var _local6:ClipVertex; var _local13:b2PolygonShape; var _local14:b2PolygonShape; var _local17:int; var _local18:uint; var _local34:int; var _local37:b2Vec2; var _local38:Number; var _local39:b2ManifoldPoint; _arg1.pointCount = 0; var _local7:int; var _local8:Array = [_local7]; var _local9:Number = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5); _local7 = _local8[0]; if (_local9 > 0){ return; }; var _local10:int; var _local11:Array = [_local10]; var _local12:Number = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3); _local10 = _local11[0]; if (_local12 > 0){ return; }; var _local15:b2XForm = new b2XForm(); var _local16:b2XForm = new b2XForm(); var _local19:Number = 0.98; var _local20:Number = 0.001; if (_local12 > ((_local19 * _local9) + _local20)){ _local13 = _arg4; _local14 = _arg2; _local15.Set(_arg5); _local16.Set(_arg3); _local17 = _local10; _local18 = 1; } else { _local13 = _arg2; _local14 = _arg4; _local15.Set(_arg3); _local16.Set(_arg5); _local17 = _local7; _local18 = 0; }; var _local21:Array = [new ClipVertex(), new ClipVertex()]; FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16); var _local22:int = _local13.m_vertexCount; var _local23:Array = _local13.m_vertices; var _local24:b2Vec2 = _local23[_local17]; var _local25:b2Vec2 = _local24.Copy(); if ((_local17 + 1) < _local22){ _local24 = _local23[int((_local17 + 1))]; _local37 = _local24.Copy(); } else { _local24 = _local23[0]; _local37 = _local24.Copy(); }; var _local26:b2Vec2 = b2Math.SubtractVV(_local37, _local25); var _local27:b2Vec2 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25)); _local27.Normalize(); var _local28:b2Vec2 = b2Math.b2CrossVF(_local27, 1); _local25 = b2Math.b2MulX(_local15, _local25); _local37 = b2Math.b2MulX(_local15, _local37); var _local29:Number = b2Math.b2Dot(_local28, _local25); var _local30:Number = -(b2Math.b2Dot(_local27, _local25)); var _local31:Number = b2Math.b2Dot(_local27, _local37); var _local32:Array = [new ClipVertex(), new ClipVertex()]; var _local33:Array = [new ClipVertex(), new ClipVertex()]; _local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30); if (_local34 < 2){ return; }; _local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31); if (_local34 < 2){ return; }; _arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy(); var _local35:int; var _local36:int; while (_local36 < b2Settings.b2_maxManifoldPoints) { _local6 = _local33[_local36]; _local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29); if (_local38 <= 0){ _local39 = _arg1.points[_local35]; _local39.separation = _local38; _local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v); _local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v); _local39.id.key = _local6.id._key; _local39.id.features.flip = _local18; _local35++; }; _local36++; }; _arg1.pointCount = _local35; } public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{ var _local8:b2Vec2; var _local9:b2Mat22; var _local22:int; var _local23:Number; var _local24:int; var _local25:Number; var _local6:int = _arg2.m_vertexCount; var _local7:Array = _arg2.m_normals; _local9 = _arg5.R; _local8 = _arg4.m_centroid; var _local10:Number = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))); var _local11:Number = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))); _local9 = _arg3.R; _local8 = _arg2.m_centroid; _local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)))); _local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)))); var _local12:Number = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y)); var _local13:Number = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y)); var _local14:int; var _local15:Number = -(Number.MAX_VALUE); var _local16:int; while (_local16 < _local6) { _local8 = _local7[_local16]; _local25 = ((_local8.x * _local12) + (_local8.y * _local13)); if (_local25 > _local15){ _local15 = _local25; _local14 = _local16; }; _local16++; }; var _local17:Number = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5); if (_local17 > 0){ return (_local17); }; var _local18:int = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1); var _local19:Number = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5); if (_local19 > 0){ return (_local19); }; var _local20:int = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0; var _local21:Number = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5); if (_local21 > 0){ return (_local21); }; if ((((_local19 > _local17)) && ((_local19 > _local21)))){ _local24 = -1; _local22 = _local18; _local23 = _local19; } else { if (_local21 > _local17){ _local24 = 1; _local22 = _local20; _local23 = _local21; } else { _arg1[0] = _local14; return (_local17); }; }; while (true) { if (_local24 == -1){ _local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1); } else { _local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0; }; _local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5); if (_local17 > 0){ return (_local17); }; if (_local17 > _local23){ _local22 = _local14; _local23 = _local17; } else { break; }; }; _arg1[0] = _local22; return (_local23); } public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{ var _local5:ClipVertex; var _local6:int; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:Number; var _local11:Number; var _local12:b2Vec2; var _local13:ClipVertex; _local6 = 0; _local5 = _arg2[0]; _local7 = _local5.v; _local5 = _arg2[1]; _local8 = _local5.v; _local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4); var _local10:Number = (b2Math.b2Dot(_arg3, _local8) - _arg4); if (_local9 <= 0){ var _temp1 = _local6; _local6 = (_local6 + 1); var _local14 = _temp1; _arg1[_local14] = _arg2[0]; }; if (_local10 <= 0){ var _temp2 = _local6; _local6 = (_local6 + 1); _local14 = _temp2; _arg1[_local14] = _arg2[1]; }; if ((_local9 * _local10) < 0){ _local11 = (_local9 / (_local9 - _local10)); _local5 = _arg1[_local6]; _local12 = _local5.v; _local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x))); _local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y))); _local5 = _arg1[_local6]; if (_local9 > 0){ _local13 = _arg2[0]; _local5.id = _local13.id; } else { _local13 = _arg2[1]; _local5.id = _local13.id; }; _local6++; }; return (_local6); } public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{ var _local6:b2Mat22; var _local7:b2Vec2; var _local18:Number; var _local24:Number; var _local25:Number; _arg1.pointCount = 0; _local6 = _arg3.R; _local7 = _arg2.m_localPosition; var _local8:Number = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); var _local9:Number = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); _local6 = _arg5.R; _local7 = _arg4.m_localPosition; var _local10:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); var _local11:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); var _local12:Number = (_local10 - _local8); var _local13:Number = (_local11 - _local9); var _local14:Number = ((_local12 * _local12) + (_local13 * _local13)); var _local15:Number = _arg2.m_radius; var _local16:Number = _arg4.m_radius; var _local17:Number = (_local15 + _local16); if (_local14 > (_local17 * _local17)){ return; }; if (_local14 < Number.MIN_VALUE){ _local18 = -(_local17); _arg1.normal.Set(0, 1); } else { _local24 = Math.sqrt(_local14); _local18 = (_local24 - _local17); _local25 = (1 / _local24); _arg1.normal.x = (_local25 * _local12); _arg1.normal.y = (_local25 * _local13); }; _arg1.pointCount = 1; var _local19:b2ManifoldPoint = _arg1.points[0]; _local19.id.key = 0; _local19.separation = _local18; _local8 = (_local8 + (_local15 * _arg1.normal.x)); _local9 = (_local9 + (_local15 * _arg1.normal.y)); _local10 = (_local10 - (_local16 * _arg1.normal.x)); _local11 = (_local11 - (_local16 * _arg1.normal.y)); var _local20:Number = (0.5 * (_local8 + _local10)); var _local21:Number = (0.5 * (_local9 + _local11)); var _local22:Number = (_local20 - _arg3.position.x); var _local23:Number = (_local21 - _arg3.position.y); _local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y)); _local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y)); _local22 = (_local20 - _arg5.position.x); _local23 = (_local21 - _arg5.position.y); _local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y)); _local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y)); } public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{ var _local6:b2ManifoldPoint; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:b2Vec2; var _local12:b2Mat22; var _local17:Number; var _local32:Number; var _local33:Number; var _local34:Number; _arg1.pointCount = 0; _local12 = _arg5.R; _local11 = _arg4.m_localPosition; var _local13:Number = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y))); var _local14:Number = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y))); _local7 = (_local13 - _arg3.position.x); _local8 = (_local14 - _arg3.position.y); _local12 = _arg3.R; var _local15:Number = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); var _local16:Number = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); var _local18:int; var _local19:Number = -(Number.MAX_VALUE); var _local20:Number = _arg4.m_radius; var _local21:int = _arg2.m_vertexCount; var _local22:Array = _arg2.m_vertices; var _local23:Array = _arg2.m_normals; var _local24:int; while (_local24 < _local21) { _local11 = _local22[_local24]; _local7 = (_local15 - _local11.x); _local8 = (_local16 - _local11.y); _local11 = _local23[_local24]; _local34 = ((_local11.x * _local7) + (_local11.y * _local8)); if (_local34 > _local20){ return; }; if (_local34 > _local19){ _local19 = _local34; _local18 = _local24; }; _local24++; }; if (_local19 < Number.MIN_VALUE){ _arg1.pointCount = 1; _local11 = _local23[_local18]; _local12 = _arg3.R; _arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)); _arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)); _local6 = _arg1.points[0]; _local6.id.features.incidentEdge = _local18; _local6.id.features.incidentVertex = b2_nullFeature; _local6.id.features.referenceEdge = 0; _local6.id.features.flip = 0; _local9 = (_local13 - (_local20 * _arg1.normal.x)); _local10 = (_local14 - (_local20 * _arg1.normal.y)); _local7 = (_local9 - _arg3.position.x); _local8 = (_local10 - _arg3.position.y); _local12 = _arg3.R; _local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local7 = (_local9 - _arg5.position.x); _local8 = (_local10 - _arg5.position.y); _local12 = _arg5.R; _local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local6.separation = (_local19 - _local20); return; }; var _local25:int = _local18; var _local26:int = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0; _local11 = _local22[_local25]; var _local27:b2Vec2 = _local22[_local26]; var _local28:Number = (_local27.x - _local11.x); var _local29:Number = (_local27.y - _local11.y); var _local30:Number = Math.sqrt(((_local28 * _local28) + (_local29 * _local29))); _local28 = (_local28 / _local30); _local29 = (_local29 / _local30); _local7 = (_local15 - _local11.x); _local8 = (_local16 - _local11.y); var _local31:Number = ((_local7 * _local28) + (_local8 * _local29)); _local6 = _arg1.points[0]; if (_local31 <= 0){ _local32 = _local11.x; _local33 = _local11.y; _local6.id.features.incidentEdge = b2_nullFeature; _local6.id.features.incidentVertex = _local25; } else { if (_local31 >= _local30){ _local32 = _local27.x; _local33 = _local27.y; _local6.id.features.incidentEdge = b2_nullFeature; _local6.id.features.incidentVertex = _local26; } else { _local32 = ((_local28 * _local31) + _local11.x); _local33 = ((_local29 * _local31) + _local11.y); _local6.id.features.incidentEdge = _local18; _local6.id.features.incidentVertex = 0; }; }; _local7 = (_local15 - _local32); _local8 = (_local16 - _local33); _local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8))); _local7 = (_local7 / _local17); _local8 = (_local8 / _local17); if (_local17 > _local20){ return; }; _arg1.pointCount = 1; _local12 = _arg3.R; _arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8)); _arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8)); _local9 = (_local13 - (_local20 * _arg1.normal.x)); _local10 = (_local14 - (_local20 * _arg1.normal.y)); _local7 = (_local9 - _arg3.position.x); _local8 = (_local10 - _arg3.position.y); _local12 = _arg3.R; _local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local7 = (_local9 - _arg5.position.x); _local8 = (_local10 - _arg5.position.y); _local12 = _arg5.R; _local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local6.separation = (_local17 - _local20); _local6.id.features.referenceEdge = 0; _local6.id.features.flip = 0; } } }//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID) package Box2D.Collision { public class b2ContactID { public var _key:uint; public var features:Features; public function b2ContactID(){ features = new Features(); super(); features._m_id = this; } public function Set(_arg1:b2ContactID):void{ key = _arg1._key; } public function Copy():b2ContactID{ var _local1:b2ContactID = new b2ContactID(); _local1.key = key; return (_local1); } public function set key(_arg1:uint):void{ _key = _arg1; features._referenceEdge = (_key & 0xFF); features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF); features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF); features._flip = (((_key & 4278190080) >> 24) & 0xFF); } public function get key():uint{ return (_key); } } }//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2ContactPoint { public var friction:Number; public var separation:Number; public var normal:b2Vec2; public var position:b2Vec2; public var restitution:Number; public var shape1:b2Shape; public var shape2:b2Shape; public var id:b2ContactID; public var velocity:b2Vec2; public function b2ContactPoint(){ position = new b2Vec2(); velocity = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Distance { private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var gPoint:b2Point = new b2Point(); public static var g_GJK_Iterations:int = 0; public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{ var _local6:b2Vec2; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local4:Number = (100 * Number.MIN_VALUE); var _local5:int; while (_local5 < _arg3) { _local6 = _arg2[_local5]; _local7 = Math.abs((_arg1.x - _local6.x)); _local8 = Math.abs((_arg1.y - _local6.y)); _local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x)); _local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y)); if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){ return (true); }; _local5++; }; return (false); } public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{ var _local7:b2Vec2; var _local15:Number; var _local16:Number; var _local17:b2Vec2; var _local18:b2Vec2; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:int; var _local8:Array = s_p1s; var _local9:Array = s_p2s; var _local10:Array = s_points; var _local11:int; _arg1.SetV(_arg3.GetFirstVertex(_arg4)); _arg2.SetV(_arg5.GetFirstVertex(_arg6)); var _local12:Number = 0; var _local13 = 20; var _local14:int; while (_local14 < _local13) { _local15 = (_arg2.x - _arg1.x); _local16 = (_arg2.y - _arg1.y); _local17 = _arg3.Support(_arg4, _local15, _local16); _local18 = _arg5.Support(_arg6, -(_local15), -(_local16)); _local12 = ((_local15 * _local15) + (_local16 * _local16)); _local19 = (_local18.x - _local17.x); _local20 = (_local18.y - _local17.y); _local21 = ((_local15 * _local19) + (_local16 * _local20)); if ((_local12 - ((_local15 * _local19) + (_local16 * _local20))) <= (0.01 * _local12)){ if (_local11 == 0){ _arg1.SetV(_local17); _arg2.SetV(_local18); }; g_GJK_Iterations = _local14; return (Math.sqrt(_local12)); }; switch (_local11){ case 0: _local7 = _local8[0]; _local7.SetV(_local17); _local7 = _local9[0]; _local7.SetV(_local18); _local7 = _local10[0]; _local7.x = _local19; _local7.y = _local20; _arg1.SetV(_local8[0]); _arg2.SetV(_local9[0]); _local11++; break; case 1: _local7 = _local8[1]; _local7.SetV(_local17); _local7 = _local9[1]; _local7.SetV(_local18); _local7 = _local10[1]; _local7.x = _local19; _local7.y = _local20; _local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10); break; case 2: _local7 = _local8[2]; _local7.SetV(_local17); _local7 = _local9[2]; _local7.SetV(_local18); _local7 = _local10[2]; _local7.x = _local19; _local7.y = _local20; _local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10); break; }; if (_local11 == 3){ g_GJK_Iterations = _local14; return (0); }; _local22 = -(Number.MAX_VALUE); _local23 = 0; while (_local23 < _local11) { _local7 = _local10[_local23]; _local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y))); _local23++; }; if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){ g_GJK_Iterations = _local14; _local15 = (_arg2.x - _arg1.x); _local16 = (_arg2.y - _arg1.y); _local12 = ((_local15 * _local15) + (_local16 * _local16)); return (Math.sqrt(_local12)); }; _local14++; }; g_GJK_Iterations = _local13; return (Math.sqrt(_local12)); } public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{ var _local7:b2Mat22; var _local8:b2Vec2; var _local19:Number; var _local20:Number; _local7 = _arg4.R; _local8 = _arg3.m_localPosition; var _local9:Number = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); var _local10:Number = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); _local7 = _arg6.R; _local8 = _arg5.m_localPosition; var _local11:Number = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); var _local12:Number = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); var _local13:Number = (_local11 - _local9); var _local14:Number = (_local12 - _local10); var _local15:Number = ((_local13 * _local13) + (_local14 * _local14)); var _local16:Number = (_arg3.m_radius - b2Settings.b2_toiSlop); var _local17:Number = (_arg5.m_radius - b2Settings.b2_toiSlop); var _local18:Number = (_local16 + _local17); if (_local15 > (_local18 * _local18)){ _local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14))); _local13 = (_local13 / _local19); _local14 = (_local14 / _local19); _local20 = (_local19 - _local18); _arg1.x = (_local9 + (_local16 * _local13)); _arg1.y = (_local10 + (_local16 * _local14)); _arg2.x = (_local11 - (_local17 * _local13)); _arg2.y = (_local12 - (_local17 * _local14)); return (_local20); }; if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){ _local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14))); _local13 = (_local13 / _local19); _local14 = (_local14 / _local19); _arg1.x = (_local9 + (_local16 * _local13)); _arg1.y = (_local10 + (_local16 * _local14)); _arg2.x = _arg1.x; _arg2.y = _arg1.y; return (0); }; _arg1.x = _local9; _arg1.y = _local10; _arg2.x = _arg1.x; _arg2.y = _arg1.y; return (0); } public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{ var _local6:b2Vec2; var _local7:b2Vec2; var _local8:b2Vec2; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:b2Vec2; var _local12:b2Vec2; var _local13:b2Vec2; var _local35:Number; _local6 = _arg5[0]; _local7 = _arg5[1]; _local8 = _arg5[2]; _local9 = _arg3[0]; _local10 = _arg3[1]; _local11 = _arg3[2]; _local12 = _arg4[0]; _local13 = _arg4[1]; var _local14:b2Vec2 = _arg4[2]; var _local15:Number = _local6.x; var _local16:Number = _local6.y; var _local17:Number = _local7.x; var _local18:Number = _local7.y; var _local19:Number = _local8.x; var _local20:Number = _local8.y; var _local21:Number = (_local17 - _local15); var _local22:Number = (_local18 - _local16); var _local23:Number = (_local19 - _local15); var _local24:Number = (_local20 - _local16); var _local25:Number = (_local19 - _local17); var _local26:Number = (_local20 - _local18); var _local27:Number = -(((_local15 * _local21) + (_local16 * _local22))); var _local28:Number = ((_local17 * _local21) + (_local18 * _local22)); var _local29:Number = -(((_local15 * _local23) + (_local16 * _local24))); var _local30:Number = ((_local19 * _local23) + (_local20 * _local24)); var _local31:Number = -(((_local17 * _local25) + (_local18 * _local26))); var _local32:Number = ((_local19 * _local25) + (_local20 * _local26)); if ((((_local30 <= 0)) && ((_local32 <= 0)))){ _arg1.SetV(_local11); _arg2.SetV(_local14); _local9.SetV(_local11); _local12.SetV(_local14); _local6.SetV(_local8); return (1); }; var _local33:Number = ((_local21 * _local24) - (_local22 * _local23)); var _local34:Number = (_local33 * ((_local15 * _local18) - (_local16 * _local17))); var _local36:Number = (_local33 * ((_local17 * _local20) - (_local18 * _local19))); if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){ _local35 = (_local31 / (_local31 + _local32)); _arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x))); _arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y))); _arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x))); _arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y))); _local9.SetV(_local11); _local12.SetV(_local14); _local6.SetV(_local8); return (2); }; var _local37:Number = (_local33 * ((_local19 * _local16) - (_local20 * _local15))); if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){ _local35 = (_local29 / (_local29 + _local30)); _arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x))); _arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y))); _arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x))); _arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y))); _local10.SetV(_local11); _local13.SetV(_local14); _local7.SetV(_local8); return (2); }; var _local38:Number = ((_local36 + _local37) + _local34); _local38 = (1 / _local38); var _local39:Number = (_local36 * _local38); var _local40:Number = (_local37 * _local38); var _local41:Number = ((1 - _local39) - _local40); _arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x)); _arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y)); _arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x)); _arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y)); return (3); } public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{ var _local7:b2Mat22; var _local8:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local9:b2Point = gPoint; _local8 = _arg5.m_localPosition; _local7 = _arg6.R; _local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); _local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); var _local10:Number = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity); var _local11:Number = (_arg5.m_radius - b2Settings.b2_toiSlop); if (_local10 > _local11){ _local10 = (_local10 - _local11); _local12 = (_arg2.x - _arg1.x); _local13 = (_arg2.y - _arg1.y); _local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13))); _local12 = (_local12 / _local14); _local13 = (_local13 / _local14); _arg2.x = (_arg2.x - (_local11 * _local12)); _arg2.y = (_arg2.y - (_local11 * _local13)); } else { _local10 = 0; _arg2.x = _arg1.x; _arg2.y = _arg1.y; }; return (_local10); } public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{ var _local7:int = _arg3.m_type; var _local8:int = _arg5.m_type; if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){ return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6)); }; if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){ return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6)); }; if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){ return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4)); }; if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){ return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6)); }; return (0); } public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{ var _local9:b2Vec2; var _local10:b2Vec2; var _local11:b2Vec2; var _local17:Number; var _local6:b2Vec2 = _arg5[0]; var _local7:b2Vec2 = _arg5[1]; var _local8:b2Vec2 = _arg3[0]; _local9 = _arg3[1]; _local10 = _arg4[0]; _local11 = _arg4[1]; var _local12:Number = -(_local7.x); var _local13:Number = -(_local7.y); var _local14:Number = (_local6.x - _local7.x); var _local15:Number = (_local6.y - _local7.y); var _local16:Number = Math.sqrt(((_local14 * _local14) + (_local15 * _local15))); _local14 = (_local14 / _local16); _local15 = (_local15 / _local16); _local17 = ((_local12 * _local14) + (_local13 * _local15)); if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){ _arg1.SetV(_local9); _arg2.SetV(_local11); _local8.SetV(_local9); _local10.SetV(_local11); _local6.SetV(_local7); return (1); }; _local17 = (_local17 / _local16); _arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x))); _arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y))); _arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x))); _arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y))); return (2); } } }//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Manifold { public var pointCount:int;// = 0 public var normal:b2Vec2; public var points:Array; public function b2Manifold(){ points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ManifoldPoint(); _local1++; }; normal = new b2Vec2(); } public function Set(_arg1:b2Manifold):void{ pointCount = _arg1.pointCount; var _local2:int; while (_local2 < b2Settings.b2_maxManifoldPoints) { (points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]); _local2++; }; normal.SetV(_arg1.normal); } public function Reset():void{ var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { (points[_local1] as b2ManifoldPoint).Reset(); _local1++; }; normal.SetZero(); pointCount = 0; } } }//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint) package Box2D.Collision { import Box2D.Common.Math.*; public class b2ManifoldPoint { public var separation:Number; public var localPoint2:b2Vec2; public var normalImpulse:Number; public var tangentImpulse:Number; public var localPoint1:b2Vec2; public var id:b2ContactID; public function b2ManifoldPoint(){ localPoint1 = new b2Vec2(); localPoint2 = new b2Vec2(); id = new b2ContactID(); super(); } public function Set(_arg1:b2ManifoldPoint):void{ localPoint1.SetV(_arg1.localPoint1); localPoint2.SetV(_arg1.localPoint2); separation = _arg1.separation; normalImpulse = _arg1.normalImpulse; tangentImpulse = _arg1.tangentImpulse; id.key = _arg1.id.key; } public function Reset():void{ localPoint1.SetZero(); localPoint2.SetZero(); separation = 0; normalImpulse = 0; tangentImpulse = 0; id.key = 0; } } }//package Box2D.Collision
Section 20
//b2OBB (Box2D.Collision.b2OBB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2OBB { public var R:b2Mat22; public var center:b2Vec2; public var extents:b2Vec2; public function b2OBB(){ R = new b2Mat22(); center = new b2Vec2(); extents = new b2Vec2(); super(); } } }//package Box2D.Collision
Section 21
//b2Pair (Box2D.Collision.b2Pair) package Box2D.Collision { import Box2D.Common.*; public class b2Pair { public var proxyId1:uint; public var userData;// = null public var proxyId2:uint; public var status:uint; public var next:uint; public static var e_pairFinal:uint = 4; public static var b2_tableMask:int = (b2_tableCapacity - 1); public static var e_pairRemoved:uint = 2; public static var b2_nullPair:uint = b2Settings.USHRT_MAX; public static var e_pairBuffered:uint = 1; public static var b2_nullProxy:uint = b2Settings.USHRT_MAX; public static var b2_tableCapacity:int = b2Settings.b2_maxPairs; public function SetBuffered():void{ status = (status | e_pairBuffered); } public function IsBuffered():Boolean{ return (((status & e_pairBuffered) == e_pairBuffered)); } public function IsFinal():Boolean{ return (((status & e_pairFinal) == e_pairFinal)); } public function ClearRemoved():void{ status = (status & ~(e_pairRemoved)); } public function SetFinal():void{ status = (status | e_pairFinal); } public function IsRemoved():Boolean{ return (((status & e_pairRemoved) == e_pairRemoved)); } public function ClearBuffered():void{ status = (status & ~(e_pairBuffered)); } public function SetRemoved():void{ status = (status | e_pairRemoved); } } }//package Box2D.Collision
Section 22
//b2PairCallback (Box2D.Collision.b2PairCallback) package Box2D.Collision { public class b2PairCallback { public function PairRemoved(_arg1, _arg2, _arg3):void{ } public function PairAdded(_arg1, _arg2){ return (null); } } }//package Box2D.Collision
Section 23
//b2PairManager (Box2D.Collision.b2PairManager) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PairManager { public var m_pairCount:int; public var m_pairBuffer:Array; public var m_hashTable:Array; public var m_callback:b2PairCallback; public var m_pairs:Array; public var m_pairBufferCount:int; public var m_broadPhase:b2BroadPhase; public var m_freePair:uint; public function b2PairManager(){ var _local1:uint; super(); m_hashTable = new Array(b2Pair.b2_tableCapacity); _local1 = 0; while (_local1 < b2Pair.b2_tableCapacity) { m_hashTable[_local1] = b2Pair.b2_nullPair; _local1++; }; m_pairs = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1] = new b2Pair(); _local1++; }; m_pairBuffer = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairBuffer[_local1] = new b2BufferedPair(); _local1++; }; _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy; m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy; m_pairs[_local1].userData = null; m_pairs[_local1].status = 0; m_pairs[_local1].next = (_local1 + 1); _local1++; }; m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair; m_pairCount = 0; m_pairBufferCount = 0; } private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{ var _local4:b2Pair; var _local5:uint = m_hashTable[_arg3]; _local4 = m_pairs[_local5]; while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) { _local5 = _local4.next; _local4 = m_pairs[_local5]; }; if (_local5 == b2Pair.b2_nullPair){ return (null); }; return (_local4); } private function Find(_arg1:uint, _arg2:uint):b2Pair{ var _local4:uint; if (_arg1 > _arg2){ _local4 = _arg1; _arg1 = _arg2; _arg2 = _local4; }; var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); return (FindHash(_arg1, _arg2, _local3)); } private function ValidateBuffer():void{ } public function Commit():void{ var _local1:b2BufferedPair; var _local2:int; var _local5:b2Pair; var _local6:b2Proxy; var _local7:b2Proxy; var _local3:int; var _local4:Array = m_broadPhase.m_proxyPool; _local2 = 0; while (_local2 < m_pairBufferCount) { _local1 = m_pairBuffer[_local2]; _local5 = Find(_local1.proxyId1, _local1.proxyId2); _local5.ClearBuffered(); _local6 = _local4[_local5.proxyId1]; _local7 = _local4[_local5.proxyId2]; if (_local5.IsRemoved()){ if (_local5.IsFinal() == true){ m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData); }; _local1 = m_pairBuffer[_local3]; _local1.proxyId1 = _local5.proxyId1; _local1.proxyId2 = _local5.proxyId2; _local3++; } else { if (_local5.IsFinal() == false){ _local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData); _local5.SetFinal(); }; }; _local2++; }; _local2 = 0; while (_local2 < _local3) { _local1 = m_pairBuffer[_local2]; RemovePair(_local1.proxyId1, _local1.proxyId2); _local2++; }; m_pairBufferCount = 0; if (b2BroadPhase.s_validate){ ValidateTable(); }; } public function RemoveBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair = Find(_arg1, _arg2); if (_local4 == null){ return; }; if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = m_pairBuffer[m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; m_pairBufferCount++; }; _local4.SetRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function RemovePair(_arg1:uint, _arg2:uint){ var _local3:b2Pair; var _local7:uint; var _local8:uint; var _local9:*; if (_arg1 > _arg2){ _local7 = _arg1; _arg1 = _arg2; _arg2 = _local7; }; var _local4:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); var _local5:uint = m_hashTable[_local4]; var _local6:b2Pair; while (_local5 != b2Pair.b2_nullPair) { if (Equals(m_pairs[_local5], _arg1, _arg2)){ _local8 = _local5; _local3 = m_pairs[_local5]; if (_local6){ _local6.next = _local3.next; } else { m_hashTable[_local4] = _local3.next; }; _local3 = m_pairs[_local8]; _local9 = _local3.userData; _local3.next = m_freePair; _local3.proxyId1 = b2Pair.b2_nullProxy; _local3.proxyId2 = b2Pair.b2_nullProxy; _local3.userData = null; _local3.status = 0; m_freePair = _local8; m_pairCount--; return (_local9); } else { _local6 = m_pairs[_local5]; _local5 = _local6.next; }; }; return (null); } public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{ m_broadPhase = _arg1; m_callback = _arg2; } public function AddBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2BufferedPair; var _local4:b2Pair = AddPair(_arg1, _arg2); if (_local4.IsBuffered() == false){ _local4.SetBuffered(); _local3 = m_pairBuffer[m_pairBufferCount]; _local3.proxyId1 = _local4.proxyId1; _local3.proxyId2 = _local4.proxyId2; m_pairBufferCount++; }; _local4.ClearRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function AddPair(_arg1:uint, _arg2:uint):b2Pair{ var _local6:uint; if (_arg1 > _arg2){ _local6 = _arg1; _arg1 = _arg2; _arg2 = _local6; }; var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); var _local4 = FindHash(_arg1, _arg2, _local3); if (_local4 != null){ return (_local4); }; var _local5:uint = m_freePair; _local4 = m_pairs[_local5]; m_freePair = _local4.next; _local4.proxyId1 = _arg1; _local4.proxyId2 = _arg2; _local4.status = 0; _local4.userData = null; _local4.next = m_hashTable[_local3]; m_hashTable[_local3] = _local5; m_pairCount++; return (_local4); } private function ValidateTable():void{ } public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{ return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2)))); } public static function Hash(_arg1:uint, _arg2:uint):uint{ var _local3:uint = (((_arg2 << 16) & 4294901760) | _arg1); _local3 = (~(_local3) + ((_local3 << 15) & 4294934528)); _local3 = (_local3 ^ ((_local3 >> 12) & 1048575)); _local3 = (_local3 + ((_local3 << 2) & 4294967292)); _local3 = (_local3 ^ ((_local3 >> 4) & 268435455)); _local3 = (_local3 * 2057); _local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF)); return (_local3); } public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{ return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3)))); } } }//package Box2D.Collision
Section 24
//b2Point (Box2D.Collision.b2Point) package Box2D.Collision { import Box2D.Common.Math.*; public class b2Point { public var p:b2Vec2; public function b2Point(){ p = new b2Vec2(); super(); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (p); } public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{ return (p); } } }//package Box2D.Collision
Section 25
//b2Proxy (Box2D.Collision.b2Proxy) package Box2D.Collision { public class b2Proxy { public var overlapCount:uint; public var userData;// = null public var lowerBounds:Array; public var upperBounds:Array; public var timeStamp:uint; public function b2Proxy(){ lowerBounds = [uint(0), uint(0)]; upperBounds = [uint(0), uint(0)]; super(); } public function GetNext():uint{ return (lowerBounds[0]); } public function IsValid():Boolean{ return (!((overlapCount == b2BroadPhase.b2_invalid))); } public function SetNext(_arg1:uint):void{ lowerBounds[0] = (_arg1 & 0xFFFF); } } }//package Box2D.Collision
Section 26
//b2Segment (Box2D.Collision.b2Segment) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Segment { public var p1:b2Vec2; public var p2:b2Vec2; public function b2Segment(){ p1 = new b2Vec2(); p2 = new b2Vec2(); super(); } public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{ var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local5:b2Vec2 = _arg3.p1; var _local6:Number = (_arg3.p2.x - _local5.x); var _local7:Number = (_arg3.p2.y - _local5.y); var _local8:Number = (p2.x - p1.x); var _local9:Number = (p2.y - p1.y); var _local10:Number = _local9; var _local11:Number = -(_local8); var _local12:Number = (100 * Number.MIN_VALUE); var _local13:Number = -(((_local6 * _local10) + (_local7 * _local11))); if (_local13 > _local12){ _local14 = (_local5.x - p1.x); _local15 = (_local5.y - p1.y); _local16 = ((_local14 * _local10) + (_local15 * _local11)); if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){ _local17 = ((-(_local7) * _local15) + (_local7 * _local14)); if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){ _local16 = (_local16 / _local13); _local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); _local10 = (_local10 / _local18); _local11 = (_local11 / _local18); _arg1[0] = _local16; _arg2.Set(_local10, _local11); return (true); }; }; }; return (false); } public function Extend(_arg1:b2AABB):void{ ExtendForward(_arg1); ExtendBackward(_arg1); } public function ExtendForward(_arg1:b2AABB):void{ var aabb = _arg1; var dX:Number = (p2.x - p1.x); var dY:Number = (p2.y - p1.y); var greaterthan0:* = function (_arg1){ return ((_arg1 > 0)); }; var lambda:Number = Math.min(((dX > 0)) ? ((aabb.upperBound.x - p1.x) / dX) : ((dX < 0)) ? ((aabb.lowerBound.x - p1.x) / dX) : Number.POSITIVE_INFINITY, ((dY > 0)) ? ((aabb.upperBound.y - p1.y) / dY) : ((dY < 0)) ? ((aabb.lowerBound.y - p1.y) / dY) : Number.POSITIVE_INFINITY); p2.x = (p1.x + (dX * lambda)); p2.y = (p1.y + (dY * lambda)); } public function ExtendBackward(_arg1:b2AABB):void{ var dY:Number; var lambda:Number; var aabb = _arg1; var dX:Number = (-(p2.x) + p1.x); dY = (-(p2.y) + p1.y); var greaterthan0:* = function (_arg1){ return ((_arg1 > 0)); }; lambda = Math.min(((dX > 0)) ? ((aabb.upperBound.x - p2.x) / dX) : ((dX < 0)) ? ((aabb.lowerBound.x - p2.x) / dX) : Number.POSITIVE_INFINITY, ((dY > 0)) ? ((aabb.upperBound.y - p2.y) / dY) : ((dY < 0)) ? ((aabb.lowerBound.y - p2.y) / dY) : Number.POSITIVE_INFINITY); p1.x = (p2.x + (dX * lambda)); p1.y = (p2.y + (dY * lambda)); } } }//package Box2D.Collision
Section 27
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2TimeOfImpact { public static var s_xf1:b2XForm = new b2XForm(); public static var s_xf2:b2XForm = new b2XForm(); public static var s_p1:b2Vec2 = new b2Vec2(); public static var s_p2:b2Vec2 = new b2Vec2(); public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{ var _local5:Number; var _local6:Number; var _local25:Number; var _local26:b2XForm; var _local27:b2XForm; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local7:Number = _arg1.m_sweepRadius; var _local8:Number = _arg3.m_sweepRadius; var _local9:Number = _arg2.t0; var _local10:Number = (_arg2.c.x - _arg2.c0.x); var _local11:Number = (_arg2.c.y - _arg2.c0.y); var _local12:Number = (_arg4.c.x - _arg4.c0.x); var _local13:Number = (_arg4.c.y - _arg4.c0.y); var _local14:Number = (_arg2.a - _arg2.a0); var _local15:Number = (_arg4.a - _arg4.a0); var _local16:Number = 0; var _local17:b2Vec2 = s_p1; var _local18:b2Vec2 = s_p2; var _local19 = 20; var _local20:int; var _local21:Number = 0; var _local22:Number = 0; var _local23:Number = 0; var _local24:Number = 0; while (true) { _local25 = (((1 - _local16) * _local9) + _local16); _local26 = s_xf1; _local27 = s_xf2; _arg2.GetXForm(_local26, _local25); _arg4.GetXForm(_local27, _local25); _local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27); if (_local20 == 0){ if (_local23 > (2 * b2Settings.b2_toiSlop)){ _local24 = (1.5 * b2Settings.b2_toiSlop); } else { _local5 = (0.05 * b2Settings.b2_toiSlop); _local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop)); _local24 = ((_local5 > _local6)) ? _local5 : _local6; }; }; if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){ break; }; _local21 = (_local18.x - _local17.x); _local22 = (_local18.y - _local17.y); _local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22))); _local21 = (_local21 / _local28); _local22 = (_local22 / _local28); _local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8)); if (_local29 == 0){ _local16 = 1; break; }; _local30 = ((_local23 - _local24) / _local29); _local31 = (_local16 + _local30); if ((((_local31 < 0)) || ((1 < _local31)))){ _local16 = 1; break; }; if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){ break; }; _local16 = _local31; _local20++; }; return (_local16); } } }//package Box2D.Collision
Section 28
//ClipVertex (Box2D.Collision.ClipVertex) package Box2D.Collision { import Box2D.Common.Math.*; public class ClipVertex { public var id:b2ContactID; public var v:b2Vec2; public function ClipVertex(){ v = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features) package Box2D.Collision { public class Features { public var _referenceEdge:int; public var _incidentEdge:int; public var _flip:int; public var _incidentVertex:int; public var _m_id:b2ContactID; public function get referenceEdge():int{ return (_referenceEdge); } public function set incidentVertex(_arg1:int):void{ _incidentVertex = _arg1; _m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000)); } public function get flip():int{ return (_flip); } public function get incidentEdge():int{ return (_incidentEdge); } public function set referenceEdge(_arg1:int):void{ _referenceEdge = _arg1; _m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF)); } public function get incidentVertex():int{ return (_incidentVertex); } public function set flip(_arg1:int):void{ _flip = _arg1; _m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080)); } public function set incidentEdge(_arg1:int):void{ _incidentEdge = _arg1; _m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00)); } } }//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22) package Box2D.Common.Math { public class b2Mat22 { public var col1:b2Vec2; public var col2:b2Vec2; public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){ var _local4:Number; var _local5:Number; col1 = new b2Vec2(); col2 = new b2Vec2(); super(); if (((!((_arg2 == null))) && (!((_arg3 == null))))){ col1.SetV(_arg2); col2.SetV(_arg3); } else { _local4 = Math.cos(_arg1); _local5 = Math.sin(_arg1); col1.x = _local4; col2.x = -(_local5); col1.y = _local5; col2.y = _local4; }; } public function SetIdentity():void{ col1.x = 1; col2.x = 0; col1.y = 0; col2.y = 1; } public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{ col1.SetV(_arg1); col2.SetV(_arg2); } public function Set(_arg1:Number):void{ var _local2:Number; _local2 = Math.cos(_arg1); var _local3:Number = Math.sin(_arg1); col1.x = _local2; col2.x = -(_local3); col1.y = _local3; col2.y = _local2; } public function SetZero():void{ col1.x = 0; col2.x = 0; col1.y = 0; col2.y = 0; } public function SetM(_arg1:b2Mat22):void{ col1.SetV(_arg1.col1); col2.SetV(_arg1.col2); } public function AddM(_arg1:b2Mat22):void{ col1.x = (col1.x + _arg1.col1.x); col1.y = (col1.y + _arg1.col1.y); col2.x = (col2.x + _arg1.col2.x); col2.y = (col2.y + _arg1.col2.y); } public function Abs():void{ col1.Abs(); col2.Abs(); } public function Copy():b2Mat22{ return (new b2Mat22(0, col1, col2)); } public function Invert(_arg1:b2Mat22):b2Mat22{ var _local2:Number; var _local4:Number; var _local6:Number; _local2 = col1.x; var _local3:Number = col2.x; _local4 = col1.y; var _local5:Number = col2.y; _local6 = ((_local2 * _local5) - (_local3 * _local4)); _local6 = (1 / _local6); _arg1.col1.x = (_local6 * _local5); _arg1.col2.x = (-(_local6) * _local3); _arg1.col1.y = (-(_local6) * _local4); _arg1.col2.y = (_local6 * _local2); return (_arg1); } public function GetAngle():Number{ return (Math.atan2(col1.y, col1.x)); } public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:Number = col1.x; var _local5:Number = col2.x; var _local6:Number = col1.y; var _local7:Number = col2.y; var _local8:Number = ((_local4 * _local7) - (_local5 * _local6)); _local8 = (1 / _local8); _arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3))); _arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2))); return (_arg1); } } }//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math) package Box2D.Common.Math { public class b2Math { public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1)); public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity); public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0); public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x)); return (_local3); } public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y)); return (_local3); } public static function b2IsValid(_arg1:Number):Boolean{ return (isFinite(_arg1)); } public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y)); return (_local3); } public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = b2MulMV(_arg1.R, _arg2); _local3.x = (_local3.x + _arg1.position.x); _local3.y = (_local3.y + _arg1.position.y); return (_local3); } public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{ var _local3:Number = (_arg1.x - _arg2.x); var _local4:Number = (_arg1.y - _arg2.y); return (((_local3 * _local3) + (_local4 * _local4))); } public static function b2Swap(_arg1:Array, _arg2:Array):void{ var _local3:* = _arg1[0]; _arg1[0] = _arg2[0]; _arg2[0] = _local3; } public static function b2AbsM(_arg1:b2Mat22):b2Mat22{ var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2)); return (_local2); } public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y)); return (_local3); } public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; var _local4:Number; _local3 = SubtractVV(_arg2, _arg1.position); _local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y)); _local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y)); _local3.x = _local4; return (_local3); } public static function b2Abs(_arg1:Number):Number{ return (((_arg1 > 0)) ? _arg1 : -(_arg1)); } public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{ return (b2Max(_arg2, b2Min(_arg1, _arg3))); } public static function b2AbsV(_arg1:b2Vec2):b2Vec2{ var _local2:b2Vec2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y)); return (_local2); } public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y)); return (_local3); } public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x))); } public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y))); } public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x)); return (_local3); } public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2)); return (_local3); } public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{ var _local3:Number = (_arg1.x - _arg2.x); var _local4:Number = (_arg1.y - _arg2.y); return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4)))); } public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1)); var _local4:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2)); var _local5:b2Mat22 = new b2Mat22(0, _local3, _local4); return (_local5); } public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y)); return (_local3); } public static function b2IsPowerOfTwo(_arg1:uint):Boolean{ var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0))); return (_local2); } public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{ return (b2MaxV(_arg2, b2MinV(_arg1, _arg3))); } public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{ var _local3:Number = Math.random(); _local3 = (((_arg2 - _arg1) * _local3) + _arg1); return (_local3); } public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2)); return (_local3); } public static function b2Min(_arg1:Number, _arg2:Number):Number{ return (((_arg1 < _arg2)) ? _arg1 : _arg2); } public static function b2Random():Number{ return (((Math.random() * 2) - 1)); } public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2)); return (_local3); } public static function b2NextPowerOfTwo(_arg1:uint):uint{ _arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647)); _arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823)); _arg1 = (_arg1 | ((_arg1 >> 4) & 268435455)); _arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF)); _arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF)); return ((_arg1 + 1)); } public static function b2Max(_arg1:Number, _arg2:Number):Number{ return (((_arg1 > _arg2)) ? _arg1 : _arg2); } public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y))); return (_local3); } } }//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep) package Box2D.Common.Math { public class b2Sweep { public var localCenter:b2Vec2; public var a:Number; public var c:b2Vec2; public var a0:Number; public var c0:b2Vec2; public var t0:Number; public function b2Sweep(){ localCenter = new b2Vec2(); c0 = new b2Vec2(); c = new b2Vec2(); super(); } public function Advance(_arg1:Number):void{ var _local2:Number; if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){ _local2 = ((_arg1 - t0) / (1 - t0)); c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x)); c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y)); a0 = (((1 - _local2) * a0) + (_local2 * a)); t0 = _arg1; }; } public function GetXForm(_arg1:b2XForm, _arg2:Number):void{ var _local4:Number; var _local5:Number; if ((1 - t0) > Number.MIN_VALUE){ _local4 = ((_arg2 - t0) / (1 - t0)); _arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x)); _arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y)); _local5 = (((1 - _local4) * a0) + (_local4 * a)); _arg1.R.Set(_local5); } else { _arg1.position.SetV(c); _arg1.R.Set(a); }; var _local3:b2Mat22 = _arg1.R; _arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y))); _arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y))); } } }//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2) package Box2D.Common.Math { public class b2Vec2 { public var y:Number; public var x:Number; public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Add(_arg1:b2Vec2):void{ x = (x + _arg1.x); y = (y + _arg1.y); } public function Set(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Multiply(_arg1:Number):void{ x = (x * _arg1); y = (y * _arg1); } public function Length():Number{ return (Math.sqrt(((x * x) + (y * y)))); } public function LengthSquared():Number{ return (((x * x) + (y * y))); } public function MulM(_arg1:b2Mat22):void{ var _local2:Number = x; x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y)); y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y)); } public function SetZero():void{ x = 0; y = 0; } public function MinV(_arg1:b2Vec2):void{ x = ((x < _arg1.x)) ? x : _arg1.x; y = ((y < _arg1.y)) ? y : _arg1.y; } public function Normalize():Number{ var _local1:Number = Math.sqrt(((x * x) + (y * y))); if (_local1 < Number.MIN_VALUE){ return (0); }; var _local2:Number = (1 / _local1); x = (x * _local2); y = (y * _local2); return (_local1); } public function CrossVF(_arg1:Number):void{ var _local2:Number = x; x = (_arg1 * y); y = (-(_arg1) * _local2); } public function MaxV(_arg1:b2Vec2):void{ x = ((x > _arg1.x)) ? x : _arg1.x; y = ((y > _arg1.y)) ? y : _arg1.y; } public function SetV(_arg1:b2Vec2):void{ x = _arg1.x; y = _arg1.y; } public function Negative():b2Vec2{ return (new b2Vec2(-(x), -(y))); } public function CrossFV(_arg1:Number):void{ var _local2:Number = x; x = (-(_arg1) * y); y = (_arg1 * _local2); } public function Abs():void{ if (x < 0){ x = -(x); }; if (y < 0){ y = -(y); }; } public function Subtract(_arg1:b2Vec2):void{ x = (x - _arg1.x); y = (y - _arg1.y); } public function Copy():b2Vec2{ return (new b2Vec2(x, y)); } public function MulTM(_arg1:b2Mat22):void{ var _local2:Number = b2Math.b2Dot(this, _arg1.col1); y = b2Math.b2Dot(this, _arg1.col2); x = _local2; } public function IsValid():Boolean{ return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y)))); } public static function Make(_arg1:Number, _arg2:Number):b2Vec2{ return (new b2Vec2(_arg1, _arg2)); } } }//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm) package Box2D.Common.Math { public class b2XForm { public var position:b2Vec2; public var R:b2Mat22; public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{ position = new b2Vec2(); R = new b2Mat22(); super(); if (_arg1){ position.SetV(_arg1); R.SetM(_arg2); }; } public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{ position.SetV(_arg1); R.SetM(_arg2); } public function Set(_arg1:b2XForm):void{ position.SetV(_arg1.position); R.SetM(_arg1.R); } public function SetIdentity():void{ position.SetZero(); R.SetIdentity(); } } }//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color) package Box2D.Common { import Box2D.Common.Math.*; public class b2Color { private var _r:uint;// = 0 private var _g:uint;// = 0 private var _b:uint;// = 0 public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function set b(_arg1:Number):void{ _b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function get color():uint{ return (((_r | (_g << 8)) | (_b << 16))); } public function set r(_arg1:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function set g(_arg1:Number):void{ _g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } } }//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings) package Box2D.Common { import Box2D.Common.Math.*; public class b2Settings { public static const b2_angularSleepTolerance:Number = 0.0111111111111111; public static const b2_linearSleepTolerance:Number = 0.01; public static const b2_angularSlop:Number = ((2 / 180) * b2_pi); public static const b2_linearSlop:Number = 0.005; public static const b2_pi:Number = Math.PI; public static const b2_maxProxies:int = 0x0400; public static const b2_maxAngularVelocitySquared:Number = 62500; public static const b2_maxPolygonVertices:int = 16; public static const b2_velocityThreshold:Number = 1; public static const b2_contactBaumgarte:Number = 0.2; public static const b2_maxPairs:int = 8192; public static const b2_maxTOIContactsPerIsland:int = 32; public static const b2_timeToSleep:Number = 0.5; public static const b2_maxManifoldPoints:int = 2; public static const b2_maxAngularVelocity:Number = 250; public static const b2_maxAngularCorrection:Number = ((8 / 180) * b2_pi); public static const USHRT_MAX:int = 0xFFFF; public static const b2_maxLinearVelocity:Number = 200; public static const b2_maxLinearCorrection:Number = 0.2; public static const b2_toiSlop:Number = 0.04; public static const b2_maxLinearVelocitySquared:Number = 40000; public static function b2Assert(_arg1:Boolean):void{ var _local2:b2Vec2; if (!_arg1){ _local2.x++; }; } } }//package Box2D.Common
Section 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2CircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; var _local3:b2ManifoldPoint = m_manifold.points[0]; _local3.normalImpulse = 0; _local3.tangentImpulse = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2ManifoldPoint; var _local8:b2ManifoldPoint; var _local5:b2Body = m_shape1.m_body; var _local6:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf); var _local7:b2ContactPoint = s_evalCP; _local7.shape1 = m_shape1; _local7.shape2 = m_shape2; _local7.friction = m_friction; _local7.restitution = m_restitution; if (m_manifold.pointCount > 0){ m_manifoldCount = 1; _local8 = m_manifold.points[0]; if (m0.pointCount == 0){ _local8.normalImpulse = 0; _local8.tangentImpulse = 0; if (_arg1){ _local7.position = _local5.GetWorldPoint(_local8.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Add(_local7); }; } else { _local4 = m0.points[0]; _local8.normalImpulse = _local4.normalImpulse; _local8.tangentImpulse = _local4.tangentImpulse; if (_arg1){ _local7.position = _local5.GetWorldPoint(_local8.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local8.separation; _local7.id.key = _local8.id._key; _arg1.Persist(_local7); }; }; } else { m_manifoldCount = 0; if ((((m0.pointCount > 0)) && (_arg1))){ _local4 = m0.points[0]; _local7.position = _local5.GetWorldPoint(_local4.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2CircleContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2Contact { public var m_shape1:b2Shape; public var m_shape2:b2Shape; public var m_prev:b2Contact; public var m_toi:Number; public var m_next:b2Contact; public var m_friction:Number; public var m_manifoldCount:int; public var m_node1:b2ContactEdge; public var m_node2:b2ContactEdge; public var m_restitution:Number; public var m_flags:uint; public static var e_toiFlag:uint = 8; public static var e_nonSolidFlag:uint = 1; public static var e_slowFlag:uint = 2; public static var e_islandFlag:uint = 4; public static var s_registers:Array; public static var s_initialized:Boolean = false; public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){ m_node1 = new b2ContactEdge(); m_node2 = new b2ContactEdge(); super(); m_flags = 0; if (((!(_arg1)) || (!(_arg2)))){ m_shape1 = null; m_shape2 = null; return; }; if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){ m_flags = (m_flags | e_nonSolidFlag); }; m_shape1 = _arg1; m_shape2 = _arg2; m_manifoldCount = 0; m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction)); m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution); m_prev = null; m_next = null; m_node1.contact = null; m_node1.prev = null; m_node1.next = null; m_node1.other = null; m_node2.contact = null; m_node2.prev = null; m_node2.next = null; m_node2.other = null; } public function IsSolid():Boolean{ return (((m_flags & e_nonSolidFlag) == 0)); } public function GetShape1():b2Shape{ return (m_shape1); } public function GetShape2():b2Shape{ return (m_shape2); } public function GetNext():b2Contact{ return (m_next); } public function GetManifoldCount():int{ return (m_manifoldCount); } public function GetManifolds():Array{ return (null); } public function Update(_arg1:b2ContactListener):void{ var _local2:int = m_manifoldCount; Evaluate(_arg1); var _local3:int = m_manifoldCount; var _local4:b2Body = m_shape1.m_body; var _local5:b2Body = m_shape2.m_body; if ((((_local3 == 0)) && ((_local2 > 0)))){ _local4.WakeUp(); _local5.WakeUp(); }; if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){ m_flags = (m_flags & ~(e_slowFlag)); } else { m_flags = (m_flags | e_slowFlag); }; } public function Evaluate(_arg1:b2ContactListener):void{ } public static function InitializeRegisters():void{ var _local2:int; s_registers = new Array(b2Shape.e_shapeTypeCount); var _local1:int; while (_local1 < b2Shape.e_shapeTypeCount) { s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount); _local2 = 0; while (_local2 < b2Shape.e_shapeTypeCount) { s_registers[_local1][_local2] = new b2ContactRegister(); _local2++; }; _local1++; }; AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape); AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape); AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape); } public static function Destroy(_arg1:b2Contact, _arg2):void{ if (_arg1.m_manifoldCount > 0){ _arg1.m_shape1.m_body.WakeUp(); _arg1.m_shape2.m_body.WakeUp(); }; var _local3:int = _arg1.m_shape1.m_type; var _local4:int = _arg1.m_shape2.m_type; var _local5:b2ContactRegister = s_registers[_local3][_local4]; var _local6:Function = _local5.destroyFcn; _local6(_arg1, _arg2); } public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{ s_registers[_arg3][_arg4].createFcn = _arg1; s_registers[_arg3][_arg4].destroyFcn = _arg2; s_registers[_arg3][_arg4].primary = true; if (_arg3 != _arg4){ s_registers[_arg4][_arg3].createFcn = _arg1; s_registers[_arg4][_arg3].destroyFcn = _arg2; s_registers[_arg4][_arg3].primary = false; }; } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ var _local8:b2Contact; var _local9:int; var _local10:b2Manifold; if (s_initialized == false){ InitializeRegisters(); s_initialized = true; }; var _local4:int = _arg1.m_type; var _local5:int = _arg2.m_type; var _local6:b2ContactRegister = s_registers[_local4][_local5]; var _local7:Function = _local6.createFcn; if (_local7 != null){ if (_local6.primary){ return (_local7(_arg1, _arg2, _arg3)); }; _local8 = _local7(_arg2, _arg1, _arg3); _local9 = 0; while (_local9 < _local8.m_manifoldCount) { _local10 = _local8.GetManifolds()[_local9]; _local8.GetManifolds()[_local9].normal = _local10.normal.Negative(); _local9++; }; return (_local8); //unresolved jump }; return (null); } } }//package Box2D.Dynamics.Contacts
Section 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactConstraint { public var points:Array; public var normal:b2Vec2; public var restitution:Number; public var body1:b2Body; public var manifold:b2Manifold; public var body2:b2Body; public var friction:Number; public var pointCount:int; public function b2ContactConstraint(){ normal = new b2Vec2(); super(); points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ContactConstraintPoint(); _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; public class b2ContactConstraintPoint { public var r2:b2Vec2; public var separation:Number; public var positionImpulse:Number; public var normalImpulse:Number; public var tangentMass:Number; public var equalizedMass:Number; public var tangentImpulse:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var normalMass:Number; public var velocityBias:Number; public var r1:b2Vec2; public function b2ContactConstraintPoint(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); r1 = new b2Vec2(); r2 = new b2Vec2(); super(); } } }//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2ContactEdge { public var other:b2Body; public var prev:b2ContactEdge; public var contact:b2Contact; public var next:b2ContactEdge; } }//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister) package Box2D.Dynamics.Contacts { public class b2ContactRegister { public var primary:Boolean; public var createFcn:Function; public var destroyFcn:Function; } }//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; public class b2ContactResult { public var position:b2Vec2; public var shape1:b2Shape; public var shape2:b2Shape; public var normalImpulse:Number; public var normal:b2Vec2; public var tangentImpulse:Number; public var id:b2ContactID; public function b2ContactResult(){ position = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactSolver { public var m_constraintCount:int; public var m_constraints:Array; public var m_allocator; public var m_step:b2TimeStep; public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){ var _local5:b2Contact; var _local6:int; var _local7:b2Vec2; var _local8:b2Mat22; var _local10:b2Body; var _local11:b2Body; var _local12:int; var _local13:Array; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:int; var _local23:b2Manifold; var _local24:Number; var _local25:Number; var _local26:b2ContactConstraint; var _local27:uint; var _local28:b2ManifoldPoint; var _local29:b2ContactConstraintPoint; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local39:Number; var _local40:Number; var _local41:Number; var _local42:Number; var _local43:Number; var _local44:Number; var _local45:Number; var _local46:Number; var _local47:Number; m_step = new b2TimeStep(); m_constraints = new Array(); super(); m_step.dt = _arg1.dt; m_step.inv_dt = _arg1.inv_dt; m_step.maxIterations = _arg1.maxIterations; m_allocator = _arg4; m_constraintCount = 0; _local6 = 0; while (_local6 < _arg3) { _local5 = _arg2[_local6]; m_constraintCount = (m_constraintCount + _local5.m_manifoldCount); _local6++; }; _local6 = 0; while (_local6 < m_constraintCount) { m_constraints[_local6] = new b2ContactConstraint(); _local6++; }; var _local9:int; _local6 = 0; while (_local6 < _arg3) { _local5 = _arg2[_local6]; _local10 = _local5.m_shape1.m_body; _local11 = _local5.m_shape2.m_body; _local12 = _local5.m_manifoldCount; _local13 = _local5.GetManifolds(); _local14 = _local5.m_friction; _local15 = _local5.m_restitution; _local16 = _local10.m_linearVelocity.x; _local17 = _local10.m_linearVelocity.y; _local18 = _local11.m_linearVelocity.x; _local19 = _local11.m_linearVelocity.y; _local20 = _local10.m_angularVelocity; _local21 = _local11.m_angularVelocity; _local22 = 0; while (_local22 < _local12) { _local23 = _local13[_local22]; _local24 = _local23.normal.x; _local25 = _local23.normal.y; _local26 = m_constraints[_local9]; _local26.body1 = _local10; _local26.body2 = _local11; _local26.manifold = _local23; _local26.normal.x = _local24; _local26.normal.y = _local25; _local26.pointCount = _local23.pointCount; _local26.friction = _local14; _local26.restitution = _local15; _local27 = 0; while (_local27 < _local26.pointCount) { _local28 = _local23.points[_local27]; _local29 = _local26.points[_local27]; _local29.normalImpulse = _local28.normalImpulse; _local29.tangentImpulse = _local28.tangentImpulse; _local29.separation = _local28.separation; _local29.positionImpulse = 0; _local29.localAnchor1.SetV(_local28.localPoint1); _local29.localAnchor2.SetV(_local28.localPoint2); _local8 = _local10.m_xf.R; _local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x); _local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y); _local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33)); _local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33)); _local32 = _local30; _local29.r1.Set(_local32, _local33); _local8 = _local11.m_xf.R; _local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x); _local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y); _local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35)); _local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35)); _local34 = _local30; _local29.r2.Set(_local34, _local35); _local36 = ((_local32 * _local32) + (_local33 * _local33)); _local37 = ((_local34 * _local34) + (_local35 * _local35)); _local38 = ((_local32 * _local24) + (_local33 * _local25)); _local39 = ((_local34 * _local24) + (_local35 * _local25)); _local40 = (_local10.m_invMass + _local11.m_invMass); _local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39))))); _local29.normalMass = (1 / _local40); _local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass)); _local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39))))); _local29.equalizedMass = (1 / _local41); _local42 = _local25; _local43 = -(_local24); _local44 = ((_local32 * _local42) + (_local33 * _local43)); _local45 = ((_local34 * _local42) + (_local35 * _local43)); _local46 = (_local10.m_invMass + _local11.m_invMass); _local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45))))); _local29.tangentMass = (1 / _local46); _local29.velocityBias = 0; if (_local29.separation > 0){ _local29.velocityBias = (-60 * _local29.separation); }; _local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33)); _local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32)); _local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31)); if (_local47 < -(b2Settings.b2_velocityThreshold)){ _local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47)); }; _local27++; }; _local9++; _local22++; }; _local6++; }; } public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2Mat22; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:int; var _local19:int; var _local20:b2ContactConstraintPoint; var _local21:Number; var _local22:Number; var _local23:b2ContactConstraintPoint; var _local5:int; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_invMass; _local10 = _local7.m_invI; _local11 = _local8.m_invMass; _local12 = _local8.m_invI; _local13 = _local6.normal.x; _local14 = _local6.normal.y; _local15 = _local14; _local16 = -(_local13); if (_arg1.warmStarting){ _local19 = _local6.pointCount; _local18 = 0; while (_local18 < _local19) { _local20 = _local6.points[_local18]; _local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio); _local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio); _local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15)); _local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16)); _local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21)))); _local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21)); _local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22)); _local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21)))); _local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21)); _local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22)); _local18++; }; } else { _local19 = _local6.pointCount; _local18 = 0; while (_local18 < _local19) { _local23 = _local6.points[_local18]; _local23.normalImpulse = 0; _local23.tangentImpulse = 0; _local18++; }; }; _local5++; }; } public function SolvePositionConstraints(_arg1:Number):Boolean{ var _local3:b2Mat22; var _local4:b2Vec2; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:b2Vec2; var _local10:Number; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:int; var _local20:int; var _local21:b2ContactConstraintPoint; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local2:Number = 0; var _local5:int; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_sweep.c; _local10 = _local7.m_sweep.a; _local11 = _local8.m_sweep.c; _local12 = _local8.m_sweep.a; _local13 = (_local7.m_mass * _local7.m_invMass); _local14 = (_local7.m_mass * _local7.m_invI); _local15 = (_local8.m_mass * _local8.m_invMass); _local16 = (_local8.m_mass * _local8.m_invI); _local17 = _local6.normal.x; _local18 = _local6.normal.y; _local19 = _local6.pointCount; _local20 = 0; while (_local20 < _local19) { _local21 = _local6.points[_local20]; _local3 = _local7.m_xf.R; _local4 = _local7.m_sweep.localCenter; _local22 = (_local21.localAnchor1.x - _local4.x); _local23 = (_local21.localAnchor1.y - _local4.y); _local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23)); _local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23)); _local22 = _local26; _local3 = _local8.m_xf.R; _local4 = _local8.m_sweep.localCenter; _local24 = (_local21.localAnchor2.x - _local4.x); _local25 = (_local21.localAnchor2.y - _local4.y); _local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25)); _local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25)); _local24 = _local26; _local27 = (_local9.x + _local22); _local28 = (_local9.y + _local23); _local29 = (_local11.x + _local24); _local30 = (_local11.y + _local25); _local31 = (_local29 - _local27); _local32 = (_local30 - _local28); _local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation); _local2 = b2Math.b2Min(_local2, _local33); _local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0)); _local35 = (-(_local21.equalizedMass) * _local34); _local36 = _local21.positionImpulse; _local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0); _local35 = (_local21.positionImpulse - _local36); _local37 = (_local35 * _local17); _local38 = (_local35 * _local18); _local9.x = (_local9.x - (_local13 * _local37)); _local9.y = (_local9.y - (_local13 * _local38)); _local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37)))); _local7.m_sweep.a = _local10; _local7.SynchronizeTransform(); _local11.x = (_local11.x + (_local15 * _local37)); _local11.y = (_local11.y + (_local15 * _local38)); _local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37)))); _local8.m_sweep.a = _local12; _local8.SynchronizeTransform(); _local20++; }; _local5++; }; return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop))); } public function SolveVelocityConstraints():void{ var _local1:int; var _local2:b2ContactConstraintPoint; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:b2Mat22; var _local18:b2Vec2; var _local20:b2ContactConstraint; var _local21:b2Body; var _local22:b2Body; var _local23:Number; var _local24:Number; var _local25:b2Vec2; var _local26:b2Vec2; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:int; var _local38:Number; var _local19:int; while (_local19 < m_constraintCount) { _local20 = m_constraints[_local19]; _local21 = _local20.body1; _local22 = _local20.body2; _local23 = _local21.m_angularVelocity; _local24 = _local22.m_angularVelocity; _local25 = _local21.m_linearVelocity; _local26 = _local22.m_linearVelocity; _local27 = _local21.m_invMass; _local28 = _local21.m_invI; _local29 = _local22.m_invMass; _local30 = _local22.m_invI; _local31 = _local20.normal.x; _local32 = _local20.normal.y; _local33 = _local32; _local34 = -(_local31); _local35 = _local20.friction; _local37 = _local20.pointCount; _local1 = 0; while (_local1 < _local37) { _local2 = _local20.points[_local1]; _local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y)); _local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x)); _local9 = ((_local7 * _local31) + (_local8 * _local32)); _local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias)); _local10 = ((_local7 * _local33) + (_local8 * _local34)); _local12 = (_local2.tangentMass * -(_local10)); _local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0); _local11 = (_local13 - _local2.normalImpulse); _local38 = (_local35 * _local2.normalImpulse); _local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38); _local12 = (_local14 - _local2.tangentImpulse); _local15 = ((_local11 * _local31) + (_local12 * _local33)); _local16 = ((_local11 * _local32) + (_local12 * _local34)); _local25.x = (_local25.x - (_local27 * _local15)); _local25.y = (_local25.y - (_local27 * _local16)); _local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15)))); _local26.x = (_local26.x + (_local29 * _local15)); _local26.y = (_local26.y + (_local29 * _local16)); _local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15)))); _local2.normalImpulse = _local13; _local2.tangentImpulse = _local14; _local1++; }; _local21.m_angularVelocity = _local23; _local22.m_angularVelocity = _local24; _local19++; }; } public function FinalizeVelocityConstraints():void{ var _local2:b2ContactConstraint; var _local3:b2Manifold; var _local4:int; var _local5:b2ManifoldPoint; var _local6:b2ContactConstraintPoint; var _local1:int; while (_local1 < m_constraintCount) { _local2 = m_constraints[_local1]; _local3 = _local2.manifold; _local4 = 0; while (_local4 < _local2.pointCount) { _local5 = _local3.points[_local4]; _local6 = _local2.points[_local4]; _local5.normalImpulse = _local6.normalImpulse; _local5.tangentImpulse = _local6.tangentImpulse; _local4++; }; _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2NullContact extends b2Contact { override public function Evaluate(_arg1:b2ContactListener):void{ } override public function GetManifolds():Array{ return (null); } } }//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolyAndCircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape)); b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape)); m_manifold.pointCount = 0; var _local3:b2ManifoldPoint = m_manifold.points[0]; _local3.normalImpulse = 0; _local3.tangentImpulse = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:int; var _local3:b2Vec2; var _local4:b2Vec2; var _local5:b2ManifoldPoint; var _local10:b2ManifoldPoint; var _local11:Boolean; var _local12:uint; var _local13:int; var _local6:b2Body = m_shape1.m_body; var _local7:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf); var _local8:Array = [false, false]; var _local9:b2ContactPoint = s_evalCP; _local9.shape1 = m_shape1; _local9.shape2 = m_shape2; _local9.friction = m_friction; _local9.restitution = m_restitution; if (m_manifold.pointCount > 0){ _local2 = 0; while (_local2 < m_manifold.pointCount) { _local10 = m_manifold.points[_local2]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < m0.pointCount) { if (_local8[_local13] == true){ } else { _local5 = m0.points[_local13]; if (_local5.id._key == _local12){ _local8[_local13] = true; _local10.normalImpulse = _local5.normalImpulse; _local10.tangentImpulse = _local5.tangentImpulse; _local11 = true; if (_arg1 != null){ _local9.position = _local6.GetWorldPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m_manifold.normal); _local9.separation = _local10.separation; _local9.id.key = _local12; _arg1.Persist(_local9); }; break; }; }; _local13++; }; if ((((_local11 == false)) && (!((_arg1 == null))))){ _local9.position = _local6.GetWorldPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m_manifold.normal); _local9.separation = _local10.separation; _local9.id.key = _local12; _arg1.Add(_local9); }; _local2++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (_arg1 == null){ return; }; _local2 = 0; while (_local2 < m0.pointCount) { if (_local8[_local2]){ } else { _local5 = m0.points[_local2]; _local9.position = _local6.GetWorldPoint(_local5.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1); _local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2); _local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y)); _local9.normal.SetV(m0.normal); _local9.separation = _local5.separation; _local9.id.key = _local5.id._key; _arg1.Remove(_local9); }; _local2++; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolyAndCircleContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolygonContact extends b2Contact { private var m_manifolds:Array; private var m0:b2Manifold; public var m_manifold:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{ m0 = new b2Manifold(); m_manifolds = [new b2Manifold()]; super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local2:b2Vec2; var _local3:b2Vec2; var _local4:b2ManifoldPoint; var _local7:b2ContactPoint; var _local8:int; var _local10:b2ManifoldPoint; var _local11:Boolean; var _local12:uint; var _local13:int; var _local5:b2Body = m_shape1.m_body; var _local6:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf); var _local9:Array = [false, false]; _local7 = s_evalCP; _local7.shape1 = m_shape1; _local7.shape2 = m_shape2; _local7.friction = m_friction; _local7.restitution = m_restitution; if (m_manifold.pointCount > 0){ _local8 = 0; while (_local8 < m_manifold.pointCount) { _local10 = m_manifold.points[_local8]; _local10.normalImpulse = 0; _local10.tangentImpulse = 0; _local11 = false; _local12 = _local10.id._key; _local13 = 0; while (_local13 < m0.pointCount) { if (_local9[_local13] == true){ } else { _local4 = m0.points[_local13]; if (_local4.id._key == _local12){ _local9[_local13] = true; _local10.normalImpulse = _local4.normalImpulse; _local10.tangentImpulse = _local4.tangentImpulse; _local11 = true; if (_arg1 != null){ _local7.position = _local5.GetWorldPoint(_local10.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local10.separation; _local7.id.key = _local12; _arg1.Persist(_local7); }; break; }; }; _local13++; }; if ((((_local11 == false)) && (!((_arg1 == null))))){ _local7.position = _local5.GetWorldPoint(_local10.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m_manifold.normal); _local7.separation = _local10.separation; _local7.id.key = _local12; _arg1.Add(_local7); }; _local8++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (_arg1 == null){ return; }; _local8 = 0; while (_local8 < m0.pointCount) { if (_local9[_local8]){ } else { _local4 = m0.points[_local8]; _local7.position = _local5.GetWorldPoint(_local4.localPoint1); _local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1); _local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2); _local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y)); _local7.normal.SetV(m0.normal); _local7.separation = _local4.separation; _local7.id.key = _local4.id._key; _arg1.Remove(_local7); }; _local8++; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolygonContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2DistanceJoint extends b2Joint { public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_bias:Number; public var m_gamma:Number; public var m_u:b2Vec2; public var m_mass:Number; public var m_impulse:Number; public var m_dampingRatio:Number; public var m_frequencyHz:Number; public var m_length:Number; public function b2DistanceJoint(_arg1:b2DistanceJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u = new b2Vec2(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_length = _arg1.length; m_frequencyHz = _arg1.frequencyHz; m_dampingRatio = _arg1.dampingRatio; m_impulse = 0; m_gamma = 0; m_bias = 0; m_inv_dt = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; var _local3:Number; var _local4:b2Body; var _local5:b2Body; var _local6:Number; var _local8:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; m_inv_dt = _arg1.inv_dt; _local4 = m_body1; _local5 = m_body2; _local2 = _local4.m_xf.R; _local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local4.m_sweep.localCenter.y); _local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7)); _local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7)); _local6 = _local3; _local2 = _local5.m_xf.R; _local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local5.m_sweep.localCenter.y); _local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local3; m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6); m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7); var _local10:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y))); if (_local10 > b2Settings.b2_linearSlop){ m_u.Multiply((1 / _local10)); } else { m_u.SetZero(); }; var _local11:Number = ((_local6 * m_u.y) - (_local7 * m_u.x)); var _local12:Number = ((_local8 * m_u.y) - (_local9 * m_u.x)); var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12)); m_mass = (1 / _local13); if (m_frequencyHz > 0){ _local14 = (_local10 - m_length); _local15 = ((2 * Math.PI) * m_frequencyHz); _local16 = (((2 * m_mass) * m_dampingRatio) * _local15); _local17 = ((m_mass * _local15) * _local15); m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17)))); m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma); m_mass = (1 / (_local13 + m_gamma)); }; if (_arg1.warmStarting){ m_impulse = (m_impulse * _arg1.dtRatio); _local18 = (m_impulse * m_u.x); _local19 = (m_impulse * m_u.y); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19)); _local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18)))); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19)); _local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18)))); } else { m_impulse = 0; }; } override public function GetReactionTorque():Number{ return (0); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2(); _local1.SetV(m_u); _local1.Multiply((m_inv_dt * m_impulse)); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local1:b2Mat22; if (m_frequencyHz > 0){ return (true); }; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local1 = _local2.m_xf.R; var _local4:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local5:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local6:Number = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5)); _local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5)); _local4 = _local6; _local1 = _local3.m_xf.R; var _local7:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8)); _local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8)); _local7 = _local6; var _local9:Number = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4); var _local10:Number = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5); var _local11:Number = Math.sqrt(((_local9 * _local9) + (_local10 * _local10))); _local9 = (_local9 / _local11); _local10 = (_local10 / _local11); var _local12:Number = (_local11 - m_length); _local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local13:Number = (-(m_mass) * _local12); m_u.Set(_local9, _local10); var _local14:Number = (_local13 * m_u.x); var _local15:Number = (_local13 * m_u.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14)))); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15)); _local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14)))); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop)); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; _local2 = _local3.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6)); _local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6)); _local5 = _local7; _local2 = _local4.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local7; var _local10:Number = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6)); var _local11:Number = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5)); var _local12:Number = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9)); var _local13:Number = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8)); var _local14:Number = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11))); var _local15:Number = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse))); m_impulse = (m_impulse + _local15); var _local16:Number = (_local15 * m_u.x); var _local17:Number = (_local15 * m_u.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16)))); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17)); _local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); } } }//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2DistanceJointDef extends b2JointDef { public var localAnchor1:b2Vec2; public var length:Number; public var dampingRatio:Number; public var localAnchor2:b2Vec2; public var frequencyHz:Number; public function b2DistanceJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_distanceJoint; length = 1; frequencyHz = 0; dampingRatio = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1.SetV(body1.GetLocalPoint(_arg3)); localAnchor2.SetV(body2.GetLocalPoint(_arg4)); var _local5:Number = (_arg4.x - _arg3.x); var _local6:Number = (_arg4.y - _arg3.y); length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6))); frequencyHz = 0; dampingRatio = 0; } } }//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2GearJoint extends b2Joint { public var m_ground2:b2Body; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_ratio:Number; public var m_revolute2:b2RevoluteJoint; public var m_force:Number; public var m_mass:Number; public var m_prismatic2:b2PrismaticJoint; public var m_ground1:b2Body; public var m_revolute1:b2RevoluteJoint; public var m_prismatic1:b2PrismaticJoint; public var m_constant:Number; public var m_J:b2Jacobian; public function b2GearJoint(_arg1:b2GearJointDef){ var _local4:Number; var _local5:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_J = new b2Jacobian(); super(_arg1); var _local2:int = _arg1.joint1.m_type; var _local3:int = _arg1.joint2.m_type; m_revolute1 = null; m_prismatic1 = null; m_revolute2 = null; m_prismatic2 = null; m_ground1 = _arg1.joint1.m_body1; m_body1 = _arg1.joint1.m_body2; if (_local2 == b2Joint.e_revoluteJoint){ m_revolute1 = (_arg1.joint1 as b2RevoluteJoint); m_groundAnchor1.SetV(m_revolute1.m_localAnchor1); m_localAnchor1.SetV(m_revolute1.m_localAnchor2); _local4 = m_revolute1.GetJointAngle(); } else { m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint); m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1); m_localAnchor1.SetV(m_prismatic1.m_localAnchor2); _local4 = m_prismatic1.GetJointTranslation(); }; m_ground2 = _arg1.joint2.m_body1; m_body2 = _arg1.joint2.m_body2; if (_local3 == b2Joint.e_revoluteJoint){ m_revolute2 = (_arg1.joint2 as b2RevoluteJoint); m_groundAnchor2.SetV(m_revolute2.m_localAnchor1); m_localAnchor2.SetV(m_revolute2.m_localAnchor2); _local5 = m_revolute2.GetJointAngle(); } else { m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint); m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1); m_localAnchor2.SetV(m_prismatic2.m_localAnchor2); _local5 = m_prismatic2.GetJointTranslation(); }; m_ratio = _arg1.ratio; m_constant = (_local4 + (m_ratio * _local5)); m_force = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local15:Number; var _local2:b2Body = m_ground1; var _local3:b2Body = m_ground2; var _local4:b2Body = m_body1; var _local5:b2Body = m_body2; var _local14:Number = 0; m_J.SetZero(); if (m_revolute1){ m_J.angular1 = -1; _local14 = (_local14 + _local4.m_invI); } else { _local10 = _local2.m_xf.R; _local11 = m_prismatic1.m_localXAxis1; _local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); _local10 = _local4.m_xf.R; _local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y); _local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9)); _local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9)); _local8 = _local13; _local12 = ((_local8 * _local7) - (_local9 * _local6)); m_J.linear1.Set(-(_local6), -(_local7)); m_J.angular1 = -(_local12); _local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12))); }; if (m_revolute2){ m_J.angular2 = -(m_ratio); _local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI)); } else { _local10 = _local3.m_xf.R; _local11 = m_prismatic2.m_localXAxis1; _local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); _local10 = _local5.m_xf.R; _local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x); _local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y); _local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9)); _local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9)); _local8 = _local13; _local12 = ((_local8 * _local7) - (_local9 * _local6)); m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7)); m_J.angular2 = (-(m_ratio) * _local12); _local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12)))); }; m_mass = (1 / _local14); if (_arg1.warmStarting){ _local15 = (_arg1.dt * m_force); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y)); _local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1)); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y)); _local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2)); } else { m_force = 0; }; } override public function GetReactionTorque():Number{ var _local1:b2Mat22 = m_body2.m_xf.R; var _local2:Number = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x); var _local3:Number = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y); var _local4:Number = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3)); _local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3)); _local2 = _local4; _local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x)))); return (_local4); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y)); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local4:Number; var _local5:Number; var _local1:Number = 0; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; if (m_revolute1){ _local4 = m_revolute1.GetJointAngle(); } else { _local4 = m_prismatic1.GetJointTranslation(); }; if (m_revolute2){ _local5 = m_revolute2.GetJointAngle(); } else { _local5 = m_prismatic2.GetJointTranslation(); }; var _local6:Number = (m_constant - (_local4 + (m_ratio * _local5))); var _local7:Number = (-(m_mass) * _local6); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y)); _local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1)); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2)); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((_local1 < b2Settings.b2_linearSlop)); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local5:Number = ((-(_arg1.inv_dt) * m_mass) * _local4); m_force = (m_force + _local5); var _local6:Number = (_arg1.dt * _local5); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2)); } } }//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2GearJointDef extends b2JointDef { public var joint1:b2Joint; public var joint2:b2Joint; public var ratio:Number; public function b2GearJointDef(){ type = b2Joint.e_gearJoint; joint1 = null; joint2 = null; ratio = 1; } } }//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2Jacobian { public var linear1:b2Vec2; public var linear2:b2Vec2; public var angular1:Number; public var angular2:Number; public function b2Jacobian(){ linear1 = new b2Vec2(); linear2 = new b2Vec2(); super(); } public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{ linear1.SetV(_arg1); angular1 = _arg2; linear2.SetV(_arg3); angular2 = _arg4; } public function SetZero():void{ linear1.SetZero(); angular1 = 0; linear2.SetZero(); angular2 = 0; } public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{ return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4))); } } }//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Joint { public var m_islandFlag:Boolean; public var m_body1:b2Body; public var m_prev:b2Joint; public var m_next:b2Joint; public var m_type:int; public var m_collideConnected:Boolean; public var m_node1:b2JointEdge; public var m_node2:b2JointEdge; public var m_inv_dt:Number; public var m_userData; public var m_body2:b2Body; public static const e_unknownJoint:int = 0; public static const e_inactiveLimit:int = 0; public static const e_atUpperLimit:int = 2; public static const e_atLowerLimit:int = 1; public static const e_gearJoint:int = 6; public static const e_revoluteJoint:int = 1; public static const e_equalLimits:int = 3; public static const e_distanceJoint:int = 3; public static const e_pulleyJoint:int = 4; public static const e_prismaticJoint:int = 2; public static const e_mouseJoint:int = 5; public function b2Joint(_arg1:b2JointDef){ m_node1 = new b2JointEdge(); m_node2 = new b2JointEdge(); super(); m_type = _arg1.type; m_prev = null; m_next = null; m_body1 = _arg1.body1; m_body2 = _arg1.body2; m_collideConnected = _arg1.collideConnected; m_islandFlag = false; m_userData = _arg1.userData; } public function GetBody2():b2Body{ return (m_body2); } public function GetAnchor1():b2Vec2{ return (null); } public function GetAnchor2():b2Vec2{ return (null); } public function GetNext():b2Joint{ return (m_next); } public function GetType():int{ return (m_type); } public function InitVelocityConstraints(_arg1:b2TimeStep):void{ } public function GetReactionTorque():Number{ return (0); } public function GetUserData(){ return (m_userData); } public function GetReactionForce():b2Vec2{ return (null); } public function SolvePositionConstraints():Boolean{ return (false); } public function SetUserData(_arg1):void{ m_userData = _arg1; } public function GetBody1():b2Body{ return (m_body1); } public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ } public function InitPositionConstraints():void{ } public static function Destroy(_arg1:b2Joint, _arg2):void{ } public static function Create(_arg1:b2JointDef, _arg2):b2Joint{ var _local3:b2Joint; switch (_arg1.type){ case e_distanceJoint: _local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef)); break; case e_mouseJoint: _local3 = new b2MouseJoint((_arg1 as b2MouseJointDef)); break; case e_prismaticJoint: _local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef)); break; case e_revoluteJoint: _local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef)); break; case e_pulleyJoint: _local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef)); break; case e_gearJoint: _local3 = new b2GearJoint((_arg1 as b2GearJointDef)); break; default: break; }; return (_local3); } } }//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2JointDef { public var body2:b2Body; public var type:int; public var userData; public var collideConnected:Boolean; public var body1:b2Body; public function b2JointDef(){ type = b2Joint.e_unknownJoint; userData = null; body1 = null; body2 = null; collideConnected = false; } } }//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointEdge { public var other:b2Body; public var next:b2JointEdge; public var prev:b2JointEdge; public var joint:b2Joint; } }//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2MouseJoint extends b2Joint { private var K1:b2Mat22; private var K:b2Mat22; public var m_beta:Number; public var m_mass:b2Mat22; private var K2:b2Mat22; public var m_target:b2Vec2; public var m_gamma:Number; public var m_impulse:b2Vec2; public var m_C:b2Vec2; public var m_localAnchor:b2Vec2; public var m_maxForce:Number; public function b2MouseJoint(_arg1:b2MouseJointDef){ var _local3:Number; K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); m_localAnchor = new b2Vec2(); m_target = new b2Vec2(); m_impulse = new b2Vec2(); m_mass = new b2Mat22(); m_C = new b2Vec2(); super(_arg1); m_target.SetV(_arg1.target); var _local2:Number = (m_target.x - m_body2.m_xf.position.x); _local3 = (m_target.y - m_body2.m_xf.position.y); var _local4:b2Mat22 = m_body2.m_xf.R; m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y)); m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y)); m_maxForce = _arg1.maxForce; m_impulse.SetZero(); var _local5:Number = m_body2.m_mass; var _local6:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz); var _local7:Number = (((2 * _local5) * _arg1.dampingRatio) * _local6); var _local8:Number = ((_arg1.timeStep * _local5) * (_local6 * _local6)); m_gamma = (1 / (_local7 + _local8)); m_beta = (_local8 / (_local7 + _local8)); } public function SetTarget(_arg1:b2Vec2):void{ if (m_body2.IsSleeping()){ m_body2.WakeUp(); }; m_target = _arg1; } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local7:Number; var _local8:Number; _local2 = m_body2; _local3 = _local2.m_xf.R; _local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x); _local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y); var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local7 = _local2.m_invMass; _local8 = _local2.m_invI; K1.col1.x = _local7; K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = _local7; K2.col1.x = ((_local8 * _local5) * _local5); K2.col2.x = ((-(_local8) * _local4) * _local5); K2.col1.y = ((-(_local8) * _local4) * _local5); K2.col2.y = ((_local8 * _local4) * _local4); K.SetM(K1); K.AddM(K2); K.col1.x = (K.col1.x + m_gamma); K.col2.y = (K.col2.y + m_gamma); K.Invert(m_mass); m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x); m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y); _local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98); var _local9:Number = (_arg1.dt * m_impulse.x); var _local10:Number = (_arg1.dt * m_impulse.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9)))); } override public function GetAnchor1():b2Vec2{ return (m_target); } override public function GetReactionTorque():Number{ return (0); } override public function GetReactionForce():b2Vec2{ return (m_impulse); } override public function SolvePositionConstraints():Boolean{ return (true); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local2:b2Body = m_body2; _local3 = _local2.m_xf.R; var _local6:Number = (m_localAnchor.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor.y - _local2.m_sweep.localCenter.y); _local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7)); _local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7)); _local6 = _local4; var _local8:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7)); var _local9:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6)); _local3 = m_mass; _local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x)); _local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y)); var _local10:Number = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5))); var _local11:Number = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5))); var _local12:Number = m_impulse.x; var _local13:Number = m_impulse.y; m_impulse.x = (m_impulse.x + _local10); m_impulse.y = (m_impulse.y + _local11); var _local14:Number = m_impulse.Length(); if (_local14 > m_maxForce){ m_impulse.Multiply((m_maxForce / _local14)); }; _local10 = (m_impulse.x - _local12); _local11 = (m_impulse.y - _local13); var _local15:Number = (_arg1.dt * _local10); var _local16:Number = (_arg1.dt * _local11); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); } } }//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2MouseJointDef extends b2JointDef { public var timeStep:Number; public var target:b2Vec2; public var maxForce:Number; public var dampingRatio:Number; public var frequencyHz:Number; public function b2MouseJointDef(){ target = new b2Vec2(); super(); type = b2Joint.e_mouseJoint; maxForce = 0; frequencyHz = 5; dampingRatio = 0.7; timeStep = (1 / 60); } } }//package Box2D.Dynamics.Joints
Section 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PrismaticJoint extends b2Joint { public var m_limitForce:Number; public var m_lowerTranslation:Number; public var m_localXAxis1:b2Vec2; public var m_refAngle:Number; public var m_torque:Number; public var m_motorForce:Number; public var m_enableLimit:Boolean; public var m_angularMass:Number; public var m_maxMotorForce:Number; public var m_localYAxis1:b2Vec2; public var m_force:Number; public var m_motorMass:Number; public var m_upperTranslation:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_limitState:int; public var m_linearMass:Number; public var m_motorJacobian:b2Jacobian; public var m_limitPositionImpulse:Number; public var m_motorSpeed:Number; public var m_enableMotor:Boolean; public var m_linearJacobian:b2Jacobian; public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_localXAxis1 = new b2Vec2(); m_localYAxis1 = new b2Vec2(); m_linearJacobian = new b2Jacobian(); m_motorJacobian = new b2Jacobian(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_localXAxis1.SetV(_arg1.localAxis1); m_localYAxis1.x = -(m_localXAxis1.y); m_localYAxis1.y = m_localXAxis1.x; m_refAngle = _arg1.referenceAngle; m_linearJacobian.SetZero(); m_linearMass = 0; m_force = 0; m_angularMass = 0; m_torque = 0; m_motorJacobian.SetZero(); m_motorMass = 0; m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerTranslation = _arg1.lowerTranslation; m_upperTranslation = _arg1.upperTranslation; m_maxMotorForce = _arg1.maxMotorForce; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local8:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; var _local4:Number = _local2.m_invMass; var _local5:Number = _local3.m_invMass; var _local6:Number = _local2.m_invI; var _local7:Number = _local3.m_invI; var _local9:Number = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local10:Number = ((-(_arg1.inv_dt) * m_linearMass) * _local9); m_force = (m_force + _local10); var _local11:Number = (_arg1.dt * _local10); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2)); var _local12:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity); var _local13:Number = ((-(_arg1.inv_dt) * m_angularMass) * _local12); m_torque = (m_torque + _local13); var _local14:Number = (_arg1.dt * _local13); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14)); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed); _local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15); _local17 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce); _local16 = (m_motorForce - _local17); _local11 = (_arg1.dt * _local16); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local19); } else { if (m_limitState == e_atLowerLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); } else { if (m_limitState == e_atUpperLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); }; }; }; _local11 = (_arg1.dt * _local19); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function GetUpperLimit():Number{ return (m_upperTranslation); } public function GetLowerLimit():Number{ return (m_lowerTranslation); } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function GetJointTranslation():Number{ var _local3:b2Mat22; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; var _local4:b2Vec2 = _local1.GetWorldPoint(m_localAnchor1); var _local5:b2Vec2 = _local2.GetWorldPoint(m_localAnchor2); var _local6:Number = (_local5.x - _local4.x); var _local7:Number = (_local5.y - _local4.y); var _local8:b2Vec2 = _local1.GetWorldVector(m_localXAxis1); var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7)); return (_local9); } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ var _local1:b2Mat22 = m_body1.m_xf.R; var _local2:Number = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y))); var _local3:Number = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y))); var _local4:Number = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y))); var _local5:Number = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y))); return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5)))); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local9:b2Mat22; var _local10:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; var _local5:Number = _local3.m_invMass; var _local6:Number = _local4.m_invMass; var _local7:Number = _local3.m_invI; var _local8:Number = _local4.m_invI; _local9 = _local3.m_xf.R; var _local11:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local12:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12)); _local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12)); _local11 = _local10; _local9 = _local4.m_xf.R; var _local13:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local14:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; var _local15:Number = (_local3.m_sweep.c.x + _local11); var _local16:Number = (_local3.m_sweep.c.y + _local12); var _local17:Number = (_local4.m_sweep.c.x + _local13); var _local18:Number = (_local4.m_sweep.c.y + _local14); var _local19:Number = (_local17 - _local15); var _local20:Number = (_local18 - _local16); _local9 = _local3.m_xf.R; var _local21:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y)); var _local22:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y)); var _local23:Number = ((_local21 * _local19) + (_local22 * _local20)); _local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local24:Number = (-(m_linearMass) * _local23); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2)); var _local25:Number = b2Math.b2Abs(_local23); var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle); _local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); var _local27:Number = (-(m_angularMass) * _local26); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); var _local28:Number = b2Math.b2Abs(_local26); if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local9 = _local3.m_xf.R; _local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); _local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12)); _local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12)); _local11 = _local10; _local9 = _local4.m_xf.R; _local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); _local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; _local15 = (_local3.m_sweep.c.x + _local11); _local16 = (_local3.m_sweep.c.y + _local12); _local17 = (_local4.m_sweep.c.x + _local13); _local18 = (_local4.m_sweep.c.y + _local14); _local19 = (_local17 - _local15); _local20 = (_local18 - _local16); _local9 = _local3.m_xf.R; _local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y)); _local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y)); _local31 = ((_local29 * _local19) + (_local30 * _local20)); _local32 = 0; if (m_limitState == e_equalLimits){ _local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26)); } else { if (m_limitState == e_atLowerLimit){ _local1 = (_local31 - m_lowerTranslation); _local25 = b2Math.b2Max(_local25, -(_local1)); _local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); } else { if (m_limitState == e_atUpperLimit){ _local1 = (_local31 - m_upperTranslation); _local25 = b2Math.b2Max(_local25, _local1); _local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); }; }; }; _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop)))); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function GetJointSpeed():Number{ var _local3:b2Mat22; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; _local3 = _local1.m_xf.R; var _local4:Number = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); var _local5:Number = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local3 = _local2.m_xf.R; var _local7:Number = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8)); _local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8)); _local7 = _local6; var _local9:Number = (_local1.m_sweep.c.x + _local4); var _local10:Number = (_local1.m_sweep.c.y + _local5); var _local11:Number = (_local2.m_sweep.c.x + _local7); var _local12:Number = (_local2.m_sweep.c.y + _local8); var _local13:Number = (_local11 - _local9); var _local14:Number = (_local12 - _local10); var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1); var _local16:b2Vec2 = _local1.m_linearVelocity; var _local17:b2Vec2 = _local2.m_linearVelocity; var _local18:Number = _local1.m_angularVelocity; var _local19:Number = _local2.m_angularVelocity; var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4))))); return (_local20); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local5:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local10:Number = _local2.m_invMass; var _local11:Number = _local3.m_invMass; var _local12:Number = _local2.m_invI; var _local13:Number = _local3.m_invI; _local4 = _local2.m_xf.R; var _local14:Number = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y)); var _local15:Number = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y)); var _local16:Number = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x); var _local17:Number = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y); m_linearJacobian.linear1.x = -(_local14); m_linearJacobian.linear1.y = -(_local15); m_linearJacobian.linear2.x = _local14; m_linearJacobian.linear2.y = _local15; m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14))); m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14)); m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2)); m_linearMass = (1 / m_linearMass); m_angularMass = (_local12 + _local13); if (m_angularMass > Number.MIN_VALUE){ m_angularMass = (1 / m_angularMass); }; if (((m_enableLimit) || (m_enableMotor))){ _local4 = _local2.m_xf.R; _local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y)); _local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y)); m_motorJacobian.linear1.x = -(_local18); m_motorJacobian.linear1.y = -(_local19); m_motorJacobian.linear2.x = _local18; m_motorJacobian.linear2.y = _local19; m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18))); m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18)); m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2)); m_motorMass = (1 / m_motorMass); if (m_enableLimit){ _local20 = (_local16 - _local6); _local21 = (_local17 - _local7); _local22 = ((_local18 * _local20) + (_local19 * _local21)); if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){ m_limitState = e_equalLimits; } else { if (_local22 <= m_lowerTranslation){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local22 >= m_upperTranslation){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; }; }; if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit == false){ m_limitForce = 0; }; if (_arg1.warmStarting){ _local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x))); _local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y))); _local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x))); _local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y))); _local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1))); _local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2))); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28)); } else { m_force = 0; m_torque = 0; m_limitForce = 0; m_motorForce = 0; }; m_limitPositionImpulse = 0; } public function GetMotorForce():Number{ return (m_motorForce); } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } public function SetMaxMotorForce(_arg1:Number):void{ m_maxMotorForce = _arg1; } override public function GetReactionTorque():Number{ return (m_torque); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerTranslation = _arg1; m_upperTranslation = _arg2; } } }//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2PrismaticJointDef extends b2JointDef { public var motorSpeed:Number; public var localAxis1:b2Vec2; public var referenceAngle:Number; public var upperTranslation:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var enableMotor:Boolean; public var maxMotorForce:Number; public var lowerTranslation:Number; public function b2PrismaticJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); localAxis1 = new b2Vec2(); super(); type = b2Joint.e_prismaticJoint; localAxis1.Set(1, 0); referenceAngle = 0; enableLimit = false; lowerTranslation = 0; upperTranslation = 0; enableMotor = false; maxMotorForce = 0; motorSpeed = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); localAxis1 = body1.GetLocalVector(_arg4); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PulleyJoint extends b2Joint { public var m_limitState1:int; public var m_limitState2:int; public var m_ground:b2Body; public var m_maxLength2:Number; public var m_maxLength1:Number; public var m_limitPositionImpulse1:Number; public var m_limitPositionImpulse2:Number; public var m_force:Number; public var m_constant:Number; public var m_positionImpulse:Number; public var m_state:int; public var m_ratio:Number; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_limitMass1:Number; public var m_limitMass2:Number; public var m_pulleyMass:Number; public var m_u1:b2Vec2; public var m_limitForce1:Number; public var m_limitForce2:Number; public var m_u2:b2Vec2; public static const b2_minPulleyLength:Number = 2; public function b2PulleyJoint(_arg1:b2PulleyJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u1 = new b2Vec2(); m_u2 = new b2Vec2(); super(_arg1); m_ground = m_body1.m_world.m_groundBody; m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x); m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y); m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x); m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_ratio = _arg1.ratio; m_constant = (_arg1.length1 + (m_ratio * _arg1.length2)); m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength))); m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio)); m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; } public function GetGroundAnchor2():b2Vec2{ var _local1:b2Vec2 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor2); return (_local1); } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = m_u2.Copy(); _local1.Multiply(m_force); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local3:b2Mat22; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; var _local4:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local5:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local6:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local7:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); var _local23:Number = 0; if (m_state == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9)); _local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9)); _local8 = _local22; _local3 = _local2.m_xf.R; _local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11)); _local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11)); _local10 = _local22; _local12 = (_local1.m_sweep.c.x + _local8); _local13 = (_local1.m_sweep.c.y + _local9); _local14 = (_local2.m_sweep.c.x + _local10); _local15 = (_local2.m_sweep.c.y + _local11); m_u1.Set((_local12 - _local4), (_local13 - _local5)); m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local16 = m_u1.Length(); _local17 = m_u2.Length(); if (_local16 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / _local16)); } else { m_u1.SetZero(); }; if (_local17 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / _local17)); } else { m_u2.SetZero(); }; _local18 = ((m_constant - _local16) - (m_ratio * _local17)); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_pulleyMass) * _local18); _local20 = m_positionImpulse; m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19)); _local19 = (m_positionImpulse - _local20); _local12 = (-(_local19) * m_u1.x); _local13 = (-(_local19) * m_u1.y); _local14 = ((-(m_ratio) * _local19) * m_u2.x); _local15 = ((-(m_ratio) * _local19) * m_u2.y); _local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12)); _local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13)); _local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local1.SynchronizeTransform(); _local2.SynchronizeTransform(); }; if (m_limitState1 == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x); _local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9)); _local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9)); _local8 = _local22; _local12 = (_local1.m_sweep.c.x + _local8); _local13 = (_local1.m_sweep.c.y + _local9); m_u1.Set((_local12 - _local4), (_local13 - _local5)); _local16 = m_u1.Length(); if (_local16 > b2Settings.b2_linearSlop){ m_u1.x = (m_u1.x * (1 / _local16)); m_u1.y = (m_u1.y * (1 / _local16)); } else { m_u1.SetZero(); }; _local18 = (m_maxLength1 - _local16); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass1) * _local18); _local21 = m_limitPositionImpulse1; m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19)); _local19 = (m_limitPositionImpulse1 - _local21); _local12 = (-(_local19) * m_u1.x); _local13 = (-(_local19) * m_u1.y); _local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12)); _local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13)); _local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12)))); _local1.SynchronizeTransform(); }; if (m_limitState2 == e_atUpperLimit){ _local3 = _local2.m_xf.R; _local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x); _local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y); _local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11)); _local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11)); _local10 = _local22; _local14 = (_local2.m_sweep.c.x + _local10); _local15 = (_local2.m_sweep.c.y + _local11); m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local17 = m_u2.Length(); if (_local17 > b2Settings.b2_linearSlop){ m_u2.x = (m_u2.x * (1 / _local17)); m_u2.y = (m_u2.y * (1 / _local17)); } else { m_u2.SetZero(); }; _local18 = (m_maxLength2 - _local17); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass2) * _local18); _local21 = m_limitPositionImpulse2; m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19)); _local19 = (m_limitPositionImpulse2 - _local21); _local14 = (-(_local19) * m_u2.x); _local15 = (-(_local19) * m_u2.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local2.SynchronizeTransform(); }; return ((_local23 < b2Settings.b2_linearSlop)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; var _local10:Number = (_local2.m_sweep.c.x + _local5); var _local11:Number = (_local2.m_sweep.c.y + _local6); var _local12:Number = (_local3.m_sweep.c.x + _local8); var _local13:Number = (_local3.m_sweep.c.y + _local9); var _local14:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local15:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local16:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local17:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); m_u1.Set((_local10 - _local14), (_local11 - _local15)); m_u2.Set((_local12 - _local16), (_local13 - _local17)); var _local18:Number = m_u1.Length(); var _local19:Number = m_u2.Length(); if (_local18 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / _local18)); } else { m_u1.SetZero(); }; if (_local19 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / _local19)); } else { m_u2.SetZero(); }; var _local20:Number = ((m_constant - _local18) - (m_ratio * _local19)); if (_local20 > 0){ m_state = e_inactiveLimit; m_force = 0; } else { m_state = e_atUpperLimit; m_positionImpulse = 0; }; if (_local18 < m_maxLength1){ m_limitState1 = e_inactiveLimit; m_limitForce1 = 0; } else { m_limitState1 = e_atUpperLimit; m_limitPositionImpulse1 = 0; }; if (_local19 < m_maxLength2){ m_limitState2 = e_inactiveLimit; m_limitForce2 = 0; } else { m_limitState2 = e_atUpperLimit; m_limitPositionImpulse2 = 0; }; var _local21:Number = ((_local5 * m_u1.y) - (_local6 * m_u1.x)); var _local22:Number = ((_local8 * m_u2.y) - (_local9 * m_u2.x)); m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21)); m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22)); m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2)); m_limitMass1 = (1 / m_limitMass1); m_limitMass2 = (1 / m_limitMass2); m_pulleyMass = (1 / m_pulleyMass); if (_arg1.warmStarting){ _local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x); _local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y); _local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x); _local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25)))); } else { m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; }; } override public function GetReactionTorque():Number{ return (0); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; if (m_state == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13)))); _local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18); _local20 = m_force; m_force = b2Math.b2Max(0, (m_force + _local19)); _local19 = (m_force - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x); _local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; if (m_limitState1 == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11))); _local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18); _local20 = m_limitForce1; m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19)); _local19 = (m_limitForce1 - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); }; if (m_limitState2 == e_atUpperLimit){ _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13))); _local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18); _local20 = m_limitForce2; m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19)); _local19 = (m_limitForce2 - _local20); _local16 = ((-(_arg1.dt) * _local19) * m_u2.x); _local17 = ((-(_arg1.dt) * _local19) * m_u2.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; } public function GetLength1():Number{ var _local1:b2Vec2 = m_body1.GetWorldPoint(m_localAnchor1); var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local4:Number = (_local1.x - _local2); var _local5:Number = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetLength2():Number{ var _local1:b2Vec2 = m_body2.GetWorldPoint(m_localAnchor2); var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); var _local4:Number = (_local1.x - _local2); var _local5:Number = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetGroundAnchor1():b2Vec2{ var _local1:b2Vec2 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor1); return (_local1); } } }//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2PulleyJointDef extends b2JointDef { public var maxLength1:Number; public var maxLength2:Number; public var length1:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var groundAnchor1:b2Vec2; public var groundAnchor2:b2Vec2; public var ratio:Number; public var length2:Number; public function b2PulleyJointDef(){ groundAnchor1 = new b2Vec2(); groundAnchor2 = new b2Vec2(); localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_pulleyJoint; groundAnchor1.Set(-1, 1); groundAnchor2.Set(1, 1); localAnchor1.Set(-1, 0); localAnchor2.Set(1, 0); length1 = 0; maxLength1 = 0; length2 = 0; maxLength2 = 0; ratio = 1; collideConnected = true; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{ body1 = _arg1; body2 = _arg2; groundAnchor1.SetV(_arg3); groundAnchor2.SetV(_arg4); localAnchor1 = body1.GetLocalPoint(_arg5); localAnchor2 = body2.GetLocalPoint(_arg6); var _local8:Number = (_arg5.x - _arg3.x); var _local9:Number = (_arg5.y - _arg3.y); length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); var _local10:Number = (_arg6.x - _arg4.x); var _local11:Number = (_arg6.y - _arg4.y); length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); ratio = _arg7; var _local12:Number = (length1 + (ratio * length2)); maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength)); maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio); } } }//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2RevoluteJoint extends b2Joint { public var m_limitForce:Number; public var m_pivotMass:b2Mat22; public var m_motorForce:Number; public var m_enableLimit:Boolean; public var m_limitState:int; public var m_motorMass:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; private var K1:b2Mat22; private var K2:b2Mat22; private var K3:b2Mat22; private var K:b2Mat22; public var m_pivotForce:b2Vec2; public var m_enableMotor:Boolean; public var m_referenceAngle:Number; public var m_limitPositionImpulse:Number; public var m_motorSpeed:Number; public var m_upperAngle:Number; public var m_lowerAngle:Number; public var m_maxMotorTorque:Number; public static var tImpulse:b2Vec2 = new b2Vec2(); public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){ K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); K3 = new b2Mat22(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_pivotForce = new b2Vec2(); m_pivotMass = new b2Mat22(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_referenceAngle = _arg1.referenceAngle; m_pivotForce.Set(0, 0); m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerAngle = _arg1.lowerAngle; m_upperAngle = _arg1.upperAngle; m_maxMotorTorque = _arg1.maxMotorTorque; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local5:Number; var _local10:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local11:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7)); var _local12:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6)); var _local13:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12))); var _local14:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12))); m_pivotForce.x = (m_pivotForce.x + _local13); m_pivotForce.y = (m_pivotForce.y + _local14); var _local15:Number = (_arg1.dt * _local13); _local16 = (_arg1.dt * _local14); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15)))); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed); _local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17); _local19 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque); _local18 = (m_motorForce - _local19); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity); _local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local21); } else { if (m_limitState == e_atLowerLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); } else { if (m_limitState == e_atUpperLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); }; }; }; _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21)); }; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function GetUpperLimit():Number{ return (m_upperAngle); } public function GetLowerLimit():Number{ return (m_lowerAngle); } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ return (m_pivotForce); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local6:b2Mat22; var _local25:Number; var _local26:Number; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; var _local5:Number = 0; _local6 = _local3.m_xf.R; var _local7:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x); var _local8:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y); var _local9:Number = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8)); _local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8)); _local7 = _local9; _local6 = _local4.m_xf.R; var _local10:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x); var _local11:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y); _local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11)); _local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11)); _local10 = _local9; var _local12:Number = (_local3.m_sweep.c.x + _local7); var _local13:Number = (_local3.m_sweep.c.y + _local8); var _local14:Number = (_local4.m_sweep.c.x + _local10); var _local15:Number = (_local4.m_sweep.c.y + _local11); var _local16:Number = (_local14 - _local12); var _local17:Number = (_local15 - _local13); _local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17))); var _local18:Number = _local3.m_invMass; var _local19:Number = _local4.m_invMass; var _local20:Number = _local3.m_invI; var _local21:Number = _local4.m_invI; K1.col1.x = (_local18 + _local19); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local18 + _local19); K2.col1.x = ((_local20 * _local8) * _local8); K2.col2.x = ((-(_local20) * _local7) * _local8); K2.col1.y = ((-(_local20) * _local7) * _local8); K2.col2.y = ((_local20 * _local7) * _local7); K3.col1.x = ((_local21 * _local11) * _local11); K3.col2.x = ((-(_local21) * _local10) * _local11); K3.col1.y = ((-(_local21) * _local10) * _local11); K3.col2.y = ((_local21 * _local10) * _local10); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Solve(tImpulse, -(_local16), -(_local17)); var _local22:Number = tImpulse.x; var _local23:Number = tImpulse.y; _local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23)); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22)))); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22)))); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); var _local24:Number = 0; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle); _local26 = 0; if (m_limitState == e_equalLimits){ _local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local24 = b2Math.b2Abs(_local2); } else { if (m_limitState == e_atLowerLimit){ _local2 = (_local25 - m_lowerAngle); _local24 = b2Math.b2Max(0, -(_local2)); _local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); } else { if (m_limitState == e_atUpperLimit){ _local2 = (_local25 - m_upperAngle); _local24 = b2Math.b2Max(0, _local2); _local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); }; }; }; _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop)))); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function GetJointSpeed():Number{ return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity)); } public function SetMaxMotorTorque(_arg1:Number):void{ m_maxMotorTorque = _arg1; } public function GetJointAngle():Number{ return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle)); } public function GetMotorTorque():Number{ return (m_motorForce); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local7:Number; var _local14:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x); _local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x); var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local10:Number = _local2.m_invMass; var _local11:Number = _local3.m_invMass; var _local12:Number = _local2.m_invI; var _local13:Number = _local3.m_invI; K1.col1.x = (_local10 + _local11); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local10 + _local11); K2.col1.x = ((_local12 * _local7) * _local7); K2.col2.x = ((-(_local12) * _local6) * _local7); K2.col1.y = ((-(_local12) * _local6) * _local7); K2.col2.y = ((_local12 * _local6) * _local6); K3.col1.x = ((_local13 * _local9) * _local9); K3.col2.x = ((-(_local13) * _local8) * _local9); K3.col1.y = ((-(_local13) * _local8) * _local9); K3.col2.y = ((_local13 * _local8) * _local8); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Invert(m_pivotMass); m_motorMass = (1 / (_local12 + _local13)); if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit){ _local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle); if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){ m_limitState = e_equalLimits; } else { if (_local14 <= m_lowerAngle){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local14 >= m_upperAngle){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; } else { m_limitForce = 0; }; if (_arg1.warmStarting){ _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); } else { m_pivotForce.SetZero(); m_motorForce = 0; m_limitForce = 0; }; m_limitPositionImpulse = 0; } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } override public function GetReactionTorque():Number{ return (m_limitForce); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerAngle = _arg1; m_upperAngle = _arg2; } } }//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2RevoluteJointDef extends b2JointDef { public var upperAngle:Number; public var enableMotor:Boolean; public var referenceAngle:Number; public var motorSpeed:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var lowerAngle:Number; public var maxMotorTorque:Number; public function b2RevoluteJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_revoluteJoint; localAnchor1.Set(0, 0); localAnchor2.Set(0, 0); referenceAngle = 0; lowerAngle = 0; upperAngle = 0; maxMotorTorque = 0; motorSpeed = 0; enableLimit = false; enableMotor = false; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2Body { public var m_next:b2Body; public var m_xf:b2XForm; public var m_contactList:b2ContactEdge; public var m_angularVelocity:Number; public var m_shapeList:b2Shape; public var m_force:b2Vec2; public var m_mass:Number; public var m_sweep:b2Sweep; public var m_torque:Number; public var m_userData; public var m_flags:uint; public var m_world:b2World; public var m_prev:b2Body; public var m_invMass:Number; public var m_type:int; public var m_linearDamping:Number; public var m_shapeCount:int; public var m_angularDamping:Number; public var m_invI:Number; public var m_linearVelocity:b2Vec2; public var m_sleepTime:Number; public var m_jointList:b2JointEdge; public var m_I:Number; public static var e_fixedRotationFlag:uint = 64; public static var e_frozenFlag:uint = 2; public static var e_maxTypes:uint = 3; public static var e_sleepFlag:uint = 8; private static var s_massData:b2MassData = new b2MassData(); public static var e_bulletFlag:uint = 32; public static var e_staticType:uint = 1; public static var e_islandFlag:uint = 4; public static var e_allowSleepFlag:uint = 16; private static var s_xf1:b2XForm = new b2XForm(); public static var e_dynamicType:uint = 2; public function b2Body(_arg1:b2BodyDef, _arg2:b2World){ m_xf = new b2XForm(); m_sweep = new b2Sweep(); m_linearVelocity = new b2Vec2(); m_force = new b2Vec2(); super(); m_flags = 0; if (_arg1.isBullet){ m_flags = (m_flags | e_bulletFlag); }; if (_arg1.fixedRotation){ m_flags = (m_flags | e_fixedRotationFlag); }; if (_arg1.allowSleep){ m_flags = (m_flags | e_allowSleepFlag); }; if (_arg1.isSleeping){ m_flags = (m_flags | e_sleepFlag); }; m_world = _arg2; m_xf.position.SetV(_arg1.position); m_xf.R.Set(_arg1.angle); m_sweep.localCenter.SetV(_arg1.massData.center); m_sweep.t0 = 1; m_sweep.a0 = (m_sweep.a = _arg1.angle); var _local3:b2Mat22 = m_xf.R; var _local4:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_jointList = null; m_contactList = null; m_prev = null; m_next = null; m_linearDamping = _arg1.linearDamping; m_angularDamping = _arg1.angularDamping; m_force.Set(0, 0); m_torque = 0; m_linearVelocity.SetZero(); m_angularVelocity = 0; m_sleepTime = 0; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = _arg1.massData.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = _arg1.massData.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; m_userData = _arg1.userData; m_shapeList = null; m_shapeCount = 0; } public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{ return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_arg1.x - m_sweep.c.x))))); } public function SetLinearVelocity(_arg1:b2Vec2):void{ m_linearVelocity.SetV(_arg1); } public function WakeUp():void{ m_flags = (m_flags & ~(e_sleepFlag)); m_sleepTime = 0; } public function GetLocalCenter():b2Vec2{ return (m_sweep.localCenter); } public function ApplyTorque(_arg1:Number):void{ if (IsSleeping()){ WakeUp(); }; m_torque = (m_torque + _arg1); } public function IsFrozen():Boolean{ return (((m_flags & e_frozenFlag) == e_frozenFlag)); } public function IsDynamic():Boolean{ return ((m_type == e_dynamicType)); } public function GetLinearVelocity():b2Vec2{ return (m_linearVelocity); } public function SynchronizeTransform():void{ m_xf.R.Set(m_sweep.a); var _local1:b2Mat22 = m_xf.R; var _local2:b2Vec2 = m_sweep.localCenter; m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y))); m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y))); } public function GetInertia():Number{ return (m_I); } public function IsSleeping():Boolean{ return (((m_flags & e_sleepFlag) == e_sleepFlag)); } public function SetMassFromShapes():void{ var _local1:b2Shape; if (m_world.m_lock == true){ return; }; m_mass = 0; m_invMass = 0; m_I = 0; m_invI = 0; var _local2:Number = 0; var _local3:Number = 0; var _local4:b2MassData = s_massData; _local1 = m_shapeList; while (_local1) { _local1.ComputeMass(_local4); m_mass = (m_mass + _local4.mass); _local2 = (_local2 + (_local4.mass * _local4.center.x)); _local3 = (_local3 + (_local4.mass * _local4.center.y)); m_I = (m_I + _local4.I); _local1 = _local1.m_next; }; if (m_mass > 0){ m_invMass = (1 / m_mass); _local2 = (_local2 * m_invMass); _local3 = (_local3 * m_invMass); }; if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){ m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3)))); m_invI = (1 / m_I); } else { m_I = 0; m_invI = 0; }; m_sweep.localCenter.Set(_local2, _local3); var _local5:b2Mat22 = m_xf.R; var _local6:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)); m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); _local1 = m_shapeList; while (_local1) { _local1.UpdateSweepRadius(m_sweep.localCenter); _local1 = _local1.m_next; }; var _local7:int = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (_local7 != m_type){ _local1 = m_shapeList; while (_local1) { _local1.RefilterProxy(m_world.m_broadPhase, m_xf); _local1 = _local1.m_next; }; }; } public function PutToSleep():void{ m_flags = (m_flags | e_sleepFlag); m_sleepTime = 0; m_linearVelocity.SetZero(); m_angularVelocity = 0; m_force.SetZero(); m_torque = 0; } public function GetJointList():b2JointEdge{ return (m_jointList); } public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{ var _local3:b2Shape; var _local7:Boolean; if (m_world.m_lock == true){ return (true); }; if (IsFrozen()){ return (false); }; m_xf.R.Set(_arg2); m_xf.position.SetV(_arg1); var _local4:b2Mat22 = m_xf.R; var _local5:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y)); m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_sweep.a0 = (m_sweep.a = _arg2); var _local6:Boolean; _local3 = m_shapeList; while (_local3) { _local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf); if (_local7 == false){ _local6 = true; break; }; _local3 = _local3.m_next; }; if (_local6 == true){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local3 = m_shapeList; while (_local3) { _local3.DestroyProxy(m_world.m_broadPhase); _local3 = _local3.m_next; }; return (false); }; m_world.m_broadPhase.Commit(); return (true); } public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulXT(m_xf, _arg1)); } public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_force.x = (m_force.x + _arg1.x); m_force.y = (m_force.y + _arg1.y); m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))); } public function SynchronizeShapes():Boolean{ var _local4:b2Shape; var _local1:b2XForm = s_xf1; _local1.R.Set(m_sweep.a0); var _local2:b2Mat22 = _local1.R; var _local3:b2Vec2 = m_sweep.localCenter; _local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y))); _local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y))); var _local5:Boolean; _local4 = m_shapeList; while (_local4) { _local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf); if (_local5 == false){ break; }; _local4 = _local4.m_next; }; if (_local5 == false){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local4 = m_shapeList; while (_local4) { _local4.DestroyProxy(m_world.m_broadPhase); _local4 = _local4.m_next; }; return (false); }; return (true); } public function GetAngle():Number{ return (m_sweep.a); } public function GetXForm():b2XForm{ return (m_xf); } public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22 = m_xf.R; var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y))); _local3.x = (_local3.x + m_xf.position.x); _local3.y = (_local3.y + m_xf.position.y); return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x))))); } public function GetNext():b2Body{ return (m_next); } public function GetMass():Number{ return (m_mass); } public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x)); m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y)); m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)))); } public function GetAngularVelocity():Number{ return (m_angularVelocity); } public function SetAngularVelocity(_arg1:Number):void{ m_angularVelocity = _arg1; } public function SetMass(_arg1:b2MassData):void{ var _local2:b2Shape; if (m_world.m_lock == true){ return; }; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = _arg1.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = _arg1.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; m_sweep.localCenter.SetV(_arg1.center); var _local3:b2Mat22 = m_xf.R; var _local4:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); _local2 = m_shapeList; while (_local2) { _local2.UpdateSweepRadius(m_sweep.localCenter); _local2 = _local2.m_next; }; var _local5:int = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (_local5 != m_type){ _local2 = m_shapeList; while (_local2) { _local2.RefilterProxy(m_world.m_broadPhase, m_xf); _local2 = _local2.m_next; }; }; } public function IsStatic():Boolean{ return ((m_type == e_staticType)); } public function GetWorldVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulMV(m_xf.R, _arg1)); } public function GetShapeList():b2Shape{ return (m_shapeList); } public function Advance(_arg1:Number):void{ m_sweep.Advance(_arg1); m_sweep.c.SetV(m_sweep.c0); m_sweep.a = m_sweep.a0; SynchronizeTransform(); } public function SetBullet(_arg1:Boolean):void{ if (_arg1){ m_flags = (m_flags | e_bulletFlag); } else { m_flags = (m_flags & ~(e_bulletFlag)); }; } public function CreateShape(_arg1:b2ShapeDef):b2Shape{ if (m_world.m_lock == true){ return (null); }; var _local2:b2Shape = b2Shape.Create(_arg1, m_world.m_blockAllocator); _local2.m_next = m_shapeList; m_shapeList = _local2; m_shapeCount++; _local2.m_body = this; _local2.CreateProxy(m_world.m_broadPhase, m_xf); _local2.UpdateSweepRadius(m_sweep.localCenter); return (_local2); } public function IsConnected(_arg1:b2Body):Boolean{ var _local2:b2JointEdge = m_jointList; while (_local2) { if (_local2.other == _arg1){ return ((_local2.joint.m_collideConnected == false)); }; _local2 = _local2.next; }; return (false); } public function DestroyShape(_arg1:b2Shape):void{ if (m_world.m_lock == true){ return; }; _arg1.DestroyProxy(m_world.m_broadPhase); var _local2:b2Shape = m_shapeList; var _local3:b2Shape; var _local4:Boolean; while (_local2 != null) { if (_local2 == _arg1){ if (_local3){ _local3.m_next = _arg1.m_next; } else { m_shapeList = _arg1.m_next; }; _local4 = true; break; }; _local3 = _local2; _local2 = _local2.m_next; }; _arg1.m_body = null; _arg1.m_next = null; m_shapeCount--; b2Shape.Destroy(_arg1, m_world.m_blockAllocator); } public function GetUserData(){ return (m_userData); } public function IsBullet():Boolean{ return (((m_flags & e_bulletFlag) == e_bulletFlag)); } public function GetWorldCenter():b2Vec2{ return (m_sweep.c); } public function AllowSleeping(_arg1:Boolean):void{ if (_arg1){ m_flags = (m_flags | e_allowSleepFlag); } else { m_flags = (m_flags & ~(e_allowSleepFlag)); WakeUp(); }; } public function SetUserData(_arg1):void{ m_userData = _arg1; } public function GetLocalVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulTMV(m_xf.R, _arg1)); } public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{ var _local2:b2Mat22 = m_xf.R; var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y))); _local3.x = (_local3.x + m_xf.position.x); _local3.y = (_local3.y + m_xf.position.y); return (_local3); } public function GetWorld():b2World{ return (m_world); } public function GetPosition():b2Vec2{ return (m_xf.position); } } }//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class b2BodyDef { public var angularDamping:Number; public var angle:Number; public var isSleeping:Boolean; public var position:b2Vec2; public var isBullet:Boolean; public var allowSleep:Boolean; public var userData; public var fixedRotation:Boolean; public var linearDamping:Number; public var massData:b2MassData; public function b2BodyDef(){ massData = new b2MassData(); position = new b2Vec2(); super(); massData.center.SetZero(); massData.mass = 0; massData.I = 0; userData = null; position.Set(0, 0); angle = 0; linearDamping = 0; angularDamping = 0; allowSleep = true; isSleeping = false; fixedRotation = false; isBullet = false; } } }//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener) package Box2D.Dynamics { public class b2BoundaryListener { public function Violation(_arg1:b2Body):void{ } } }//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2ContactFilter { public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter); ; public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{ var _local3:b2FilterData = _arg1.GetFilterData(); var _local4:b2FilterData = _arg2.GetFilterData(); if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){ return ((_local3.groupIndex > 0)); }; var _local5:Boolean = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0)))); return (_local5); } public function RayCollide(_arg1, _arg2:b2Shape):Boolean{ if (!_arg1){ return (true); }; return (ShouldCollide((_arg1 as b2Shape), _arg2)); } } }//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener) package Box2D.Dynamics { import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class b2ContactListener { public function Add(_arg1:b2ContactPoint):void{ } public function Remove(_arg1:b2ContactPoint):void{ } public function Persist(_arg1:b2ContactPoint):void{ } public function Result(_arg1:b2ContactResult):void{ } } }//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2ContactManager extends b2PairCallback { public var m_world:b2World; public var m_destroyImmediate:Boolean; public var m_nullContact:b2NullContact; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2ContactManager(){ m_nullContact = new b2NullContact(); super(); m_world = null; m_destroyImmediate = false; } override public function PairRemoved(_arg1, _arg2, _arg3):void{ if (_arg3 == null){ return; }; var _local4:b2Contact = (_arg3 as b2Contact); if (_local4 == m_nullContact){ return; }; Destroy(_local4); } public function Destroy(_arg1:b2Contact):void{ var _local7:b2Body; var _local8:b2Body; var _local9:Array; var _local10:b2ContactPoint; var _local11:int; var _local12:b2Manifold; var _local13:int; var _local14:b2ManifoldPoint; var _local15:b2Vec2; var _local16:b2Vec2; var _local2:b2Shape = _arg1.m_shape1; var _local3:b2Shape = _arg1.m_shape2; var _local4:int = _arg1.m_manifoldCount; if ((((_local4 > 0)) && (m_world.m_contactListener))){ _local7 = _local2.m_body; _local8 = _local3.m_body; _local9 = _arg1.GetManifolds(); _local10 = s_evalCP; _local10.shape1 = _arg1.m_shape1; _local10.shape2 = _arg1.m_shape1; _local10.friction = _arg1.m_friction; _local10.restitution = _arg1.m_restitution; _local11 = 0; while (_local11 < _local4) { _local12 = _local9[_local11]; _local10.normal.SetV(_local12.normal); _local13 = 0; while (_local13 < _local12.pointCount) { _local14 = _local12.points[_local13]; _local10.position = _local7.GetWorldPoint(_local14.localPoint1); _local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1); _local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2); _local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y)); _local10.separation = _local14.separation; _local10.id.key = _local14.id._key; m_world.m_contactListener.Remove(_local10); _local13++; }; _local11++; }; }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_world.m_contactList){ m_world.m_contactList = _arg1.m_next; }; var _local5:b2Body = _local2.m_body; var _local6:b2Body = _local3.m_body; if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local5.m_contactList){ _local5.m_contactList = _arg1.m_node1.next; }; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local6.m_contactList){ _local6.m_contactList = _arg1.m_node2.next; }; b2Contact.Destroy(_arg1, m_world.m_blockAllocator); m_world.m_contactCount--; } override public function PairAdded(_arg1, _arg2){ var _local5:b2Body; var _local3:b2Shape = (_arg1 as b2Shape); var _local4:b2Shape = (_arg2 as b2Shape); _local5 = _local3.m_body; var _local6:b2Body = _local4.m_body; if (((_local5.IsStatic()) && (_local6.IsStatic()))){ return (m_nullContact); }; if (_local3.m_body == _local4.m_body){ return (m_nullContact); }; if (_local6.IsConnected(_local5)){ return (m_nullContact); }; if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){ return (m_nullContact); }; var _local7:b2Contact = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator); if (_local7 == null){ return (m_nullContact); }; _local3 = _local7.m_shape1; _local4 = _local7.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; _local7.m_prev = null; _local7.m_next = m_world.m_contactList; if (m_world.m_contactList != null){ m_world.m_contactList.m_prev = _local7; }; m_world.m_contactList = _local7; _local7.m_node1.contact = _local7; _local7.m_node1.other = _local6; _local7.m_node1.prev = null; _local7.m_node1.next = _local5.m_contactList; if (_local5.m_contactList != null){ _local5.m_contactList.prev = _local7.m_node1; }; _local5.m_contactList = _local7.m_node1; _local7.m_node2.contact = _local7; _local7.m_node2.other = _local5; _local7.m_node2.prev = null; _local7.m_node2.next = _local6.m_contactList; if (_local6.m_contactList != null){ _local6.m_contactList.prev = _local7.m_node2; }; _local6.m_contactList = _local7.m_node2; m_world.m_contactCount++; return (_local7); } public function Collide():void{ var _local2:b2Body; var _local3:b2Body; var _local1:b2Contact = m_world.m_contactList; while (_local1) { _local2 = _local1.m_shape1.m_body; _local3 = _local1.m_shape2.m_body; if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){ } else { _local1.Update(m_world.m_contactListener); }; _local1 = _local1.m_next; }; } } }//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw) package Box2D.Dynamics { import flash.display.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2DebugDraw { public var m_xformScale:Number;// = 1 public var m_fillAlpha:Number;// = 1 public var m_alpha:Number;// = 1 public var m_drawFlags:uint; public var m_lineThickness:Number;// = 1 public var m_drawScale:Number;// = 1 public var m_sprite:Sprite; public static var e_coreShapeBit:uint = 4; public static var e_shapeBit:uint = 1; public static var e_centerOfMassBit:uint = 64; public static var e_aabbBit:uint = 8; public static var e_obbBit:uint = 16; public static var e_pairBit:uint = 32; public static var e_jointBit:uint = 2; public function b2DebugDraw(){ m_drawFlags = 0; } public function ClearFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags & ~(_arg1)); } public function SetFlags(_arg1:uint):void{ m_drawFlags = _arg1; } public function AppendFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags | _arg1); } public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale)); m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale)); } public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha); var _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.endFill(); } public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); } public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); var _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); } public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha); m_sprite.graphics.moveTo(0, 0); m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); m_sprite.graphics.endFill(); m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale)); } public function GetFlags():uint{ return (m_drawFlags); } public function DrawXForm(_arg1:b2XForm):void{ m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale)); m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale)); } } }//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener) package Box2D.Dynamics { import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; public class b2DestructionListener { public function SayGoodbyeShape(_arg1:b2Shape):void{ } public function SayGoodbyeJoint(_arg1:b2Joint):void{ } } }//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2Island { public var m_listener:b2ContactListener; public var m_positionIterationCount:int; public var m_bodyCapacity:int; public var m_bodies:Array; public var m_joints:Array; public var m_jointCapacity:int; public var m_contactCount:int; public var m_contacts:Array; public var m_contactCapacity:int; public var m_jointCount:int; public var m_allocator; public var m_bodyCount:int; private static var s_reportCR:b2ContactResult = new b2ContactResult(); public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){ var _local6:int; super(); m_bodyCapacity = _arg1; m_contactCapacity = _arg2; m_jointCapacity = _arg3; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_allocator = _arg4; m_listener = _arg5; m_bodies = new Array(_arg1); _local6 = 0; while (_local6 < _arg1) { m_bodies[_local6] = null; _local6++; }; m_contacts = new Array(_arg2); _local6 = 0; while (_local6 < _arg2) { m_contacts[_local6] = null; _local6++; }; m_joints = new Array(_arg3); _local6 = 0; while (_local6 < _arg3) { m_joints[_local6] = null; _local6++; }; m_positionIterationCount = 0; } public function AddBody(_arg1:b2Body):void{ var _local2 = m_bodyCount++; m_bodies[_local2] = _arg1; } public function AddJoint(_arg1:b2Joint):void{ var _local2 = m_jointCount++; m_joints[_local2] = _arg1; } public function Report(_arg1:Array):void{ var _local2:b2Mat22; var _local3:b2Vec2; var _local5:b2Contact; var _local6:b2ContactConstraint; var _local7:b2ContactResult; var _local8:b2Body; var _local9:int; var _local10:Array; var _local11:int; var _local12:b2Manifold; var _local13:int; var _local14:b2ManifoldPoint; var _local15:b2ContactConstraintPoint; if (m_listener == null){ return; }; var _local4:int; while (_local4 < m_contactCount) { _local5 = m_contacts[_local4]; _local6 = _arg1[_local4]; _local7 = s_reportCR; _local7.shape1 = _local5.m_shape1; _local7.shape2 = _local5.m_shape2; _local8 = _local7.shape1.m_body; _local9 = _local5.m_manifoldCount; _local10 = _local5.GetManifolds(); _local11 = 0; while (_local11 < _local9) { _local12 = _local10[_local11]; _local7.normal.SetV(_local12.normal); _local13 = 0; while (_local13 < _local12.pointCount) { _local14 = _local12.points[_local13]; _local15 = _local6.points[_local13]; _local7.position = _local8.GetWorldPoint(_local14.localPoint1); _local7.normalImpulse = _local15.normalImpulse; _local7.tangentImpulse = _local15.tangentImpulse; _local7.id.key = _local14.id.key; m_listener.Result(_local7); _local13++; }; _local11++; }; _local4++; }; } public function AddContact(_arg1:b2Contact):void{ var _local2 = m_contactCount++; m_contacts[_local2] = _arg1; } public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{ var _local5:int; var _local6:b2Body; var _local7:b2Joint; var _local9:int; var _local10:Boolean; var _local11:Boolean; var _local12:Boolean; var _local13:Number; var _local14:Number; var _local15:Number; _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.IsStatic()){ } else { _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x)))); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y)))); _local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque)); _local6.m_force.SetZero(); _local6.m_torque = 0; _local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1)); _local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1)); if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){ _local6.m_linearVelocity.Normalize(); _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity); }; if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){ if (_local6.m_angularVelocity < 0){ _local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity); } else { _local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity; }; }; }; _local5++; }; var _local8:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local8.InitVelocityConstraints(_arg1); _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local7.InitVelocityConstraints(_arg1); _local5++; }; _local5 = 0; while (_local5 < _arg1.maxIterations) { _local8.SolveVelocityConstraints(); _local9 = 0; while (_local9 < m_jointCount) { _local7 = m_joints[_local9]; _local7.SolveVelocityConstraints(_arg1); _local9++; }; _local5++; }; _local8.FinalizeVelocityConstraints(); _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.IsStatic()){ } else { _local6.m_sweep.c0.SetV(_local6.m_sweep.c); _local6.m_sweep.a0 = _local6.m_sweep.a; _local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x)); _local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y)); _local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity)); _local6.SynchronizeTransform(); }; _local5++; }; if (_arg3){ _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local7.InitPositionConstraints(); _local5++; }; m_positionIterationCount = 0; while (m_positionIterationCount < _arg1.maxIterations) { _local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte); _local11 = true; _local5 = 0; while (_local5 < m_jointCount) { _local7 = m_joints[_local5]; _local12 = _local7.SolvePositionConstraints(); _local11 = ((_local11) && (_local12)); _local5++; }; if (((_local10) && (_local11))){ break; }; m_positionIterationCount++; }; }; Report(_local8.m_constraints); if (_arg4){ _local13 = Number.MAX_VALUE; _local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance); _local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance); _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.m_invMass == 0){ } else { if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){ _local6.m_sleepTime = 0; _local13 = 0; }; if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){ _local6.m_sleepTime = 0; _local13 = 0; } else { _local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt); _local13 = b2Math.b2Min(_local13, _local6.m_sleepTime); }; }; _local5++; }; if (_local13 >= b2Settings.b2_timeToSleep){ _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag); _local6.m_linearVelocity.SetZero(); _local6.m_angularVelocity = 0; _local5++; }; }; }; } public function Clear():void{ m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:int; var _local5:b2Body; var _local6:Boolean; var _local3:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local2 = 0; while (_local2 < _arg1.maxIterations) { _local3.SolveVelocityConstraints(); _local2++; }; _local2 = 0; while (_local2 < m_bodyCount) { _local5 = m_bodies[_local2]; if (_local5.IsStatic()){ } else { _local5.m_sweep.c0.SetV(_local5.m_sweep.c); _local5.m_sweep.a0 = _local5.m_sweep.a; _local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x)); _local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y)); _local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity)); _local5.SynchronizeTransform(); }; _local2++; }; var _local4:Number = 0.75; _local2 = 0; while (_local2 < _arg1.maxIterations) { _local6 = _local3.SolvePositionConstraints(_local4); if (_local6){ break; }; _local2++; }; Report(_local3.m_constraints); } } }//package Box2D.Dynamics
Section 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep) package Box2D.Dynamics { public class b2TimeStep { public var warmStarting:Boolean; public var positionCorrection:Boolean; public var dt:Number; public var maxIterations:int; public var dtRatio:Number; public var inv_dt:Number; } }//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class b2World { public var m_inv_dt0:Number; public var m_boundaryListener:b2BoundaryListener; public var m_contactList:b2Contact; public var m_blockAllocator; public var m_contactListener:b2ContactListener; public var m_raycastSegment:b2Segment; public var m_broadPhase:b2BroadPhase; public var m_destructionListener:b2DestructionListener; public var m_jointCount:int; public var m_lock:Boolean; public var m_bodyCount:int; public var m_raycastUserData; public var m_allowSleep:Boolean; public var m_positionIterationCount:int; public var m_groundBody:b2Body; public var m_contactCount:int; public var m_raycastNormal:b2Vec2; public var m_contactFilter:b2ContactFilter; public var m_bodyList:b2Body; public var m_debugDraw:b2DebugDraw; public var m_stackAllocator; public var m_jointList:b2Joint; public var m_gravity:b2Vec2; public var m_contactManager:b2ContactManager; private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8); public static var m_continuousPhysics:Boolean; public static var m_warmStarting:Boolean; private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6); public static var m_positionCorrection:Boolean; private static var s_xf:b2XForm = new b2XForm(); public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){ m_raycastNormal = new b2Vec2(); m_contactManager = new b2ContactManager(); super(); m_destructionListener = null; m_boundaryListener = null; m_contactFilter = b2ContactFilter.b2_defaultFilter; m_contactListener = null; m_debugDraw = null; m_bodyList = null; m_contactList = null; m_jointList = null; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_positionCorrection = true; m_warmStarting = true; m_continuousPhysics = true; m_allowSleep = _arg3; m_gravity = _arg2; m_lock = false; m_inv_dt0 = 0; m_contactManager.m_world = this; m_broadPhase = new b2BroadPhase(_arg1, m_contactManager); var _local4:b2BodyDef = new b2BodyDef(); m_groundBody = CreateBody(_local4); } public function DrawJoint(_arg1:b2Joint):void{ var _local11:b2PulleyJoint; var _local12:b2Vec2; var _local13:b2Vec2; var _local2:b2Body = _arg1.m_body1; var _local3:b2Body = _arg1.m_body2; var _local4:b2XForm = _local2.m_xf; var _local5:b2XForm = _local3.m_xf; var _local6:b2Vec2 = _local4.position; var _local7:b2Vec2 = _local5.position; var _local8:b2Vec2 = _arg1.GetAnchor1(); var _local9:b2Vec2 = _arg1.GetAnchor2(); var _local10:b2Color = s_jointColor; switch (_arg1.m_type){ case b2Joint.e_distanceJoint: m_debugDraw.DrawSegment(_local8, _local9, _local10); break; case b2Joint.e_pulleyJoint: _local11 = (_arg1 as b2PulleyJoint); _local12 = _local11.GetGroundAnchor1(); _local13 = _local11.GetGroundAnchor2(); m_debugDraw.DrawSegment(_local12, _local8, _local10); m_debugDraw.DrawSegment(_local13, _local9, _local10); m_debugDraw.DrawSegment(_local12, _local13, _local10); break; case b2Joint.e_mouseJoint: m_debugDraw.DrawSegment(_local8, _local9, _local10); break; default: if (_local2 != m_groundBody){ m_debugDraw.DrawSegment(_local6, _local8, _local10); }; m_debugDraw.DrawSegment(_local8, _local9, _local10); if (_local3 != m_groundBody){ m_debugDraw.DrawSegment(_local7, _local9, _local10); }; }; } public function Refilter(_arg1:b2Shape):void{ _arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf); } public function SetDebugDraw(_arg1:b2DebugDraw):void{ m_debugDraw = _arg1; } public function SetContinuousPhysics(_arg1:Boolean):void{ m_continuousPhysics = _arg1; } public function GetProxyCount():int{ return (m_broadPhase.m_proxyCount); } public function DrawDebugData():void{ var _local2:int; var _local3:b2Body; var _local4:b2Shape; var _local5:b2Joint; var _local6:b2BroadPhase; var _local11:b2XForm; var _local15:Boolean; var _local16:uint; var _local17:b2Pair; var _local18:b2Proxy; var _local19:b2Proxy; var _local20:b2Vec2; var _local21:b2Vec2; var _local22:b2Proxy; var _local23:b2PolygonShape; var _local24:b2OBB; var _local25:b2Vec2; var _local26:b2Mat22; var _local27:b2Vec2; var _local28:Number; if (m_debugDraw == null){ return; }; m_debugDraw.m_sprite.graphics.clear(); var _local1:uint = m_debugDraw.GetFlags(); var _local7:b2Vec2 = new b2Vec2(); var _local8:b2Vec2 = new b2Vec2(); var _local9:b2Vec2 = new b2Vec2(); var _local10:b2Color = new b2Color(0, 0, 0); var _local12:b2AABB = new b2AABB(); var _local13:b2AABB = new b2AABB(); var _local14:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()]; if ((_local1 & b2DebugDraw.e_shapeBit)){ _local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit); _local3 = m_bodyList; while (_local3) { _local11 = _local3.m_xf; _local4 = _local3.GetShapeList(); while (_local4) { if (_local3.IsStatic()){ DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15); } else { if (_local3.IsSleeping()){ DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15); } else { DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15); }; }; _local4 = _local4.m_next; }; _local3 = _local3.m_next; }; }; if ((_local1 & b2DebugDraw.e_jointBit)){ _local5 = m_jointList; while (_local5) { DrawJoint(_local5); _local5 = _local5.m_next; }; }; if ((_local1 & b2DebugDraw.e_pairBit)){ _local6 = m_broadPhase; _local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y)); _local10.Set(0.9, 0.9, 0.3); _local2 = 0; while (_local2 < b2Pair.b2_tableCapacity) { _local16 = _local6.m_pairManager.m_hashTable[_local2]; while (_local16 != b2Pair.b2_nullPair) { _local17 = _local6.m_pairManager.m_pairs[_local16]; _local18 = _local6.m_proxyPool[_local17.proxyId1]; _local19 = _local6.m_proxyPool[_local17.proxyId2]; _local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value)); _local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value)); _local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value)); _local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value)); _local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value)); _local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value)); _local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value)); _local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value)); _local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x)); _local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y)); _local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x)); _local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y)); m_debugDraw.DrawSegment(_local8, _local9, _local10); _local16 = _local17.next; }; _local2++; }; }; if ((_local1 & b2DebugDraw.e_aabbBit)){ _local6 = m_broadPhase; _local20 = _local6.m_worldAABB.lowerBound; _local21 = _local6.m_worldAABB.upperBound; _local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y)); _local10.Set(0.9, 0.3, 0.9); _local2 = 0; while (_local2 < b2Settings.b2_maxProxies) { _local22 = _local6.m_proxyPool[_local2]; if (_local22.IsValid() == false){ } else { _local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value)); _local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value)); _local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value)); _local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value)); _local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y); _local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y); _local14[2].Set(_local12.upperBound.x, _local12.upperBound.y); _local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y); m_debugDraw.DrawPolygon(_local14, 4, _local10); }; _local2++; }; _local14[0].Set(_local20.x, _local20.y); _local14[1].Set(_local21.x, _local20.y); _local14[2].Set(_local21.x, _local21.y); _local14[3].Set(_local20.x, _local21.y); m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9)); }; if ((_local1 & b2DebugDraw.e_obbBit)){ _local10.Set(0.5, 0.3, 0.5); _local3 = m_bodyList; while (_local3) { _local11 = _local3.m_xf; _local4 = _local3.GetShapeList(); while (_local4) { if (_local4.m_type != b2Shape.e_polygonShape){ } else { _local23 = (_local4 as b2PolygonShape); _local24 = _local23.GetOBB(); _local25 = _local24.extents; _local14[0].Set(-(_local25.x), -(_local25.y)); _local14[1].Set(_local25.x, -(_local25.y)); _local14[2].Set(_local25.x, _local25.y); _local14[3].Set(-(_local25.x), _local25.y); _local2 = 0; while (_local2 < 4) { _local26 = _local24.R; _local27 = _local14[_local2]; _local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y))); _local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y))); _local14[_local2].x = _local28; _local26 = _local11.R; _local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y))); _local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y))); _local14[_local2].x = _local28; _local2++; }; m_debugDraw.DrawPolygon(_local14, 4, _local10); }; _local4 = _local4.m_next; }; _local3 = _local3.m_next; }; }; if ((_local1 & b2DebugDraw.e_centerOfMassBit)){ _local3 = m_bodyList; while (_local3) { _local11 = s_xf; _local11.R = _local3.m_xf.R; _local11.position = _local3.GetWorldCenter(); m_debugDraw.DrawXForm(_local11); _local3 = _local3.m_next; }; }; } public function DestroyBody(_arg1:b2Body):void{ var _local4:b2JointEdge; var _local5:b2Shape; if (m_lock == true){ return; }; var _local2:b2JointEdge = _arg1.m_jointList; while (_local2) { _local4 = _local2; _local2 = _local2.next; if (m_destructionListener){ m_destructionListener.SayGoodbyeJoint(_local4.joint); }; DestroyJoint(_local4.joint); }; var _local3:b2Shape = _arg1.m_shapeList; while (_local3) { _local5 = _local3; _local3 = _local3.m_next; if (m_destructionListener){ m_destructionListener.SayGoodbyeShape(_local5); }; _local5.DestroyProxy(m_broadPhase); b2Shape.Destroy(_local5, m_blockAllocator); }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_bodyList){ m_bodyList = _arg1.m_next; }; m_bodyCount--; } public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{ var _local6:b2CircleShape; var _local7:b2Vec2; var _local8:Number; var _local9:b2Vec2; var _local10:int; var _local11:b2PolygonShape; var _local12:int; var _local13:Array; var _local14:Array; var _local15:Array; var _local5:b2Color = s_coreColor; switch (_arg1.m_type){ case b2Shape.e_circleShape: _local6 = (_arg1 as b2CircleShape); _local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition); _local8 = _local6.m_radius; _local9 = _arg2.R.col1; m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3); if (_arg4){ m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5); }; break; case b2Shape.e_polygonShape: _local11 = (_arg1 as b2PolygonShape); _local12 = _local11.GetVertexCount(); _local13 = _local11.GetVertices(); _local14 = new Array(b2Settings.b2_maxPolygonVertices); _local10 = 0; while (_local10 < _local12) { _local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]); _local10++; }; m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3); if (_arg4){ _local15 = _local11.GetCoreVertices(); _local10 = 0; while (_local10 < _local12) { _local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]); _local10++; }; m_debugDraw.DrawPolygon(_local14, _local12, _local5); }; break; }; } public function GetGroundBody():b2Body{ return (m_groundBody); } public function SetContactFilter(_arg1:b2ContactFilter):void{ m_contactFilter = _arg1; } public function Solve(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local9:int; var _local10:int; var _local11:b2Body; var _local12:b2ContactEdge; var _local13:b2JointEdge; var _local14:Boolean; m_positionIterationCount = 0; var _local3:b2Island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2 = _local2.m_next; }; var _local4:b2Contact = m_contactList; while (_local4) { _local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag)); _local4 = _local4.m_next; }; var _local5:b2Joint = m_jointList; while (_local5) { _local5.m_islandFlag = false; _local5 = _local5.m_next; }; var _local6:int = m_bodyCount; var _local7:Array = new Array(_local6); var _local8:b2Body = m_bodyList; while (_local8) { if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){ } else { if (_local8.IsStatic()){ } else { _local3.Clear(); _local9 = 0; var _temp1 = _local9; _local9 = (_local9 + 1); var _local15 = _temp1; _local7[_local15] = _local8; _local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag); while (_local9 > 0) { --_local9; _local2 = _local7[_local9]; _local3.AddBody(_local2); _local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag)); if (_local2.IsStatic()){ } else { _local12 = _local2.m_contactList; while (_local12) { if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){ } else { if (_local12.contact.m_manifoldCount == 0){ } else { _local3.AddContact(_local12.contact); _local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag); _local11 = _local12.other; if ((_local11.m_flags & b2Body.e_islandFlag)){ } else { var _temp2 = _local9; _local9 = (_local9 + 1); var _local16 = _temp2; _local7[_local16] = _local11; _local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag); }; }; }; _local12 = _local12.next; }; _local13 = _local2.m_jointList; while (_local13) { if (_local13.joint.m_islandFlag == true){ } else { _local3.AddJoint(_local13.joint); _local13.joint.m_islandFlag = true; _local11 = _local13.other; if ((_local11.m_flags & b2Body.e_islandFlag)){ } else { var _temp3 = _local9; _local9 = (_local9 + 1); _local16 = _temp3; _local7[_local16] = _local11; _local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag); }; }; _local13 = _local13.next; }; }; }; _local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep); if (_local3.m_positionIterationCount > m_positionIterationCount){ m_positionIterationCount = _local3.m_positionIterationCount; }; _local10 = 0; while (_local10 < _local3.m_bodyCount) { _local2 = _local3.m_bodies[_local10]; if (_local2.IsStatic()){ _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); }; _local10++; }; }; }; _local8 = _local8.m_next; }; _local2 = m_bodyList; while (_local2) { if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (_local2.IsStatic()){ } else { _local14 = _local2.SynchronizeShapes(); if ((((_local14 == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(_local2); }; }; }; _local2 = _local2.m_next; }; m_broadPhase.Commit(); } public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{ var _local4:Array = new Array(_arg3); var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3); var _local6:int; while (_local6 < _local5) { _arg2[_local6] = _local4[_local6]; _local6++; }; return (_local5); } public function GetContactCount():int{ return (m_contactCount); } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Shape; var _local4:b2Shape; var _local5:b2Body; var _local6:b2Body; var _local7:b2ContactEdge; var _local11:b2Contact; var _local12:b2Contact; var _local13:Number; var _local14:b2Body; var _local15:int; var _local16:b2TimeStep; var _local17:int; var _local18:Number; var _local19:Number; var _local20:b2Body; var _local21:Boolean; var _local8:b2Island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener); var _local9:int = m_bodyCount; var _local10:Array = new Array(_local9); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2.m_sweep.t0 = 0; _local2 = _local2.m_next; }; _local11 = m_contactList; while (_local11) { _local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local11 = _local11.m_next; }; while (true) { _local12 = null; _local13 = 1; _local11 = m_contactList; for (;_local11;(_local11 = _local11.m_next)) { if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){ } else { _local18 = 1; if ((_local11.m_flags & b2Contact.e_toiFlag)){ _local18 = _local11.m_toi; } else { _local3 = _local11.m_shape1; _local4 = _local11.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){ continue; }; _local19 = _local5.m_sweep.t0; if (_local5.m_sweep.t0 < _local6.m_sweep.t0){ _local19 = _local6.m_sweep.t0; _local5.m_sweep.Advance(_local19); } else { if (_local6.m_sweep.t0 < _local5.m_sweep.t0){ _local19 = _local5.m_sweep.t0; _local6.m_sweep.Advance(_local19); }; }; _local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep); if ((((_local18 > 0)) && ((_local18 < 1)))){ _local18 = (((1 - _local18) * _local19) + _local18); if (_local18 > 1){ _local18 = 1; }; }; _local11.m_toi = _local18; _local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag); }; if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){ _local12 = _local11; _local13 = _local18; }; }; }; if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){ break; }; _local3 = _local12.m_shape1; _local4 = _local12.m_shape2; _local5 = _local3.m_body; _local6 = _local4.m_body; _local5.Advance(_local13); _local6.Advance(_local13); _local12.Update(m_contactListener); _local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag)); if (_local12.m_manifoldCount == 0){ } else { _local14 = _local5; if (_local14.IsStatic()){ _local14 = _local6; }; _local8.Clear(); _local15 = 0; var _temp1 = _local15; _local15 = (_local15 + 1); var _local22 = _temp1; _local10[_local22] = _local14; _local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag); while (_local15 > 0) { --_local15; _local2 = _local10[_local15]; _local8.AddBody(_local2); _local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag)); if (_local2.IsStatic()){ } else { _local7 = _local2.m_contactList; while (_local7) { if (_local8.m_contactCount == _local8.m_contactCapacity){ } else { if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){ } else { if (_local7.contact.m_manifoldCount == 0){ } else { _local8.AddContact(_local7.contact); _local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag); _local20 = _local7.other; if ((_local20.m_flags & b2Body.e_islandFlag)){ } else { if (_local20.IsStatic() == false){ _local20.Advance(_local13); _local20.WakeUp(); }; var _temp2 = _local15; _local15 = (_local15 + 1); var _local23 = _temp2; _local10[_local23] = _local20; _local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag); }; }; }; }; _local7 = _local7.next; }; }; }; _local16 = new b2TimeStep(); _local16.dt = ((1 - _local13) * _arg1.dt); _local16.inv_dt = (1 / _local16.dt); _local16.maxIterations = _arg1.maxIterations; _local8.SolveTOI(_local16); _local17 = 0; while (_local17 < _local8.m_bodyCount) { _local2 = _local8.m_bodies[_local17]; _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (_local2.IsStatic()){ } else { _local21 = _local2.SynchronizeShapes(); if ((((_local21 == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(_local2); }; _local7 = _local2.m_contactList; while (_local7) { _local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag)); _local7 = _local7.next; }; }; }; _local17++; }; _local17 = 0; while (_local17 < _local8.m_contactCount) { _local11 = _local8.m_contacts[_local17]; _local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local17++; }; m_broadPhase.Commit(); }; }; } public function GetJointList():b2Joint{ return (m_jointList); } public function Validate():void{ m_broadPhase.Validate(); } public function SetGravity(_arg1:b2Vec2):void{ m_gravity = _arg1; } public function GetPairCount():int{ return (m_broadPhase.m_pairManager.m_pairCount); } public function GetBodyList():b2Body{ return (m_bodyList); } public function SetWarmStarting(_arg1:Boolean):void{ m_warmStarting = _arg1; } public function SetPositionCorrection(_arg1:Boolean):void{ m_positionCorrection = _arg1; } public function CreateJoint(_arg1:b2JointDef):b2Joint{ var _local3:b2Body; var _local4:b2Shape; var _local2:b2Joint = b2Joint.Create(_arg1, m_blockAllocator); _local2.m_prev = null; _local2.m_next = m_jointList; if (m_jointList){ m_jointList.m_prev = _local2; }; m_jointList = _local2; m_jointCount++; _local2.m_node1.joint = _local2; _local2.m_node1.other = _local2.m_body2; _local2.m_node1.prev = null; _local2.m_node1.next = _local2.m_body1.m_jointList; if (_local2.m_body1.m_jointList){ _local2.m_body1.m_jointList.prev = _local2.m_node1; }; _local2.m_body1.m_jointList = _local2.m_node1; _local2.m_node2.joint = _local2; _local2.m_node2.other = _local2.m_body1; _local2.m_node2.prev = null; _local2.m_node2.next = _local2.m_body2.m_jointList; if (_local2.m_body2.m_jointList){ _local2.m_body2.m_jointList.prev = _local2.m_node2; }; _local2.m_body2.m_jointList = _local2.m_node2; if (_arg1.collideConnected == false){ _local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2; _local4 = _local3.m_shapeList; while (_local4) { _local4.RefilterProxy(m_broadPhase, _local3.m_xf); _local4 = _local4.m_next; }; }; return (_local2); } public function DestroyJoint(_arg1:b2Joint):void{ var _local5:b2Body; var _local6:b2Shape; var _local2:Boolean = _arg1.m_collideConnected; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_jointList){ m_jointList = _arg1.m_next; }; var _local3:b2Body = _arg1.m_body1; var _local4:b2Body = _arg1.m_body2; _local3.WakeUp(); _local4.WakeUp(); if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local3.m_jointList){ _local3.m_jointList = _arg1.m_node1.next; }; _arg1.m_node1.prev = null; _arg1.m_node1.next = null; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local4.m_jointList){ _local4.m_jointList = _arg1.m_node2.next; }; _arg1.m_node2.prev = null; _arg1.m_node2.next = null; b2Joint.Destroy(_arg1, m_blockAllocator); m_jointCount--; if (_local2 == false){ _local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4; _local6 = _local5.m_shapeList; while (_local6) { _local6.RefilterProxy(m_broadPhase, _local5.m_xf); _local6 = _local6.m_next; }; }; } public function SetContactListener(_arg1:b2ContactListener):void{ m_contactListener = _arg1; } public function Raycast(_arg1:b2Segment, _arg2:Array, _arg3:int, _arg4):int{ var _local5:Array = new Array(_arg3); m_raycastSegment = _arg1; m_raycastUserData = _arg4; var _local6:int = m_broadPhase.QuerySegment(_arg1, _local5, _arg3, RaycastSortKey); var _local7:int; while (_local7 < _local6) { _arg2[_local7] = _local5[_local7]; _local7++; }; return (_local6); } public function RaycastOne(_arg1:b2Segment, _arg2:Array, _arg3:b2Vec2, _arg4):b2Shape{ var _local5:Array = new Array(1); var _local6:Number = Raycast(_arg1, _local5, 1, _arg4); if (_local6 == 0){ return (null); }; if (_local6 > 1){ trace(_local6); }; var _local7:b2Shape = _local5[0]; var _local8:b2XForm = _local7.GetBody().GetXForm(); _local7.TestSegment(_local8, _arg2, _arg3, _arg1, 1); return (_local7); } public function CreateBody(_arg1:b2BodyDef):b2Body{ if (m_lock == true){ return (null); }; var _local2:b2Body = new b2Body(_arg1, this); _local2.m_prev = null; _local2.m_next = m_bodyList; if (m_bodyList){ m_bodyList.m_prev = _local2; }; m_bodyList = _local2; m_bodyCount++; return (_local2); } public function RaycastSortKey(_arg1:b2Shape){ if (((m_contactFilter) && (!(m_contactFilter.RayCollide(m_raycastUserData, _arg1))))){ return (-1); }; var _local2:b2Body = _arg1.GetBody(); var _local3:b2XForm = _local2.GetXForm(); var _local4:Array = [0]; if (!_arg1.TestSegment(_local3, _local4, m_raycastNormal, m_raycastSegment, 1)){ return (-1); }; return (_local4[0]); } public function SetBoundaryListener(_arg1:b2BoundaryListener):void{ m_boundaryListener = _arg1; } public function SetDestructionListener(_arg1:b2DestructionListener):void{ m_destructionListener = _arg1; } public function Step(_arg1:Number, _arg2:int):void{ m_lock = true; var _local3:b2TimeStep = new b2TimeStep(); _local3.dt = _arg1; _local3.maxIterations = _arg2; if (_arg1 > 0){ _local3.inv_dt = (1 / _arg1); } else { _local3.inv_dt = 0; }; _local3.dtRatio = (m_inv_dt0 * _arg1); _local3.positionCorrection = m_positionCorrection; _local3.warmStarting = m_warmStarting; m_contactManager.Collide(); if (_local3.dt > 0){ Solve(_local3); }; if (((m_continuousPhysics) && ((_local3.dt > 0)))){ SolveTOI(_local3); }; DrawDebugData(); m_inv_dt0 = _local3.inv_dt; m_lock = false; } public function GetBodyCount():int{ return (m_bodyCount); } public function GetJointCount():int{ return (m_jointCount); } } }//package Box2D.Dynamics
Section 75
//AdLoader (CPMStar.AdLoader) package CPMStar { import flash.events.*; import flash.display.*; import flash.net.*; import flash.system.*; public class AdLoader extends Sprite { private var cpmstarLoader:Loader; private var contentspotid:String; public function AdLoader(_arg1:String){ this.contentspotid = _arg1; addEventListener(Event.ADDED, addedHandler); } private function dispatchHandler(_arg1:Event):void{ dispatchEvent(_arg1); } private function addedHandler(_arg1:Event):void{ removeEventListener(Event.ADDED, addedHandler); Security.allowDomain("server.cpmstar.com"); var _local2 = "http://server.cpmstar.com/adviewas3.swf"; var _local3:DisplayObjectContainer = parent; cpmstarLoader = new Loader(); cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler); cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler); cpmstarLoader.load(new URLRequest(((_local2 + "?contentspotid=") + contentspotid))); addChild(cpmstarLoader); } } }//package CPMStar
Section 76
//worldSelectCloud2_4 (endMovie_fla.worldSelectCloud2_4) package endMovie_fla { import flash.display.*; public dynamic class worldSelectCloud2_4 extends MovieClip { public var rand:Number; public function worldSelectCloud2_4(){ addFrameScript(0, this.frame1, 1061, this.frame1062); } function frame1062(){ gotoAndPlay(2); } function frame1(){ this.rand = Math.round((Math.random() * 300)); gotoAndPlay(this.rand); } } }//package endMovie_fla
Section 77
//bubble_logo3_32 (Lic_All_fla.bubble_logo3_32) package Lic_All_fla { import flash.display.*; public dynamic class bubble_logo3_32 extends MovieClip { public function bubble_logo3_32(){ addFrameScript(0, frame1, 9, frame10); } function frame10(){ stop(); } function frame1(){ stop(); } } }//package Lic_All_fla
Section 78
//MB_Explode_5 (Lic_All_fla.MB_Explode_5) package Lic_All_fla { import flash.display.*; public dynamic class MB_Explode_5 extends MovieClip { public function MB_Explode_5(){ addFrameScript(0, frame1, 18, frame19); } function frame1(){ } function frame19(){ stop(); } } }//package Lic_All_fla
Section 79
//MB_eyes_MB_4 (Lic_All_fla.MB_eyes_MB_4) package Lic_All_fla { import flash.display.*; public dynamic class MB_eyes_MB_4 extends MovieClip { public function MB_eyes_MB_4(){ addFrameScript(31, frame32); } function frame32(){ gotoAndPlay(1); } } }//package Lic_All_fla
Section 80
//MB_mouse_3 (Lic_All_fla.MB_mouse_3) package Lic_All_fla { import flash.display.*; public dynamic class MB_mouse_3 extends MovieClip { public function MB_mouse_3(){ addFrameScript(6, frame7); } function frame7(){ gotoAndPlay(1); } } }//package Lic_All_fla
Section 81
//MB_mouse_6 (Lic_All_fla.MB_mouse_6) package Lic_All_fla { import flash.display.*; public dynamic class MB_mouse_6 extends MovieClip { public function MB_mouse_6(){ addFrameScript(35, frame36); } function frame36(){ gotoAndPlay(1); } } }//package Lic_All_fla
Section 82
//Symbol7_3 (Lic_FWG_fla.Symbol7_3) package Lic_FWG_fla { import flash.events.*; import flash.text.*; import flash.display.*; import flash.geom.*; import flash.media.*; import flash.utils.*; import flash.filters.*; import flash.net.*; import flash.ui.*; import flash.accessibility.*; import flash.errors.*; import flash.system.*; public dynamic class Symbol7_3 extends MovieClip { public function Symbol7_3(){ addFrameScript(228, frame229); } function frame229(){ stop(); } } }//package Lic_FWG_fla
Section 83
//MB_Explode_4 (Lic_MouseBreaker_fla.MB_Explode_4) package Lic_MouseBreaker_fla { import flash.display.*; public dynamic class MB_Explode_4 extends MovieClip { public function MB_Explode_4(){ addFrameScript(0, frame1, 18, frame19); } function frame1(){ } function frame19(){ stop(); } } }//package Lic_MouseBreaker_fla
Section 84
//MB_eyes_MB_3 (Lic_MouseBreaker_fla.MB_eyes_MB_3) package Lic_MouseBreaker_fla { import flash.display.*; public dynamic class MB_eyes_MB_3 extends MovieClip { public function MB_eyes_MB_3(){ addFrameScript(31, frame32); } function frame32(){ gotoAndPlay(1); } } }//package Lic_MouseBreaker_fla
Section 85
//MB_mouse_2 (Lic_MouseBreaker_fla.MB_mouse_2) package Lic_MouseBreaker_fla { import flash.display.*; public dynamic class MB_mouse_2 extends MovieClip { public function MB_mouse_2(){ addFrameScript(6, frame7); } function frame7(){ gotoAndPlay(1); } } }//package Lic_MouseBreaker_fla
Section 86
//MB_mouse_5 (Lic_MouseBreaker_fla.MB_mouse_5) package Lic_MouseBreaker_fla { import flash.display.*; public dynamic class MB_mouse_5 extends MovieClip { public function MB_mouse_5(){ addFrameScript(35, frame36); } function frame36(){ gotoAndPlay(1); } } }//package Lic_MouseBreaker_fla
Section 87
//FontAsset (mx.core.FontAsset) package mx.core { import flash.text.*; public class FontAsset extends Font implements IFlexAsset { mx_internal static const VERSION:String = "3.4.0.9271"; } }//package mx.core
Section 88
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 89
//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 90
//elvis_head_31 (Objects_fla.elvis_head_31) package Objects_fla { import flash.display.*; public dynamic class elvis_head_31 extends MovieClip { public var glasses:MovieClip; public var eyelids:MovieClip; public function elvis_head_31(){ addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package Objects_fla
Section 91
//TwoNamesblinks_33 (Objects_fla.TwoNamesblinks_33) package Objects_fla { import flash.display.*; public dynamic class TwoNamesblinks_33 extends MovieClip { public function TwoNamesblinks_33(){ addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package Objects_fla
Section 92
//FlashConnect (org.flashdevelop.utils.FlashConnect) package org.flashdevelop.utils { import flash.events.*; import flash.xml.*; import flash.net.*; import flash.utils.*; public class FlashConnect { public static var onReturnData:Function; public static var port:Number = 1978; private static var interval:Number; private static var messages:Array; public static var onConnection:Function; public static var host:String = "localhost"; public static var status:Number = 0; private static var socket:XMLSocket; public static var limit:Number = 1000; private static var counter:Number; private static function onIOError(_arg1:IOErrorEvent):void{ _slot1.status = -1; if (_slot1.onConnection != null){ _slot1.onConnection(); }; } public static function atrace(... _args):void{ var _local2:String = _args.join(","); var _local3:XMLNode = createMsgNode(_local2, TraceLevel.DEBUG); _slot1.send(_local3); } private static function createMsgNode(_arg1:String, _arg2:Number):XMLNode{ if (isNaN(_arg2)){ _arg2 = TraceLevel.DEBUG; }; var _local3:XMLNode = new XMLNode(1, null); var _local4:XMLNode = new XMLNode(3, encodeURI(_arg1)); _local3.attributes.state = _arg2.toString(); _local3.attributes.cmd = "trace"; _local3.nodeName = "message"; _local3.appendChild(_local4); return (_local3); } public static function send(_arg1:XMLNode):void{ if (messages == null){ initialize(); }; messages.push(_arg1); } private static function onSecurityError(_arg1:SecurityErrorEvent):void{ _slot1.status = -1; if (_slot1.onConnection != null){ _slot1.onConnection(); }; } private static function onConnect(_arg1:Event):void{ _slot1.status = 1; if (_slot1.onConnection != null){ _slot1.onConnection(); }; } public static function trace(_arg1:Object, _arg2:Number=1):void{ var _local3:XMLNode = createMsgNode(_arg1.toString(), _arg2); _slot1.send(_local3); } private static function initialize():void{ counter = 0; messages = new Array(); socket = new XMLSocket(); socket.addEventListener(DataEvent.DATA, onData); socket.addEventListener(Event.CONNECT, onConnect); socket.addEventListener(IOErrorEvent.IO_ERROR, onIOError); socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError); interval = setInterval(sendStack, 50); socket.connect(host, port); } private static function sendStack():void{ var _local1:XMLDocument; var _local2:XMLNode; var _local3:String; var _local4:XMLNode; var _local5:XMLNode; if ((((messages.length > 0)) && ((status == 1)))){ _local1 = new XMLDocument(); _local2 = _local1.createElement("flashconnect"); while (messages.length != 0) { counter++; if (counter > limit){ clearInterval(interval); _local3 = new String("FlashConnect aborted. You have reached the limit of maximum messages."); _local4 = createMsgNode(_local3, TraceLevel.ERROR); _local2.appendChild(_local4); break; } else { _local5 = XMLNode(messages.shift()); _local2.appendChild(_local5); }; }; _local1.appendChild(_local2); socket.send(_local1); }; } private static function onData(_arg1:DataEvent):void{ _slot1.status = 1; if (_slot1.onReturnData != null){ _slot1.onReturnData(_arg1.data); }; } public static function mtrace(_arg1:Object, _arg2:String, _arg3:String, _arg4:Number):void{ var _local5:String = _arg3.split("/").join("\\"); var _local6:String = ((((_local5 + ":") + _arg4) + ":") + _arg1); _slot1.trace(_local6, TraceLevel.DEBUG); } } }//package org.flashdevelop.utils
Section 93
//TraceLevel (org.flashdevelop.utils.TraceLevel) package org.flashdevelop.utils { public class TraceLevel { public static const DEBUG:Number = 1; public static const FATAL:Number = 4; public static const WARNING:Number = 2; public static const INFO:Number = 0; public static const ERROR:Number = 3; } }//package org.flashdevelop.utils
Section 94
//sumoHelmet_46 (skier_fla.sumoHelmet_46) package skier_fla { import flash.display.*; public dynamic class sumoHelmet_46 extends MovieClip { public function sumoHelmet_46(){ addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package skier_fla
Section 95
//worldselectCloud1_92 (Titles_fla.worldselectCloud1_92) package Titles_fla { import flash.display.*; public dynamic class worldselectCloud1_92 extends MovieClip { public var rand:Number; public function worldselectCloud1_92(){ addFrameScript(0, frame1, 1034, frame1035); } function frame1(){ rand = Math.round((Math.random() * 300)); gotoAndPlay(rand); } function frame1035(){ gotoAndPlay(2); } } }//package Titles_fla
Section 96
//worldSelectCloud2_59 (Titles_fla.worldSelectCloud2_59) package Titles_fla { import flash.display.*; public dynamic class worldSelectCloud2_59 extends MovieClip { public var rand:Number; public function worldSelectCloud2_59(){ addFrameScript(0, frame1, 1061, frame1062); } function frame1062(){ gotoAndPlay(2); } function frame1(){ rand = Math.round((Math.random() * 300)); gotoAndPlay(rand); } } }//package Titles_fla
Section 97
//Achievement (Achievement) package { public class Achievement { var specificLevel:int; var testFunction:String; var name:String; var testFunctionParams:String; var completeFunction:String; var completeFunctionParams:String; var complete:Boolean; var description:String; public function Achievement(){ name = "undefined"; description = "undefined"; complete = false; testFunction = null; completeFunction = null; completeFunctionParams = null; testFunctionParams = null; specificLevel = -1; } } }//package
Section 98
//AchievementBox (AchievementBox) package { import flash.text.*; import flash.display.*; public dynamic class AchievementBox extends MovieClip { public var selectedClip:MovieClip; public var tick:MovieClip; public var textNumber:TextField; public var medalover:MovieClip; } }//package
Section 99
//Achievements (Achievements) package { import org.flashdevelop.utils.*; public class Achievements { public var list:Array; public var unlockedList:Array; public function Achievements(){ trace("INITIALISING ACHIEVEMENTS"); list = new Array(); unlockedList = new Array(); Add(1, "&Level1 Timetrial", "Finish in 60 seconds to unlock &Level2", "AchTest_FinishLevel", "-1,1,60", "AchPass_UnlockLevel", "2"); Add(2, "&Level2 Timetrial", "Finish in 90 seconds to unlock &Level3", "AchTest_FinishLevel", "-1,2,90", "AchPass_UnlockLevel", "3"); Add(3, "&Level3 Timetrial", "Finish in 60 seconds to unlock &Level4", "AchTest_FinishLevel", "-1,3,60", "AchPass_UnlockLevel", "4"); Add(4, "&Level4 Timetrial", "Finish in 60 seconds to unlock &Level5", "AchTest_FinishLevel", "-1,4,60", "AchPass_UnlockLevel", "5"); Add(5, "&Level5 Timetrial", "Finish in 50 seconds to unlock &Level6", "AchTest_FinishLevel", "-1,5,50", "AchPass_UnlockLevel", "6"); Add(6, "&Level6 Timetrial", "Finish in 75 seconds to unlock Bear Skis", "AchTest_FinishLevel", "-1,6,75", "AchPass_UnlockSkis", "7"); Add(1, "&Level1 Pickups", "Collect all pickups to unlock &Level7", "AchTest_Pickups", "-1,1,25", "AchPass_UnlockLevel", "7"); Add(2, "&Level2 Pickups", "Hit all Snowmen to unlock &Level8", "AchTest_AllSnowmen", "-1,2", "AchPass_UnlockLevel", "8"); Add(3, "&Level3 Sequences", "Complete 3 sequences to unlock &Level9", "AchTest_AllSequences", "-1,3", "AchPass_UnlockLevel", "9"); Add(4, "&Level4 Hoops", "Pose through all the hoops to unlock &Level10", "AchTest_AllHoops", "-1,4", "AchPass_UnlockLevel", "10"); Add(5, "&Level5 Pickups", "Collect all pickups to unlock &Level11", "AchTest_Pickups", "-1,5,41", "AchPass_UnlockLevel", "11"); Add(6, "&Level6 Pickups", "Collect 50 pickups to unlock &Level12", "AchTest_Pickups", "-1,6,50", "AchPass_UnlockLevel", "12"); Add(7, "&Level7 Bonus Challenge", "Ski Jump 3000 inches to unlock &Bike2", "AchTest_SkiJump", "-1,7,3000", "AchPass_UnlockBike", "2"); Add(8, "&Level8 Bonus Challenge", "Don't crash to unlock &Bike3", "AchTest_DontCrash", "-1,8", "AchPass_UnlockBike", "3"); Add(9, "&Level9 Bonus Challenge", "Pose at a height of 650 inches to unlock &Bike4", "AchTest_HighestPoint", "-1,9,650", "AchPass_UnlockBike", "4"); Add(10, "&Level10 Bonus Challenge", "Do 9 somersaults off the cliff to unlock &Bike5", "AchTest_CliffSomersaults", "-1,10,9", "AchPass_UnlockBike", "5"); Add(11, "&Level11 Bonus Challenge", "Collect ALL pickups to unlock &Bike6", "AchTest_Pickups", "-1,11,96", "AchPass_UnlockBike", "6"); Add(12, "&Level12 Bonus Challenge", "Smash 20 penguins to unlock Banana skis", "AchTest_SmashPenguins", "-1,12,20", "AchPass_UnlockSkis", "6"); Add(1, "&Level1 Super Challenge", "Collect bonus icon to unlock &Bike1 Badge", "AchTest_BonusPickup", "-1,1", "AchPass_UnlockHorn", "1"); Add(2, "&Level2 Super Challenge", "Collect bonus icon to unlock &Bike2 Badge", "AchTest_BonusPickup", "-1,2", "AchPass_UnlockHorn", "2"); Add(3, "&Level3 Super Challenge", "Collect bonus icon to unlock &Bike3 Badge", "AchTest_BonusPickup", "-1,3", "AchPass_UnlockHorn", "3"); Add(4, "&Level4 Super Challenge", "Collect bonus icon to unlock &Bike4 Badge", "AchTest_BonusPickup", "-1,4", "AchPass_UnlockHorn", "4"); Add(5, "&Level5 Super Challenge", "Collect bonus icon to unlock &Bike5 Badge", "AchTest_BonusPickup", "-1,5", "AchPass_UnlockHorn", "5"); Add(6, "&Level6 Super Challenge", "Collect bonus icon to unlock &Bike6 Badge", "AchTest_BonusPickup", "-1,6", "AchPass_UnlockHorn", "6"); Add(1, "&Level1 SuperTime", "Finish in 28 seconds to unlock Clown Skis", "AchTest_FinishLevel", "-1,1,28", "AchPass_UnlockSkis", "5"); Add(2, "&Level2 Timetrial", "Finish in 45 seconds", "AchTest_FinishLevel", "-1,2,45", "AchPass_Null", "3"); Add(3, "&Level3 Timetrial", "Finish in 45 seconds", "AchTest_FinishLevel", "-1,3,45", "AchPass_Null", "4"); Add(4, "&Level4 Timetrial", "Finish in 50 seconds", "AchTest_FinishLevel", "-1,4,50", "AchPass_Null", "5"); Add(5, "&Level5 Timetrial", "Finish in 45 seconds", "AchTest_FinishLevel", "-1,5,45", "AchPass_Null", "6"); Add(6, "&Level6 Timetrial", "Finish in 70 seconds", "AchTest_FinishLevel", "-1,6,70", "AchPass_Null", "7"); Add(7, "&Level7 SuperBonus", "Ski Jump 9000 inches", "AchTest_SkiJump", "-1,7,9000", "AchPass_Null", "2"); Add(8, "&Level8 SuperBonus", "Finish in 50 seconds", "AchTest_FinishLevel", "-1,8,50", "AchPass_Null", "3"); Add(9, "&Level9 SuperBonus", "Pose at a height of 1000 inches", "AchTest_HighestPoint", "-1,9,1000", "AchPass_Null", "4"); Add(10, "&Level10 SuperBonus", "Do 11 somersaults off the cliff", "AchTest_CliffSomersaults", "-1,10,11", "AchPass_Null", "5"); Add(11, "&Level11 SuperBonus", "Collect FEWER THAN 60 pickups", "AchTest_FewPickups", "-1,11,60", "AchPass_Null", "6"); Add(12, "&Level12 SuperBonus", "Don't smash ANY penguins", "AchTest_SmashFewPenguins", "-1,12,1", "AchPass_Null", "5"); } public function GetAchievementIndex(_arg1:Achievement):int{ var _local3:Achievement; var _local2:int; for each (_local3 in list) { if (_local3 == _arg1){ return (_local2); }; _local2++; }; return (0); } public function Add(_arg1:int, _arg2:String, _arg3:String, _arg4:String, _arg5:String, _arg6:String, _arg7:String){ var _local8:Achievement = new Achievement(); _local8.specificLevel = _arg1; _local8.name = _arg2; _local8.description = _arg3; _local8.testFunction = _arg4; _local8.testFunctionParams = _arg5; _local8.completeFunction = _arg6; _local8.completeFunctionParams = _arg7; list.push(_local8); } function AchTest_SingleRearWheelie(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:Number = Number(_local2[2]); _local5 = (_local5 * Defs.fps); if (_local4 != Game.currentLevel){ return (false); }; if (Game.bestRearWheelieTime >= _local5){ return (true); }; return (false); } function AchTest_UnlockAll(_arg1:String):Boolean{ var _local3:Achievement; var _local2:int; for each (_local3 in list) { if (_local3.complete){ _local2++; }; }; if (_local2 >= (list.length - 1)){ return (true); }; return (false); } function AchTest_Place(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:int = int(_local2[2]); _local5--; if (_local4 != Game.currentLevel){ return (false); }; if (Game.playerRacePosition <= _local5){ return (true); }; return (false); } function AchTest_SingleAirTime(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:Number = Number(_local2[2]); _local5 = (_local5 * Defs.fps); if (_local4 != Game.currentLevel){ return (false); }; if (Game.bestSingleAirTime >= _local5){ return (true); }; return (false); } function AchTest_CliffSomersaults(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:int = int(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; if (Game.cliffJumpRotCount >= _local5){ return (true); }; return (false); } public function TestNone(){ unlockedList = new Array(); } public function CountAchievementsComplete():int{ var _local2:Achievement; var _local1:int; for each (_local2 in list) { if (_local2.complete){ _local1++; }; }; return (_local1); } function AchPass_UnlockBike(_arg1:String):void{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); _local3--; trace(("unlocked bike - " + _local3)); var _local4:PlayerBikeData = PlayerBikes.GetBikeData(_local3); _local4.available = true; } function AchTest_ForwardSomersault(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:Number = Number(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; if (Game.levelForwardSomersaults >= _local5){ return (true); }; return (false); } function AchTest_AllHoops(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); --_local4; if (_local4 != Game.currentLevel){ return (false); }; if (Game.numHoopsComplete >= Game.totalHoops){ return (true); }; return (false); } function AchTest_MultiSomersault(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:int = int(_local2[2]); trace(("testing multi somersault " + _local5)); if (_local4 != Game.currentLevel){ return (false); }; if (_local5 >= Game.highestMultiSomersault){ return (true); }; return (false); } function AchTest_BonusLevel(_arg1:String):Boolean{ var _local3:Achievement; var _local2:int; for each (_local3 in list) { if (_local3.completeFunction == "AchPass_BonusLevel"){ if (_local3.complete){ _local2++; }; }; }; if (_local2 == 5){ return (true); }; return (false); } function AchPass_Nothing(_arg1:String):void{ } public function TestAll(){ var _local1:Achievement; var _local2:Boolean; unlockedList = new Array(); for each (_local1 in list) { if (_local1.complete == false){ _local2 = this[_local1.testFunction](_local1.testFunctionParams); if (_local2){ if (_local1.completeFunction != "AchPass_Null"){ var _local5 = this; _local5[_local1.completeFunction](_local1.completeFunctionParams); }; _local1.complete = true; unlockedList.push(_local1); }; }; }; } function AchTest_BoostLevel(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:int = int(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; if (Game.highestBoostLevel >= _local5){ return (true); }; return (false); } function AchTest_AllSequences(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); --_local4; if (_local4 != Game.currentLevel){ return (false); }; if (Game.numSequencesComplete >= Game.totalSequences){ return (true); }; return (false); } public function AllComplete():Boolean{ var _local1:Achievement; for each (_local1 in list) { if (_local1.complete == false){ return (false); }; }; return (true); } function AchTest_BackwardSomersault(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:Number = Number(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; if (Game.levelBackSomersaults >= _local5){ return (true); }; return (false); } public function GetFullString(_arg1:String, _arg2:Boolean=true, _arg3:Boolean=true):String{ var _local4:int; var _local5:String; var _local8:String; var _local9:Level; var _local10:PlayerBikeData; var _local6:Array = new Array(); _local6 = _arg1.split(" "); var _local7 = ""; for each (_local8 in _local6) { if (_local8.match("&Level")){ _local5 = _local8.substr(6); _local4 = int(_local5); _local9 = Game.levels[(_local4 - 1)]; if (_arg2){ _local8 = (("'" + _local9.name) + "'"); _local7 = (_local7 + _local8); _local7 = (_local7 + " "); }; } else { if (_local8.match("&Bike")){ _local5 = _local8.substr(5); _local4 = int(_local5); _local10 = PlayerBikes.GetBikeData((_local4 - 1)); if (_arg3){ _local8 = (("'" + _local10.name) + "'"); _local7 = (_local7 + _local8); _local7 = (_local7 + " "); }; } else { _local7 = (_local7 + _local8); _local7 = (_local7 + " "); }; }; }; return (_local7); } function AchTest_SkiJump(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:int = int(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; if (Game.skiJumpDistance >= _local5){ return (true); }; return (false); } function AchTest_Crash(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:int = int(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; if (Game.numCrashes <= _local5){ return (true); }; return (false); } function AchTest_FewPickups(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:int = int(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; FlashConnect.trace(((("Few Pickups: " + Game.numPickupsCollected) + " / ") + _local5)); if (Game.numPickupsCollected < _local5){ return (true); }; return (false); } function AchTest_DontCrash(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); --_local4; if (_local4 != Game.currentLevel){ return (false); }; if (Game.playerHitFloorCount == 0){ return (true); }; return (false); } function AchTest_FinishLevel(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:Number = Number(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; var _local6:Number = (_local5 * Defs.fps); if (Game.raceTimer <= _local6){ return (true); }; return (false); } function AchTest_TotalFrontWheelie(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:Number = Number(_local2[2]); _local5 = (_local5 * Defs.fps); if (_local4 != Game.currentLevel){ return (false); }; if (Game.levelFrontWheelieTime >= _local5){ return (true); }; return (false); } public function CalculateScore():int{ var _local7:Achievement; var _local1:Array = new Array(); var _local2 = 500; var _local3 = 750; var _local4 = 1000; _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local2, _local3, _local4); _local1.push(_local4); _local1.push(_local4); _local1.push(_local4); _local1.push(_local4); _local1.push(_local4); _local1.push(_local4); trace(((_local1.length + " --- ") + list.length)); var _local5:int; var _local6:int; while (_local6 < list.length) { _local7 = list[_local6]; if (_local7.complete){ _local5 = (_local5 + _local1[_local6]); }; _local6++; }; return (_local5); } function AchPass_BonusLevel(_arg1:String):void{ trace("Bonus level beaten"); } function AchPass_UnlockSkis(_arg1:String):void{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); _local3--; FlashConnect.trace(("unlocked Skis - " + _local3)); Game.SetSkiUnlock(_local3, true); } function AchPass_UnlockHorn(_arg1:String):void{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); _local3--; FlashConnect.trace(("unlocked Horn - " + _local3)); var _local4:PlayerBikeData = PlayerBikes.GetBikeData(_local3); _local4.bellAvailable = true; } function AchTest_Pickups(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:int = int(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; if (Game.numPickupsCollected >= _local5){ return (true); }; return (false); } function AchTest_SmashFewPenguins(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:int = int(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; FlashConnect.trace(((("smash few penguins " + Game.numPenguinsSmashed) + " / ") + _local5)); if (Game.numPenguinsSmashed < _local5){ return (true); }; return (false); } public function GetLevelAchievements(_arg1:int):Array{ var _local3:Achievement; _arg1++; var _local2:Array = new Array(); for each (_local3 in list) { if (_local3.specificLevel == _arg1){ _local2.push(_local3); }; }; return (_local2); } function AchTest_BonusPickup(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); --_local4; if (_local4 != Game.currentLevel){ return (false); }; if (Game.bonusPickupCollected){ return (true); }; return (false); } function AchPass_WinGame(_arg1:String):void{ trace("Game won"); } function AchTest_TotalRearWheelie(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:Number = Number(_local2[2]); _local5 = (_local5 * Defs.fps); if (_local4 != Game.currentLevel){ return (false); }; if (Game.levelWheelieTime >= _local5){ return (true); }; return (false); } function AchTest_AirTime(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:Number = Number(_local2[2]); _local5 = (_local5 * Defs.fps); if (_local4 != Game.currentLevel){ return (false); }; if (Game.levelAirTime >= _local5){ return (true); }; return (false); } function AchTest_AllSnowmen(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); --_local4; if (_local4 != Game.currentLevel){ return (false); }; if (Game.numSnowmenHit >= Game.totalSnowmen){ return (true); }; return (false); } function AchTest_HighestPoint(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:int = int(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; var _local6:int = -(Game.highestPoint); if (_local6 >= _local5){ return (true); }; return (false); } function AchPass_UnlockLevel(_arg1:String):void{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); _local3--; trace(("unlocked level - " + _local3)); var _local4:Level = Game.GetLevel(_local3); _local4.available = true; _local4.played = false; } function AchTest_SmashPenguins(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); _local4--; var _local5:int = int(_local2[2]); if (_local4 != Game.currentLevel){ return (false); }; FlashConnect.trace(((("smash penguins " + Game.numPenguinsSmashed) + " / ") + _local5)); if (Game.numPenguinsSmashed >= _local5){ return (true); }; return (false); } function AchTest_SneakyStart(_arg1:String):Boolean{ var _local2:Array = _arg1.split(","); var _local3:int = int(_local2[0]); if (_local3 != -1){ if ((_local3 - 1) != Game.currentBikeIndex){ return (false); }; }; var _local4:int = int(_local2[1]); --_local4; if (_local4 != Game.currentLevel){ return (false); }; if (Game.gotSneakyStart){ return (true); }; return (false); } } }//package
Section 100
//AchievementScreen (AchievementScreen) package { import flash.text.*; import flash.display.*; public dynamic class AchievementScreen extends MovieClip { public var sponsorBar:MovieClip; public var buttonMore:SimpleButton; public var textClickToPlay:TextField; public var textDescription:TextField; public var buttonViewGameCompleteScreen:SimpleButton; public var textName:TextField; public var buttonBack:SimpleButton; } }//package
Section 101
//AchievementUnlockedScreen (AchievementUnlockedScreen) package { import flash.text.*; import flash.display.*; public dynamic class AchievementUnlockedScreen extends MovieClip { public var textAchievement:TextField; public var buttonNext:SimpleButton; public var medal:AchievementBox; public var sponsorBar:MovieClip; public function AchievementUnlockedScreen(){ addFrameScript(30, frame31); } function frame31(){ stop(); } } }//package
Section 102
//AGingameButton2 (AGingameButton2) package { import flash.display.*; public dynamic class AGingameButton2 extends SimpleButton { } }//package
Section 103
//AnimDef (AnimDef) package { public class AnimDef { var endFrame:int; var name:String; var startFrame:int; public function AnimDef(_arg1:String, _arg2:int, _arg3:int){ name = _arg1; startFrame = (_arg2 - 1); endFrame = (_arg3 - 1); } } }//package
Section 104
//arcticParrot (arcticParrot) package { import flash.display.*; public dynamic class arcticParrot extends MovieClip { } }//package
Section 105
//AreYouSure (AreYouSure) package { import flash.display.*; public dynamic class AreYouSure extends MovieClip { public var buttonCancel:SimpleButton; public var buttonOK:SimpleButton; } }//package
Section 106
//background1 (background1) package { import flash.display.*; public dynamic class background1 extends MovieClip { } }//package
Section 107
//background2 (background2) package { import flash.display.*; public dynamic class background2 extends MovieClip { } }//package
Section 108
//background3 (background3) package { import flash.display.*; public dynamic class background3 extends MovieClip { } }//package
Section 109
//background4 (background4) package { import flash.display.*; public dynamic class background4 extends MovieClip { } }//package
Section 110
//background5 (background5) package { import flash.display.*; public dynamic class background5 extends MovieClip { } }//package
Section 111
//background6 (background6) package { import flash.display.*; public dynamic class background6 extends MovieClip { } }//package
Section 112
//BikeSelectScreen (BikeSelectScreen) package { import flash.text.*; import flash.display.*; public dynamic class BikeSelectScreen extends MovieClip { public var badge5:MovieClip; public var buttonOK:SimpleButton; public var textBikerName:TextField; public var buttonBack:SimpleButton; public var chosenSki:MovieClip; public var ski1:MovieClip; public var ski2:MovieClip; public var ski3:MovieClip; public var ski4:MovieClip; public var ski5:MovieClip; public var ski6:MovieClip; public var textUnlock:TextField; public var footwear4:MovieClip; public var footwear5:MovieClip; public var footwear6:MovieClip; public var footwear7:MovieClip; public var textBikerBio:TextField; public var footwear2:MovieClip; public var footwear3:MovieClip; public var badge1:MovieClip; public var badge2:MovieClip; public var badge3:MovieClip; public var badge4:MovieClip; public var chosen:MovieClip; public var buttonAchievements:SimpleButton; public var badge6:MovieClip; public var footwear1:MovieClip; } }//package
Section 113
//BonusPickup (BonusPickup) package { import flash.display.*; public dynamic class BonusPickup extends MovieClip { } }//package
Section 114
//boostBar (boostBar) package { import flash.display.*; public dynamic class boostBar extends MovieClip { } }//package
Section 115
//BoostLevel (BoostLevel) package { import flash.display.*; public dynamic class BoostLevel extends MovieClip { } }//package
Section 116
//BrickWall (BrickWall) package { import flash.display.*; public dynamic class BrickWall extends MovieClip { } }//package
Section 117
//BrickWall_Hit (BrickWall_Hit) package { import flash.display.*; public dynamic class BrickWall_Hit extends MovieClip { } }//package
Section 118
//buttonInGameMoreGames (buttonInGameMoreGames) package { import flash.display.*; public dynamic class buttonInGameMoreGames extends SimpleButton { } }//package
Section 119
//buttonPauseMute (buttonPauseMute) package { import flash.display.*; public dynamic class buttonPauseMute extends SimpleButton { } }//package
Section 120
//Cactus (Cactus) package { import flash.display.*; public dynamic class Cactus extends MovieClip { } }//package
Section 121
//Cactus_Hit (Cactus_Hit) package { import flash.display.*; public dynamic class Cactus_Hit extends MovieClip { } }//package
Section 122
//Cactus1 (Cactus1) package { import flash.display.*; public dynamic class Cactus1 extends MovieClip { } }//package
Section 123
//Checkpoint (Checkpoint) package { import flash.display.*; public dynamic class Checkpoint extends MovieClip { } }//package
Section 124
//Collision (Collision) package { import flash.geom.*; public class Collision { public static var stats_numIntersections:int; static var PolyCollision_LineHit:Line; public static var IntersectionX:Number = 0; public static var IntersectionY:Number = 0; public static var stats_numBBTests:int; public static var stats_numPolyCollisionTests:int; public static var closestX:Number = 0; public static var closestY:Number = 0; static var PhysObjList:Array = new Array(); public static var closestInfiniteX:Number = 0; public static var closestInfiniteY:Number = 0; public static var main:Main; public static function FindNearestPathStartPointToPos(_arg1:Number, _arg2:Number):Poly{ var _local5:Poly; var _local6:Point; var _local7:*; var _local3:Poly; var _local4:Number = 99999999; for each (_local5 in Game.polygonList) { if (((_local5.active) && ((_local5.type == Poly.polytype_PATH)))){ _local6 = _local5.GetPoint(0); _local7 = Utils.Dist2BetweenPoints(_local6.x, _local6.y, _arg1, _arg2); if (_local7 < _local4){ _local4 = _local7; _local3 = _local5; }; }; }; return (_local3); } static function SideOfLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Boolean{ var _local7:Number = DotProduct((_arg3 - _arg1), (_arg4 - _arg2), (_arg5 - _arg1), (_arg6 - _arg2)); if (_local7 < 0){ return (false); }; return (true); } static function GameObjectInPolyBoundingBox(_arg1:GameObj, _arg2:Poly):Boolean{ var _local3:Number = (_arg1.radius + 50); var _local4:Number = _arg1.xpos; var _local5:Number = _arg1.ypos; if (_arg2.boundingRectangle == null){ return (false); }; stats_numBBTests++; if (_local4 < (_arg2.boundingRectangle.left - _local3)){ return (false); }; if (_local4 > (_arg2.boundingRectangle.right + _local3)){ return (false); }; if (_local5 < (_arg2.boundingRectangle.top - _local3)){ return (false); }; if (_local5 > (_arg2.boundingRectangle.bottom + _local3)){ return (false); }; return (true); } static function DotProduct(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ var _local5:Number = ((_arg1 * _arg3) + (_arg2 * _arg4)); return (_local5); } static function PolyCollision(_arg1:GameObj, _arg2:Poly, _arg3:Number, _arg4:Number, _arg5:Number):Boolean{ var _local8:Line; var _local9:Boolean; var _local10:Number; var _local15:Line; var _local16:int; var _local17:int; var _local18:*; var _local19:Number; var _local20:Number; var _local21:Line; var _local22:Line; stats_numPolyCollisionTests++; var _local6:Array = new Array(); var _local7:Array = new Array(); var _local11:Number = (_arg1.xpos + _arg3); var _local12:Number = (_arg1.ypos + _arg4); var _local13:Number = _arg5; var _local14:Number = (_arg5 * _local13); for each (_local15 in _arg2.lineList) { _local9 = SideOfLine(_local15.x0, _local15.y0, _local15.x1, _local15.y1, _local11, _local12); if (_local9 == true){ _local10 = Dist2ToLine(_local15.x0, _local15.y0, _local15.x1, _local15.y1, _local11, _local12); if (_local10 < _local14){ _local6.push(_local15); _local7.push(_local10); }; }; }; _local18 = _local6.length; _local16 = 0; while (_local16 < (_local18 - 1)) { _local17 = _local16; while (_local17 < _local18) { _local19 = _local7[_local16]; _local20 = _local7[_local17]; _local21 = _local6[_local16]; _local22 = _local6[_local17]; if (_local20 < _local19){ _local7[_local16] = _local20; _local7[_local17] = _local19; _local6[_local16] = _local22; _local6[_local17] = _local21; }; _local17++; }; _local16++; }; _local16 = 0; while (_local16 < _local18) { _local8 = _local6[_local16]; _local9 = SideOfLine(_local8.x0, _local8.y0, _local8.x1, _local8.y1, _local11, _local12); if (_local9 == true){ _local10 = Dist2ToLine(_local8.x0, _local8.y0, _local8.x1, _local8.y1, _local11, _local12); if (_local10 < _local14){ stats_numIntersections++; Intersected(_arg1, _local8, closestX, closestY, _arg3, _arg4, _arg5); PolyCollision_LineHit = _local8; return (true); }; }; return (true); _local16++; }; return (false); } public static function LineLineIntersection(_arg1:Line, _arg2:Line):Boolean{ var _local3:Number = _arg1.x0; var _local4:Number = _arg1.y0; var _local5:Number = _arg1.x1; var _local6:Number = _arg1.y1; var _local7:Number = _arg2.x0; var _local8:Number = _arg2.y0; var _local9:Number = _arg2.x1; var _local10:Number = _arg2.y1; var _local11:Number = (_local5 - _local3); var _local12:Number = (_local9 - _local7); var _local13:Number = ((_local6 - _local4) / _local11); var _local14:Number = ((_local10 - _local8) / _local12); var _local15:Number = (_local4 - (_local13 * _local3)); var _local16:Number = (_local8 - (_local14 * _local7)); var _local17:Number = ((_local15 - _local16) / (_local14 - _local13)); var _local18:Number = (((_local13 * (_local16 - _local15)) / (_local13 - _local14)) + _local15); if (_arg1.boundingRect.contains(_local17, _local18)){ if (_arg2.boundingRect.contains(_local17, _local18)){ IntersectionX = _local17; IntersectionY = _local18; return (true); }; }; return (false); } public static function FindHighestFloorPos(_arg1:Number):Number{ var _local2:Number; var _local3:Boolean; var _local4:Poly; var _local5:Line; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; for each (_local4 in Game.polygonList) { for each (_local5 in _local4.lineList) { _local6 = _arg1; _local7 = 0; if ((((_local6 >= _local5.x0)) && ((_local6 <= _local5.x1)))){ _local8 = ((1 / (_local5.x1 - _local5.x0)) * (_local6 - _local5.x0)); _local9 = (_local5.y0 + (_local5.dy * _local8)); return (_local9); }; }; }; return (999999); } static function Dist2ToLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{ ClosestPointOnLine(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6); var _local7:Number = (closestX - _arg5); var _local8:Number = (closestY - _arg6); return (((_local7 * _local7) + (_local8 * _local8))); } static function PlayerPickupCollision(){ var _local7:GameObj; var _local8:Boolean; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local1:PhysObj_Instance = Game.GetPhysObjInstanceByName("player"); if (_local1 == null){ return; }; var _local2:GameObj = _local1.GetGameObject(0); var _local3:Number = (Math.cos((_local2.dir - (Math.PI / 2))) * 30); var _local4:Number = (Math.sin((_local2.dir - (Math.PI / 2))) * 30); _local3 = 0; _local4 = 0; var _local5:Number = (_local2.xpos + _local3); var _local6:Number = (_local2.ypos + _local4); for each (_local7 in PhysObjList) { _local8 = false; _local9 = (_local5 - _local7.xpos); _local10 = (_local6 - _local7.ypos); if (_local7.name == "hoop"){ _local9 = (_local5 - (_local7.xpos + 14)); _local11 = Math.abs(_local9); _local12 = Math.abs(_local10); if ((((_local11 < 14)) && ((_local12 < 90)))){ _local8 = true; }; } else { if (_local7.name == "jumpstart"){ if (_local5 > _local7.xpos){ _local8 = true; }; } else { _local13 = _local7.radius; _local14 = (_local7.radius * _local13); _local15 = ((_local9 * _local9) + (_local10 * _local10)); if (_local15 < _local14){ _local8 = true; }; }; }; if (_local8){ if (_local7.collisionHitFunction != null){ _local7.collisionHitFunction(_local2); }; }; }; } static function DistBetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ var _local5:Number = (_arg3 - _arg1); var _local6:Number = (_arg4 - _arg2); return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6)))); } public static function SingleObjectZoneCollision(_arg1:GameObj):Poly{ var _local2:Poly; for each (_local2 in Game.polygonList) { if (((_local2.active) && ((_local2.type == Poly.polytype_ZONE)))){ if (GameObjectInPolyBoundingBox(_arg1, _local2)){ if (PointInConvexPoly(_arg1.xpos, _arg1.ypos, _local2.lineList)){ return (_local2); }; }; }; }; return (null); } public static function PointInConvexPoly(_arg1:Number, _arg2:Number, _arg3:Array):Boolean{ var _local5:int; var _local6:Line; var _local7:Number; var _local4:int = _arg3.length; _local5 = 0; while (_local5 < _local4) { _local6 = _arg3[_local5]; _local7 = DotProduct((_local6.x0 - _arg1), (_local6.y0 - _arg2), _local6.nx, _local6.ny); if (_local7 < 0){ return (false); }; _local5++; }; return (true); } static function DistBetween(_arg1:GameObj, _arg2:GameObj):Number{ var _local3:Number = (_arg2.xpos - _arg1.xpos); var _local4:Number = (_arg2.ypos - _arg1.ypos); return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4)))); } public static function ClosestPointOnLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{ var _local7:Number = (_arg5 - _arg1); var _local8:Number = (_arg6 - _arg2); var _local9:Number = (_arg3 - _arg1); var _local10:Number = (_arg4 - _arg2); var _local11:Number = ((_local9 * _local9) + (_local10 * _local10)); var _local12:Number = ((_local7 * _local9) + (_local8 * _local10)); var _local13:Number = (_local12 / _local11); closestInfiniteX = (_arg1 + (_local9 * _local13)); closestInfiniteY = (_arg2 + (_local10 * _local13)); if (_local13 < 0){ _local13 = 0; }; if (_local13 > 1){ _local13 = 1; }; closestX = (_arg1 + (_local9 * _local13)); closestY = (_arg2 + (_local10 * _local13)); } static function Intersected(_arg1:GameObj, _arg2:Line, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):void{ var _local14:int; var _local15:Number; var _local8 = 50; var _local9:Number = ((_arg1.oldxpos + _arg5) - _arg3); var _local10:Number = ((_arg1.oldypos + _arg6) - _arg4); _local9 = (_local9 / Number(_local8)); _local10 = (_local10 / Number(_local8)); var _local11:Number = (_arg1.xpos + _arg5); var _local12:Number = (_arg1.ypos + _arg6); var _local13:Number = (_arg7 * _arg7); _local14 = 0; while (_local14 < _local8) { _local11 = (_local11 + _local9); _local12 = (_local12 + _local10); _local15 = Dist2ToLine(_arg2.x0, _arg2.y0, _arg2.x1, _arg2.y1, _local11, _local12); if (_local15 > _local13){ _arg1.xpos = (_local11 - _arg5); _arg1.ypos = (_local12 - _arg6); return; }; _local14++; }; } public static function MakeLists(){ var _local1:GameObj; PhysObjList.splice(0, PhysObjList.length); for each (_local1 in GameObjects.objs) { if (((_local1.active) && (_local1.colFlag_canBePickedUp))){ PhysObjList.push(_local1); }; }; } static function SideOfLine1(_arg1:Line, _arg2:Number, _arg3:Number):Boolean{ var _local4:Number = DotProduct((_arg1.x1 - _arg1.x0), (_arg1.y1 - _arg1.y0), (_arg2 - _arg1.x0), (_arg3 - _arg1.y0)); if (_local4 < 0){ return (false); }; return (true); } public static function Update(){ stats_numIntersections = 0; stats_numBBTests = 0; stats_numPolyCollisionTests = 0; Debug.StartTimer("collision"); MakeLists(); PlayerPickupCollision(); Debug.EndTimer("collision"); } public static function PlayerDeathZoneCollision():void{ var _local2:Poly; if (Game.goPlayer.colFlag_playercanbekilled == false){ return; }; var _local1:GameObj = Game.goPlayer; for each (_local2 in Game.polygonList) { if (((((_local2.active) && ((_local2.type == Poly.polytype_ZONE)))) && ((_local2.subTypeName == "Death")))){ if (GameObjectInPolyBoundingBox(_local1, _local2)){ if (PointInConvexPoly(_local1.xpos, _local1.ypos, _local2.lineList)){ _local1.PlayerHitEnemy(null); return; }; }; }; }; } static function DistToLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{ ClosestPointOnLine(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6); var _local7:Number = (closestX - _arg5); var _local8:Number = (closestY - _arg6); var _local9:Number = Math.sqrt(((_local7 * _local7) + (_local8 * _local8))); return (_local9); } static function Dist2Between(_arg1:GameObj, _arg2:GameObj):Number{ var _local3:Number = (_arg2.xpos - _arg1.xpos); var _local4:Number = (_arg2.ypos - _arg1.ypos); return (((_local3 * _local3) + (_local4 * _local4))); } public static function FindPathByIndex(_arg1:int):Poly{ var _local3:Poly; var _local2:int; for each (_local3 in Game.polygonList) { if (((_local3.active) && ((_local3.type == Poly.polytype_PATH)))){ if (_local2 == _arg1){ return (_local3); }; _local2++; }; }; return (null); } static function Dist2BetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ var _local5:Number = (_arg3 - _arg1); var _local6:Number = (_arg4 - _arg2); return (((_local5 * _local5) + (_local6 * _local6))); } } }//package
Section 125
//ContactListener (ContactListener) package { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class ContactListener extends b2ContactListener { override public function Add(_arg1:b2ContactPoint):void{ var _local2:GameObj; var _local3:PhysObj_Instance; var _local4:b2Body; var _local6:b2Body; _local4 = _arg1.shape1.GetBody(); var _local5:PhysObj_BodyUserData = _local4.GetUserData(); _local6 = _arg1.shape2.GetBody(); var _local7:PhysObj_BodyUserData = _local6.GetUserData(); var _local8:b2Vec2 = new b2Vec2(0, 0); Game.numCollisionTests++; TestBikeWheelDown(_arg1); if (((_local5.type.match("bike")) && ((_local7.type == "Pickup")))){ _local7.instance.collideFunction = Game.RemoveObj_Pickup; if (_local7.instance.collidetimer == 0){ _local7.instance.collidetimer = 10; }; }; if (((_local7.type.match("bike")) && ((_local5.type == "Pickup")))){ _local5.instance.collideFunction = Game.RemoveObj_Pickup; if (_local5.instance.collidetimer == 0){ _local5.instance.collidetimer = 10; }; }; if (((_local5.type.match("bike")) && ((_local7.type == "switch_to_back")))){ Game.SwitchToBack(); }; if (((_local7.type.match("bike")) && ((_local5.type == "switch_to_back")))){ Game.SwitchToBack(); }; if (((_local5.type.match("bike")) && ((_local7.type == "switch_to_front")))){ Game.SwitchToFront(); }; if (((_local7.type.match("bike")) && ((_local5.type == "switch_to_front")))){ Game.SwitchToFront(); }; if (((_local5.type.match("bike")) && ((_local7.type == "endrace")))){ Game.CrossedFinishLine(); }; if (((_local7.type.match("bike")) && ((_local5.type == "endrace")))){ Game.CrossedFinishLine(); }; if ((((_local7.type == "ball")) && ((_local5.type == "mover50")))){ _local8.x = Math.cos(Utils.DegToRad(_local5.instance.rot)); _local8.y = Math.sin(Utils.DegToRad(_local5.instance.rot)); _local8.Multiply(50); _local6.ApplyForce(_local8, _local6.GetWorldCenter()); }; if ((((_local5.type == "ball")) && ((((_local7.type == "bouncer")) || ((_local7.type == "bouncer2")))))){ _local2 = GameObjects.objs[_local7.gameObjectID]; _local2.BouncerBounce(); SoundPlayer.Play("sfx_boing"); }; if ((((_local7.type == "ball")) && ((((_local5.type == "bouncer")) || ((_local5.type == "bouncer2")))))){ _local2 = GameObjects.objs[_local5.gameObjectID]; _local2.BouncerBounce(); SoundPlayer.Play("sfx_boing"); }; if ((((_local5.type == "ball")) && ((_local7.type == "conveyor100")))){ _local8.x = Math.cos(Utils.DegToRad(_local7.instance.rot)); _local8.y = Math.sin(Utils.DegToRad(_local7.instance.rot)); _local4.ApplyForce(_local8, _local4.GetLocalCenter()); }; if ((((_local7.type == "ball")) && ((_local5.type == "conveyor100")))){ _local8.x = Math.cos(Utils.DegToRad(_local5.instance.rot)); _local8.y = Math.sin(Utils.DegToRad(_local5.instance.rot)); _local6.ApplyForce(_local8, _local6.GetLocalCenter()); }; if ((((_local5.type == "ball")) && ((_local7.type == "gem")))){ _local7.instance.collideFunction = Game.RemoveObj_Gem; if (_local7.instance.collidetimer == 0){ _local7.instance.collidetimer = 10; }; }; if ((((_local7.type == "ball")) && ((_local5.type == "gem")))){ _local5.instance.collideFunction = Game.RemoveObj_Gem; if (_local5.instance.collidetimer == 0){ _local5.instance.collidetimer = 10; }; }; if ((((_local5.type == "cannonball")) && ((((_local7.type == "pin_disappear")) || ((_local7.type == "pin_disappear_broken")))))){ _local2 = GameObjects.objs[_local7.gameObjectID]; if (_local2.PinDisappearHit()){ _local7.instance.collideFunction = Game.RemoveObj_Standard; if (_local7.instance.collidetimer == 0){ _local7.instance.collidetimer = 10; }; }; }; if ((((_local7.type == "cannonball")) && ((((_local5.type == "pin_disappear")) || ((_local5.type == "pin_disappear_broken")))))){ SoundPlayer.Play("sfx_removepin", Utils.RandBetweenFloat(0.5, 1)); _local2 = GameObjects.objs[_local5.gameObjectID]; if (_local2.PinDisappearHit()){ _local5.instance.collideFunction = Game.RemoveObj_Standard; if (_local5.instance.collidetimer == 0){ _local5.instance.collidetimer = 10; }; }; }; } public function TestBikeWheelDown(_arg1:b2ContactPoint):void{ var _local2:b2Body = _arg1.shape1.GetBody(); var _local3:PhysObj_BodyUserData = _local2.GetUserData(); var _local4:b2Body = _arg1.shape2.GetBody(); var _local5:PhysObj_BodyUserData = _local4.GetUserData(); if (_local3.type.match("bike")){ if (_local5.type.match("killer")){ Game.StartPlayerHitFloor(); }; if (_arg1.shape1.m_userData == "body"){ Game.StartPlayerHitFloor(); } else { Game.BikeWheelIsDown(); }; }; if (_local5.type.match("bike")){ if (_local3.type.match("killer")){ Game.StartPlayerHitFloor(); }; if (_arg1.shape2.m_userData == "body"){ Game.StartPlayerHitFloor(); } else { Game.BikeWheelIsDown(); }; }; } override public function Persist(_arg1:b2ContactPoint):void{ var _local2:GameObj; var _local3:PhysObj_Instance; var _local4:b2Body; var _local6:b2Body; var _local8:b2Vec2; _local4 = _arg1.shape1.GetBody(); var _local5:PhysObj_BodyUserData = _local4.GetUserData(); _local6 = _arg1.shape2.GetBody(); var _local7:PhysObj_BodyUserData = _local6.GetUserData(); _local8 = new b2Vec2(0, 0); Game.numCollisionTests++; TestBikeWheelDown(_arg1); if (((_local5.type.match("bike")) && ((_local7.type == "mover50")))){ _local8.x = Math.cos(Utils.DegToRad(_local7.instance.rot)); _local8.y = Math.sin(Utils.DegToRad(_local7.instance.rot)); _local8.Multiply(50); _local4.ApplyForce(_local8, _local4.GetWorldCenter()); }; if (((_local7.type.match("bike")) && ((_local5.type == "mover50")))){ _local8.x = Math.cos(Utils.DegToRad(_local5.instance.rot)); _local8.y = Math.sin(Utils.DegToRad(_local5.instance.rot)); _local8.Multiply(50); _local6.ApplyForce(_local8, _local6.GetWorldCenter()); }; } } }//package
Section 126
//CPMStarLoaderScreen (CPMStarLoaderScreen) package { import flash.display.*; public dynamic class CPMStarLoaderScreen extends MovieClip { public var loader:MovieClip; public var buttonSkipCPMStarAd:SimpleButton; public var adBox:MovieClip; } }//package
Section 127
//Crystals (Crystals) package { import flash.display.*; public dynamic class Crystals extends MovieClip { } }//package
Section 128
//Crystals_Hit (Crystals_Hit) package { import flash.display.*; public dynamic class Crystals_Hit extends MovieClip { } }//package
Section 129
//Debug (Debug) package { import flash.display.*; import flash.utils.*; import org.flashdevelop.utils.*; public class Debug { static var timerTimes:Array; static var timerNames:Array; static var timerStartTimes:Array; public static var debugMode:int = 0; static var immediateTime:int; public function Debug(){ timerNames = new Array(); timerStartTimes = new Array(); timerTimes = new Array(); } public static function RenderTimers(_arg1:BitmapData){ var _local5:String; var _local6:int; var _local7:Number; if (IsSet(2) == false){ return; }; var _local2:Number = timerTimes[0]; var _local3 = 80; var _local4 = 50; _local6 = 0; while (_local6 < timerNames.length) { _local7 = ((100 / _local2) * timerTimes[_local6]); _local5 = (((((("Timer " + timerNames[_local6]) + " : ") + timerTimes[_local6]) + " (") + int(_local7).toString()) + "%"); GraphicObjects.RenderStringAt(_arg1, GraphicObjects.gfx_font1, _local4, _local3, _local5); _local3 = (_local3 + 15); _local6++; }; } public static function StopImmediateTimer(_arg1:String){ var _local2:int = (getTimer() - immediateTime); FlashConnect.trace(((("Immediate Timer: " + _local2) + " - ") + _arg1)); } public static function StartTimer(_arg1:String){ timerNames.push(_arg1); timerStartTimes.push(getTimer()); timerTimes.push(getTimer()); } public static function EndTimer(_arg1:String){ var _local3:String; var _local2:int; for each (_local3 in timerNames) { if (_local3 == _arg1){ timerTimes[_local2] = (getTimer() - timerStartTimes[_local2]); }; _local2++; }; } public static function StartTimers(){ timerNames = new Array(); timerTimes = new Array(); timerStartTimes = new Array(); StartTimer("total"); } public static function IsSet(_arg1:int):Boolean{ if ((debugMode & _arg1) == 0){ return (false); }; return (true); } public static function StartImmediateTimer(){ immediateTime = getTimer(); } public static function StopTimers(){ EndTimer("total"); } } }//package
Section 130
//Defs (Defs) package { import flash.geom.*; public class Defs { public static const zpos_PICKUP = 1100; public static const zpos_ENEMY = 1000; public static const displayarea_w = 640; public static const zpos_OVERLAY = 500; public static const zpos_PLAYER = 1000; public static const fps:Number = 33; public static const zpos_FAR = 10000; public static const zpos_BACKGROUND = 10000; public static const displayarea_h = 480; public static const platformW2 = 15; public static var screenRect:Rectangle = new Rectangle(0, 0, displayarea_w, displayarea_h); public static var pointZero:Point = new Point(0, 0); } }//package
Section 131
//DisplayObj (DisplayObj) package { import flash.events.*; import flash.text.*; import flash.display.*; import flash.geom.*; public class DisplayObj { var frames:Array; var flags:int; public var frame:int; public function DisplayObj(_arg1:String, _arg2:MovieClip, _arg3:Number, _arg4:int):void{ flags = _arg4; frame = 0; if (_arg2 != null){ CreateBitmapsFromMovieClip(_arg1, _arg2, flags); }; } public function SetFrame(_arg1:int){ frame = _arg1; if (frame < 0){ frame = 0; }; if (frame >= frames.length){ frame = (frames.length - 1); }; } public function GetMaxFrames():int{ return (frames.length); } public function CreateBitmapsFromMovieClip(_arg1:String, _arg2:MovieClip, _arg3:int):void{ var _local4:int; var _local5:int; var _local6:int; var _local7:int; var _local8:Matrix; var _local9:Rectangle; var _local10:Bitmap; var _local11:BitmapData; var _local12:Bitmap; var _local13:BitmapData; var _local15:*; frames = new Array(); var _local14 = 1; _arg2.gotoAndStop(1); _local4 = 0; while (_local4 < _arg2.totalFrames) { _local15 = new DisplayObjFrame(); _local15.mat = new Matrix(); _local15.colTrans = new ColorTransform(); _local9 = _arg2.getBounds(null); _local9.x = Math.floor(_local9.x); _local9.y = Math.floor(_local9.y); _local9.width = Math.ceil(_local9.width); _local9.height = Math.ceil(_local9.height); _local7 = Math.floor(_local7); _local8 = new Matrix(); _local6 = _local9.left; _local7 = _local9.top; _local8.translate(-(_local6), -(_local7)); _local15.xoffset = Number(_local6); _local15.yoffset = Number(_local7); if (((!((_arg2.width == 0))) && (!((_arg2.height == 0))))){ _local11 = new BitmapData(_local9.width, _local9.height, true, 0); _local11.draw(_arg2, _local8); _local15.bitmapData = _local11; } else { trace(((("ERROR: Null bitmap found. MC=" + _arg1) + " frame=") + _local14)); _local15.bitmapData = null; }; _local15.sourceRect = new Rectangle(0, 0, _local11.width, _local11.height); _local15.point = new Point(0, 0); frames.push(_local15); _arg2.nextFrame(); _local14++; _local4++; }; } function CreateAsciiStringTable():Array{ var _local1:Array = new Array(); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(""); _local1.push(" "); _local1.push("!"); _local1.push("'"); _local1.push("#"); _local1.push("$"); _local1.push("%"); _local1.push("&"); _local1.push("'"); _local1.push("("); _local1.push(")"); _local1.push("*"); _local1.push("+"); _local1.push(","); _local1.push("-"); _local1.push("."); _local1.push("/"); _local1.push("0"); _local1.push("1"); _local1.push("2"); _local1.push("3"); _local1.push("4"); _local1.push("5"); _local1.push("6"); _local1.push("7"); _local1.push("8"); _local1.push("9"); _local1.push(":"); _local1.push(";"); _local1.push("<"); _local1.push("="); _local1.push(">"); _local1.push("?"); _local1.push("@"); _local1.push("A"); _local1.push("B"); _local1.push("C"); _local1.push("D"); _local1.push("E"); _local1.push("F"); _local1.push("G"); _local1.push("H"); _local1.push("I"); _local1.push("J"); _local1.push("K"); _local1.push("L"); _local1.push("M"); _local1.push("N"); _local1.push("O"); _local1.push("P"); _local1.push("Q"); _local1.push("R"); _local1.push("S"); _local1.push("T"); _local1.push("U"); _local1.push("V"); _local1.push("W"); _local1.push("X"); _local1.push("Y"); _local1.push("Z"); _local1.push("["); _local1.push("\\"); _local1.push("]"); _local1.push("^"); _local1.push("_"); _local1.push("'"); _local1.push("a"); _local1.push("b"); _local1.push("c"); _local1.push("d"); _local1.push("e"); _local1.push("f"); _local1.push("g"); _local1.push("h"); _local1.push("i"); _local1.push("j"); _local1.push("k"); _local1.push("l"); _local1.push("m"); _local1.push("n"); _local1.push("o"); _local1.push("p"); _local1.push("q"); _local1.push("r"); _local1.push("s"); _local1.push("t"); _local1.push("u"); _local1.push("v"); _local1.push("w"); _local1.push("x"); _local1.push("y"); _local1.push("z"); _local1.push("{"); _local1.push("|"); _local1.push("}"); _local1.push("~"); return (_local1); } public function CreateFont(_arg1:TextFormat):void{ var _local2:int; var _local3:int; var _local4:int; var _local5:int; var _local6:Matrix; var _local7:Rectangle; var _local8:Bitmap; var _local9:BitmapData; var _local11:TextField; var _local12:*; frames = new Array(); var _local10:Array = CreateAsciiStringTable(); _local2 = 0; while (_local2 < _local10.length) { _local11 = new TextField(); _local11.textColor = 4294967295; _local11.selectable = false; _local11.embedFonts = true; _local11.autoSize = TextFieldAutoSize.LEFT; _local11.x = 0; _local11.y = 0; _local11.text = _local10[_local2]; _local11.setTextFormat(_arg1); _local12 = new DisplayObjFrame(); _local12.mat = new Matrix(); _local12.colTrans = new ColorTransform(); _local7 = _local11.getBounds(null); _local6 = new Matrix(); _local6.translate(-(_local7.x), -(_local7.y)); _local12.xoffset = 0; _local12.yoffset = 0; _local9 = new BitmapData(_local7.width, _local7.height, true, 0); _local9.draw(_local11, _local6, null, null, null, true); _local12.bitmapData = _local9; _local12.sourceRect = new Rectangle(0, 0, _local9.width, _local9.height); _local12.point = new Point(0, 0); frames.push(_local12); _local2++; }; } } }//package
Section 132
//DisplayObjFrame (DisplayObjFrame) package { import flash.events.*; import flash.display.*; import flash.geom.*; class DisplayObjFrame { public var mat:Matrix; public var colTrans:ColorTransform; public var xoffset:Number; public var yoffset:Number; public var point:Point; public var bitmapData:BitmapData; public var sourceRect:Rectangle; public function RenderAt(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{ point.x = (_arg2 + xoffset); point.y = (_arg3 + yoffset); _arg1.copyPixels(bitmapData, sourceRect, point, null, null, true); } public function RenderAtRotScaled(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number=1, _arg5:Number=0, _arg6:ColorTransform=null, _arg7:Boolean=false):void{ mat.identity(); mat.translate(xoffset, yoffset); mat.rotate(_arg5); mat.translate(-(xoffset), -(yoffset)); mat.scale(_arg4, _arg4); mat.translate((_arg2 + (xoffset * _arg4)), (_arg3 + (yoffset * _arg4))); if (bitmapData != null){ _arg1.draw(bitmapData, mat, _arg6, null, null, _arg7); }; } public function RenderAtRotScaled_SourceRect(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number=1, _arg5:Number=0, _arg6:ColorTransform=null, _arg7:Boolean=false, _arg8:Rectangle=null, _arg9:int=0, _arg10:int=0):void{ mat.identity(); mat.translate(xoffset, yoffset); mat.rotate(_arg5); mat.translate(-(xoffset), -(yoffset)); mat.scale(_arg4, _arg4); mat.translate((_arg2 + ((xoffset - _arg9) * _arg4)), (_arg3 + ((yoffset - _arg10) * _arg4))); _arg8.x = _arg2; _arg8.y = _arg3; if (bitmapData != null){ _arg1.draw(bitmapData, mat, _arg6, null, _arg8, _arg7); }; } } }//package
Section 133
//EasterStatue (EasterStatue) package { import flash.display.*; public dynamic class EasterStatue extends MovieClip { } }//package
Section 134
//EasterStatue_Hit (EasterStatue_Hit) package { import flash.display.*; public dynamic class EasterStatue_Hit extends MovieClip { } }//package
Section 135
//EnterCheatCodeScreen (EnterCheatCodeScreen) package { import flash.text.*; import flash.display.*; public dynamic class EnterCheatCodeScreen extends MovieClip { public var tick0:MovieClip; public var buttonOK:SimpleButton; public var textInput:TextField; public var unlock1:TextField; public var unlock2:TextField; public var unlock3:TextField; public var tick1:MovieClip; public var tick2:MovieClip; public var tick3:MovieClip; public var buttonBack:SimpleButton; public var buttonHints:SimpleButton; public var unlock0:TextField; } }//package
Section 136
//exportedButtonSiKids (exportedButtonSiKids) package { import flash.display.*; public dynamic class exportedButtonSiKids extends SimpleButton { } }//package
Section 137
//ExternalData (ExternalData) package { import flash.events.*; import flash.net.*; import org.flashdevelop.utils.*; import flash.system.*; public class ExternalData { static var xmlLoader:URLLoader; public static var constants:Object; static var loader:URLLoader; public static var xml:XML; static var xxx:XML = <data> <playerbike bike="1" selectframe="1" ingameid="6" name="Pirate James" acc="200" vel="150" jumpvel="1500" bio="Speed: 1/6. Ex Secret agent turned pirate entrepreneur, he set up the worlds largest pirate emporium which naturally led him to be one of the worlds best skiers. He has license to break his leg in three places."/> <playerbike bike="2" selectframe="2" ingameid="5" name="Lee Cliff Van" acc="200" vel="155" jumpvel="1550" bio="Speed: 2/6. More at home on top of his mule, dont mess with his mule ! His main job as spaghetti delivery driver has paid his way for entry to this competition although his technique is espcially ugly. "/> <playerbike bike="3" selectframe="3" ingameid="3" name="Squirrel Man" acc="200" vel="160" jumpvel="1600" bio="Speed: 3/6. Squirrel man was originally the worlds top super villain, we'll he would have been but he failed the job interview, he now works as a postman and just does super villianing at weekends as a hobby. A natural skier with a great jump."/> <playerbike bike="4" selectframe="4" ingameid="4" name="Sammy Toyota" acc="200" vel="165" jumpvel="1650" bio="Speed: 4/6. Sammy is ex sumo world champion, after 23 years of consequtive titles he quit the sport to try and become champion at darts, that didnt work out and neither did syncronised swimming so he took up skiing. His extra blubber does come in handy as he rolls down the mountain."/> <playerbike bike="5" selectframe="5" ingameid="2" name="Santa Carlos" acc="200" vel="170" jumpvel="1700" bio="Speed: 5/6. Carlos is Bolvias answer to er... I cant think of any famous skiers, Eddie edwards... Training in the bolivian mountains using only greased up palm leaves as skis he is a natural. He took the santa job to pay for his training."/> <playerbike bike="6" selectframe="6" ingameid="1" name="Babe Lincoln" acc="200" vel="175" jumpvel="1750" bio="Speed: 6/6. One of America's greatest icons brought back from the dead after being cryogenically frozen in time. Naturally good at everything he does he makes a great skiier especially with his aerodynamically shaped helmet."/> <constants> <constant name="obstaclecol" value="2,1"/> <constant name="bridge_dens" value="2"/> <constant name="bridge_dist" value="2"/> <constant name="hoselindamp" value="0"/> <constant name="hoselowerang" value="-7"/> <constant name="hoseupperang" value="7"/> <constant name="hosedensity" value="0.4"/> </constants> <gameconstants> <constant name="swingdist" value="30"/> <constant name="swingforce" value="4"/> <constant name="swingreleaseforce" value="0.2"/> </gameconstants> <level name="Level 1, Easy Pickings" fillframe="1" surfaceframe="2" surfacethickness="10"> <objgroup name=""> <obj type="endrace" x="27248" y="-1878" rot="0" params=""/> <obj type="Checkpoint" x="414" y="-4783" rot="0" params=""/> <obj type="Pickup01" x="20795" y="-2513" rot="0" params=""/> <obj type="Pickup02" x="20868" y="-2515" rot="0" params=""/> <obj type="Pickup02" x="20952" y="-2519" rot="0" params=""/> <obj type="Pickup02" x="21040" y="-2524" rot="0" params=""/> <obj type="Pickup02" x="21113" y="-2530" rot="0" params=""/> <obj type="Ramp" x="13068" y="-3190" rot="0" params=""/> <obj type="Ramp" x="22544" y="-2568" rot="0" params=""/> <obj type="Hoop" x="23048" y="-2715" rot="0" params=""/> <obj type="Pickup01" x="13238" y="-3292" rot="0" params=""/> <obj type="Pickup02" x="13302" y="-3304" rot="0" params=""/> <obj type="Pickup02" x="13356" y="-3319" rot="0" params=""/> <obj type="Pickup02" x="13403" y="-3332" rot="0" params=""/> <obj type="Pickup02" x="13452" y="-3339" rot="0" params=""/> <obj type="BonusPickup" x="13356" y="-3496" rot="0" params=""/> <obj type="BrickWall" x="907" y="-4782" rot="0" params=""/> <obj type="GlassPane" x="2225" y="-4677" rot="0" params=""/> <obj type="MelonBarrow" x="7766" y="-4322" rot="0" params=""/> <obj type="MelonBarrow" x="14113" y="-3060" rot="0" params=""/> <obj type="BrickWall" x="15398" y="-3084" rot="0" params=""/> <obj type="BrickWall" x="22188" y="-2558" rot="0" params=""/> <obj type="Checkpoint" x="3707" y="-4740" rot="0" params=""/> <obj type="Checkpoint" x="8372" y="-4338" rot="0" params=""/> <obj type="Checkpoint" x="14365" y="-3054" rot="0" params=""/> <obj type="Checkpoint" x="20546" y="-2464" rot="0" params=""/> <obj type="Pickup01" x="16521" y="-3211" rot="0" params=""/> <obj type="Pickup02" x="16583" y="-3209" rot="0" params=""/> <obj type="Pickup02" x="16650" y="-3206" rot="0" params=""/> <obj type="Pickup02" x="16710" y="-3204" rot="0" params=""/> <obj type="Pickup02" x="16778" y="-3203" rot="0" params=""/> <obj type="Pickup01" x="2453" y="-4717" rot="0" params=""/> <obj type="Pickup02" x="2530" y="-4721" rot="0" params=""/> <obj type="Pickup02" x="2603" y="-4727" rot="0" params=""/> <obj type="Pickup02" x="2680" y="-4733" rot="0" params=""/> <obj type="Pickup02" x="2751" y="-4742" rot="0" params=""/> <obj type="Pickup01" x="8920" y="-4384" rot="0" params=""/> <obj type="Pickup02" x="9005" y="-4392" rot="0" params=""/> <obj type="Pickup02" x="9076" y="-4406" rot="0" params=""/> <obj type="Pickup02" x="9141" y="-4415" rot="0" params=""/> <obj type="Pickup02" x="9203" y="-4428" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-1525,-7014, -1039,-6709, -755,-6175, -594,-5751, -360,-5472, -101,-5197, 53,-5054, 101,-4784, 677,-4784, 965,-4784"/> <points a="1145,-4760, 1466,-4717, 1665,-4696, 1966,-4679, 2200,-4676, 2526,-4683, 2790,-4707, 3117,-4728, 3482,-4739, 3870,-4742"/> <points a="4149,-4736, 4483,-4714, 4785,-4675, 5107,-4596, 5385,-4509, 5585,-4449, 5894,-4372, 6261,-4311, 6613,-4293, 7046,-4287"/> <points a="7429,-4295, 7796,-4328, 8115,-4338, 8498,-4340, 8765,-4332, 9140,-4309, 9448,-4269, 9819,-4202, 10167,-4133, 10594,-4034"/> <points a="11061,-3924, 11375,-3837, 11678,-3713, 11993,-3562, 12327,-3416, 12679,-3295, 13054,-3195, 13417,-3122, 13829,-3072, 14204,-3055"/> <points a="14564,-3056, 14884,-3073, 15212,-3078, 15685,-3098, 16009,-3134, 16250,-3156, 16591,-3159, 16979,-3145, 17414,-3105, 17800,-3066"/> <points a="18201,-2977, 18569,-2887, 18922,-2775, 19323,-2629, 19821,-2503, 20217,-2469, 20623,-2466, 21004,-2476, 21427,-2508, 21765,-2541"/> <points a="22196,-2564, 22636,-2571, 22956,-2571, 23331,-2549, 23683,-2505, 23986,-2449, 24409,-2373, 24784,-2293, 25142,-2184, 25518,-2040"/> <points a="25876,-1916, 26208,-1885, 26769,-1883, 27377,-1883, 27921,-1883, 27988,-2374, 28153,-2426, 28336,-2544, 28449,-2550, 28566,-2610"/> <points a="28812,-2693, 28946,-2665, 29109,-2840, 29311,-3055, 29523,-3228, 29840,-3374, 30083,-3398, 30283,-3266, 30679,-3687, 30961,-3796"/> <points a="31168,-3754, 31630,-3628, 32718,-3788, 33518,-3500, 34222,-3788, 34830,-3564, 35502,-3756, 36142,-3500"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <level name="Level 2, Bits And Bobs" fillframe="7" surfaceframe="8" surfacethickness="10"> <objgroup name=""> <obj type="Checkpoint" x="902" y="786" rot="0" params=""/> <obj type="Checkpoint" x="4459" y="1205" rot="0" params=""/> <obj type="Checkpoint" x="12731" y="2837" rot="0" params=""/> <obj type="Checkpoint" x="15985" y="2792" rot="0" params=""/> <obj type="Checkpoint" x="22515" y="3320" rot="0" params=""/> <obj type="Checkpoint" x="25808" y="3616" rot="0" params=""/> <obj type="Checkpoint" x="32770" y="5720" rot="0" params=""/> <obj type="endrace" x="39507" y="6564" rot="0" params=""/> <obj type="JumpAdvisor2" x="5355" y="957" rot="0" params=""/> <obj type="Penguin" x="2515" y="988" rot="0" params=""/> <obj type="Igloo" x="4228" y="1209" rot="0" params=""/> <obj type="Snowman" x="9320" y="2135" rot="0" params=""/> <obj type="Pickup01" x="1520" y="757" rot="0" params=""/> <obj type="Pickup02" x="1600" y="765" rot="0" params=""/> <obj type="Pickup02" x="1671" y="771" rot="0" params=""/> <obj type="Pickup02" x="1736" y="776" rot="0" params=""/> <obj type="Pickup02" x="1808" y="783" rot="0" params=""/> <obj type="Pickup01" x="4792" y="1144" rot="0" params=""/> <obj type="Pickup02" x="4860" y="1141" rot="0" params=""/> <obj type="Pickup02" x="4923" y="1134" rot="0" params=""/> <obj type="Pickup02" x="4989" y="1128" rot="0" params=""/> <obj type="Pickup02" x="5045" y="1121" rot="0" params=""/> <obj type="Pickup01" x="11449" y="2282" rot="0" params=""/> <obj type="Pickup02" x="11521" y="2271" rot="0" params=""/> <obj type="Pickup02" x="11593" y="2256" rot="0" params=""/> <obj type="Pickup02" x="11657" y="2247" rot="0" params=""/> <obj type="Pickup02" x="11720" y="2241" rot="0" params=""/> <obj type="Pickup02" x="14080" y="2722" rot="0" params=""/> <obj type="Pickup01" x="22030" y="3288" rot="0" params=""/> <obj type="Pickup02" x="22097" y="3255" rot="0" params=""/> <obj type="Pickup02" x="22160" y="3229" rot="0" params=""/> <obj type="Pickup02" x="22226" y="3198" rot="0" params=""/> <obj type="Pickup02" x="22291" y="3175" rot="0" params=""/> <obj type="Pickup01" x="8783" y="2127" rot="0" params=""/> <obj type="Pickup02" x="8855" y="2116" rot="0" params=""/> <obj type="Pickup02" x="8919" y="2100" rot="0" params=""/> <obj type="Pickup02" x="8984" y="2089" rot="0" params=""/> <obj type="Pickup02" x="9049" y="2083" rot="0" params=""/> <obj type="Pickup02" x="13916" y="2720" rot="0" params=""/> <obj type="Pickup02" x="13730" y="2724" rot="0" params=""/> <obj type="Pickup02" x="14277" y="2724" rot="0" params=""/> <obj type="Penguin" x="2611" y="1010" rot="0" params=""/> <obj type="Penguin" x="2714" y="1028" rot="0" params=""/> <obj type="Snowman" x="7085" y="1769" rot="0" params=""/> <obj type="Snowman" x="7275" y="1898" rot="0" params=""/> <obj type="Snowman" x="7462" y="2018" rot="0" params=""/> <obj type="Snowman" x="7678" y="2134" rot="0" params=""/> <obj type="JumpAdvisor2" x="15630" y="2635" rot="0" params=""/> <obj type="JumpAdvisor2" x="33159" y="5498" rot="0" params=""/> <obj type="Igloo" x="1131" y="790" rot="0" params=""/> <obj type="Igloo" x="16370" y="2805" rot="0" params=""/> <obj type="Snowman" x="19567" y="3571" rot="0" params=""/> <obj type="Snowman" x="20404" y="3564" rot="0" params=""/> <obj type="Snowman" x="23495" y="3770" rot="0" params=""/> <obj type="Snowman" x="27402" y="4595" rot="0" params=""/> <obj type="Snowman" x="28142" y="4729" rot="0" params=""/> <obj type="Snowman" x="29800" y="4690" rot="0" params=""/> <obj type="Snowman" x="37731" y="6562" rot="0" params=""/> <obj type="BonusPickup" x="15774" y="2433" rot="0" params=""/> <obj type="Checkpoint" x="8320" y="2237" rot="0" params=""/> <obj type="Checkpoint" x="10678" y="2369" rot="0" params=""/> <obj type="Checkpoint" x="14361" y="2754" rot="0" params=""/> <obj type="Checkpoint" x="19875" y="3582" rot="0" params=""/> <obj type="Checkpoint" x="24531" y="3651" rot="0" params=""/> <obj type="Checkpoint" x="28675" y="4756" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-1117,-486, -869,-456, -500,-459, -240,-265, -103,-95, -16,-72, 59,-60, 80,205, 191,448, 436,596"/> <points a="577,780, 1016,780, 1287,784, 1649,810, 1996,868, 2233,924, 2622,1018, 2991,1076, 3327,1118, 3798,1182"/> <points a="4100,1204, 4477,1201, 4856,1174, 5233,1135, 5292,1080, 5373,1117, 5622,1068, 6453,1162, 6699,1425, 6958,1674"/> <points a="7202,1854, 7485,2026, 7715,2145, 7990,2208, 8261,2236, 8467,2231, 8666,2196, 8956,2129, 9071,2113, 9144,2114"/> <points a="9422,2144, 9626,2221, 9747,2276, 9959,2325, 10028,2327, 10077,2317, 10165,2295, 10226,2274, 10268,2272, 10305,2274"/> <points a="10341,2285, 10464,2324, 10557,2355, 10617,2363, 10687,2365, 10741,2365, 10810,2354, 11122,2322, 11200,2318, 11249,2318"/> <points a="11293,2323, 11441,2347, 11649,2428, 11747,2519, 11808,2592, 11887,2683, 12001,2767, 12103,2800, 12279,2829, 12479,2837"/> <points a="12759,2836, 13135,2805, 13497,2755, 13817,2747, 14169,2747, 14464,2757, 14723,2781, 15066,2833, 15271,2859, 15375,2860"/> <points a="15431,2847, 15463,2837, 15492,2810, 15517,2785, 15538,2774, 15557,2773, 15622,2778, 15877,2794, 16190,2795, 16478,2798"/> <points a="16791,2816, 17185,2837, 17561,2901, 17854,2993, 18238,3144, 18549,3321, 18763,3412, 18994,3485, 19273,3540, 19691,3579"/> <points a="20070,3579, 20382,3559, 20806,3521, 21209,3459, 21490,3398, 21794,3347, 22207,3315, 22561,3318, 22774,3350, 23033,3428"/> <points a="23198,3524, 23303,3624, 23362,3698, 23394,3735, 23427,3756, 23483,3764, 23528,3763, 23557,3754, 23625,3729, 23677,3708"/> <points a="23727,3706, 23776,3707, 23846,3719, 23932,3748, 23988,3756, 24034,3755, 24067,3754, 24216,3742, 24317,3724, 24376,3697"/> <points a="24453,3649, 24777,3651, 25193,3651, 25353,3651, 25402,3643, 25427,3629, 25453,3609, 25658,3612, 25880,3622, 26019,3662"/> <points a="26115,3720, 26236,3841, 26420,4037, 26666,4239, 26945,4421, 27323,4573, 27702,4652, 28063,4714, 28527,4754, 28880,4753"/> <points a="29209,4702, 29421,4667, 29613,4667, 29844,4686, 30303,4830, 30654,5025, 30962,5243, 31213,5415, 31741,5600, 32191,5680"/> <points a="32480,5719, 32573,5726, 32865,5721, 32974,5707, 33029,5680, 33068,5659, 33090,5638, 33118,5637, 33134,5657, 33156,5676"/> <points a="33209,5702, 33260,5705, 33431,5704, 33478,5701, 33521,5696, 33645,5685, 33701,5676, 33749,5656, 33842,5618, 33933,5607"/> <points a="34063,5601, 34252,5612, 34472,5647, 34614,5713, 34908,5887, 35289,6112, 35680,6275, 36043,6393, 36491,6472, 36991,6528"/> <points a="37524,6557, 38225,6557, 39121,6557, 40049,6557, 40122,6236, 40234,6191, 40386,5991, 40435,5802, 40540,5755, 40744,5845"/> <points a="40894,6190, 41045,6417, 41418,6674, 41738,6674, 42107,6640, 42377,6575, 42609,6521, 42811,6469, 43045,6513, 43262,6590"/> <points a="43495,6646, 44131,6614, 44995,6519, 45667,6327, 46278,6443, 46949,6560, 47572,6390, 48308,6390"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <level name="Level 3, Downhill all the way" fillframe="5" surfaceframe="6" surfacethickness="10"> <objgroup name=""> <obj type="Checkpoint" x="304" y="306" rot="0" params=""/> <obj type="Ramp" x="4159" y="1552" rot="0" params=""/> <obj type="JumpAdvisor2" x="4337" y="1426" rot="0" params=""/> <obj type="Ramp" x="10618" y="4265" rot="0" params=""/> <obj type="JumpAdvisor2" x="10803" y="4111" rot="0" params=""/> <obj type="Ramp" x="23802" y="10378" rot="0" params=""/> <obj type="JumpAdvisor2" x="23966" y="10222" rot="0" params=""/> <obj type="Pickup01" x="1155" y="347" rot="0" params=""/> <obj type="Pickup02" x="1220" y="364" rot="0" params=""/> <obj type="Pickup02" x="1292" y="383" rot="0" params=""/> <obj type="Pickup02" x="1353" y="404" rot="0" params=""/> <obj type="Pickup02" x="1421" y="422" rot="0" params=""/> <obj type="Pickup01" x="17018" y="7113" rot="0" params=""/> <obj type="Pickup02" x="17079" y="7131" rot="0" params=""/> <obj type="Pickup02" x="17129" y="7147" rot="0" params=""/> <obj type="Pickup02" x="17189" y="7166" rot="0" params=""/> <obj type="Pickup02" x="17252" y="7186" rot="0" params=""/> <obj type="Pickup01" x="20347" y="8876" rot="0" params=""/> <obj type="Pickup02" x="20400" y="8889" rot="0" params=""/> <obj type="Pickup02" x="20454" y="8893" rot="0" params=""/> <obj type="Pickup02" x="20508" y="8903" rot="0" params=""/> <obj type="Pickup02" x="20569" y="8910" rot="0" params=""/> <obj type="Pickup01" x="27633" y="11917" rot="0" params=""/> <obj type="Pickup02" x="27692" y="11918" rot="0" params=""/> <obj type="Pickup02" x="27746" y="11919" rot="0" params=""/> <obj type="Pickup02" x="27799" y="11923" rot="0" params=""/> <obj type="Pickup02" x="27852" y="11921" rot="0" params=""/> <obj type="endrace" x="46132" y="17475" rot="0" params=""/> <obj type="Pickup01" x="30938" y="12956" rot="0" params=""/> <obj type="Pickup02" x="31023" y="13013" rot="0" params=""/> <obj type="Pickup02" x="31089" y="13065" rot="0" params=""/> <obj type="Pickup02" x="31162" y="13115" rot="0" params=""/> <obj type="Pickup02" x="31244" y="13180" rot="0" params=""/> <obj type="Hoop" x="35545" y="14705" rot="0" params=""/> <obj type="Pickup01" x="37974" y="15618" rot="0" params=""/> <obj type="Pickup02" x="38051" y="15653" rot="0" params=""/> <obj type="Pickup02" x="38115" y="15684" rot="0" params=""/> <obj type="Pickup02" x="38177" y="15712" rot="0" params=""/> <obj type="Pickup02" x="38237" y="15743" rot="0" params=""/> <obj type="Hoop" x="41909" y="16766" rot="0" params=""/> <obj type="Checkpoint" x="11094" y="4313" rot="0" params=""/> <obj type="BonusPickup" x="24082" y="9901" rot="0" params=""/> <obj type="Checkpoint" x="24676" y="10580" rot="0" params=""/> <obj type="Cactus" x="2067" y="806" rot="0" params=""/> <obj type="Cactus" x="2646" y="1082" rot="0" params=""/> <obj type="Cactus" x="4708" y="1697" rot="0" params=""/> <obj type="Cactus1" x="6087" y="2258" rot="0" params=""/> <obj type="Cactus1" x="7226" y="2864" rot="0" params=""/> <obj type="Cactus1" x="8978" y="3894" rot="0" params=""/> <obj type="Obelisk" x="9043" y="3926" rot="0" params=""/> <obj type="Obelisk" x="11231" y="4327" rot="0" params=""/> <obj type="Obelisk" x="15995" y="6779" rot="0" params=""/> <obj type="Obelisk" x="21519" y="9357" rot="0" params=""/> <obj type="Obelisk" x="24751" y="10592" rot="0" params=""/> <obj type="Cactus" x="27330" y="11895" rot="0" params=""/> <obj type="Cactus" x="28761" y="12180" rot="0" params=""/> <obj type="Cactus1" x="32530" y="14130" rot="0" params=""/> <obj type="Cactus1" x="36762" y="15143" rot="0" params=""/> <obj type="Cactus" x="36813" y="15153" rot="0" params=""/> <obj type="Cactus1" x="36866" y="15168" rot="0" params=""/> <obj type="Cactus1" x="40622" y="16849" rot="0" params=""/> <obj type="Cactus1" x="41083" y="16915" rot="0" params=""/> <obj type="Igloo" x="41216" y="16914" rot="0" params=""/> <obj type="Checkpoint" x="6275" y="2328" rot="0" params=""/> <obj type="Checkpoint" x="13840" y="5854" rot="0" params=""/> <obj type="Checkpoint" x="17760" y="7550" rot="0" params=""/> <obj type="Checkpoint" x="28154" y="12071" rot="0" params=""/> <obj type="Checkpoint" x="32970" y="14319" rot="0" params=""/> <obj type="Checkpoint" x="37281" y="15309" rot="0" params=""/> <obj type="Checkpoint" x="41015" y="16904" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-1549,405, -1021,-169, -659,-542, -498,-407, -252,-222, -110,-226, 18,304, 594,304, 710,311, 979,345"/> <points a="1174,389, 1534,499, 1714,588, 1988,746, 2387,944, 2789,1124, 3180,1292, 3604,1432, 3948,1519, 4202,1552"/> <points a="4405,1601, 4898,1748, 5420,1967, 6010,2212, 6431,2394, 6825,2591, 7198,2826, 7480,3057, 7733,3278, 8072,3470"/> <points a="8380,3617, 8844,3832, 9186,3950, 9580,4040, 9884,4126, 10219,4205, 10685,4269, 10950,4310, 11280,4314, 11727,4531"/> <points a="12074,4692, 12440,4877, 12881,5132, 13231,5368, 13475,5587, 13873,5875, 14262,6117, 14680,6315, 15139,6509, 15452,6620"/> <points a="15720,6687, 16138,6800, 16460,6915, 16817,7084, 17135,7243, 17641,7487, 18140,7738, 18571,7980, 19007,8275, 19485,8544"/> <points a="19818,8703, 20265,8904, 20839,9127, 21332,9265, 21790,9430, 22289,9684, 22706,9957, 22979,10113, 23060,10161, 23219,10243"/> <points a="23354,10291, 23432,10314, 23711,10354, 23826,10376, 24217,10474, 24625,10582, 24793.5,10582, 24958,10694, 25377,10870, 25794,11094"/> <points a="26153,11341, 26487,11534, 26925,11747, 27243,11856, 27660,11977, 28287,12092, 28723,12154, 29185,12251, 29627,12364, 29953,12487"/> <points a="30398,12695, 30810,12914, 31193,13183, 31624,13534, 31949,13776, 32368,14037, 32744,14226, 33126,14381, 33532,14501, 34038,14633"/> <points a="34519,14731, 34904,14764, 35146,14790, 35454,14827, 35850,14889, 36433,15039, 37076,15220, 37524,15412, 37864,15600, 38097,15773"/> <points a="38420,16008, 38878,16223, 39335,16382, 39803,16541, 40398,16754, 40731,16862, 41007,16901, 41317,16913, 41442,16905, 41774,16881"/> <points a="42000,16881, 42215,16896, 42522,16944, 43044,17099, 43294,17178, 43475,17243, 43808,17331, 44037,17394, 44247,17434, 44550,17462"/> <points a="44900,17469, 46020,17469, 46660,17469, 46784,17183, 46903,17461, 47055,16948, 47267,17473, 47560,16584, 47817,17431, 47996,16697"/> <points a="48339,17441, 48523,17144, 48756,17445, 49039,16860, 49541,17457, 49783,17015, 50071,17337, 50616,16167, 51265,17033, 51510,16759"/> <points a="52244,17556, 52540,17285, 53660,18437"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <level name="Level 4, Steps down" fillframe="1" surfaceframe="2" surfacethickness="10"> <objgroup name=""> <obj type="Checkpoint" x="304" y="316" rot="0" params=""/> <obj type="Hoop" x="3488" y="424" rot="0" params=""/> <obj type="Pickup01" x="5749" y="1056" rot="0" params=""/> <obj type="Hoop" x="8528" y="966" rot="0" params=""/> <obj type="Pickup01" x="12771" y="1519" rot="0" params=""/> <obj type="Pickup02" x="12836" y="1488" rot="0" params=""/> <obj type="Pickup02" x="12892" y="1458" rot="0" params=""/> <obj type="Pickup02" x="12941" y="1442" rot="0" params=""/> <obj type="Pickup02" x="12991" y="1420" rot="0" params=""/> <obj type="Hoop" x="14339" y="1358" rot="0" params=""/> <obj type="Pickup01" x="18401" y="2222" rot="0" params=""/> <obj type="Pickup02" x="18462" y="2214" rot="0" params=""/> <obj type="Pickup02" x="18533" y="2209" rot="0" params=""/> <obj type="Pickup02" x="18598" y="2200" rot="0" params=""/> <obj type="Pickup02" x="18649" y="2195" rot="0" params=""/> <obj type="Hoop" x="23649" y="2299" rot="0" params=""/> <obj type="Hoop" x="26125" y="2400" rot="0" params=""/> <obj type="Pickup02" x="5819" y="1064" rot="0" params=""/> <obj type="Pickup02" x="5878" y="1064" rot="0" params=""/> <obj type="Pickup02" x="5937" y="1064" rot="0" params=""/> <obj type="Pickup02" x="6004" y="1065" rot="0" params=""/> <obj type="endrace" x="44701" y="5928" rot="0" params=""/> <obj type="Ramp" x="27766" y="2687" rot="0" params=""/> <obj type="Checkpoint" x="24022" y="2465" rot="0" params=""/> <obj type="Checkpoint" x="33115" y="3611" rot="0" params=""/> <obj type="Checkpoint" x="41077" y="5581" rot="0" params=""/> <obj type="Ramp" x="30288" y="3072" rot="0" params=""/> <obj type="JumpAdvisor2" x="30460" y="2924" rot="0" params=""/> <obj type="BonusPickup" x="21217" y="2424" rot="0" params=""/> <obj type="Checkpoint" x="2312" y="640" rot="0" params=""/> <obj type="Checkpoint" x="5584" y="1091" rot="0" params=""/> <obj type="Checkpoint" x="8005" y="1077" rot="0" params=""/> <obj type="Checkpoint" x="10127" y="1249" rot="0" params=""/> <obj type="Checkpoint" x="13633" y="1489" rot="0" params=""/> <obj type="Checkpoint" x="17187" y="2180" rot="0" params=""/> <obj type="Checkpoint" x="20515" y="2693" rot="0" params=""/> <obj type="Checkpoint" x="26255" y="2622" rot="0" params=""/> <obj type="Checkpoint" x="30510" y="3179" rot="0" params=""/> <obj type="Checkpoint" x="35150" y="4167" rot="0" params=""/> <obj type="Checkpoint" x="37917" y="4892" rot="0" params=""/> <obj type="Snowman" x="921" y="385" rot="0" params=""/> <obj type="Snowman" x="3808" y="668" rot="0" params=""/> <obj type="Snowman" x="3891" y="669" rot="0" params=""/> <obj type="Snowman" x="6145" y="1105" rot="0" params=""/> <obj type="Penguin" x="6981" y="982" rot="0" params=""/> <obj type="Penguin" x="7084" y="985" rot="0" params=""/> <obj type="Penguin" x="7194" y="989" rot="0" params=""/> <obj type="Stalagmite1" x="8691" y="1140" rot="10" params=""/> <obj type="Stalagmite" x="8829" y="1165" rot="10" params=""/> <obj type="Igloo" x="12210" y="1618" rot="0" params=""/> <obj type="Snowman" x="14715" y="1563" rot="0" params=""/> <obj type="Snowman" x="14797" y="1539" rot="0" params=""/> <obj type="Snowman" x="16345" y="2001" rot="0" params=""/> <obj type="Snowman" x="16728" y="2104" rot="0" params=""/> <obj type="Penguin" x="17815" y="2219" rot="0" params=""/> <obj type="Penguin" x="17976" y="2225" rot="0" params=""/> <obj type="Penguin" x="18125" y="2235" rot="0" params=""/> <obj type="Penguin" x="19512" y="2541" rot="0" params=""/> <obj type="Penguin" x="19594" y="2568" rot="0" params=""/> <obj type="Snowman" x="21043" y="2685" rot="0" params=""/> <obj type="Snowman" x="21151" y="2675" rot="0" params=""/> <obj type="Snowman" x="21267" y="2664" rot="0" params=""/> <obj type="Snowman" x="21387" y="2653" rot="0" params=""/> <obj type="Snowman" x="21506" y="2635" rot="0" params=""/> <obj type="Snowman" x="23274" y="2397" rot="0" params=""/> <obj type="Igloo" x="24291" y="2471" rot="0" params=""/> <obj type="Penguin" x="25368" y="2527" rot="0" params=""/> <obj type="Penguin" x="25516" y="2525" rot="0" params=""/> <obj type="Penguin" x="25672" y="2527" rot="0" params=""/> <obj type="Stalagmite1" x="26756" y="2615" rot="0" params=""/> <obj type="Stalagmite" x="26903" y="2622" rot="0" params=""/> <obj type="Stalagmite" x="28280" y="2679" rot="0" params=""/> <obj type="Snowman" x="29594" y="2926" rot="0" params=""/> <obj type="Penguin" x="31993" y="3281" rot="0" params=""/> <obj type="Penguin" x="32095" y="3277" rot="0" params=""/> <obj type="Stalagmite1" x="33389" y="3607" rot="0" params=""/> <obj type="Stalagmite" x="34346" y="3966" rot="0" params=""/> <obj type="Snowman" x="35811" y="4403" rot="0" params=""/> <obj type="Snowman" x="35895" y="4453" rot="0" params=""/> <obj type="Snowman" x="36834" y="4688" rot="0" params=""/> <obj type="Snowman" x="38308" y="4865" rot="0" params=""/> <obj type="Snowman" x="38539" y="4933" rot="0" params=""/> <obj type="Igloo" x="40623" y="5490" rot="0" params=""/> <obj type="Penguin" x="41643" y="5563" rot="0" params=""/> <obj type="Penguin" x="41692" y="5562" rot="0" params=""/> <obj type="Penguin" x="41744" y="5563" rot="0" params=""/> <obj type="Penguin" x="41808" y="5596" rot="0" params=""/> <obj type="Penguin" x="41848" y="5643" rot="0" params=""/> <obj type="Penguin" x="41897" y="5655" rot="0" params=""/> <obj type="Penguin" x="41950" y="5653" rot="0" params=""/> <obj type="Stalagmite1" x="44425" y="5931" rot="0" params=""/> <obj type="Hoop" x="33130" y="3358" rot="0" params=""/> <obj type="Hoop" x="37562" y="4577" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-1507,334, -1205,218, -1059,310, -1012,208, -790,321, -715,104, -574,294, -437,39, -291,291, -173,-22"/> <points a="-118,313, 681,313, 707,385, 1059,385, 1216,403, 1490,484, 1777,580, 1962,616, 2203,638, 2447,638"/> <points a="2660,616, 2920,582, 3114,557, 3289,546, 3323,668, 3935,668, 4114,684, 4235,731, 4449,804, 4731,925"/> <points a="4966,1012, 5250,1056, 5553,1088, 5825,1104, 6136,1104, 6316,1094, 6513,1046, 6678,1008, 6849,981, 7056,984"/> <points a="7341,997, 7599,1044, 7820,1072, 8095,1079, 8319,1079, 8331,1117, 8591,1128, 8816,1165, 9027,1192, 9246,1192"/> <points a="9434,1190, 9461,1239, 9686,1249, 10230,1249, 10437,1261, 10755,1301, 11028,1360, 11215,1419, 11515,1517, 11851,1591"/> <points a="12111,1614, 12387,1616, 12655,1605, 12928,1555, 13272,1503, 13539,1486, 13809,1489, 14161,1490, 14213,1630, 14367,1629"/> <points a="14500,1623, 14625,1593, 14736,1554, 14833,1531, 14949,1528, 15126,1528, 15299,1548, 15606,1613, 15829,1700, 16090,1864"/> <points a="16351,2006, 16495,2054, 16875,2132, 17315,2195, 17617,2214, 17925,2224, 18171,2239, 18562,2277, 18834,2329, 19133,2405"/> <points a="19482,2535, 19735,2611, 20032,2649, 20315,2687, 20582,2695, 21039,2685, 21364,2656, 21770,2599, 22197,2526, 22561,2469"/> <points a="22706,2442, 22982,2409, 23249,2396, 23569,2396, 23599,2468, 24111,2468, 24623,2468, 24649,2526, 25321,2526, 25961,2526"/> <points a="26006,2621, 26550,2621, 27191,2621, 27225,2680, 28025,2680, 28665,2680, 28732,2681, 28947,2698, 29205,2751, 29287,2795"/> <points a="29417,2867, 29625,2940, 29748,2980, 29923,3016, 30206,3071, 30385,3072, 30426,3179, 30602,3178, 30689,3297, 31231,3304"/> <points a="31689,3296, 31904,3286, 32300,3270, 32361,3261, 32536,3270, 32726,3294, 32860,3322, 32963,3385, 33030,3438, 33029,3611"/> <points a="33578,3615, 33738,3618, 33814,3625, 33873,3649, 33944,3689, 34000,3735, 34035,3968, 34707,3968, 34729,3997, 34748,4117"/> <points a="34803,4154, 34908,4164, 35196,4164, 35379,4186, 35575,4244, 35723,4343, 35916,4467, 36058,4533, 36225,4592, 36377,4637"/> <points a="36500,4659, 36726,4683, 36979,4689, 37150,4689, 37219,4674, 37312,4677, 37426,4717, 37472,4864, 37813,4897, 38161,4879"/> <points a="38214,4862, 38406,4864, 38505,4930, 38640,4939, 38719,5081, 38949,5075, 39103,5175, 39209,5166, 39460,5146, 39683,5146"/> <points a="39788,5188, 39963,5310, 40173,5399, 40364,5448, 40555,5487, 40754,5487, 40908,5465, 40937,5464, 41034,5582, 41278,5583"/> <points a="41566,5583, 41621,5564, 41772,5564, 41846,5652, 42018,5650, 42131,5774, 42397,5774, 42685,5774, 42847,5904, 43936,5935"/> <points a="44485,5936, 44839,5915, 45187,5862, 45339,5826, 45473,5768, 45633,5663, 45765,5523, 45825,5495, 46062,5489, 46062,5649"/> <points a="46222,5649, 46222,5809, 46414,5809, 46414,5937, 46638,5937, 46638,6065, 46926,6065, 46926,6225, 47182,6225, 47182,6385"/> <points a="47374,6385, 47374,6545, 47598,6545, 47598,6289, 47790,6289, 47790,6129, 47918,6129, 47918,6001, 48046,6001, 48046,5841"/> <points a="48238,5841, 48238,5649, 48398,5649, 48398,5521, 48654,5521, 48654,5681, 48846,5681, 48846,5841, 49038,5841, 49038,5969"/> <points a="49230,5969, 49262,5809, 49454,5809, 49454,5937, 49614,5937"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <level name="Level 5, Steep" fillframe="13" surfaceframe="14" surfacethickness="10"> <objgroup name=""> <obj type="Checkpoint" x="304" y="306" rot="0" params=""/> <obj type="endrace" x="36582" y="16101" rot="0" params=""/> <obj type="Pickup01" x="1101" y="545" rot="0" params=""/> <obj type="Pickup02" x="1126" y="604" rot="0" params=""/> <obj type="Pickup02" x="1149" y="656" rot="0" params=""/> <obj type="Pickup02" x="1176" y="718" rot="0" params=""/> <obj type="Pickup02" x="1197" y="779" rot="0" params=""/> <obj type="Hoop" x="4168" y="1011" rot="0" params=""/> <obj type="Pickup01" x="5227" y="2720" rot="0" params=""/> <obj type="Pickup02" x="5257" y="2795" rot="0" params=""/> <obj type="Pickup02" x="5288" y="2866" rot="0" params=""/> <obj type="Pickup02" x="5318" y="2927" rot="0" params=""/> <obj type="Pickup02" x="5343" y="2987" rot="0" params=""/> <obj type="Pickup01" x="10435" y="4663" rot="0" params=""/> <obj type="Pickup02" x="10502" y="4643" rot="0" params=""/> <obj type="Pickup02" x="10566" y="4616" rot="0" params=""/> <obj type="Pickup02" x="10629" y="4593" rot="0" params=""/> <obj type="Pickup02" x="10687" y="4577" rot="0" params=""/> <obj type="Pickup01" x="13810" y="7027" rot="0" params=""/> <obj type="Pickup02" x="13854" y="7089" rot="0" params=""/> <obj type="Pickup02" x="13887" y="7143" rot="0" params=""/> <obj type="Pickup02" x="13925" y="7189" rot="0" params=""/> <obj type="Pickup02" x="13959" y="7236" rot="0" params=""/> <obj type="Hoop" x="20130" y="10014" rot="0" params=""/> <obj type="Hoop" x="23164" y="9903" rot="0" params=""/> <obj type="Hoop" x="23241" y="9917" rot="0" params=""/> <obj type="Hoop" x="23317" y="9938" rot="0" params=""/> <obj type="Pickup01" x="25296" y="11297" rot="0" params=""/> <obj type="Hoop" x="30476" y="14972" rot="0" params=""/> <obj type="Hoop" x="31952" y="14925" rot="0" params=""/> <obj type="Pickup02" x="16233" y="8886" rot="0" params=""/> <obj type="Pickup02" x="16347" y="9034" rot="0" params=""/> <obj type="Pickup02" x="16448" y="9177" rot="0" params=""/> <obj type="Pickup02" x="16547" y="9336" rot="0" params=""/> <obj type="Pickup02" x="16658" y="9503" rot="0" params=""/> <obj type="Pickup02" x="16792" y="9667" rot="0" params=""/> <obj type="Pickup02" x="25355" y="11366" rot="0" params=""/> <obj type="Pickup02" x="25397" y="11418" rot="0" params=""/> <obj type="Pickup02" x="25438" y="11466" rot="0" params=""/> <obj type="Pickup02" x="25482" y="11516" rot="0" params=""/> <obj type="Pickup01" x="28755" y="14730" rot="0" params=""/> <obj type="Pickup02" x="28839" y="14761" rot="0" params=""/> <obj type="Pickup02" x="28918" y="14786" rot="0" params=""/> <obj type="Pickup02" x="28979" y="14804" rot="0" params=""/> <obj type="Pickup02" x="29040" y="14824" rot="0" params=""/> <obj type="Pickup01" x="34299" y="16011" rot="0" params=""/> <obj type="Pickup02" x="34374" y="15997" rot="0" params=""/> <obj type="Pickup02" x="34449" y="15991" rot="0" params=""/> <obj type="Pickup02" x="34526" y="15990" rot="0" params=""/> <obj type="Pickup02" x="34587" y="15990" rot="0" params=""/> <obj type="Checkpoint" x="7615" y="4417" rot="0" params=""/> <obj type="Checkpoint" x="18645" y="10229" rot="0" params=""/> <obj type="Checkpoint" x="30705" y="15119" rot="0" params=""/> <obj type="Ramp" x="26911" y="13612" rot="30" params=""/> <obj type="BonusPickup" x="27441" y="13384" rot="0" params=""/> <obj type="Crystals" x="1575" y="1213" rot="0" params=""/> <obj type="Crystals" x="1754" y="1240" rot="0" params=""/> <obj type="Crystals" x="3459" y="1059" rot="0" params=""/> <obj type="Crystals" x="7400" y="4424" rot="0" params=""/> <obj type="Crystals" x="7978" y="4403" rot="0" params=""/> <obj type="Stalagmite" x="9170" y="4623" rot="0" params=""/> <obj type="Stalagmite" x="9831" y="4750" rot="0" params=""/> <obj type="Crystals" x="18186" y="10228" rot="0" params=""/> <obj type="Crystals" x="19529" y="10225" rot="0" params=""/> <obj type="Crystals" x="31309" y="15113" rot="0" params=""/> <obj type="Crystals" x="36057" y="16106" rot="0" params=""/> <obj type="Stalagmite1" x="35885" y="16109" rot="0" params=""/> <obj type="Stalagmite1" x="34728" y="16096" rot="0" params=""/> <obj type="Stalagmite" x="35005" y="16111" rot="0" params=""/> <obj type="Stalagmite" x="34852" y="16110" rot="0" params=""/> <obj type="Checkpoint" x="2940" y="1007" rot="0" params=""/> <obj type="Checkpoint" x="10080" y="4754" rot="0" params=""/> <obj type="Checkpoint" x="22416" y="10006" rot="0" params=""/> <obj type="Checkpoint" x="26950" y="13615" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-1144,73, -968,186, -727,255, -506,200, -389,-5, -287,-23, -133,-117, 55,304, 672,304, 760,308"/> <points a="794,316, 855,336, 895,367, 1017,495, 1075,590, 1158,787, 1241,993, 1277,1056, 1303,1094, 1336,1126"/> <points a="1403,1167, 1451,1191, 1495,1203, 1541,1210, 1575,1211, 1698,1208, 1875,1195, 2048,1166, 2219,1133, 2431,1079"/> <points a="2598,1032, 2707,1018, 2883,1007, 3114,1006, 3483,1038, 3796,1087, 4018,1142, 4152,1197, 4255,1256, 4334,1314"/> <points a="4406,1379, 4462,1453, 4542,1582, 4744,1924, 4900,2168, 5090,2518, 5285,2970, 5409,3208, 5486,3353, 5527,3409"/> <points a="5698,3585, 5900,3752, 6132,3913, 6422,4093, 6749,4238, 7061,4349, 7324,4393, 7567,4415, 7835,4414, 8082,4397"/> <points a="8270,4394, 8493,4406, 8676,4424, 8821,4458, 9046,4535, 9118,4576, 9308,4648, 9508,4694, 9723,4733, 9894,4750"/> <points a="10174,4753, 10462,4738, 10829,4705, 11097,4692, 11262,4690, 11503,4693, 11596,4698, 11654,4710, 11700,4728, 11831,4796"/> <points a="12042,4940, 12239,5080, 12402,5207, 12645,5446, 12837,5675, 13002,5891, 13196,6166, 13418,6527, 13620,6850, 13775,7072"/> <points a="13955,7300, 14118,7478, 14234,7578, 14429,7697, 14647,7812, 15038,7990, 15367,8154, 15623,8332, 15817,8503, 16001,8695"/> <points a="16158,8886, 16265,9032, 16393,9225, 16645,9585, 16749,9714, 16913,9869, 17056,9974, 17133,10019, 17294,10087, 17379,10110"/> <points a="17586,10157, 17902,10201, 18129,10217, 18451,10227, 18867,10227, 19201,10227, 19368,10222, 19687,10200, 19909,10181, 20203,10163"/> <points a="20525,10142, 20914,10110, 21333,10074, 21628,10047, 21907,10024, 22220,10009, 22536,9998, 22856,9998, 23002,10003, 23151,10023"/> <points a="23294,10058, 23451,10126, 23712,10243, 24007,10392, 24297,10544, 24590,10731, 24837,10920, 25051,11114, 25289,11360, 25493,11604"/> <points a="25723,11909, 25987,12300, 26216,12727, 26487,13104, 26748,13419, 27021,13721, 27372,14047, 27646,14257, 27967,14469, 28329,14644"/> <points a="28696,14766, 29113,14885, 29459,14977, 29817,15038, 30152,15092, 30328,15119, 30558,15120, 31032,15116, 31280,15100, 31583,15073"/> <points a="31880,15063, 32087,15079, 32261,15123, 32410,15200, 32605,15390, 32755,15597, 32891,15786, 32978,15876, 33117,15978, 33186,16018"/> <points a="33240,16029, 33463,16067, 33650,16091, 33976,16095, 34616,16095, 35608,16095, 36504,16095, 37176,16095, 37270,15634, 37442,15574"/> <points a="37595,15597, 37734,15702, 37873,16096, 38050,16131, 38163,16142, 38379,16085, 38679,16007, 38963,15882, 39060,15786, 39202,15867"/> <points a="39366,16074, 39713,16259, 39873,16254, 40284,16169, 40281,16072, 40585,15888, 40781,15855, 40855,15885, 40892,15961, 41228,16057"/> <points a="41303,16026, 41326,15939, 41724,15854, 41848,15851, 42206,16100, 42500,16143, 42818,16324, 42824,16369, 43153,16628, 43212,16622"/> <points a="43574,16559, 43586,16466, 43605,16352, 44114,16159, 44400,16110, 44448,16167, 44899,16540, 45303,16677"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <level name="Level 6, Zaggies" fillframe="9" surfaceframe="10" surfacethickness="10"> <objgroup name=""> <obj type="Checkpoint" x="304" y="306" rot="0" params=""/> <obj type="Pickup01" x="1370" y="329" rot="0" params=""/> <obj type="Pickup02" x="1427" y="331" rot="0" params=""/> <obj type="Pickup02" x="1472" y="335" rot="0" params=""/> <obj type="Pickup02" x="1520" y="342" rot="0" params=""/> <obj type="Pickup02" x="1570" y="353" rot="0" params=""/> <obj type="Hoop" x="3156" y="410" rot="0" params=""/> <obj type="Pickup01" x="3245" y="443" rot="0" params=""/> <obj type="Pickup02" x="3307" y="449" rot="0" params=""/> <obj type="Pickup02" x="3361" y="465" rot="0" params=""/> <obj type="Pickup02" x="3406" y="494" rot="0" params=""/> <obj type="Pickup01" x="6092" y="1045" rot="0" params=""/> <obj type="Pickup02" x="6148" y="1044" rot="0" params=""/> <obj type="Pickup02" x="6207" y="1044" rot="0" params=""/> <obj type="Pickup02" x="6251" y="1045" rot="0" params=""/> <obj type="Pickup02" x="6301" y="1048" rot="0" params=""/> <obj type="Pickup01" x="8084" y="1424" rot="0" params=""/> <obj type="Pickup02" x="8128" y="1459" rot="0" params=""/> <obj type="Pickup02" x="8177" y="1470" rot="0" params=""/> <obj type="Pickup02" x="8231" y="1470" rot="0" params=""/> <obj type="Pickup02" x="8290" y="1468" rot="0" params=""/> <obj type="Pickup01" x="13160" y="2347" rot="0" params=""/> <obj type="Pickup02" x="13222" y="2385" rot="0" params=""/> <obj type="Pickup02" x="13274" y="2418" rot="0" params=""/> <obj type="Pickup02" x="13327" y="2452" rot="0" params=""/> <obj type="Pickup02" x="13381" y="2485" rot="0" params=""/> <obj type="Pickup01" x="16406" y="2584" rot="0" params=""/> <obj type="Pickup02" x="16470" y="2592" rot="0" params=""/> <obj type="Pickup02" x="16524" y="2596" rot="0" params=""/> <obj type="Pickup02" x="16570" y="2606" rot="0" params=""/> <obj type="Pickup02" x="16619" y="2618" rot="0" params=""/> <obj type="Pickup01" x="22756" y="3695" rot="0" params=""/> <obj type="Pickup02" x="22826" y="3676" rot="0" params=""/> <obj type="Pickup02" x="22884" y="3657" rot="0" params=""/> <obj type="Pickup02" x="22939" y="3639" rot="0" params=""/> <obj type="Pickup02" x="22999" y="3617" rot="0" params=""/> <obj type="Pickup01" x="25354" y="4117" rot="0" params=""/> <obj type="Pickup02" x="25420" y="4107" rot="0" params=""/> <obj type="Pickup02" x="25491" y="4093" rot="0" params=""/> <obj type="Pickup02" x="25557" y="4082" rot="0" params=""/> <obj type="Pickup02" x="25622" y="4071" rot="0" params=""/> <obj type="Hoop" x="30344" y="4483" rot="0" params=""/> <obj type="Hoop" x="32427" y="4816" rot="0" params=""/> <obj type="Hoop" x="35223" y="5241" rot="0" params=""/> <obj type="Pickup01" x="38711" y="6003" rot="0" params=""/> <obj type="Pickup02" x="38766" y="6000" rot="0" params=""/> <obj type="Pickup02" x="38819" y="6005" rot="0" params=""/> <obj type="Pickup02" x="38865" y="6012" rot="0" params=""/> <obj type="Pickup02" x="38911" y="6021" rot="0" params=""/> <obj type="endrace" x="52406" y="7300" rot="0" params=""/> <obj type="Hoop" x="49356" y="6669" rot="0" params=""/> <obj type="Pickup01" x="43488" y="6427" rot="0" params=""/> <obj type="Pickup02" x="43576" y="6422" rot="0" params=""/> <obj type="Pickup02" x="43652" y="6425" rot="0" params=""/> <obj type="Pickup02" x="43717" y="6434" rot="0" params=""/> <obj type="Pickup02" x="43781" y="6455" rot="0" params=""/> <obj type="Pickup01" x="40674" y="6456" rot="0" params=""/> <obj type="Pickup02" x="40754" y="6486" rot="0" params=""/> <obj type="Pickup02" x="40852" y="6514" rot="0" params=""/> <obj type="Pickup02" x="40940" y="6524" rot="0" params=""/> <obj type="Pickup02" x="41036" y="6534" rot="0" params=""/> <obj type="Ramp" x="36845" y="5559" rot="0" params=""/> <obj type="JumpAdvisor2" x="37014" y="5439" rot="0" params=""/> <obj type="Pickup02" x="3444" y="522" rot="0" params=""/> <obj type="Checkpoint" x="11491" y="2087" rot="0" params=""/> <obj type="Ramp" x="18122" y="2918" rot="0" params=""/> <obj type="BonusPickup" x="18388" y="2522" rot="0" params=""/> <obj type="Checkpoint" x="19680" y="3031" rot="0" params=""/> <obj type="Checkpoint" x="25029" y="4154" rot="0" params=""/> <obj type="Checkpoint" x="41887" y="6527" rot="0" params=""/> <obj type="EasterStatue" x="2107" y="554" rot="0" params=""/> <obj type="EasterStatue" x="2587" y="562" rot="0" params=""/> <obj type="EasterStatue" x="4474" y="914" rot="0" params=""/> <obj type="EasterStatue" x="5830" y="1103" rot="0" params=""/> <obj type="EasterStatue" x="9687" y="1723" rot="0" params=""/> <obj type="EasterStatue" x="14113" y="2614" rot="0" params=""/> <obj type="EasterStatue" x="15775" y="2622" rot="0" params=""/> <obj type="EasterStatue" x="16180" y="2620" rot="0" params=""/> <obj type="EasterStatue" x="25981" y="4253" rot="0" params=""/> <obj type="EasterStatue" x="28324" y="4548" rot="0" params=""/> <obj type="EasterStatue" x="34005" y="5166" rot="0" params=""/> <obj type="EasterStatue" x="45539" y="7127" rot="0" params=""/> <obj type="EasterStatue" x="50841" y="7250" rot="0" params=""/> <obj type="Checkpoint" x="4071" y="931" rot="0" params=""/> <obj type="Checkpoint" x="6474" y="1186" rot="0" params=""/> <obj type="Checkpoint" x="10006" y="1770" rot="0" params=""/> <obj type="Checkpoint" x="13732" y="2638" rot="0" params=""/> <obj type="Checkpoint" x="15963" y="2619" rot="0" params=""/> <obj type="Checkpoint" x="21222" y="3504" rot="0" params=""/> <obj type="Checkpoint" x="23990" y="3924" rot="0" params=""/> <obj type="Checkpoint" x="27903" y="4559" rot="0" params=""/> <obj type="Checkpoint" x="31451" y="4902" rot="0" params=""/> <obj type="Checkpoint" x="35946" y="5546" rot="0" params=""/> <obj type="Checkpoint" x="39203" y="6205" rot="0" params=""/> <obj type="Checkpoint" x="43603" y="6540" rot="0" params=""/> <obj type="Checkpoint" x="45119" y="7154" rot="0" params=""/> <obj type="Checkpoint" x="46790" y="7108" rot="0" params=""/> <obj type="Checkpoint" x="50247" y="7269" rot="0" params=""/> <obj type="JumpAdvisor2" x="46315" y="6895" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-1361,-78, -587,-64, -199,-7, -79,306, 688,306, 992,391, 1312,362, 2062,560, 2363,543, 2621,567"/> <points a="3115,532, 3666,936, 3940,917, 4244,947, 4544,910, 5052,978, 5223,935, 5792,1110, 6014,1091, 6349,1188"/> <points a="6683,1179, 6951,1223, 7313,1328, 7602,1496, 8013,1439, 8102,1507, 8424,1484, 8622,1505, 8825,1481, 9134,1574"/> <points a="9461,1750, 9721,1721, 9947,1768, 10480,1757, 11366.95,2085.6499999999987, 11927,2084, 12000,2133, 12434,2287, 12810,2235, 13005,2289"/> <points a="13548,2649, 14335,2598, 14628,2635, 15126,2547, 15324,2630, 15493,2596, 15552,2622, 16343,2618, 16723,2891, 17271,2852"/> <points a="17855,2957, 18220,2902, 18283,2943, 18818,2905, 19595,3027, 19789.55,3026.55, 19986,3010, 20255,3095, 20577,3316, 20941,3490"/> <points a="21347,3512, 21703,3711, 22029,3678, 22766,3751, 23132,3699, 23825,3916, 24192,3934, 24643,4155, 25507,4152, 25883,4263"/> <points a="26205,4229, 26918,4330, 27232,4279, 27741,4561, 28515,4549, 28843,4509, 29263,4590, 29648,4541, 30295,4613, 30543,4790"/> <points a="30947,4755, 31760,4989, 32350,4941, 32646,5000, 33131,4977, 33646,5180, 34188,5165, 34643,5399, 35139,5348, 35837,5550"/> <points a="36133,5531, 36397,5561, 36702,5531, 37130,5588, 37771,5986, 38285,6088, 38690,6042, 39049,6206, 39470,6191, 39599,6158"/> <points a="39722,6200, 39843,6180, 40106,6233, 40434,6338, 40660,6510, 40847,6551, 41049,6570, 41296,6495, 41342,6531, 41729,6457"/> <points a="41800,6523, 42069,6528, 42329,6507, 42486,6561, 42736,6474, 42921,6538, 43444,6493, 43497,6539, 43818,6543, 44006,6639"/> <points a="44311,6793, 44619,6967, 44944,7145, 45175,7157, 45458,7140, 45592,7121, 45698,7107, 46048,7096, 46235,6987, 46286,7030"/> <points a="46678,7103, 46940,7112, 47223,7014, 47485,6936, 47531,6942, 47734,7073, 47941,7029, 48106,7050, 48577,6990, 48828,6797"/> <points a="49246,6778, 49709,7054, 50031,7285, 50588,7237, 50666,7287, 50933,7227, 51220,7247, 51429,7214, 51512,7282, 51837,7296"/> <points a="52829,7296, 52979,7296, 53079,7202, 53147,7228, 53216,7112, 53323,7135, 53458,7025, 53553,7060, 53667,6905, 53776,6930"/> <points a="53940,6724, 54073,6770, 54198,6575, 54311,6613, 54564,6396, 54697,6451, 55000,6162, 55053,6218, 55302,6027, 55405,6093"/> <points a="55690,5834, 55767,5879, 56113,5645, 56191,5716, 56600,5509, 56652,5564, 57124,5291, 57458,5453, 58000,5300, 58620,5793"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <level name="Level 7 (bonus), Ski Jump" fillframe="13" surfaceframe="14" surfacethickness="10"> <objgroup name=""> <obj type="Checkpoint" x="304" y="314" rot="0" params=""/> <obj type="SkiJumpStart" x="11049" y="5135" rot="0" params=""/> <obj type="Parrot" x="11493" y="5098" rot="0" params=""/> <obj type="Parrot" x="11919" y="5200" rot="0" params=""/> <obj type="Parrot" x="12521" y="5291" rot="0" params=""/> <obj type="Parrot" x="13038" y="5184" rot="0" params=""/> <obj type="Parrot" x="13642" y="5242" rot="0" params=""/> <obj type="Parrot" x="14165" y="5406" rot="0" params=""/> <obj type="Parrot" x="14647" y="5299" rot="0" params=""/> <obj type="Parrot" x="13834" y="5593" rot="0" params=""/> <obj type="Parrot" x="13235" y="5593" rot="0" params=""/> <obj type="Parrot" x="12771" y="5598" rot="0" params=""/> <obj type="Parrot" x="12730" y="4983" rot="0" params=""/> <obj type="Parrot" x="13257" y="4855" rot="0" params=""/> <obj type="Parrot" x="13917" y="4815" rot="0" params=""/> <obj type="Parrot" x="13726" y="5013" rot="0" params=""/> <obj type="Parrot" x="14491" y="5001" rot="0" params=""/> <obj type="Parrot" x="15038" y="4947" rot="0" params=""/> <obj type="Parrot" x="15467" y="5297" rot="0" params=""/> <obj type="Parrot" x="16018" y="4828" rot="0" params=""/> <obj type="Parrot" x="16665" y="4804" rot="0" params=""/> <obj type="Parrot" x="17037" y="5281" rot="0" params=""/> <obj type="Parrot" x="17004" y="5698" rot="0" params=""/> <obj type="Parrot" x="16349" y="5904" rot="0" params=""/> <obj type="Parrot" x="17527" y="5556" rot="0" params=""/> <obj type="Parrot" x="18015" y="5042" rot="0" params=""/> <obj type="Parrot" x="17571" y="4750" rot="0" params=""/> <obj type="Parrot" x="18403" y="5550" rot="0" params=""/> <obj type="Parrot" x="19016" y="5871" rot="0" params=""/> <obj type="Parrot" x="19432" y="5519" rot="0" params=""/> <obj type="Parrot" x="19433" y="5004" rot="0" params=""/> <obj type="Parrot" x="20169" y="4780" rot="0" params=""/> <obj type="Parrot" x="20617" y="5228" rot="0" params=""/> <obj type="Parrot" x="21161" y="5804" rot="0" params=""/> <obj type="endrace" x="28489" y="18036" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-1157,-154, -790,-97, -428,-96, -161,-60, -47,311, 720,311, 871,318, 1200,350, 1467,389, 1695,435"/> <points a="1955,500, 2157,564, 2370,622, 2578,673, 2762,697, 3048,697, 3336,697, 3624,697, 3792,696, 4004,704"/> <points a="4175,720, 4372,755, 4572,808, 4787,877, 5010,962, 5213,1048, 5404,1150, 5648,1318, 5919,1537, 6189,1797"/> <points a="6512,2145, 6768,2418, 7152,2802, 7632,3282, 8016,3666, 8332,3975, 8686,4321, 9003,4620, 9167,4763, 9272,4855"/> <points a="9421,4979, 9545,5067, 9722,5169, 9946,5255, 10113,5299, 10330,5330, 10527,5333, 10640,5328, 10770,5315, 10838,5292"/> <points a="10909,5247, 10929,5239, 10972,5236, 11002,5245, 11075,5284, 11274,5412, 11933,5924, 13002,6850, 15471,8842, 17121,10180"/> <points a="18721,11714, 19991,12900, 21576,14458, 23784,16666, 24520,17370, 24910,17690, 25169,17858, 25522,18005, 25864,18033, 26345,18033"/> <points a="27465,18033, 28969,18033, 29105,18017, 29171,18001, 29270,17968, 29370,17929, 29578,17868, 29615,17758, 29788,17656, 30108,17666"/> <points a="30547,18024, 31083,18174, 31657,18041, 32136,18157, 32609,18038, 32961,18152, 33309,18033, 33654,18138, 33967,18009, 34284,18148"/> <points a="34626,18041"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <level name="Level 8 (bonus) Death Steps" fillframe="7" surfaceframe="8" surfacethickness="10"> <objgroup name=""> <obj type="Checkpoint" x="304" y="306" rot="0" params=""/> <obj type="endrace" x="28675" y="12262" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-1589,46, -1098,39, -704,36, -288,196, -81,307, 303,307, 1071,307, 1200,327, 1471,430, 1505,560"/> <points a="1674,553, 1732,678, 1957,680, 2034,897, 2236,886, 2266,960, 2400,972, 2439,1067, 2647,1067, 2700,1286"/> <points a="3074,1306, 3102,1445, 3318,1445, 3346,1501, 3426,1501, 3446,1545, 3507,1547, 3583,1739, 3839,1739, 3858,1794"/> <points a="3952,1797, 4047,2009, 4478,2010, 4519,2096, 4693,2084, 4714,2196, 4800,2198, 4868,2336, 5012,2348, 5220,2476"/> <points a="5378,2458, 5521,2507, 5577,2668, 5778,2669, 5859,2862, 6265,2861, 6327,3099, 6563,3099, 6569,3130, 6687,3132"/> <points a="6689,3172, 7022,3170, 7024,3187, 7165,3187, 7196,3270, 7324,3270, 7350,3399, 7537,3398, 7604,3518, 7771,3512"/> <points a="7814,3678, 7998,3678, 8041,3813, 8271,3829, 8318,4044, 8529,4073, 8620,4203, 8845,4270, 8871,4389, 8947,4402"/> <points a="9024,4582, 9285,4575, 9321,4662, 9425,4664, 9456,4725, 9552,4732, 9560,4775, 9638,4780, 9717,4946, 9828,4946"/> <points a="9853,5007, 9948,5023, 9954,5071, 10153,5083, 10166,5134, 10221,5135, 10246,5182, 10315,5176, 10322,5195, 10338,5194"/> <points a="10345,5205, 10364,5203, 10373,5212, 10391,5211, 10397,5223, 10419,5222, 10421,5233, 10603,5237, 10637,5399, 10861,5399"/> <points a="10883,5560, 11117,5559, 11138,5712, 11362,5712, 11426,5904, 11778,5904, 11816,6091, 12040,6091, 12054,6257, 12250,6261"/> <points a="12311,6414, 12430,6490, 12570,6512, 12597,6550, 12647,6759, 12957,6764, 13079,7052, 13592,7053, 13730,7312, 14163,7394"/> <points a="14278,7701, 14899,7740, 15107,8170, 15716,8170, 15897,8568, 16306,8567, 16435,8803, 16579,8803, 16623,8923, 17043,8915"/> <points a="17093,9080, 17514,9086, 17542,9250, 17827,9254, 17916,9505, 18673,9504, 18694,9774, 18911,9772, 18910,9959, 19665,9955"/> <points a="19688,10114, 19933,10064, 20007,10178, 20192,10152, 20258,10241, 20404,10209, 20454,10277, 20675,10280, 20742,10363, 20829,10363"/> <points a="20836,10455, 21228,10457, 21228,10516, 21452,10516, 21452,10559, 21783,10579, 21783,10707, 22423,10707, 22423,10867, 22999,10867"/> <points a="22999,10995, 23415,10995, 23415,11155, 23959,11155, 23959,11283, 24407,11283, 24407,11411, 24535,11411, 24535,11507, 24727,11507"/> <points a="24727,11635, 24855,11635, 24855,11763, 25015,11763, 25015,11891, 25143,11891, 25143,11987, 25303,11987, 25527,11987, 25526,12025"/> <points a="25557,12028, 25564,12061, 25689,12138, 26052,12250, 26564,12250, 28164,12250, 29252,12250, 29333,11655, 31765,11655, 32107,11716"/> <points a="32577,11859, 32930,12215, 33282,12311, 33666,12311, 34146,12151, 34466,11991, 34882,11895, 35170,11735, 35522,11607, 35874,11543"/> <points a="36610,11543"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <level name="Level 9 (bonus) Pipette" fillframe="13" surfaceframe="14" surfacethickness="10"> <objgroup name=""> <obj type="endrace" x="29398" y="50" rot="0" params=""/> <obj type="Checkpoint" x="98" y="-1" rot="0" params=""/> <obj type="Checkpoint" x="24821" y="-94" rot="0" params=""/> <obj type="Checkpoint" x="20049" y="180" rot="0" params=""/> <obj type="Checkpoint" x="13961" y="-137" rot="0" params=""/> <obj type="Checkpoint" x="8582" y="115" rot="0" params=""/> <obj type="Checkpoint" x="3355" y="-81" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-2068,-277, -191,-281, -92,0, 420,0, 589,19, 781,53, 954,72, 1123,72, 1342,53, 1552,15"/> <points a="1716,5, 2108,0, 2364,0, 2394,-1, 2422,-7, 2450,-21, 2465,-39, 2475,-56, 2489,-85, 2533,-84"/> <points a="2546,-52, 2555,-36, 2572,-19, 2597,-4, 2618,-1, 2865,-15, 2995,-44, 3304,-82, 3494,-88, 3568,-83"/> <points a="3777,-37, 3952,18, 4168,84, 4371,161, 4496,211, 4552,228, 4666,244, 4774,246, 4877,240, 5036,212"/> <points a="5168,171, 5275,126, 5333,93, 5369,58, 5393,29, 5452,27, 5489,60, 5548,94, 5591,107, 5732,120"/> <points a="5956,120, 6340,120, 6544,107, 6771,78, 7034,63, 7198,32, 7405,26, 7639,29, 8041,54, 8256,84"/> <points a="8437,110, 8634,117, 9044,122, 9260,120, 9571,113, 9751,101, 9988,75, 10126,56, 10233,37, 10291,20"/> <points a="10369,-9, 10402,-32, 10443,-63, 10476,-95, 10508,-130, 10530,-150, 10552,-160, 10575,-162, 10619,-152, 10879,-78"/> <points a="11082,-36, 11387,21, 11687,60, 11984,79, 12272,83, 12435,76, 12615,63, 12671,44, 12704,12, 12720,-16"/> <points a="12758,-15, 12767,18, 12794,36, 12860,51, 12948,51, 13047,41, 13194,23, 13344,-17, 13451,-53, 13597,-90"/> <points a="13672,-113, 13789,-131, 13855,-138, 14063,-138, 14450,-135, 14966,-97, 15518,-44, 16085,9, 16314,20, 16415,20"/> <points a="16556,16, 16620,5, 16701,-19, 16746,-41, 16770,-65, 16790,-106, 16896,-108, 16907,-67, 16927,-43, 17055,-16"/> <points a="17153,2, 17310,6, 17535,4, 17857,-3, 18171,-11, 18325,-11, 18609,11, 18950,66, 19340,128, 19663,161"/> <points a="19950,176, 20275,182, 20645,158, 21003,132, 21222,106, 21342,75, 21469,30, 21618,-34, 21664,-49, 21707,-54"/> <points a="21794,-53, 21999,-35, 22296,34, 22667,109, 23011,176, 23194,188, 23903,191, 24006,187, 24133,158, 24284,101"/> <points a="24405,56, 24576,-30, 24666,-70, 24711,-84, 24781,-95, 24893,-96, 25095,-87, 25143,-63, 25205,-31, 25378,30"/> <points a="25599,64, 25839,63, 26047,45, 26193,26, 26398,44, 29150,44, 29918,44, 30178,-643, 33218,-643"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <level name="Level 10 (bonus) The Cliff" fillframe="11" surfaceframe="12" surfacethickness="10"> <objgroup name=""> <obj type="endrace" x="51420" y="11663" rot="0" params=""/> <obj type="Pickup01" x="950" y="251" rot="0" params=""/> <obj type="Pickup02" x="1004" y="247" rot="0" params=""/> <obj type="Pickup02" x="1058" y="240" rot="0" params=""/> <obj type="Pickup02" x="1122" y="234" rot="0" params=""/> <obj type="Pickup02" x="1172" y="230" rot="0" params=""/> <obj type="Pickup01" x="4719" y="1191" rot="0" params=""/> <obj type="Pickup02" x="4777" y="1170" rot="0" params=""/> <obj type="Pickup02" x="4833" y="1150" rot="0" params=""/> <obj type="Pickup02" x="4889" y="1132" rot="0" params=""/> <obj type="Pickup02" x="4944" y="1119" rot="0" params=""/> <obj type="Pickup01" x="7262" y="1772" rot="0" params=""/> <obj type="Pickup02" x="7320" y="1755" rot="0" params=""/> <obj type="Pickup02" x="7370" y="1743" rot="0" params=""/> <obj type="Pickup02" x="7428" y="1733" rot="0" params=""/> <obj type="Pickup02" x="7477" y="1722" rot="0" params=""/> <obj type="Hoop" x="8599" y="1709" rot="0" params=""/> <obj type="Pickup01" x="18387" y="3390" rot="0" params=""/> <obj type="Pickup02" x="18451" y="3383" rot="0" params=""/> <obj type="Pickup02" x="18503" y="3377" rot="0" params=""/> <obj type="Pickup02" x="18561" y="3367" rot="0" params=""/> <obj type="Pickup02" x="18610" y="3360" rot="0" params=""/> <obj type="CliffJumpStart" x="37805" y="7726" rot="0" params=""/> <obj type="Hoop" x="24346" y="4428" rot="0" params=""/> <obj type="Checkpoint" x="25534" y="6711" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-180,-23, -81,307, 494,307, 622,307, 874,293, 1114,265, 1291,252, 1433,258, 1608,298, 1698,353"/> <points a="1795,450, 1976,638, 2118,866, 2251,1071, 2323,1138, 2422,1188, 2589,1212, 2877,1244, 3137,1264, 3460,1272"/> <points a="4004,1272, 4324,1272, 4486,1268, 4605,1257, 4690,1232, 4829,1219, 4888,1211, 4926,1209, 5310,1209, 5462,1213"/> <points a="5641,1231, 5773,1253, 5943,1313, 6164,1433, 6278,1522, 6457,1701, 6557,1762, 6701,1794, 6843,1810, 6990,1810"/> <points a="7406,1810, 8558,1810, 8935,3797, 12423,3797, 12684,3800, 12865,3819, 13081,3834, 13343,3828, 13607,3814, 13909,3777"/> <points a="14103,3736, 14316,3678, 14508,3629, 14714,3601, 14834,3596, 15063,3596, 15332,3610, 15578,3624, 16015,3643, 16347,3643"/> <points a="16839,3629, 17161,3596, 17459,3543, 17746,3473, 17996,3434, 18193,3427, 18358,3426, 18498,3435, 18752,3456, 19003,3501"/> <points a="19472,3656, 19769,3783, 20076,3942, 20611,4279, 20821,4413, 21043,4505, 21222,4556, 21369,4578, 21546,4584, 21686,4587"/> <points a="22560,4996, 24663,6364, 25334,6710, 26614,6710, 27095,6727, 27959,6887, 28600,7107, 29132,7255, 29540,7302, 29966,7297"/> <points a="30030,7286, 30408,7248, 30841,7239, 31225,7239, 31897,7239, 32169,7245, 32431,7281, 32729,7346, 33018,7453, 33315,7603"/> <points a="33504,7731, 33671,7834, 33814,7892, 33907,7911, 34099,7914, 34351,7913, 35354,7889, 36232,7852, 36825,7813, 37724,7780"/> <points a="38907,11642, 39135,11654, 39903,11654, 40532,11679, 41044,11709, 41438,11731, 41865,11687, 42253,11628, 42668,11628, 43028,11660"/> <points a="43442,11694, 43955,11676, 44272,11609, 44594,11545, 44948,11580, 45270,11647, 45587,11683, 45878,11645, 46102,11614, 46456,11625"/> <points a="46710,11663, 46993,11703, 47346,11672, 47663,11617, 47948,11559, 48302,11583, 48619,11641, 48901,11688, 49193,11663, 49449,11631"/> <points a="49673,11673, 49962,11656, 50412,11584, 50604,11584, 50859,11635, 51242,11657, 51912,11658, 52205,10750, 55117,10750"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <level name="Level 11 (bonus) all the pickups" fillframe="1" surfaceframe="2" surfacethickness="10"> <objgroup name=""> <obj type="Checkpoint" x="1631" y="361" rot="0" params=""/> <obj type="Pickup02" x="2179" y="314" rot="0" params=""/> <obj type="Pickup02" x="2342" y="279" rot="0" params=""/> <obj type="Pickup02" x="2537" y="236" rot="0" params=""/> <obj type="Pickup02" x="2737" y="234" rot="0" params=""/> <obj type="Pickup02" x="2948" y="260" rot="0" params=""/> <obj type="Pickup02" x="3135" y="314" rot="0" params=""/> <obj type="Pickup02" x="3350" y="362" rot="0" params=""/> <obj type="Pickup02" x="3555" y="378" rot="0" params=""/> <obj type="Pickup02" x="3803" y="376" rot="0" params=""/> <obj type="Pickup02" x="4060" y="371" rot="0" params=""/> <obj type="Pickup02" x="4321" y="365" rot="0" params=""/> <obj type="Pickup02" x="4598" y="389" rot="0" params=""/> <obj type="Pickup02" x="4849" y="458" rot="0" params=""/> <obj type="Pickup02" x="5096" y="565" rot="0" params=""/> <obj type="Pickup02" x="5313" y="679" rot="0" params=""/> <obj type="Pickup02" x="5525" y="835" rot="0" params=""/> <obj type="Pickup02" x="5708" y="1015" rot="0" params=""/> <obj type="Pickup02" x="5883" y="1159" rot="0" params=""/> <obj type="Pickup02" x="6077" y="1316" rot="0" params=""/> <obj type="Pickup02" x="6331" y="1473" rot="0" params=""/> <obj type="Pickup02" x="6553" y="1603" rot="0" params=""/> <obj type="Pickup02" x="6786" y="1681" rot="0" params=""/> <obj type="Pickup02" x="7060" y="1715" rot="0" params=""/> <obj type="Pickup02" x="7296" y="1743" rot="0" params=""/> <obj type="Pickup02" x="7554" y="1746" rot="0" params=""/> <obj type="Pickup02" x="7755" y="1740" rot="0" params=""/> <obj type="Pickup02" x="8062" y="1646" rot="0" params=""/> <obj type="Pickup02" x="8143" y="1620" rot="0" params=""/> <obj type="Pickup02" x="8221" y="1604" rot="0" params=""/> <obj type="Pickup02" x="8469" y="1616" rot="0" params=""/> <obj type="Pickup02" x="8549" y="1595" rot="0" params=""/> <obj type="Pickup02" x="8627" y="1560" rot="0" params=""/> <obj type="Pickup02" x="9006" y="1457" rot="0" params=""/> <obj type="Pickup02" x="9142" y="1447" rot="0" params=""/> <obj type="Pickup02" x="9272" y="1444" rot="0" params=""/> <obj type="Pickup02" x="9682" y="1488" rot="0" params=""/> <obj type="Pickup02" x="9825" y="1528" rot="0" params=""/> <obj type="Pickup02" x="9758" y="1508" rot="0" params=""/> <obj type="Pickup02" x="10234" y="1628" rot="0" params=""/> <obj type="Pickup02" x="10292" y="1646" rot="0" params=""/> <obj type="Pickup02" x="10362" y="1672" rot="0" params=""/> <obj type="Pickup02" x="10584" y="1826" rot="0" params=""/> <obj type="Pickup02" x="10695" y="1854" rot="0" params=""/> <obj type="Pickup02" x="10805" y="1885" rot="0" params=""/> <obj type="Pickup02" x="11091" y="1950" rot="0" params=""/> <obj type="Pickup02" x="11312" y="1977" rot="0" params=""/> <obj type="Pickup02" x="11554" y="1991" rot="0" params=""/> <obj type="Pickup02" x="11799" y="1991" rot="0" params=""/> <obj type="Pickup02" x="12017" y="1980" rot="0" params=""/> <obj type="Pickup02" x="12252" y="1963" rot="0" params=""/> <obj type="Pickup02" x="12506" y="1957" rot="0" params=""/> <obj type="Pickup02" x="12745" y="1958" rot="0" params=""/> <obj type="Ramp" x="22204" y="3228" rot="0" params=""/> <obj type="Pickup02" x="13152" y="1968" rot="0" params=""/> <obj type="Pickup02" x="13331" y="1973" rot="0" params=""/> <obj type="Pickup02" x="13555" y="1986" rot="0" params=""/> <obj type="Pickup02" x="14200" y="2062" rot="0" params=""/> <obj type="Pickup02" x="14331" y="2077" rot="0" params=""/> <obj type="Pickup02" x="14480" y="2087" rot="0" params=""/> <obj type="Pickup02" x="14845" y="2101" rot="0" params=""/> <obj type="Pickup02" x="15070" y="2098" rot="0" params=""/> <obj type="Pickup02" x="14962" y="2101" rot="0" params=""/> <obj type="Pickup02" x="15617" y="2027" rot="0" params=""/> <obj type="Pickup02" x="15818" y="1989" rot="0" params=""/> <obj type="Pickup02" x="16038" y="1956" rot="0" params=""/> <obj type="Pickup02" x="16287" y="1925" rot="0" params=""/> <obj type="Pickup02" x="16831" y="1883" rot="0" params=""/> <obj type="Pickup02" x="16925" y="1883" rot="0" params=""/> <obj type="Pickup02" x="17023" y="1882" rot="0" params=""/> <obj type="Pickup02" x="17401" y="1965" rot="0" params=""/> <obj type="Pickup02" x="17626" y="2010" rot="0" params=""/> <obj type="Pickup02" x="17792" y="2055" rot="0" params=""/> <obj type="Pickup02" x="17980" y="2129" rot="0" params=""/> <obj type="Pickup02" x="18177" y="2218" rot="0" params=""/> <obj type="Pickup02" x="18385" y="2332" rot="0" params=""/> <obj type="Pickup02" x="18581" y="2467" rot="0" params=""/> <obj type="Pickup02" x="18761" y="2615" rot="0" params=""/> <obj type="Pickup02" x="18944" y="2753" rot="0" params=""/> <obj type="Pickup02" x="19142" y="2898" rot="0" params=""/> <obj type="Pickup02" x="19331" y="3035" rot="0" params=""/> <obj type="Pickup02" x="19554" y="3134" rot="0" params=""/> <obj type="Pickup02" x="19774" y="3195" rot="0" params=""/> <obj type="Pickup02" x="20070" y="3223" rot="0" params=""/> <obj type="Pickup02" x="20407" y="3221" rot="0" params=""/> <obj type="Pickup02" x="20729" y="3192" rot="0" params=""/> <obj type="Pickup02" x="21018" y="3185" rot="0" params=""/> <obj type="Pickup02" x="21228" y="3186" rot="0" params=""/> <obj type="Pickup02" x="21415" y="3186" rot="0" params=""/> <obj type="Pickup02" x="21665" y="3181" rot="0" params=""/> <obj type="Pickup02" x="21894" y="3172" rot="0" params=""/> <obj type="Pickup02" x="22174" y="3109" rot="0" params=""/> <obj type="Pickup02" x="22386" y="3104" rot="0" params=""/> <obj type="Pickup02" x="22281" y="3095" rot="0" params=""/> <obj type="Pickup02" x="22635" y="3188" rot="0" params=""/> <obj type="Pickup02" x="22923" y="3188" rot="0" params=""/> <obj type="Pickup02" x="23179" y="3188" rot="0" params=""/> <obj type="Pickup02" x="23406" y="3191" rot="0" params=""/> <obj type="endrace" x="26495" y="3275" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-114,-92, 1103,-87, 1227,360, 1963,360, 2143,354, 2312,328, 2464,286, 2569,272, 2643,269, 2811,274"/> <points a="3003,314, 3208,369, 3384,405, 3542,415, 3693,416, 4062,401, 4311,397, 4457,405, 4614,429, 4836,494"/> <points a="5085,602, 5300,714, 5488,871, 5666,1032, 5880,1215, 6111,1399, 6393,1575, 6534,1651, 6780,1736, 7038,1770"/> <points a="7331,1796, 7590,1797, 7810,1792, 8013,1772, 8210,1726, 8394,1677, 8565,1621, 8728,1557, 8819,1527, 8891,1508"/> <points a="9033,1485, 9165,1474, 9299,1468, 9419,1473, 9613,1503, 9885,1584, 10207,1705, 10464,1809, 10629,1869, 10763,1908"/> <points a="10963,1960, 11113,1985, 11191,1994, 11465,2016, 11558,2017, 11908,2016, 12194,1999, 12523,1986, 12731,1985, 13059,1993"/> <points a="13400,2003, 13760,2033, 13930,2057, 14182,2094, 14399,2114, 14681,2132, 14965,2140, 15270,2135, 15434,2112, 15559,2077"/> <points a="15729,2034, 15967,1995, 16171,1972, 16349,1958, 16559,1953, 16815,1953, 17135,1971, 17386,1996, 17505,2017, 17644,2062"/> <points a="17812,2136, 18105,2262, 18326,2387, 18545,2543, 18805,2724, 19127,2980, 19358,3128, 19488,3181, 19673,3232, 19829,3261"/> <points a="20132,3281, 20333,3285, 20516,3276, 20712,3251, 20888,3235, 21077,3234, 21493,3234, 21653,3234, 21694,3228, 21762,3224"/> <points a="22146,3224, 22530,3224, 23183,3221, 23544,3226, 23787,3238, 24031,3238, 24415,3238, 24831,3238, 25439,3238, 26043,3271"/> <points a="27323,3271, 27423,2187, 29439,2187, 29807,2193, 30105,2232, 30372,2296, 30694,2347, 31121,2281, 31641,2120, 32105,2295"/> <points a="32535,2203, 32905,2332, 33219,2226"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <level name="Level 12 (bonus) Crush The Penguinz" fillframe="13" surfaceframe="14" surfacethickness="10"> <objgroup name=""> <obj type="Penguin_Plinth" x="5396" y="1268" rot="0" params=""/> <obj type="Penguin_Physobj" x="5493" y="1266" rot="0" params=""/> <obj type="Checkpoint" x="1005" y="541" rot="0" params=""/> <obj type="Penguin_Physobj" x="5493" y="1192" rot="0" params=""/> <obj type="Penguin_Physobj" x="5493" y="1118" rot="0" params=""/> <obj type="Penguin_Physobj" x="5493" y="1044" rot="0" params=""/> <obj type="Ramp" x="9881" y="1649" rot="0" params=""/> <obj type="Penguin_Plinth" x="10411" y="1550" rot="0" params=""/> <obj type="Penguin_Physobj" x="10464" y="1549" rot="0" params=""/> <obj type="Penguin_Physobj" x="10464" y="1475" rot="0" params=""/> <obj type="Penguin_Physobj" x="10464" y="1401" rot="0" params=""/> <obj type="Penguin_Physobj" x="10588" y="1548" rot="0" params=""/> <obj type="Penguin_Physobj" x="10588" y="1475" rot="0" params=""/> <obj type="Penguin_Physobj" x="10588" y="1401" rot="0" params=""/> <obj type="Penguin_Plinth" x="17009" y="3110" rot="0" params=""/> <obj type="Penguin_Physobj" x="17070" y="3108" rot="0" params=""/> <obj type="Penguin_Physobj" x="17152" y="3108" rot="0" params=""/> <obj type="Penguin_Physobj" x="17076" y="3016" rot="90" params=""/> <obj type="Penguin_Physobj" x="17094" y="2996" rot="0" params=""/> <obj type="Penguin_Physobj" x="17132" y="2996" rot="0" params=""/> <obj type="Penguin_Physobj" x="17077" y="2904" rot="90" params=""/> <obj type="Penguin_Plinth" x="22283" y="3830" rot="0" params=""/> <obj type="Penguin_Physobj" x="22302" y="3827" rot="0" params=""/> <obj type="Penguin_Physobj" x="22387" y="3828" rot="0" params=""/> <obj type="Penguin_Physobj" x="22466" y="3828" rot="0" params=""/> <obj type="Penguin_Physobj" x="22387" y="3754" rot="0" params=""/> <obj type="Penguin_Physobj" x="22302" y="3754" rot="0" params=""/> <obj type="Penguin_Physobj" x="22466" y="3755" rot="0" params=""/> <obj type="endrace" x="26012" y="4083" rot="0" params=""/> </objgroup> <line type="0" name="" fill="0" fillscale="1"> <points a="-328,-81, 492,-77, 567,543, 1431,543, 1670,556, 1874,587, 2208,677, 2418,750, 2738,905, 2997,1028"/> <points a="3251,1139, 3534,1238, 3755,1288, 4021,1320, 4297,1332, 4745,1332, 4796,1325, 4903,1312, 4957,1280, 5094,1296"/> <points a="5270,1296, 5782,1296, 6550,1296, 6806,1296, 6931,1315, 7030,1390, 7339,1546, 7630,1630, 7955,1648, 10323,1648"/> <points a="10371,1578, 10916,1572, 11093,1546, 11293,1527, 11549,1527, 11763,1531, 12121,1545, 12457,1585, 12548,1606, 12728,1672"/> <points a="12909,1763, 13127,1903, 13342,2062, 13695,2317, 14057,2539, 14323,2691, 14587,2821, 14808,2925, 15168,3065, 15374,3133"/> <points a="15716,3229, 15956,3276, 16093,3292, 16292,3298, 16388,3291, 16485,3280, 16555,3254, 16630,3223, 16685,3192, 16901,3193"/> <points a="16948,3148, 17684,3148, 17869,3126, 18063,3094, 18236,3080, 18501,3072, 18742,3085, 18945,3115, 19174,3170, 19367,3244"/> <points a="19498,3324, 19579,3376, 19758,3480, 19879,3555, 20092,3667, 20272,3729, 20474,3796, 20623,3832, 20818,3853, 21069,3853"/> <points a="21869,3853, 22541,3853, 22757,3838, 22985,3812, 23237,3802, 23472,3801, 23788,3821, 24149,3877, 24265,3917, 24560,3999"/> <points a="24753,4035, 25084,4080, 26524,4080, 26568,3774, 26838,3679, 27336,3681, 28101,3742, 28481,3940, 29122,4140, 29622,4117"/> <points a="30055,3930, 30444,3804, 31154,4110, 31495,3949, 31924,4121, 32279,3922"/> </line> <map minx="0" maxx="0" miny="0" maxy="0" cellw="16" cellh="16"> <mapdata a=""/> </map> </level> <physobj name="SkiJumpStart" inlibrary="true" hasphysics="false"> <graphic clip="StuntTarget" frame="1" pos="0,0" rot="0" zoffset="800" gameobjfunction="InitSkiJumpStart"/> </physobj> <physobj name="CliffJumpStart" inlibrary="true" hasphysics="false"> <graphic clip="StuntTarget" frame="1" pos="0,0" rot="0" zoffset="800" gameobjfunction="InitCliffJumpStart"/> </physobj> <physobj name="endrace" inlibrary="true" hasphysics="true"> <graphic clip="Checkpoint" frame="2" pos="0,0" rot="0" zoffset="8000" gameobjfunction="InitEndLine"/> </physobj> <physobj name="Checkpoint" inlibrary="true"> <graphic clip="Checkpoint" frame="1" pos="0,0" rot="0" zoffset="8000" gameobjfunction="InitCheckpoint"/> </physobj> <physobj name="JumpAdvisor3" inlibrary="true" hasphysics="false"> <graphic clip="StuntTarget" frame="1" pos="0,0" rot="0" zoffset="8000" gameobjfunction="InitJumpAdvisor3"/> </physobj> <physobj name="JumpAdvisor2" inlibrary="true" hasphysics="false"> <graphic clip="StuntTarget" frame="1" pos="0,0" rot="0" zoffset="8000" gameobjfunction="InitJumpAdvisor2"/> </physobj> <physobj name="BrickWall" inlibrary="true" hasphysics="false"> <graphic clip="BrickWall" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitBrickWall"/> </physobj> <physobj name="Cactus" inlibrary="true" hasphysics="false"> <graphic clip="Cactus" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitCactus"/> </physobj> <physobj name="Cactus1" inlibrary="true" hasphysics="false"> <graphic clip="Cactus1" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitCactus"/> </physobj> <physobj name="Crystals" inlibrary="true" hasphysics="false"> <graphic clip="Crystals" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitCrystals"/> </physobj> <physobj name="GlassPane" inlibrary="true" hasphysics="false"> <graphic clip="GlassPane" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitGlassPane"/> </physobj> <physobj name="MelonBarrow" inlibrary="true" hasphysics="false"> <graphic clip="MelonBarrow" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitMelonBarrow"/> </physobj> <physobj name="Obelisk" inlibrary="true" hasphysics="false"> <graphic clip="Obelisk" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitObelisk"/> </physobj> <physobj name="Stalagmite" inlibrary="true" hasphysics="false"> <graphic clip="Stalagmite" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitStalagmite"/> </physobj> <physobj name="Stalagmite1" inlibrary="true" hasphysics="false"> <graphic clip="Stalagmite1" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitStalagmite"/> </physobj> <physobj name="Penguin" inlibrary="true" hasphysics="false"> <graphic clip="Penguin" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitPenguin"/> </physobj> <physobj name="Igloo" inlibrary="true" hasphysics="false"> <graphic clip="Igloo" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitIgloo"/> </physobj> <physobj name="Snowman" inlibrary="true" hasphysics="false"> <graphic clip="Snowman" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitSnowman"/> </physobj> <physobj name="EasterStatue" inlibrary="true" hasphysics="false"> <graphic clip="EasterStatue" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitEasterStatue"/> </physobj> <physobj name="BonusPickup" inlibrary="true" hasphysics="false"> <graphic clip="BonusPickup" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitBonusPickup"/> </physobj> <physobj name="Pickup01" inlibrary="true" hasphysics="false"> <graphic clip="Pickup01" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitPickupA"/> </physobj> <physobj name="Pickup02" inlibrary="true" hasphysics="false"> <graphic clip="Pickup02" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitPickupB"/> </physobj> <physobj name="Hoop" inlibrary="true" hasphysics="false"> <graphic clip="Hoop" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitHoop"/> </physobj> <physobj name="Parrot" inlibrary="true" hasphysics="false"> <graphic clip="arcticParrot" frame="1" pos="0,0" rot="0" zoffset="0" gameobjfunction="InitParrot"/> </physobj> <physobj name="Ramp" description="ramp" inlibrary="true" hasphysics="true"> <body name="ramp" pos="0,0" fixed="true" sensor="false" angulardamping="1"> <graphic clip="Ramp" frame="1" pos="0,0" rot="0" gameobjfunction="InitRamp"/> <shape type="poly" name="body" col="1,15" vertices="0,0, 93,-45, 93,21" density="0.4" friction="0" restitution="0"/> </body> </physobj> <physobj name="Penguin_Physobj" description="" inlibrary="true" hasphysics="true" initfunction="InitPhysObj_Penguin"> <body name="ramp" pos="0,0" fixed="false" sensor="false" angulardamping="1"> <graphic clip="Penguin_Physobj" frame="1" pos="0,0" rot="0" gameobjfunction="InitSmashPenguin"/> <shape type="poly" name="tumble" col="1,7" vertices="-18,-72, 18,-72, 18,0, -18,0" density="0.04" friction="1" restitution="0"/> </body> </physobj> <physobj name="Penguin_Plinth" description="" inlibrary="true" hasphysics="true"> <body name="ramp" pos="0,0" fixed="true" sensor="false" angulardamping="1"> <graphic clip="Penguin_Plinth" frame="1" pos="0,0" rot="0"/> <shape type="poly" name="plinth" col="1,7" vertices="0,0, 200,0, 200,40, 0,40" density="1" friction="5" restitution="0"/> </body> </physobj> <physobj name="snowball01" description="snowball" inlibrary="true" hasphysics="true" initfunction="InitPhysObj_Snowball01"> <body name="ball" pos="0,0" fixed="false" sensor="false" angulardamping="1"> <graphic clip="Snowball01" frame="1" pos="0,0" rot="0"/> <shape type="circle" pos="0,0" name="" col="8,1" radius="17" density="0.1" friction="0.5" restitution="0.5"/> </body> </physobj> <physobj name="snowball02" description="snowball" inlibrary="true" hasphysics="true" initfunction="InitPhysObj_Snowball02"> <body name="ball" pos="0,0" fixed="false" sensor="false" angulardamping="1"> <graphic clip="Snowball01" frame="2" pos="0,0" rot="0"/> <shape type="circle" pos="0,0" name="" col="8,1" radius="32" density="0.1" friction="0.5" restitution="0.5"/> </body> </physobj> <physobj name="snowball03" description="snowball" inlibrary="true" hasphysics="true" initfunction="InitPhysObj_Snowball03"> <body name="ball" pos="0,0" fixed="false" sensor="false" angulardamping="1"> <graphic clip="Snowball01" frame="3" pos="0,0" rot="0"/> <shape type="circle" pos="0,0" name="" col="8,1" radius="51" density="0.1" friction="0.5" restitution="0.5"/> </body> </physobj> <physobj name="bike1" description="robo" inlibrary="false"> <body name="skis" pos="0,0" fixed="false" sensor="false" angulardamping="10"> <graphic clip="Skiier01" frame="1" pos="0,0" rot="0" gameobjfunction="InitPlayer" gameobjvars="BikeBody01,-8,-18"/> <shape type="poly" name="body" col="2,15" vertices="-10,-60,10,-60,10,-40,-10,-40" density="0.4" friction="0" restitution="0"/> <shape type="circle" pos="0,-20" name="roll" col="2,1" radius="15" density="0.01" friction="3" restitution="0.0"/> <shape type="poly" name="ski" col="0,0" vertices="-35,-10, 35,-10, 35,0, -35,0" density="0.2" friction="0" restitution="0"/> </body> <body name="wheel1" pos="-30,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <body name="wheel2" pos="30,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <joint type="rev" name="joint1" body0="skis" body1="wheel1" pos="-30,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> <joint type="rev" name="joint2" body0="skis" body1="wheel2" pos="30,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> </physobj> <physobj name="bike2" description="robo" inlibrary="false"> <body name="skis" pos="0,0" fixed="false" sensor="false" angulardamping="10"> <graphic clip="Skiier01" frame="1" pos="0,0" rot="0" gameobjfunction="InitPlayer" gameobjvars="BikeBody01,-8,-18"/> <shape type="poly" name="body" col="2,15" vertices="-10,-60,10,-60,10,-40,-10,-40" density="0.4" friction="0" restitution="0"/> <shape type="circle" pos="0,-20" name="roll" col="2,1" radius="15" density="0.01" friction="3" restitution="0.0"/> <shape type="poly" name="ski" col="0,0" vertices="-50,-10, 25,-10, 25,0, -50,0" density="0.2" friction="0" restitution="0"/> </body> <body name="wheel1" pos="-50,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <body name="wheel2" pos="25,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <joint type="rev" name="joint1" body0="skis" body1="wheel1" pos="-50,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> <joint type="rev" name="joint2" body0="skis" body1="wheel2" pos="25,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> </physobj> <physobj name="bike3" description="robo" inlibrary="false"> <body name="skis" pos="0,0" fixed="false" sensor="false" angulardamping="10"> <graphic clip="Skiier01" frame="1" pos="0,0" rot="0" gameobjfunction="InitPlayer" gameobjvars="BikeBody01,-8,-18"/> <shape type="poly" name="body" col="2,15" vertices="-10,-60,10,-60,10,-40,-10,-40" density="0.4" friction="0" restitution="0"/> <shape type="circle" pos="0,-20" name="roll" col="2,1" radius="15" density="0.01" friction="3" restitution="0.0"/> <shape type="poly" name="ski" col="0,0" vertices="-35,-10, 20,-10, 20,0, -35,0" density="0.2" friction="0" restitution="0"/> </body> <body name="wheel1" pos="-35,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <body name="wheel2" pos="20,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <joint type="rev" name="joint1" body0="skis" body1="wheel1" pos="-35,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> <joint type="rev" name="joint2" body0="skis" body1="wheel2" pos="20,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> </physobj> <physobj name="bike4" description="robo" inlibrary="false"> <body name="skis" pos="0,0" fixed="false" sensor="false" angulardamping="10"> <graphic clip="Skiier01" frame="1" pos="0,0" rot="0" gameobjfunction="InitPlayer" gameobjvars="BikeBody01,-8,-18"/> <shape type="poly" name="body" col="2,15" vertices="-10,-60,10,-60,10,-40,-10,-40" density="0.4" friction="0" restitution="0"/> <shape type="circle" pos="0,-20" name="roll" col="2,1" radius="15" density="0.01" friction="3" restitution="0.0"/> <shape type="poly" name="ski" col="0,0" vertices="-20,-10, 40,-10, 40,0, -20,0" density="0.2" friction="0" restitution="0"/> </body> <body name="wheel1" pos="-20,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <body name="wheel2" pos="40,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <joint type="rev" name="joint1" body0="skis" body1="wheel1" pos="-20,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> <joint type="rev" name="joint2" body0="skis" body1="wheel2" pos="40,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> </physobj> <physobj name="bike5" description="clown" inlibrary="false"> <body name="skis" pos="0,0" fixed="false" sensor="false" angulardamping="10"> <graphic clip="Skiier01" frame="1" pos="0,0" rot="0" gameobjfunction="InitPlayer" gameobjvars="BikeBody01,-8,-18"/> <shape type="poly" name="body" col="2,15" vertices="-10,-60,10,-60,10,-40,-10,-40" density="0.4" friction="0" restitution="0"/> <shape type="circle" pos="0,-20" name="roll" col="2,1" radius="15" density="0.01" friction="3" restitution="0.0"/> <shape type="poly" name="ski" col="0,0" vertices="-20,-10, 40,-10, 40,0, -20,0" density="0.2" friction="0" restitution="0"/> </body> <body name="wheel1" pos="-20,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <body name="wheel2" pos="40,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <joint type="rev" name="joint1" body0="skis" body1="wheel1" pos="-20,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> <joint type="rev" name="joint2" body0="skis" body1="wheel2" pos="40,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> </physobj> <physobj name="bike6" description="robo" inlibrary="false"> <body name="skis" pos="0,0" fixed="false" sensor="false" angulardamping="10"> <graphic clip="Skiier01" frame="1" pos="0,0" rot="0" gameobjfunction="InitPlayer" gameobjvars="BikeBody01,-8,-18"/> <shape type="poly" name="body" col="2,15" vertices="-10,-60,10,-60,10,-40,-10,-40" density="0.4" friction="0" restitution="0"/> <shape type="circle" pos="0,-20" name="roll" col="2,1" radius="15" density="0.01" friction="3" restitution="0.0"/> <shape type="poly" name="ski" col="0,0" vertices="-22,-10, 27,-10, 27,0, -22,0" density="0.2" friction="0" restitution="0"/> </body> <body name="wheel1" pos="-22,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <body name="wheel2" pos="27,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <joint type="rev" name="joint1" body0="skis" body1="wheel1" pos="-22,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> <joint type="rev" name="joint2" body0="skis" body1="wheel2" pos="27,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> </physobj> <physobj name="bike7" description="robo" inlibrary="false"> <body name="skis" pos="0,0" fixed="false" sensor="false" angulardamping="10"> <graphic clip="Skiier01" frame="1" pos="0,0" rot="0" gameobjfunction="InitPlayer" gameobjvars="BikeBody01,-8,-18"/> <shape type="poly" name="body" col="2,15" vertices="-10,-60,10,-60,10,-40,-10,-40" density="0.4" friction="0" restitution="0"/> <shape type="circle" pos="0,-20" name="roll" col="2,1" radius="15" density="0.01" friction="3" restitution="0.0"/> <shape type="poly" name="ski" col="0,0" vertices="-22,-10, 27,-10, 27,0, -22,0" density="0.2" friction="0" restitution="0"/> </body> <body name="wheel1" pos="-22,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <body name="wheel2" pos="27,-10" fixed="false" sensor="false"> <shape type="circle" pos="0,0" name="wheel" col="2,15" radius="10" density="0.1" friction="0.0" restitution="0.0"/> </body> <joint type="rev" name="joint1" body0="skis" body1="wheel1" pos="-22,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> <joint type="rev" name="joint2" body0="skis" body1="wheel2" pos="27,-10" enablelimit="false" lowerangle="0" upperangle="0" enablemotor="false" motorspeed="0" maxmotortorque="0"/> </physobj> </data> ; public static var gameconstants:Object; static var cb:Function; static function XmlLoadedInternal(){ var _local1:int; XML.ignoreWhitespace = true; xml = new XML(xxx); GetConstants(); cb(); } public static function SendLevelStatsToServer(){ var path = "http://www.longanimalsgames.com/test/SkiManiacsAddStat.php"; var vars:URLVariables = new URLVariables(); vars.playerID = Game.currentBikeIndex; vars.levelID = Game.currentLevel; vars.time = Game.raceTimer; vars.score = Game.currentScore; vars.userID = 0; var request:URLRequest = new URLRequest(path); request.method = URLRequestMethod.POST; request.data = vars; FlashConnect.trace("Stats sent to server"); try { sendToURL(request); } catch(e:Error) { FlashConnect.trace(e.message); }; } public static function Load(_arg1:Function){ cb = _arg1; XmlLoadedInternal(); } public static function poo(_arg1:Event){ trace(loader.data.status); } public static function OutputString(_arg1:String){ System.setClipboard(_arg1); } public static function GetConstants(){ var _local1:*; var _local2:int; var _local3:XML; constants = new Object(); _local1 = xml.constants.constant.length(); _local2 = 0; while (_local2 < _local1) { _local3 = xml.constants.constant[_local2]; constants[_local3.@name] = _local3.@value; _local2++; }; gameconstants = new Object(); _local1 = xml.gameconstants.constant.length(); _local2 = 0; while (_local2 < _local1) { _local3 = xml.gameconstants.constant[_local2]; gameconstants[_local3.@name] = _local3.@value; _local2++; }; } public static function xmlLoaded(_arg1:Event){ var _local2:int; XML.ignoreWhitespace = true; xml = new XML(_arg1.target.data); GetConstants(); trace("XML Loaded"); cb(); } } }//package
Section 138
//FailedBonusLevelScreen (FailedBonusLevelScreen) package { import flash.display.*; public dynamic class FailedBonusLevelScreen extends MovieClip { public var buttonNext:SimpleButton; } }//package
Section 139
//Fills (Fills) package { import flash.display.*; public dynamic class Fills extends MovieClip { } }//package
Section 140
//FinishedLastScreen (FinishedLastScreen) package { import flash.display.*; public dynamic class FinishedLastScreen extends MovieClip { public var buttonOK:SimpleButton; } }//package
Section 141
//frontground1 (frontground1) package { import flash.display.*; public dynamic class frontground1 extends MovieClip { } }//package
Section 142
//frontground2 (frontground2) package { import flash.display.*; public dynamic class frontground2 extends MovieClip { } }//package
Section 143
//frontground3 (frontground3) package { import flash.display.*; public dynamic class frontground3 extends MovieClip { } }//package
Section 144
//frontground4 (frontground4) package { import flash.display.*; public dynamic class frontground4 extends MovieClip { } }//package
Section 145
//frontground5 (frontground5) package { import flash.display.*; public dynamic class frontground5 extends MovieClip { } }//package
Section 146
//frontground6 (frontground6) package { import flash.display.*; public dynamic class frontground6 extends MovieClip { } }//package
Section 147
//FullPageInstructions (FullPageInstructions) package { import flash.display.*; public dynamic class FullPageInstructions extends MovieClip { public var buttonNext:SimpleButton; } }//package
Section 148
//Game (Game) package { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.media.*; import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; import flash.ui.*; import org.flashdevelop.utils.*; import flash.system.*; public class Game { static const levelState_PostRace = 4; static const levelFinishedState_WON = 1; static const levelState_Play = 1; static const colCategory_Background:int = 1; static const colCategory_Pellet:int = 4; static const levelFinishedState_NOT = 0; static const levelState_Editor = 3; static const levelFinishedState_LOST = 2; static const colCategory_Ball:int = 2; static const levelState_Null = 2; static const levelState_LevelStart = 0; public static var scrollCX:Number; public static var scrollCY:Number; static var startTimer:int; static var ScoreAtStartOfLevel:int; public static var backWheelUpTimer:int = 0; public static var coastSound:SoundChannel; static var boostModifier_BackSomersault:Number = 0.08; static var playerRecording:Array; static var stuntAddedTimerMax:int; static var bgFrame:int; static var cheat0String:String = "CHEESE"; public static var numCrashes:int = 0; public static var playerHitFloorTimerMax:int; static var player_calculated_boostmul:Number; static var playerJumpingTimer:int = 0; public static var bellPlayingTimer:int; public static var bikeWheelUpTimer:int; static var currentStartPointIndex:int; static var physTimeStep:Number = 0.0166666666666667; public static var currentWorldID:int = 0; static var jumpAdvisorDisplayTimer:int; static var skiJumpEndX:int = 0; public static var maxFallSpeed; static var helpTimer:int; static var physObjs:PhysObjs; static var numLevels:int; static var numMessagesActive:int; static var currentScore:int; public static var playerRacePosition:int; public static var frontWheelieTimer:int = 0; public static var boostTimerMax:int; public static var multiSomersaultCount:int; static var PauseButton:SimpleButton; public static var playerHitFloorMaxRot:Number; public static var LevelUpdateCallback:Object; static var canShootPellet:Boolean; public static var numHoopsComplete:int; static var stuntAddedTimer:int; static var switchFlag:int = 0; public static var levelForwardSomersaults:int = 0; static var scrollMaxVel:Number; static var playerLeaning:Boolean; static var scrollToDX:Number = 0; static var numBikes:int; public static var oldPlayerRot:Number = 0; static var snowList:Array; static var scrollToDY:Number = 0; static var version:String = "v 0.8"; static var levelFailed:Boolean; public static var bikeWheelDownTimer:int; static var skiJumpFlag:Boolean; static var helpScreenID:int; static var shootHeldTime:int = 0; public static var polygonList:Array; static var numCreds:int; public static var timesList:Array; public static var snowBD:BitmapData = null; static var dbg_maxvel:Number; static var sitelocked:Boolean = false; static var cheatMode:int; static var numLives:int; static var startMode:int; public static var playerHitFloorTimer:int; static var usedebug:Boolean = false; static var w2p:Number = (1 / p2w); public static var numSnowmenHit:int; public static var numSequencesComplete:int; static var somersaultText:Array = new Array("", "Double ", "Triple ", "Quadruple ", "Quintuple ", "Multi "); public static var highestMultiSomersault:int; static var shakeCamDY:Number = 0; public static var playerRaceFinishCash:int; static var pickupMultiplier:int; static var shakeCamDX:Number = 0; public static var boostTimer:int; public static var highestBoostLevel:int; static var jumpAdvisorCurrent:int; static var levelScore:int; public static var stopScroll:Boolean; static var levels:Array; public static var backWheelDown:Boolean; static var previousStaticPoints:Array; static var skiJumpLanded:Boolean; static var currentLevel:int; public static var totalPickups:int; static var shakeCamToX:Number = 0; static var dontDieLevel:Boolean; public static var playerX:Number = 0; static var shakeCamToY:Number = 0; public static var totalSnowmen:int; public static var playerY:Number = 0; public static var boostLevel:Number; static var levelStateCount:int; static var scrollVel:Number; public static var failedChase:Boolean; static var main:Main; static var mousetimer:int = 0; static var multiplier:int; public static var boostMultiplier:int; static var cliffJumpRotCount:int; static var snowballList:Array; static var numSnowballs:int; static var numRacesCompleted; static var lastGeneratedGameObj:GameObj; public static var squeakSound:SoundChannel; static var helpOverlay:MovieClip = null; static var shakeCamTimer:int = 50; static var skiJumpLevel:Boolean; static var playerLean:Number; static var goPlayer:GameObj; static var chase_caught:Boolean; public static var totalSequences:int; static var shakeCamTimerMax:int = 50; static var cheat3String:String = "HADDOCK"; static var skiJumpDistance:int = 0; static var skiJumpStartX:int = 0; static var pause:Boolean; public static var playerRotMode:int; static var oldRecordPosX:Number; static var oldRecordPosY:Number; static var cliffJumpLevel:Boolean; static var dbg_vel:Number; static var bonusPickupCollected:Boolean; static var jumpAdvisorResultTimer:int; public static var playerRotLeaveGround:Number; static var levs:Array = new Array(1, 2, 3, 4, 5, 6, 4, 2, 1, 5, 4, 2, 1, 5, 4, 2, 1, 5); static var cheatUnlocked0:Boolean; static var levelFinishedState:int; static var cheatUnlocked2:Boolean; static var cheatUnlocked3:Boolean; static var panelRect:Rectangle = new Rectangle(500, 10, 100, 10); static var levelTimer:int; static var player_acc:Number = 400; static var pickupTimer:int; static var cheatUnlocked1:Boolean; static var boostModifier_RearWheelie:Number = 0.08; static var playerState:int; public static var playerHitFloor:Boolean; static var jumpAdvisorFlag:Boolean; public static var bestSingleAirTime:int = 0; public static var gravity; static var numPenguinsSmashed:int; static var startTimerMax:int; static var shootMode:int = 0; public static var bestRearWheelieTime:int; public static var frontWheelUpTimer:int = 0; static var messageSlots:Array; static var jumpAdvisorResult:int; public static var frontWheelDown:Boolean; static var pickupTimerMax:int; static var scrollScale:Number = 1; static var shakeCamY:Number = 0; public static var scrollXa:Number; public static var levelBackSomersaults:int = 0; static var currentProjectileType:int = 0; static var MoreGamesButton:SimpleButton; static var boost_minAirTime:Number = 40; static var help_fromIngame:Boolean; static var shakeCamX:Number = 0; static var scrollAcc:Number; static var cheat2String:String = "ELVIS"; static var jumpAdvisorTimer:int; public static var scrollYa:Number; static var cliffJumpFlag:Boolean; static var helpIsAvailable:Boolean; static var animDefs:Array; public static var endLineX:int = 0; static var player_maxvel:Number = 30; public static var levelFrontWheelieTime:int = 0; static var currentSkiIndex:int = 0; static var physGravity:Number = (1600 * w2p); static var mouseJoint:b2MouseJoint = null; static var pauseGameplayInput:Boolean; static var raceTimer:int; static var p2w:Number = 14; public static var playerHitFloorCount:int; public static var levelWheelieTime:int = 0; public static var oldScrollX:Number; public static var oldScrollY:Number; static var player_calculated_brake:Number; public static var levelAirTime:int = 0; public static var scrollH:Number; public static var snowB:Bitmap = null; public static var achievements:Achievements; static var panelRect1:Rectangle = new Rectangle(200, 3, 200, 5); public static var scrollW:Number; public static var scrollX:Number; public static var scrollY:Number; static var soundon:Boolean = true; static var cash:int; public static var playerRot:Number = 0; public static var numPickupsCollected:int; static var nextSnow:int; static var highestPoint:int; static var player_calculated_angvel:Number; static var gotSneakyStart:Boolean; static var penguinSmashLevel:Boolean; public static var numCollisionTests:int; static var skiUnlocks:Array; public static var totalHoops:int; static var physNumIterations:int = 20; static var levelState:int; static var cheat1String:String = "GERBIL"; static var numWeapons:int = 5; static var jumpAdvisorList:Array; static var boostModifier_AirTime:Number = 0.08; static var player_calculated_maxvel:Number; static var level_instances:Array; static var physObjInstances:PhysObj_Instances; static var boost_minWheelieTime:Number = 20; static var boostModifier_ForwardSomersault:Number = 0.12; public static var world:b2World; public static var playerRotCount:int; static var playerRecordingFlag:int = 0; static var cliffJumpLanded:Boolean; static var player_calculated_acc:Number; static var zsortoffset:Number = 0; static var numFirstPlaces; static var doTitleSnow:Boolean = false; public static var bikeWheelDown:Boolean = true; public static var maxBoostMultiplier:int = 5; static var cursorY:Number = 0; static var groundBody:b2Body; public static var wheelieTimer:int = 0; static var levelStateTimer:int; static var currentGameMusic:int; public static var jumptimer:int; static var scrollMaxX; static var cursorX:Number = 0; static var startPoints:Array; static var scrollMaxY; public static var boostMode:int; static var boostModifier_FrontWheelie:Number = 0.12; static var currentBikeIndex:int = 0; public static function RemoveObj_Standard(_arg1:PhysObj_Instance){ physObjInstances.Remove(_arg1); } public static function RemoveObj_BallInHopper(_arg1:PhysObj_Instance){ physObjInstances.Remove(_arg1); } static function InitAnimDefs(){ animDefs = new Array(); animDefs.push(new AnimDef("forward", 1, 8)); animDefs.push(new AnimDef("forwardIdle", 12, 18)); animDefs.push(new AnimDef("push", 23, 33)); animDefs.push(new AnimDef("pushIdle", 37, 45)); animDefs.push(new AnimDef("back", 50, 60)); animDefs.push(new AnimDef("backIdle", 63, 71)); animDefs.push(new AnimDef("crouch", 81, 87)); animDefs.push(new AnimDef("crouchIdle", 93, 101)); animDefs.push(new AnimDef("jump", 108, 117)); animDefs.push(new AnimDef("pose", 126, 170)); animDefs.push(new AnimDef("die", 171, 179)); } public static function ApplyImpulseToObjectsFromPoint(_arg1:b2Body, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{ var _local6:b2Body; var _local7:b2Vec2; var _local8:Number; var _local9:Number; _local6 = world.GetBodyList(); while (_local6) { if (_local6 != _arg1){ _local7 = new b2Vec2((_local6.GetWorldCenter().x - _arg2), (_local6.GetWorldCenter().y - _arg3)); _local8 = _local7.Length(); if (_local8 <= _arg5){ _local7.Normalize(); _local9 = Utils.ScaleTo(0, _arg4, 0, _arg5, (_arg5 - _local8)); _local7.Multiply(_local9); _local6.ApplyImpulse(_local7, _local6.GetWorldCenter()); }; }; _local6 = _local6.GetNext(); }; } static function AddPhysObjAt(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:String=""):PhysObj_Instance{ var _local9:Number; var _local10:Number; var _local11:b2BodyDef; var _local12:b2Body; var _local13:b2PolygonDef; var _local14:b2CircleDef; var _local15:int; var _local16:b2Joint; var _local18:PhysObj_Body; var _local19:PhysObj_Joint; var _local20:Number; var _local21:Number; var _local22:Point; var _local23:PhysObj_BodyUserData; var _local24:PhysObj_Shape; var _local25:PhysObj_Graphic; var _local26:b2FilterData; var _local27:b2Shape; var _local28:Point; var _local29:Number; var _local30:Number; var _local31:Point; var _local32:int; var _local33:int; var _local34:b2Body; var _local35:b2Body; var _local36:b2RevoluteJointDef; var _local37:b2PrismaticJointDef; var _local38:Number; var _local39:b2Vec2; var _local40:b2DistanceJointDef; var _local41:Number; var _local42:Number; var _local43:b2MouseJointDef; var _local6:PhysObj = physObjs.FindByName(_arg1); var _local7:PhysObj_Instance = new PhysObj_Instance(); _local7.typeName = _arg1; _local7.x = _arg2; _local7.y = _arg3; _local7.rot = _arg4; _local7.bodies = new Array(); _local7.instanceName = _arg5; _local7.hitballsound = _local6.hitballsound; physObjInstances.list.push(_local7); _local7.Init(); var _local8:Number = Utils.DegToRad(_arg4); _arg2 = (_arg2 * w2p); _arg3 = (_arg3 * w2p); var _local17:Matrix = new Matrix(); _local17.rotate(_local8); for each (_local18 in _local6.bodies) { _local11 = new b2BodyDef(); _local20 = (_local18.pos.x * w2p); _local21 = (_local18.pos.y * w2p); _local22 = new Point(_local20, _local21); _local22 = _local17.transformPoint(_local22); _local20 = _local22.x; _local21 = _local22.y; _local11.position.Set((_arg2 + _local20), (_arg3 + _local21)); _local11.angularDamping = _local18.angularDamping; _local11.linearDamping = _local18.linearDamping; _local11.angle = _local8; _local12 = world.CreateBody(_local11); _local23 = new PhysObj_BodyUserData(); _local23.type = _arg1; _local23.bodyName = _local18.name; _local23.instance = _local7; _local12.SetUserData(_local23); if (_local18.graphics.length != 0){ _local25 = _local18.graphics[0]; _local23.gameObjectID = InitPhysicsGO(_arg2, _arg3, _local25, _local25.graphicID, _local25.frame, 1000); }; for each (_local24 in _local18.shapes) { _local26 = new b2FilterData(); _local26.categoryBits = _local24.collisionCategory; _local26.maskBits = _local24.collisionMask; if (_local24.type == PhysObj_Shape.Type_Poly){ _local13 = new b2PolygonDef(); _local13.vertexCount = _local24.poly_points.length; _local13.filter = _local26; _local13.isSensor = _local18.sensor; _local15 = 0; while (_local15 < _local24.poly_points.length) { _local28 = _local24.poly_points[_local15].clone(); _local29 = (_local28.x * w2p); _local30 = (_local28.y * w2p); if (_local18.fixed){ _local31 = AlignWithPreviousVerts(_local29, _local30, _arg2, _arg3, _local8); if (_local31 != null){ _local29 = (_local29 + _local31.x); _local30 = (_local30 + _local31.y); }; }; _local13.vertices[_local15].Set(_local29, _local30); _local15++; }; _local13.friction = _local24.friction; _local13.restitution = _local24.restitution; _local13.density = _local24.density; _local27 = _local12.CreateShape(_local13); _local27.m_userData = _local24.name; } else { if (_local24.type == PhysObj_Shape.Type_Circle){ _local14 = new b2CircleDef(); _local14.radius = (_local24.circle_radius * w2p); _local14.filter = _local26; _local14.isSensor = _local18.sensor; _local14.localPosition.x = (_local24.circle_pos.x * w2p); _local14.localPosition.y = (_local24.circle_pos.y * w2p); _local14.friction = _local24.friction; _local14.restitution = _local24.restitution; _local14.density = _local24.density; _local27 = _local12.CreateShape(_local14); _local27.m_userData = _local24.name; }; }; }; if (_local18.fixed){ _local12.PutToSleep(); _local12.SetMass(new b2MassData()); } else { _local12.SetMassFromShapes(); _local12.SetBullet(true); }; _local7.bodies.push(_local12); }; for each (_local19 in _local6.joints) { _local32 = _local6.BodyIndexFromName(_local19.obj0Name); _local33 = _local6.BodyIndexFromName(_local19.obj1Name); _local34 = _local7.bodies[_local32]; _local35 = _local7.bodies[_local33]; if (_local19.type == PhysObj_Joint.Type_Rev){ _local36 = new b2RevoluteJointDef(); _local9 = (_local19.rev_pos.x * w2p); _local10 = (_local19.rev_pos.y * w2p); _local22 = new Point(_local9, _local10); _local22 = _local17.transformPoint(_local22); _local9 = _local22.x; _local10 = _local22.y; _local36.Initialize(_local34, _local35, new b2Vec2((_arg2 + _local9), (_arg3 + _local10))); _local36.enableLimit = _local19.rev_enableLimit; _local36.lowerAngle = _local19.rev_lowerAngle; _local36.upperAngle = _local19.rev_upperAngle; _local36.enableMotor = _local19.rev_enableMotor; _local36.motorSpeed = _local19.rev_motorSpeed; _local36.maxMotorTorque = _local19.rev_maxMotorTorque; _local36.collideConnected = false; _local16 = world.CreateJoint(_local36); }; if (_local19.type == PhysObj_Joint.Type_Prismatic){ _local37 = new b2PrismaticJointDef(); _local9 = (_local19.prism_pos.x * w2p); _local10 = (_local19.prism_pos.y * w2p); _local22 = new Point(_local9, _local10); _local22 = _local17.transformPoint(_local22); _local9 = _local22.x; _local10 = _local22.y; _local38 = Utils.DegToRad(_local19.prism_axisangle); _local38 = (_local38 + _local8); _local39 = new b2Vec2(Math.cos(_local38), Math.sin(_local38)); _local37.Initialize(_local34, _local35, new b2Vec2((_arg2 + _local9), (_arg3 + _local10)), _local39); _local37.enableLimit = _local19.prism_enableLimit; _local37.lowerTranslation = (_local19.prism_lowerTranslation * w2p); _local37.upperTranslation = (_local19.prism_upperTranslation * w2p); _local37.enableMotor = _local19.prism_enableMotor; _local37.motorSpeed = _local19.prism_motorSpeed; _local37.maxMotorForce = _local19.prism_maxMotorForce; _local37.collideConnected = false; _local16 = world.CreateJoint(_local37); }; if (_local19.type == PhysObj_Joint.Type_Distance){ _local40 = new b2DistanceJointDef(); _local9 = (_local19.dist_pos0.x * w2p); _local10 = (_local19.dist_pos0.y * w2p); _local41 = (_local19.dist_pos1.x * w2p); _local42 = (_local19.dist_pos1.y * w2p); _local22 = new Point(_local9, _local10); _local22 = _local17.transformPoint(_local22); _local9 = _local22.x; _local10 = _local22.y; _local22 = new Point(_local41, _local42); _local22 = _local17.transformPoint(_local22); _local41 = _local22.x; _local42 = _local22.y; _local40.Initialize(_local34, _local35, new b2Vec2((_arg2 + _local9), (_arg3 + _local10)), new b2Vec2((_arg2 + _local41), (_arg3 + _local42))); _local40.length = (_local40.length + (_local19.dist_distance * w2p)); _local40.dampingRatio = 0; _local40.collideConnected = false; _local16 = world.CreateJoint(_local40); }; if (_local19.type == PhysObj_Joint.Type_Mouse){ _local43 = new b2MouseJointDef(); _local43.target.Set(_local34.GetPosition().x, _local34.GetPosition().y); _local43.body1 = world.GetGroundBody(); _local43.body2 = _local34; _local43.maxForce = (30000 * _local34.GetMass()); _local43.dampingRatio = 0.7; _local43.frequencyHz = 10; _local43.timeStep = (1 / 60); _local16 = world.CreateJoint(_local43); mouseJoint = (_local16 as b2MouseJoint); }; _local7.joints.push(_local16); }; return (_local7); } static function GetCurrentLevel():Level{ return (levels[currentLevel]); } static function GetInitialStartPoint():Point{ var _local2:Point; var _local1:Point; var _local3:Number = 999999; for each (_local2 in startPoints) { if (_local2.x < _local3){ _local3 = _local2.x; _local1 = _local2; }; }; return (_local1); } static function GetAnimDef(_arg1:String){ var _local2:AnimDef; for each (_local2 in animDefs) { if (_local2.name == _arg1){ return (_local2); }; }; return (null); } static function RenderJumpAdvisor(_arg1:BitmapData){ var _local2:int; var _local3:int; var _local4:int; var _local6:int; var _local7:String; var _local8:int; var _local9:int; var _local10:Number; var _local11:int; var _local12:int; _local2 = 500; _local3 = 100; var _local5 = 80; if (jumpAdvisorFlag){ _local6 = 0; for each (_local7 in jumpAdvisorList) { _local8 = 0; if (_local7 == "back"){ _local8 = GraphicObjects.GetIndexByName("stuntIcon_backFlip"); }; if (_local7 == "forward"){ _local8 = GraphicObjects.GetIndexByName("stuntIcon_frontFlip"); }; if (_local7 == "pose"){ _local8 = GraphicObjects.GetIndexByName("stuntIcon_pose"); }; _local9 = 0; _local10 = 0.8; _local11 = _local2; _local12 = _local3; if (_local6 == jumpAdvisorCurrent){ _local10 = 1; _local11 = (_local11 + Utils.RandBetweenFloat(-1, 1)); _local12 = (_local12 + Utils.RandBetweenFloat(-1, 1)); }; if (_local6 < jumpAdvisorCurrent){ _local9 = 1; }; GraphicObjects.RenderAtRotScaled(_local8, _local9, _arg1, _local11, _local12, _local10); _local3 = (_local3 + _local5); _local6++; }; } else { if (jumpAdvisorResultTimer > 0){ jumpAdvisorResultTimer--; _local2 = 320; _local3 = 50; if (jumpAdvisorResult == 1){ _local7 = "Sequence successful"; }; if (jumpAdvisorResult == 2){ _local7 = "Sequence Failed"; }; _local4 = GraphicObjects.GetStringWidth(main.screenBD, GraphicObjects.gfx_font2, _local2, _local3, _local7); GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font2, (_local2 - (_local4 / 2)), _local3, _local7, null); }; }; } public static function InitHelp_nextButtonPressed(_arg1:MouseEvent){ helpScreenID++; if (helpScreenID < 9){ helpOverlay.gotoAndStop((helpScreenID + 1)); } else { helpIsAvailable = false; helpOverlay.removeEventListener(Event.ENTER_FRAME, UpdateHelpOverlay); _slot1.main.removeChild(helpOverlay); helpOverlay = null; KeyReader.InitOnce(main.stage); if (help_fromIngame){ pause = false; }; }; } public static function SubmitAllKongStats(){ } public static function InitLevel(){ InitLevel1(); } public static function StartLevelPlay2():void{ var _local5:GameObj; var _local6:int; physObjs = new PhysObjs(); physObjs.InitFromXml(ExternalData.xml); KeyReader.InitOnce(main.stage); MusicPlayer.StopMusic(); MusicPlayer.StartStream(currentGameMusic); currentGameMusic++; if (currentGameMusic > 2){ currentGameMusic = 0; }; main.InitStageForGame(); main.addChild(PauseButton); PauseButton.x = (Defs.displayarea_w - 128); PauseButton.y = 438; if (Lic.GetLicensor() == Lic.LICENSOR_KONGREGATE){ main.addChild(MoreGamesButton); MoreGamesButton.x = ((Defs.displayarea_w - 128) - 130); MoreGamesButton.y = 438; }; var _local1:Level = GetCurrentLevel(); _local1.played = true; startPoints = new Array(); Particles.Reset(); InitBox2D(); previousStaticPoints = new Array(); mouseJoint = null; skiJumpLevel = false; cliffJumpLevel = false; penguinSmashLevel = false; dontDieLevel = false; if (currentLevel == 7){ dontDieLevel = true; }; totalPickups = 0; totalSnowmen = 0; totalSequences = 0; totalHoops = 0; numPickupsCollected = 0; numSnowmenHit = 0; numSequencesComplete = 0; numHoopsComplete = 0; levelFailed = false; GameObjects.ClearAll(); physObjInstances = new PhysObj_Instances(); InitLevelPlayFromEditorObjects(); InitLevelState(levelState_LevelStart); var _local2:Number = 100; var _local3:Number = 100; if (startPoints.length != 0){ _local2 = GetInitialStartPoint().x; _local3 = GetInitialStartPoint().y; }; var _local4:String = ("bike" + int((currentSkiIndex + 1)).toString()); AddPhysObjAt(_local4, _local2, _local3, 0, "player"); InitFloor(); bgFrame = 0; pause = false; pauseGameplayInput = false; playerHitFloorCount = 0; playerHitFloor = false; playerHitFloorTimer = 0; bikeWheelDown = false; ResetBoost(); levelAirTime = 0; levelWheelieTime = 0; levelFrontWheelieTime = 0; levelBackSomersaults = 0; levelForwardSomersaults = 0; bestSingleAirTime = 0; bestRearWheelieTime = 0; multiSomersaultCount = 0; highestMultiSomersault = 0; highestBoostLevel = 0; numCrashes = 0; playerRacePosition = 0; bellPlayingTimer = 0; stuntAddedTimer = 0; stuntAddedTimerMax = 0; startTimer = 0; startMode = 0; chase_caught = false; failedChase = false; numMessagesActive = 0; messageSlots = new Array(); _local6 = 0; while (_local6 < 10) { messageSlots.push(false); _local6++; }; jumptimer = 0; QuietLoops(); pickupSoundIndex = 0; helpTimer = 5; gotSneakyStart = false; ScoreAtStartOfLevel = _slot1.achievements.CalculateScore(); InitSnowballGenerator(); InitSnow(); InitJumpAdvisor(); levelTimer = 0; pickupTimerMax = (Defs.fps / 2); pickupTimer = 0; pickupMultiplier = 1; playerJumpingTimer = 0; var _local7:PlayerBikeData = PlayerBikes.GetBikeData(_slot1.currentBikeIndex); if (_local7.inGameID == 1){ GraphicObjects.Recreate("Skiier01", 0, PlayerCallback); }; if (_local7.inGameID == 2){ GraphicObjects.Recreate("Skiier02", 0, PlayerCallback); }; if (_local7.inGameID == 3){ GraphicObjects.Recreate("Skiier03", 0, PlayerCallback); }; if (_local7.inGameID == 4){ GraphicObjects.Recreate("Skiier04", 0, PlayerCallback); }; if (_local7.inGameID == 5){ GraphicObjects.Recreate("Skiier05", 0, PlayerCallback); }; if (_local7.inGameID == 6){ GraphicObjects.Recreate("Skiier06", 0, PlayerCallback); }; InitSkiJump(); InitCliffJump(); highestPoint = 0; numPenguinsSmashed = 0; bonusPickupCollected = false; levelScore = 0; FlashConnect.trace(("Total Pickups: " + totalPickups)); FlashConnect.trace(("Total Snowmen: " + totalSnowmen)); FlashConnect.trace(("Total Sequences: " + totalSequences)); FlashConnect.trace(("Total Hoops: " + totalHoops)); stopScroll = false; numSnowballs = 0; } static function UpdateBoost(){ if (boostMode == 1){ boostTimer--; if (boostTimer <= 0){ BoostFinished(); }; }; } public static function InitHelp_buttonNoMoreHelpPressed(_arg1:MouseEvent){ helpIsAvailable = false; _slot1.main.removeChild(helpOverlay); helpOverlay = null; if (help_fromIngame){ pause = false; }; KeyReader.InitOnce(main.stage); } static function UpdateControl(){ var _local1:PhysObj_Instance = GetPhysObjInstanceByName("player"); if (_local1 == null){ return; }; } static function UpdatePlayerRot(){ var _local6:int; var _local7:String; if (playerHitFloor){ return; }; var _local1:Number = (Math.PI * 2); var _local2:Number = Math.PI; var _local3:int = playerRotCount; var _local4:Number = (oldPlayerRot % _local1); var _local5:Number = (playerRot % _local1); if (_local4 < 0){ _local4 = (_local1 + _local4); }; if (_local5 < 0){ _local5 = (_local1 + _local5); }; if (Math.abs((_local5 - _local2)) < 0.5){ if (playerRotMode == 0){ if ((((_local4 < _local2)) && ((_local5 >= _local2)))){ FlashConnect.trace("Rotated CW first time"); playerRotMode = 0; playerRotLeaveGround = (playerRot + _local2); playerRotCount++; CliffJumpIncreaseRot(); multiSomersaultCount = 0; JumpAdvisor_DoStunt("forward"); InitMessage("Forward Somersault"); AddToBoost(0.5); } else { if ((((_local4 > _local2)) && ((_local5 <= _local2)))){ FlashConnect.trace("Rotated CCW first time"); playerRotMode = 0; playerRotLeaveGround = (playerRot - _local2); playerRotCount++; CliffJumpIncreaseRot(); multiSomersaultCount = 0; JumpAdvisor_DoStunt("back"); InitMessage("Back Somersault"); AddToBoost(0.5); }; }; } else { if (playerRotMode == 1){ if ((((_local4 < _local2)) && ((_local5 >= _local2)))){ if (playerRot > playerRotLeaveGround){ trace("Rotated CW"); playerRotLeaveGround = (playerRot + _local2); playerRotCount++; }; }; } else { if (playerRotMode == -1){ if ((((_local4 > _local2)) && ((_local5 <= _local2)))){ if (playerRot < playerRotLeaveGround){ trace("Rotated CCW"); playerRotLeaveGround = (playerRot - _local2); playerRotCount++; }; }; }; }; }; }; if (_local3 != playerRotCount){ _local6 = multiSomersaultCount; if (_local6 >= somersaultText.length){ _local6 = (somersaultText.length - 1); }; _local7 = somersaultText[_local6]; if (playerRotMode == 1){ levelForwardSomersaults++; }; if (playerRotMode == -1){ levelBackSomersaults++; }; multiSomersaultCount++; if (multiSomersaultCount > highestMultiSomersault){ highestMultiSomersault = multiSomersaultCount; }; }; } static function CreatePhysObjInstanceAt(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:String=""):PhysObj_Instance{ var _local6:PhysObj_Instance = new PhysObj_Instance(); _local6.typeName = _arg1; _local6.x = _arg2; _local6.y = _arg3; _local6.rot = _arg4; _local6.bodies = new Array(); _local6.instanceName = _arg5; return (_local6); } static function InitBoost(){ boostMode = 1; boostTimer = (Defs.fps * 10); boostTimerMax = boostTimer; } static function InitJumpAdvisor(){ jumpAdvisorFlag = false; jumpAdvisorTimer = 0; jumpAdvisorList = new Array(); jumpAdvisorCurrent = 0; jumpAdvisorResult = 0; } static function RenderSnow(_arg1:BitmapData){ var _local4:int; var _local5:Snow; var _local2:Number = 100; var _local3:Number = 150; _local4 = GraphicObjects.GetIndexByName("SnowMC"); for each (_local5 in snowList) { if (((_local5.active) && (_local5.visible))){ GraphicObjects.RenderAt(_local4, _local5.frame, _arg1, _local5.xpos, _local5.ypos); }; }; } static function UpdatePlayerPosition(){ var _local2:GameObj; var _local1:GameObj; playerRacePosition = 0; for each (_local2 in GameObjects.objs) { if (((_local2.active) && (_local2.colFlag_isPlayer))){ _local1 = _local2; break; }; }; for each (_local2 in GameObjects.objs) { if (((_local2.active) && (_local2.colFlag_isEnemy))){ if (_local2.xpos > _local1.xpos){ playerRacePosition++; }; }; }; } static function UpdateMouseControl(){ var _local1:Number = cursorX; var _local2:Number = cursorY; cursorX = (cursorX + ((MouseControl.x - cursorX) * 0.4)); cursorY = (cursorY + ((MouseControl.y - cursorY) * 0.4)); } public static function LevelsCheat(){ var _local1:Level; for each (_local1 in levels) { _local1.available = true; }; } static function UpdateChase(){ var _local2:GameObj; chase_caught = false; var _local1:GameObj; for each (_local2 in GameObjects.objs) { if (((_local2.active) && (_local2.colFlag_isPlayer))){ _local1 = _local2; break; }; }; for each (_local2 in GameObjects.objs) { if (((_local2.active) && (_local2.colFlag_isEnemy))){ if (_local2.xpos > (_local1.xpos + 20)){ chase_caught = true; failedChase = true; return; }; }; }; } static function InitHelp(_arg1:Boolean=false){ help_fromIngame = _arg1; helpScreenID = 0; pause = true; helpOverlay = new PlayerControls(); helpOverlay.buttonNext.addEventListener(MouseEvent.CLICK, InitHelp_nextButtonPressed, false, 0, true); helpOverlay.buttonNoMoreHelp.addEventListener(MouseEvent.CLICK, InitHelp_buttonNoMoreHelpPressed, false, 0, true); helpOverlay.gotoAndStop((helpScreenID + 1)); helpOverlay.addEventListener(Event.ENTER_FRAME, UpdateHelpOverlay, false, 0, true); main.addChild(helpOverlay); } static function UpdatePhysObjs():void{ var _local1:PhysObj_Instance; for each (_local1 in physObjInstances.list) { _local1.Update(); }; } static function InitObjectAtMouse():void{ var _local10:Number; var _local16:b2Body; var _local17:b2Shape; var _local1:Point = new Point(MouseControl.x, MouseControl.y); var _local2:Matrix = new Matrix(); _local2.translate(scrollX, scrollY); _local2.translate(-(scrollCX), -(scrollCY)); _local2.scale((1 / scrollScale), (1 / scrollScale)); _local2.translate(scrollCX, scrollCY); _local1 = _local2.transformPoint(_local1); var _local3:Number = _local1.x; var _local4:Number = _local1.y; var _local5:Array = new Array(); _local5.push("cannonball0"); _local5.push("cannonball1"); _local5.push("cannonball2"); _local5.push("cannonball3"); _local5.push("cannonball4"); _local5.push("cannonball0"); _local5.push("cannonball1"); _local5.push("cannonball2"); _local5.push("cannonball3"); _local5.push("cannonball4"); if (mousetimer > 0){ return; }; canShootPellet = true; mousetimer = 10; var _local6:int = _local10; zsortoffset = 0; var _local7:PhysObj_Instance = GetPhysObjInstanceByName("player"); var _local8:b2Vec2 = _local7.GetBodyWorldPos(0); var _local9:Number = (_local8.x * p2w); _local10 = (_local8.y * p2w); var _local11:Number = Utils.RandCircle(); var _local12:PhysObj_Instance = AddPhysObjAt(_local5[currentProjectileType], _local9, _local10, Utils.RadToDeg(_local11), ""); var _local13:Number = Utils.ScaleTo(50, 100, 0, 100, shootHeldTime); _local11 = Math.atan2((_local4 - _local10), (_local3 - _local9)); var _local14:Number = (Math.cos(_local11) * _local13); var _local15:Number = (Math.sin(_local11) * _local13); _local12.SetLinearVelocity(_local14, _local15); for each (_local16 in _local12.bodies) { _local16.SetBullet(true); _local17 = _local16.GetShapeList(); _local17.SetUserData(_local12); }; } static function QuietLoops(){ SoundPlayer.SetVolume(squeakSound, 0); SoundPlayer.SetVolume(coastSound, 0); } static function AddPhysGameObjectAt(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:String="", _arg6:String=""):GameObj{ var _local9:PhysObj_Body; var _local10:PhysObj_Graphic; var _local7:GameObj; var _local8:PhysObj = physObjs.FindByName(_arg1); for each (_local9 in _local8.bodies) { if (_local9.graphics.length != 0){ _local10 = _local9.graphics[0]; _local7 = GameObjects.AddObj(_arg2, _arg3, (_local10.zoffset + zsortoffset)); _local7.graphicID = _local10.graphicID; _local7.frame = _local10.frame; if (_local10.goInitFuntion != ""){ var _local13 = _local7; _local13[_local10.goInitFuntion](); }; }; }; return (_local7); } static function InitFloor(){ var _local1:b2BodyDef; var _local2:b2Body; var _local3:b2PolygonDef; var _local4:Point; var _local5:Point; var _local6:Point; var _local7:Point; var _local8:Point; var _local9:int; var _local15:PhysLine; var _local16:Array; var _local17:int; var _local18:int; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local10:PhysObj_BodyUserData = new PhysObj_BodyUserData(); var _local11:Number = 50; var _local12:Level = GetCurrentLevel(); var _local13:b2FilterData = new b2FilterData(); _local13.categoryBits = 1; _local13.maskBits = 15; var _local14:b2FilterData = new b2FilterData(); _local14.categoryBits = 2; _local14.maskBits = 2; for each (_local15 in _local12.lines) { _local16 = _local15.points; _local17 = _local15.type; if (_local17 < 10){ if (_local16.length >= 2){ _local9 = 0; while (_local9 < (_local16.length - 1)) { _local5 = _local16[_local9].clone(); _local18 = (_local9 + 1); _local18 = (_local18 % _local16.length); _local6 = _local16[_local18].clone(); _local7 = _local6.clone(); _local8 = _local5.clone(); _local19 = Math.atan2((_local6.y - _local5.y), (_local6.x - _local5.x)); _local19 = (_local19 + (Math.PI / 2)); _local20 = 20; _local21 = (Math.cos(_local19) * _local20); _local22 = (Math.sin(_local19) * _local20); _local7.x = (_local7.x + _local21); _local7.y = (_local7.y + _local22); _local8.x = (_local8.x + _local21); _local8.y = (_local8.y + _local22); _local1 = new b2BodyDef(); _local1.position.Set(0, 0); _local2 = world.CreateBody(_local1); if (_local2 != null){ _local3 = new b2PolygonDef(); _local3.filter = _local13; _local3.vertexCount = 4; _local3.vertices[0].Set((_local5.x * w2p), (_local5.y * w2p)); _local3.vertices[1].Set((_local6.x * w2p), (_local6.y * w2p)); _local3.vertices[2].Set((_local7.x * w2p), (_local7.y * w2p)); _local3.vertices[3].Set((_local8.x * w2p), (_local8.y * w2p)); _local3.friction = 0.1; _local3.restitution = 0; _local3.density = 1; _local2.CreateShape(_local3); _local2.SetUserData(_local10); }; _local9++; }; }; }; }; } public static function InitLevelState(_arg1:int){ levelState = _arg1; levelStateTimer = 0; if (levelState == levelState_LevelStart){ levelStateTimer = 10; levelStateCount = 0; raceTimer = 0; }; if (levelState == levelState_PostRace){ levelStateTimer = (Defs.fps * 3); levelStateTimer = (Defs.fps * 0.5); }; if (levelState == levelState_Play){ }; if (levelState == levelState_Editor){ PhysEditor.InitEditor(scrollX, scrollY); PhysEditor.currentLevel = currentLevel; }; } static function InitNinjaProjectile(_arg1:Number, _arg2:Number){ var _local14:b2Body; var _local15:b2Shape; var _local3:Number = (_arg1 * p2w); var _local4:Number = (_arg2 * p2w); var _local5:PhysObj_Instance = GetPhysObjInstanceByName("player"); var _local6:b2Vec2 = _local5.GetBodyWorldPos(0); var _local7:Number = (_local6.x * p2w); var _local8:Number = (_local6.y * p2w); _local8 = (_local8 - 300); var _local9:Number = Utils.RandCircle(); var _local10:PhysObj_Instance = AddPhysObjAt("ninja_projectile", _local3, _local4, 0, ""); var _local11:Number = Utils.RandBetweenFloat(20, 50); _local9 = Math.atan2((_local8 - _local4), (_local7 - _local3)); var _local12:Number = (Math.cos(_local9) * _local11); var _local13:Number = (Math.sin(_local9) * _local11); _local10.SetLinearVelocity(_local12, _local13); for each (_local14 in _local10.bodies) { _local14.SetBullet(true); _local15 = _local14.GetShapeList(); _local15.SetUserData(_local10); }; } static function InitMessage(_arg1:String, _arg2:Number=0){ var _local3:PhysObj_Instance; var _local4:GameObj; _local3 = GetPhysObjInstanceByName("player"); if (_local3 == null){ return; }; goPlayer = _local3.GetGameObject(0); _local4 = GameObjects.AddObj(goPlayer.xpos, goPlayer.ypos, -100); _local4.InitTextMessage(_arg1, 0); } static function SetWeapon(_arg1:int):void{ currentProjectileType = _arg1; } static function AddGameObjectAt(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:String="", _arg6:String=""):GameObj{ var _local9:PhysObj_Graphic; var _local7:GameObj; var _local8:PhysObj = physObjs.FindByName(_arg1); if (_local8.graphics.length != 0){ _local9 = _local8.graphics[0]; _local7 = GameObjects.AddObj(_arg2, _arg3, (_local9.zoffset + zsortoffset)); _local7.graphicID = _local9.graphicID; _local7.frame = _local9.frame; if (_local9.goInitFuntion != ""){ var _local10 = _local7; _local10[_local9.goInitFuntion](); }; }; return (_local7); } static function BoostFinished(){ boostMode = 0; boostTimer = 0; boostMultiplier = 0; } static function UpdateSnowballGenerator(){ var _local1:PhysObj_Instance; var _local2:Number; var _local3:Number; var _local4:Point; var _local5:String; var _local6:int; _local1 = GetPhysObjInstanceByName("player"); if (_local1 == null){ return; }; _local2 = scrollX; _local3 = (_local2 + 700); for each (_local4 in snowballList) { if ((((_local4.x > _local2)) && ((_local4.x < _local3)))){ _local6 = Utils.RandBetweenInt(0, 100); if (_local6 < 70){ _local5 = "snowball01"; } else { if (_local6 < 90){ _local5 = "snowball02"; } else { _local5 = "snowball03"; }; }; AddPhysObjAt(_local5, _local4.x, (_local4.y - 30), 0, ""); _local4.x = (_local4.x - 10000); }; }; } static function UpdateScroll(){ var _local1:PhysObj_Instance; var _local3:Number; var _local4:Number; var _local13:Number; oldScrollX = scrollX; oldScrollY = scrollY; if (stopScroll){ return; }; _local1 = GetPhysObjInstanceByName("player"); if (_local1 == null){ return; }; var _local2:b2Vec2 = _local1.GetBodyWorldPos(0); var _local5:Number = (_local2.x * p2w); var _local6:Number = (_local2.y * p2w); var _local7:Number = 320; var _local8:Number = 240; var _local9:Level = GetCurrentLevel(); if (_local9.eventType == "chase"){ _local7 = 500; }; scrollCX = _local5; scrollCY = _local6; var _local10:b2Vec2 = _local1.GetBodyLinearVelocity(0); var _local11:Number = Math.atan2(_local10.y, _local10.x); var _local12:Number = _local10.Length(); if (_local12 < 3){ _local3 = 0; _local4 = 0; } else { _local12 = Utils.LimitNumber(3, 30, _local12); _local13 = Utils.ScaleTo(0, 150, 0, 30, _local12); _local3 = (Math.cos(_local11) * _local13); _local4 = (Math.sin(_local11) * _local13); }; scrollToDX = (scrollToDX + ((_local3 - scrollToDX) * 0.1)); scrollToDY = (scrollToDY + ((_local4 - scrollToDY) * 0.1)); scrollX = ((_local5 - _local7) + scrollToDX); scrollY = ((_local6 - _local8) + scrollToDY); scrollX = (scrollX + shakeCamX); scrollY = (scrollY + shakeCamY); scrollScale = 1; } static function GetSkiUnlock(_arg1:int):Boolean{ if (_arg1 < 0){ return (false); }; if (_arg1 >= skiUnlocks.length){ return (false); }; return (skiUnlocks[_arg1]); } static function AlignWithPreviousVerts(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Point{ var _local9:Point; var _local10:Number; var _local11:Number; var _local6:Matrix = new Matrix(); _local6.rotate(_arg5); var _local7:Point = new Point(_arg1, _arg2); var _temp1 = _local6.transformPoint(_local7); _local7 = _local6.transformPoint(_local7); _temp1.x = (_local7.x + _arg3); _local7.y = (_local7.y + _arg4); var _local8:Number = (2 * w2p); for each (_local9 in previousStaticPoints) { if (Math.abs((_local9.x - _local7.x)) < _local8){ if (Math.abs((_local9.y - _local7.y)) < _local8){ _local10 = (_local9.x - _local7.x); _local11 = (_local9.y - _local7.y); return (new Point(_local10, _local11)); }; }; }; previousStaticPoints.push(_local7.clone()); return (null); } public static function UpdateHelpOverlay(_arg1:Event){ } public static function Init(_arg1:Main){ main = _arg1; currentScore = 0; multiplier = 1; numLevels = 8; currentLevel = 0; PlayerBikes.InitOnce(); Player.InitOnce(); InitSkis(); cheatMode = 0; numFirstPlaces = 0; numRacesCompleted = 0; InitAnimDefs(); snowBD = new BitmapData(Defs.displayarea_w, Defs.displayarea_h, true, 4278190080); snowB = new Bitmap(snowBD); currentBikeIndex = 0; currentSkiIndex = 0; } static function RenderBox2D():void{ var _local4:int; var _local5:b2Body; var _local6:b2Shape; var _local7:b2Vec2; var _local8:Number; var _local9:b2Joint; var _local10:b2Vec2; var _local11:b2Vec2; var _local12:*; var _local13:b2PolygonShape; var _local14:Array; var _local15:int; var _local16:int; var _local17:b2Vec2; var _local18:b2Vec2; var _local19:Matrix; var _local20:Point; var _local21:Point; var _local22:b2CircleShape; var _local23:Number; var _local24:Point; if (Debug.IsSet(1) == false){ return; }; var _local1:Number = scrollX; var _local2:Number = scrollY; var _local3:Number = p2w; _local9 = world.GetJointList(); while (_local9) { _local10 = _local9.GetAnchor1().Copy(); _local11 = _local9.GetAnchor2().Copy(); _local10.Multiply(_slot1.p2w); _local11.Multiply(_slot1.p2w); Utils.RenderCircle(main.scrollScreenBD, (_local10.x - _local1), (_local10.y - _local2), 3, 4294901760); Utils.RenderCircle(main.scrollScreenBD, (_local11.x - _local1), (_local11.y - _local2), 3, 4294901760); _local9 = _local9.GetNext(); }; _local5 = world.GetBodyList(); while (_local5) { _local7 = _local5.GetPosition(); _local8 = _local5.GetAngle(); _local6 = _local5.GetShapeList(); while (_local6) { _local12 = _local6.GetType(); if (_local12 == b2Shape.e_polygonShape){ _local13 = b2PolygonShape(_local6); _local14 = _local13.GetVertices(); _local15 = _local13.GetVertexCount(); _local4 = 0; while (_local4 < _local15) { _local16 = (_local4 + 1); if (_local16 >= _local15){ _local16 = 0; }; _local17 = _local14[_local4].Copy(); _local18 = _local14[_local16].Copy(); _local19 = new Matrix(); _local19.rotate(_local8); _local20 = new Point(_local17.x, _local17.y); _local21 = new Point(_local18.x, _local18.y); _local20 = _local19.transformPoint(_local20); _local21 = _local19.transformPoint(_local21); _local17.x = _local20.x; _local17.y = _local20.y; _local18.x = _local21.x; _local18.y = _local21.y; _local17.Add(_local7); _local18.Add(_local7); Utils.RenderDotLine(main.scrollScreenBD, ((_local17.x * _local3) - _local1), ((_local17.y * _local3) - _local2), ((_local18.x * _local3) - _local1), ((_local18.y * _local3) - _local2), 50, 4294967295); _local4++; }; }; if (_local12 == b2Shape.e_circleShape){ _local22 = b2CircleShape(_local6); _local23 = (_local22.GetRadius() * _local3); _local19 = new Matrix(); _local19.rotate(_local8); _local24 = new Point(_local22.GetLocalPosition().x, _local22.GetLocalPosition().y); _local24 = _local19.transformPoint(_local24); Utils.RenderCircle(main.scrollScreenBD, (((_local7.x * _local3) + (_local24.x * _local3)) - _local1), (((_local7.y * _local3) + (_local24.y * _local3)) - _local2), _local23, 4294967295); }; _local6 = _local6.GetNext(); }; _local5 = _local5.GetNext(); }; } public static function InitGame(){ Debug.debugMode = 0; numLives = 3; polygonList = new Array(); startPoints = new Array(); currentStartPointIndex = 0; currentLevel = 0; pause = true; timesList = new Array(); cash = 0; currentGameMusic = 0; squeakSound = SoundPlayer.StartLoop(SoundPlayer.GetId("pedalling"), 0); coastSound = SoundPlayer.StartLoop(SoundPlayer.GetId("coasting"), 0); helpIsAvailable = true; cheatUnlocked0 = false; cheatUnlocked1 = false; cheatUnlocked2 = false; PauseButton = new buttonPauseMute(); PauseButton.addEventListener(MouseEvent.CLICK, PauseButtonPressed); MoreGamesButton = new buttonInGameMoreGames(); MoreGamesButton.addEventListener(MouseEvent.CLICK, MoreGamesButtonPressed); ScoreAtStartOfLevel = 0; } static function CliffJumpIncreaseRot(){ if (cliffJumpFlag == false){ return; }; if (cliffJumpLanded == true){ return; }; cliffJumpRotCount++; } public static function UpdateBikeWheelDown():void{ if (bikeWheelDown){ bikeWheelDownTimer++; bikeWheelUpTimer = 0; } else { if (bikeWheelUpTimer == 0){ InitPlayerUpdateRot(); }; bikeWheelUpTimer++; bikeWheelDownTimer = 0; }; } static function SkiJumpLanded(){ if (skiJumpFlag == false){ return; }; if (skiJumpLanded == true){ return; }; var _local1:PhysObj_Instance = GetPhysObjInstanceByName("player"); if (_local1 == null){ return; }; var _local2:GameObj = _local1.GetGameObject(0); skiJumpEndX = _local2.xpos; skiJumpDistance = (skiJumpEndX - skiJumpStartX); skiJumpLanded = true; } public static function BikeWheelIsDown():void{ var _local1:PhysObj_Instance; var _local2:GameObj; EndJumpAdvisor(); if (bikeWheelDown == false){ _local1 = _slot1.GetPhysObjInstanceByName("player"); _local2 = _local1.GetGameObject(0); SkiJumpLanded(); CliffJumpLanded(); }; bikeWheelDown = true; } static function RenderTitleScreen(){ if (doTitleSnow){ TitleScreenState.UpdateSnowEvent(); return; }; } static function JumpAdvisor_DoStunt(_arg1:String){ if (jumpAdvisorFlag == false){ return; }; var _local2:String = jumpAdvisorList[jumpAdvisorCurrent]; FlashConnect.trace(((("" + _local2) + " : ") + _arg1)); if (_local2 == _arg1){ jumpAdvisorCurrent++; if (jumpAdvisorCurrent >= jumpAdvisorList.length){ SoundPlayer.Play("sfx_sequence_complete"); jumpAdvisorResult = 1; jumpAdvisorResultTimer = (Defs.fps * 2); AddToBoost((0.5 * jumpAdvisorList.length)); jumpAdvisorFlag = false; numSequencesComplete++; }; } else { SoundPlayer.Play("sfx_sequence_failed"); jumpAdvisorResult = 2; jumpAdvisorResultTimer = (Defs.fps * 2); jumpAdvisorFlag = false; }; } static function GetNumLinesByType(_arg1:int):int{ var _local4:PhysLine; var _local2:int; var _local3:Level = GetCurrentLevel(); for each (_local4 in _local3.lines) { if (_local4.type == _arg1){ _local2++; }; }; return (_local2); } public static function ZeroStuntTimers():void{ bikeWheelDownTimer = 0; bikeWheelUpTimer = 0; frontWheelieTimer = 0; wheelieTimer = 0; backWheelUpTimer = 0; frontWheelUpTimer = 0; } static function InitSkiJump(){ skiJumpFlag = false; skiJumpStartX = 0; skiJumpEndX = 0; skiJumpDistance = 0; skiJumpLanded = false; } static function SetSkiUnlock(_arg1:int, _arg2:Boolean){ if (_arg1 < 0){ return; }; if (_arg1 >= skiUnlocks.length){ return; }; skiUnlocks[_arg1] = _arg2; } static function AwardCashForFinalPosition(){ playerRaceFinishCash = 0; if (playerRacePosition == 0){ playerRaceFinishCash = 100; }; if (playerRacePosition == 1){ playerRaceFinishCash = 50; }; if (playerRacePosition == 2){ playerRaceFinishCash = 25; }; if (playerRacePosition == 3){ playerRaceFinishCash = 10; }; if (playerRacePosition == 4){ playerRaceFinishCash = 6; }; if (playerRacePosition == 5){ playerRaceFinishCash = 5; }; if (playerRacePosition == 6){ playerRaceFinishCash = 4; }; if (playerRacePosition == 7){ playerRaceFinishCash = 3; }; if (playerRacePosition == 8){ playerRaceFinishCash = 2; }; if (playerRacePosition == 9){ playerRaceFinishCash = 1; }; cash = (cash + playerRaceFinishCash); } static function Render(){ var _local2:int; var _local3:int; var _local4:Number; var _local5:int; var _local6:int; var _local14:Matrix; var _local16:Graphics; if (pause){ return; }; if (levelState == levelState_Null){ return; }; if (levelState == levelState_Editor){ _local16 = main.fillScreenMC.graphics; _local16.clear(); PhysEditor.RenderEditor(); return; }; var _local1:BitmapData = main.scrollScreenBD; var _local7:int = levs[currentLevel]; var _local8:int = ((GraphicObjects.gfx_back01 + _local7) - 1); var _local9:int = ((GraphicObjects.gfx_back07 + _local7) - 1); var _local10:int = ((GraphicObjects.gfx_back13 + _local7) - 1); var _local11:int = GraphicObjects.GetWidth(_local8, 0); var _local12:int = GraphicObjects.GetWidth(_local9, 0); var _local13:int = GraphicObjects.GetWidth(_local10, 0); GraphicObjects.RenderAt(_local8, 0, _local1, 0, 0); _local6 = 0; _local5 = (int((scrollX * 0.025)) % _local12); GraphicObjects.RenderAt(_local9, 0, _local1, -(_local5), _local6); GraphicObjects.RenderAt(_local9, 0, _local1, (-(_local5) + _local12), _local6); _local6 = 0; _local5 = (int((scrollX * 0.05)) % _local13); GraphicObjects.RenderAt(_local10, 0, _local1, -(_local5), _local6); GraphicObjects.RenderAt(_local10, 0, _local1, (-(_local5) + _local13), _local6); GameObjects.Render(); Particles.Render(_slot1.main); RenderFloor(); RenderMiniMapFloor(); _local14 = new Matrix(); RenderBox2D(); _local1.draw(main.fillScreenMC); main.snowTestScreenBD.fillRect(Defs.screenRect, 0); main.snowTestScreenBD.draw(main.fillScreenMC); HitTestSnow(main.snowTestScreenBD); _local14 = new Matrix(); _local14.translate(0, (Defs.displayarea_h - 100)); var _local15:ColorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, -128); _local1.draw(main.fillScreenMC1, _local14, _local15, null, new Rectangle(0, (Defs.displayarea_h - 100), 300, 100)); main.screenBD.copyPixels(_local1, Defs.screenRect, Defs.pointZero); RenderSnow(main.screenBD); RenderPanel(); Debug.StopTimers(); Debug.RenderTimers(main.screenBD); } static function HitTestSnow(_arg1:BitmapData){ var _local4:Snow; var _local5:uint; var _local6:int; var _local7:Particle; var _local2:Number = 100; var _local3:Number = 150; for each (_local4 in snowList) { if (((_local4.active) && (_local4.visible))){ _local5 = _arg1.getPixel(_local4.xpos, _local4.ypos); if (_local5 != 0){ _local4.visible = false; _local6 = 0; while (_local6 < 5) { _local7 = Particles.Add((_local4.xpos + scrollX), (_local4.ypos + scrollY)); _local7.InitStickSnow(); _local6++; }; }; }; }; } static function AwardCashForAchievement(){ cash = (cash + 200); } public static function RemoveObj_Pellet(_arg1:PhysObj_Instance){ physObjInstances.Remove(_arg1); } static function GetNumLevelsUnlocked():int{ var _local2:Level; var _local1:int; for each (_local2 in levels) { if (_local2.available){ _local1++; }; }; return (_local1); } static function GetLevel(_arg1:int):Level{ if (_arg1 >= levels.length){ return (null); }; return (levels[_arg1]); } static function InitBox2D():void{ var _local1:b2AABB = new b2AABB(); _local1.lowerBound.Set(-250000, -250000); _local1.upperBound.Set(250000, 250000); var _local2:b2Vec2 = new b2Vec2(0, physGravity); var _local3:Boolean; world = new b2World(_local1, _local2, _local3); groundBody = world.GetGroundBody(); groundBody.SetUserData(-1); var _local4:ContactListener = new ContactListener(); world.SetContactListener(_local4); } static function UpdateSnow(){ var _local1:Number; var _local2:Number; var _local3:Snow; _local1 = (scrollX - oldScrollX); _local2 = (scrollY - oldScrollY); for each (_local3 in snowList) { if (_local3.active){ _local3.Update(_local1, _local2); }; }; } public static function LoadLevels(){ levels = new Array(); var _local1:XML = ExternalData.xml; var _local2:* = _local1.level.length(); var _local3:int; while (_local3 < _local2) { LoadLevel(_local3); _local3++; }; GetLevel(0).available = true; GetLevel(0).played = false; } public static function LoadLevel(_arg1:int){ var _local4:int; var _local5:int; var _local6:XML; var _local7:XML; var _local8:int; var _local9:String; var _local10:int; var _local11:PhysLine; var _local12:XML; var _local13:String; var _local14:Array; var _local15:Point; var _local16:XML; var _local17:XML; var _local18:String; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:PhysObj_Instance; var _local2:XML = ExternalData.xml; _local2 = _local2.level[_arg1]; var _local3:Level = new Level(); _local3.name = XmlHelper.GetAttrString(_local2.@name, "undefined"); _local3.category = XmlHelper.GetAttrInt(_local2.@category, 0); _local3.fillFrame = XmlHelper.GetAttrInt(_local2.@fillframe, 1); _local3.surfaceFrame = XmlHelper.GetAttrInt(_local2.@surfaceframe, 2); _local3.surfaceThickness = XmlHelper.GetAttrInt(_local2.@surfacethickness, 10); _local3.eventType = XmlHelper.GetAttrString(_local2.@type, "race"); _local3.eventOpponentsString = XmlHelper.GetAttrString(_local2.@opponents, "1"); _local3.exclusiveChar = XmlHelper.GetAttrInt(_local2.@exclusivechar, -1); _local3.eventWinParam = XmlHelper.GetAttrNumber(_local2.@win, 1); _local4 = 0; while (_local4 < _local2.helpscreen.length()) { _local6 = _local2.helpscreen[_local4]; _local3.helpscreenFrames.push(XmlHelper.GetAttrInt(_local6.@frame, 0)); _local4++; }; _local3.Calculate(); _local3.lines = new Array(); _local3.linetypes = new Array(); _local4 = 0; while (_local4 < _local2.line.length()) { _local7 = _local2.line[_local4]; _local8 = XmlHelper.GetAttrInt(_local7.@type, 0); _local9 = XmlHelper.GetAttrString(_local7.@name, ""); _local10 = XmlHelper.GetAttrInt(_local7.@fill, 1); _local11 = new PhysLine(); _local11.type = _local8; _local11.name = _local9; _local11.fill = _local10; _local11.fillScaleX = XmlHelper.GetAttrNumber(_local7.@fillscale, 1); _local11.fillScaleY = XmlHelper.GetAttrNumber(_local7.@fillscale, 1); _local5 = 0; while (_local5 < _local7.points.length()) { _local12 = _local7.points[_local5]; _local13 = XmlHelper.GetAttrString(_local12.@a, ""); _local14 = Utils.PointArrayFromString(_local13); for each (_local15 in _local14) { _local11.points.push(_local15); }; _local5++; }; _local3.lines.push(_local11); _local4++; }; _local5 = 0; while (_local5 < _local2.objgroup.length()) { _local16 = _local2.objgroup[_local5]; _local4 = 0; while (_local4 < _local16.obj.length()) { _local17 = _local16.obj[_local4]; _local18 = _local17.@type; _local19 = Number(_local17.@x); _local20 = Number(_local17.@y); _local21 = Number(_local17.@rot); _local22 = CreatePhysObjInstanceAt(_local18, _local19, _local20, _local21, ""); _local3.instances.push(_local22); _local4++; }; _local5++; }; _local4 = 0; while (_local4 < _local2.obj.length()) { _local17 = _local2.obj[_local4]; _local18 = _local17.@type; _local19 = Number(_local17.@x); _local20 = Number(_local17.@y); _local21 = Number(_local17.@rot); _local22 = CreatePhysObjInstanceAt(_local18, _local19, _local20, _local21, ""); _local3.instances.push(_local22); _local4++; }; levels.push(_local3); } static function InitPhysicsGO(_arg1:Number, _arg2:Number, _arg3:PhysObj_Graphic, _arg4:int=0, _arg5:int=0, _arg6:Number=1000):int{ var _local7:GameObj; _arg6 = (_arg6 + _arg3.zoffset); if (_arg3 == null){ _local7 = GameObjects.AddObj((_arg1 * p2w), (_arg2 * p2w), (_arg6 + zsortoffset)); _local7.InitPhysicsObject(_arg4, _arg5, 0, 0, "", false); } else { if (_arg3.goInitFuntion == ""){ _local7 = GameObjects.AddObj((_arg1 * p2w), (_arg2 * p2w), (_arg6 + zsortoffset)); _local7.InitPhysicsObject(_arg4, _arg5, _arg3.offset.x, _arg3.offset.y, _arg3.goInitFuntionVarString, _arg3.hasShadow); } else { _local7 = GameObjects.AddObj((_arg1 * p2w), (_arg2 * p2w), (_arg6 + zsortoffset)); _local7.InitPhysicsObject(_arg4, _arg5, _arg3.offset.x, _arg3.offset.y, _arg3.goInitFuntionVarString, _arg3.hasShadow); var _local8 = _local7; _local8[_arg3.goInitFuntion](); }; }; lastGeneratedGameObj = _local7; return (GameObjects.lastGenIndex); } static function AddToBoost(_arg1:Number):Number{ if (_arg1 > 0){ FlashConnect.trace(("AddToBoost: " + _arg1)); }; _arg1 = (_arg1 * 0.1); if (playerRecordingFlag == 2){ return (0); }; boostLevel = (boostLevel + _arg1); if (boostLevel > 1){ boostLevel = 1; }; if (boostLevel < 0){ boostLevel = 0; }; stuntAddedTimerMax = (stuntAddedTimer = 15); return ((_arg1 * 100)); } static function StartJumpAdvisor(_arg1:int){ var _local4:int; jumpAdvisorFlag = true; jumpAdvisorTimer = (Defs.fps * 3); jumpAdvisorList = new Array(); var _local2:Boolean; var _local3:int; while (_local3 < _arg1) { if (_local2 == false){ _local4 = Utils.RandBetweenInt(0, 2); } else { _local4 = Utils.RandBetweenInt(0, 1); }; if (_local4 == 0){ jumpAdvisorList.push("back"); }; if (_local4 == 1){ jumpAdvisorList.push("forward"); }; if (_local4 == 2){ _local2 = true; jumpAdvisorList.push("pose"); }; _local3++; }; jumpAdvisorCurrent = 0; jumpAdvisorResult = 0; jumpAdvisorResultTimer = 0; } public static function UpdateGameplay():void{ var _local3:PhysObj_Instance; var _local4:Array; var _local5:GameObj; var _local6:Level; Debug.StartTimers(); if (pause){ return; }; if (levelState == levelState_Editor){ PhysEditor.UpdateEditor(); return; }; if (usedebug){ if (KeyReader.Pressed(KeyReader.KEY_SPACE)){ InitLevelState(levelState_Editor); }; }; if (levelState == levelState_Null){ return; }; if (mousetimer > 0){ mousetimer--; }; if (LevelUpdateCallback != null){ LevelUpdateCallback(); }; var _local1 = 1; if (usedebug){ if (KeyReader.Pressed(KeyReader.KEY_1)){ StartRecordPlayer(); }; if (KeyReader.Pressed(KeyReader.KEY_2)){ StopRecordPlayer(); }; if (KeyReader.Pressed(KeyReader.KEY_3)){ Debug.debugMode = (Debug.debugMode ^ 1); }; if (KeyReader.Pressed(KeyReader.KEY_4)){ Debug.debugMode = (Debug.debugMode ^ 2); }; if (KeyReader.Pressed(KeyReader.KEY_5)){ achievements.TestAll(); InitLevelState(levelState_Null); TitleScreenState.InitLevelEndScreen(); }; if (KeyReader.Pressed(KeyReader.KEY_6)){ currentSkiIndex++; if (currentSkiIndex >= 7){ currentSkiIndex = 0; }; StartLevelPlay(); }; if (KeyReader.Pressed(KeyReader.KEY_7)){ StartLevelPlay(); }; if (KeyReader.Pressed(KeyReader.KEY_8)){ currentLevel--; if (currentLevel < 0){ currentLevel = (levels.length - 1); }; StartLevelPlay(); }; if (KeyReader.Pressed(KeyReader.KEY_9)){ currentLevel++; if (currentLevel >= levels.length){ currentLevel = 0; }; StartLevelPlay(); }; }; if (levelFinishedState == levelFinishedState_WON){ }; if (levelFinishedState == levelFinishedState_LOST){ }; if (levelState == levelState_LevelStart){ levelStateTimer--; if (levelStateTimer <= 0){ levelStateTimer = Defs.fps; levelStateCount++; _local5 = GameObjects.AddObj(320, 100, 100); if (levelStateCount == 3){ InitLevelState(levelState_Play); if (startMode == 1){ gotSneakyStart = true; _local5.InitMessage(3); } else { _local5.InitMessage((levelStateCount - 1)); }; } else { _local5.InitMessage((levelStateCount - 1)); }; }; }; if (levelState == levelState_PostRace){ levelStateTimer--; if (levelStateTimer <= 0){ if (playerRecordingFlag == 2){ StopRecordPlayer(); }; if ((((cheatMode == 0)) && ((levelFailed == false)))){ AwardCashForFinalPosition(); achievements.TestAll(); PostRaceStatTest(); SubmitAllKongStats(); } else { achievements.TestNone(); }; SaveData.Save(); InitLevelState(levelState_Null); TitleScreenState.InitLevelEndScreen(levelFailed); }; }; UpdatePlayerHitFloor(); if (stuntAddedTimer > 0){ stuntAddedTimer--; }; var _local2:int; while (_local2 < _local1) { levelTimer++; bikeWheelDown = false; backWheelDown = false; frontWheelDown = false; numCollisionTests = 0; Debug.StartTimer("physworld"); world.Step(physTimeStep, physNumIterations); Debug.EndTimer("physworld"); Debug.StartTimer("physworld1"); UpdateGOsFromPhysics(); Debug.EndTimer("physworld1"); if ((((levelState == levelState_Play)) || ((levelState == levelState_LevelStart)))){ GameObjects.Update(); Particles.Update(1); Collision.Update(); }; _local2++; }; if (pickupTimer > 0){ pickupTimer--; if (pickupTimer <= 0){ pickupMultiplier = 1; }; }; UpdateSnowballGenerator(); UpdateSnow(); if (levelState == levelState_Play){ UpdatePlayerRot(); UpdateBikeWheelDown(); } else { ZeroStuntTimers(); }; UpdateJumpAdvisor(); UpdateRecordPlayer(); UpdatePhysObjs(); UpdateBoost(); UpdateHelp(); AddToBoost(-0.003); if ((((levelState == levelState_Play)) || ((levelState == levelState_LevelStart)))){ UpdatePlayerPosition(); _local6 = GetCurrentLevel(); if (_local6.eventType == "chase"){ UpdateChase(); }; UpdateControl(); }; TestCrossedFinishLine(); for each (_local3 in physObjInstances.list) { if (_local3.collidetimer != 0){ _local3.collidetimer++; if (_local3.collidetimer >= 5){ if (_local3.collideFunction != null){ _local3.collideFunction(_local3); }; }; }; }; _local4 = new Array(); for each (_local3 in physObjInstances.list) { if (_local3.removeFlag){ _local4.push(_local3); }; }; for each (_local3 in _local4) { physObjInstances.Remove(_local3); }; UpdateScroll(); if (switchFlag == 1){ DoSwitchToBack(); switchFlag = 0; }; if (switchFlag == 2){ DoSwitchToFront(); switchFlag = 0; }; if (levelState == levelState_Play){ raceTimer++; }; if (chase_caught){ PlayerCaught(); chase_caught = false; }; if ((((levelState == levelState_Play)) || ((levelState == levelState_LevelStart)))){ if (KeyReader.Pressed(KeyReader.KEY_P)){ if (PauseMenu.IsPaused() == false){ QuietLoops(); PauseMenu.Pause(); }; }; }; } static function UpdateRecordPlayer(){ var _local1:PlayerRecord; var _local4:PlayerRecord; var _local5:Number; var _local6:Number; if (playerRecordingFlag != 2){ return; }; var _local2:GameObj; var _local3:int; for each (_local2 in GameObjects.objs) { if (((_local2.active) && (_local2.colFlag_isPlayer))){ if (playerRecording.length == 0){ oldRecordPosX = Math.floor(_local2.xpos); oldRecordPosY = Math.floor(_local2.ypos); _local1 = new PlayerRecord(oldRecordPosX, oldRecordPosY, Utils.DP2(_local2.dir), _local2.frame); } else { _local4 = playerRecording[(playerRecording.length - 1)]; _local5 = Math.floor(_local2.xpos); _local6 = Math.floor(_local2.ypos); _local1 = new PlayerRecord(_local5, _local6, Utils.DP2(_local2.dir), _local2.frame); oldRecordPosX = Math.floor(_local2.xpos); oldRecordPosY = Math.floor(_local2.ypos); }; playerRecording.push(_local1); }; }; } static function RenderPanel(){ var _local1:PhysObj_Instance; var _local2:Level; var _local3:Number; var _local4:Number; var _local5:String; var _local6:BitmapData; var _local7:Number; var _local8:int; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:String; var _local13:int; var _local14:GameObj; var _local15:int; _local1 = GetPhysObjInstanceByName("player"); if (_local1 == null){ return; }; goPlayer = _local1.GetGameObject(0); _local2 = GetCurrentLevel(); _local6 = main.screenBD; if (usedebug){ _local3 = 20; _local4 = 50; _local12 = "not recording"; if (playerRecordingFlag == 1){ _local12 = "recording PRIMED"; }; if (playerRecordingFlag == 2){ _local12 = "Recording!!"; }; _local5 = ((("FPS: " + Utils.DP2(main.fps).toString()) + " PlayerState: ") + playerState); GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local3, _local4, _local5, null); _local4 = 80; _local5 = ((("dbg_vel: " + dbg_vel) + " dbg_maxvel:") + dbg_maxvel); _local5 = ("playerHitFloor: " + playerHitFloor); GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, _local3, _local4, _local5, null); }; _local5 = _local2.name; _local3 = (Defs.displayarea_w - 5); _local4 = (Defs.displayarea_h - 48); _local9 = GraphicObjects.GetStringWidth(main.screenBD, GraphicObjects.gfx_font1, _local3, _local4, _local5); GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font1, (_local3 - _local9), _local4, _local5, null); if (cliffJumpFlag){ _local3 = 320; _local4 = 100; _local5 = (("Cliff Jump " + cliffJumpRotCount) + " somersaults"); _local9 = GraphicObjects.GetStringWidth(main.screenBD, GraphicObjects.gfx_font2, _local3, _local4, _local5); GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font2, (_local3 - (_local9 / 2)), _local4, _local5, null); }; if (skiJumpFlag){ _local3 = 320; _local4 = 100; _local13 = (goPlayer.xpos - skiJumpStartX); if (skiJumpLanded){ _local13 = skiJumpDistance; }; _local5 = ("Ski jump distance " + _local13.toString()); _local9 = GraphicObjects.GetStringWidth(main.screenBD, GraphicObjects.gfx_font2, _local3, _local4, _local5); GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font2, (_local3 - (_local9 / 2)), _local4, _local5, null); }; if (currentLevel == (9 - 1)){ _local3 = 320; _local4 = 100; _local5 = ("Highest Point " + int(-(highestPoint)).toString()); _local9 = GraphicObjects.GetStringWidth(main.screenBD, GraphicObjects.gfx_font2, _local3, _local4, _local5); GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font2, (_local3 - (_local9 / 2)), _local4, _local5, null); _local4 = (highestPoint - scrollY); Utils.RenderDotLine(_local6, 0, _local4, 640, _local4, 300, 4294901760); }; _local3 = 10; _local4 = 20; _local5 = Utils.CounterToSecondsString(raceTimer); GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font2, _local3, _local4, _local5, null); _local3 = 100; _local4 = 20; _local5 = ("Score: " + currentScore); GraphicObjects.RenderStringAt(main.screenBD, GraphicObjects.gfx_font2, _local3, _local4, _local5, null); _local3 = 400; _local4 = 20; _local8 = GraphicObjects.gfx_boostbar; _local7 = Utils.ScaleTo(0, (GraphicObjects.GetNumFrames(_local8) - 1), 0, 1, boostLevel); GraphicObjects.RenderAt(_local8, int(_local7), _local6, _local3, _local4); _local1 = GetPhysObjInstanceByName("player"); if (_local1 != null){ _local14 = _local1.GetGameObject(0); if ((((((_local14.inAir == false)) && (_local14.crouching))) && (!((_local14.controlMode == 5))))){ _local15 = GraphicObjects.GetIndexByName("jumpPowerMeter"); _local7 = Utils.ScaleTo(0, (GraphicObjects.GetNumFrames(_local15) - 1), 0, _local14.crouchedTimerMax, _local14.crouchedTimer); GraphicObjects.RenderAt(_local15, _local7, _local6, ((_local14.xpos - 35) - scrollX), ((_local14.ypos - 5) - scrollY)); }; }; RenderJumpAdvisor(_local6); } static function GetLineListByType(_arg1:int):Array{ var _local4:PhysLine; var _local2:Array = new Array(); var _local3:Level = GetCurrentLevel(); for each (_local4 in _local3.lines) { if (_local4.type == _arg1){ _local2.push(_local4); }; }; return (_local2); } public static function PauseButtonPressed(_arg1:MouseEvent){ if ((((levelState == levelState_Play)) && ((helpOverlay == null)))){ if (PauseMenu.IsPaused() == false){ QuietLoops(); PauseMenu.Pause(); }; }; } static function RenderMiniMapFloor(){ var _local1:Rectangle; var _local2:Level; var _local3:Graphics; var _local5:int; var _local6:int; var _local7:int; var _local8:BitmapData; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Point; var _local16:Point; var _local17:Point; var _local18:Point; var _local19:Point; var _local20:Point; var _local21:Point; var _local22:int; var _local24:PhysLine; var _local25:Array; var _local27:GameObj; var _local28:*; _local1 = new Rectangle(0, 0, 300, 100); _local2 = GetCurrentLevel(); _local3 = main.fillScreenMC1.graphics; _local3.clear(); _local3.beginFill(0, 1); _local3.drawRect(_local1.x, _local1.y, _local1.width, _local1.height); _local3.endFill(); var _local4:Number = 500; _local5 = GraphicObjects.GetNumFrames(GraphicObjects.gfx_fills); _local6 = (_local2.fillFrame - 1); _local6 = (_local6 % _local5); _local7 = (_local2.surfaceFrame - 1); _local7 = (_local7 % _local5); _local8 = GraphicObjects.GetBitmapData(GraphicObjects.gfx_fills, _local6); var _local9:BitmapData = GraphicObjects.GetBitmapData(GraphicObjects.gfx_fills, _local7); var _local10:Number = _local8.width; var _local11:Number = _local8.height; _local12 = 0.05; _local13 = ((scrollCX * _local12) - 40); _local14 = ((scrollCY * _local12) - 50); _local2 = GetCurrentLevel(); if (_local2.lines.length == 0){ return; }; var _local23:int = _local2.surfaceThickness; _local3.lineStyle(NaN, 0, 1, true); for each (_local24 in _local2.lines) { _local28 = _local24.type; if (_local28 == 0){ if (_local24.points.length >= 2){ _local22 = 0; while (_local22 < (_local24.points.length - 1)) { _local16 = _local24.points[_local22].clone(); _local17 = _local24.points[(_local22 + 1)].clone(); _local16.x = (_local16.x * _local12); _local16.y = (_local16.y * _local12); _local17.x = (_local17.x * _local12); _local17.y = (_local17.y * _local12); _local16.x = (_local16.x - _local13); _local16.y = (_local16.y - _local14); _local17.x = (_local17.x - _local13); _local17.y = (_local17.y - _local14); _local16.x = Math.floor(_local16.x); _local16.y = Math.floor(_local16.y); _local17.x = Math.floor(_local17.x); _local17.y = Math.floor(_local17.y); if ((((_local16.y > (_local1.height + 5))) && ((_local17.y > (_local1.height + 5))))){ } else { _local18 = _local17.clone(); _local18.y = _local1.height; _local19 = _local16.clone(); _local19.y = _local1.height; if ((((_local17.x < -20)) || ((_local16.x > (_local1.width + 10))))){ } else { _local3.beginFill(4286611584, 1); _local3.moveTo(_local16.x, _local16.y); _local3.lineTo(_local17.x, _local17.y); _local3.lineTo(_local18.x, _local18.y); _local3.lineTo(_local19.x, _local19.y); _local3.endFill(); }; }; _local22++; }; }; }; }; _local25 = new Array(); _local25.push(0); _local25.push(0xFFFF00); _local25.push(0xFFFF); _local25.push(0xFF00FF); _local25.push(16746632); _local25.push(0xFFFFFF); _local25.push(0xFFFFFF); _local25.push(0xFFFFFF); var _local26:int = GraphicObjects.GetIndexByName("miniMap_icons"); for each (_local27 in GameObjects.objs) { if (_local27.active){ _local16.x = _local27.xpos; _local16.y = _local27.ypos; _local16.x = (_local16.x * _local12); _local16.y = (_local16.y * _local12); _local16.x = (_local16.x - _local13); _local16.y = (_local16.y - _local14); if (_local27.colFlag_isPlayer){ _local3.beginFill(0xFFFFFF, 1); _local3.drawRect((_local16.x - 3), (_local16.y - 5), 5, 5); _local3.endFill(); } else { if (_local27.minimapID != 0){ _local3.beginFill(_local25[_local27.minimapID], 1); _local3.drawRect((_local16.x - 2), (_local16.y - 2), 5, 5); _local3.endFill(); }; }; }; }; } static function GetLastStartPoint(_arg1:Number):Point{ var _local3:Point; var _local2:Point = startPoints[0]; var _local4:Number = -1000; for each (_local3 in startPoints) { if (_local3.x < _arg1){ if (_local3.x > _local4){ _local4 = _local3.x; _local2 = _local3; }; }; }; return (_local2); } static function PlayerCallback(_arg1:MovieClip):void{ _arg1.skiBack.gotoAndStop((currentSkiIndex + 1)); _arg1.skiFront.gotoAndStop((currentSkiIndex + 1)); var _local2:PlayerBikeData = PlayerBikes.GetBikeData(_slot1.currentBikeIndex); _arg1.hat.visible = false; if (_local2.bellAvailable){ _arg1.hat.visible = true; }; } public static function SwitchToBack(){ switchFlag = 1; trace("SwitchToBack"); } public static function RemoveObj_BallInWrongHopper(_arg1:PhysObj_Instance){ physObjInstances.Remove(_arg1); } public static function SwitchToFront(){ switchFlag = 2; } public static function InitLevel1(){ trace("INIT LEVEL "); TitleScreenState.InitLevelSelect(); } public static function InitLevel2(){ var _local1:GameObj; KeyReader.InitOnce(main.stage); numBikes = PlayerBikes.bikes.length; Particles.Reset(); ObjectDefs.Init(); GameObjects.ClearAll(); levelFinishedState = levelFinishedState_NOT; scrollX = 0; scrollY = 0; oldScrollX = 0; oldScrollY = 0; LevelUpdateCallback = null; scrollW = 10000; scrollH = 1000; scrollMaxX = (scrollW - Defs.displayarea_w); scrollMaxY = (scrollH - Defs.displayarea_h); gravity = 0.2; maxFallSpeed = 6; polygonList = new Array(); startPoints = new Array(); InitBox2D(); levelTimer = 0; physObjs = new PhysObjs(); physObjs.InitFromXml(ExternalData.xml); scrollAcc = 0.01; scrollVel = 0; scrollMaxVel = 2; physObjInstances = new PhysObj_Instances(); pause = false; StartLevelPlay(); } static function CycleWeapon(_arg1:int):void{ currentProjectileType = (currentProjectileType + _arg1); if (currentProjectileType >= numWeapons){ currentProjectileType = 0; }; if (currentProjectileType < 0){ currentProjectileType = (numWeapons - 1); }; } public static function AddScore(_arg1:int):void{ currentScore = (currentScore + (_arg1 * multiplier)); levelScore = (levelScore + (_arg1 * multiplier)); } static function ExamineBox2D():void{ var _local1:int; var _local2:b2Body; var _local3:b2Vec2; return; } public static function RemoveObj_Gem(_arg1:PhysObj_Instance){ physObjInstances.Remove(_arg1); } public static function StartLevelPlay():void{ ExternalData.Load(StartLevelPlay2); } public static function DoSwitchToBack(){ var _local1:PhysObj_Instance; _local1 = GetPhysObjInstanceByName("player"); if (_local1 == null){ return; }; _local1.SetBodyCollisionMask(-1, 7); } static function GetPhysObjInstanceByName(_arg1:String):PhysObj_Instance{ var _local2:PhysObj_Instance; for each (_local2 in physObjInstances.list) { if (_local2.instanceName == _arg1){ return (_local2); }; }; return (null); } public static function InitLevelPlayFromEditorObjects(){ var _local1:PhysObj_Instance; var _local2:PhysObj; zsortoffset = 0; level_instances = GetCurrentLevelInstances(); for each (_local1 in level_instances) { _local2 = physObjs.FindByName(_local1.typeName); if (_local2.graphics.length != 0){ AddGameObjectAt(_local1.typeName, _local1.x, _local1.y, _local1.rot, _local1.instanceName, _local1.initParams); zsortoffset = (zsortoffset + 0.01); } else { FlashConnect.trace(("initing physobj: " + _local1.typeName)); if (_local2.hasPhysics){ AddPhysObjAt(_local1.typeName, _local1.x, _local1.y, _local1.rot, _local1.instanceName); zsortoffset = (zsortoffset + 0.01); } else { AddPhysGameObjectAt(_local1.typeName, _local1.x, _local1.y, _local1.rot, _local1.instanceName, _local1.initParams); zsortoffset = (zsortoffset + 0.01); }; }; }; } static function InitSkis(){ skiUnlocks = new Array(); var _local1:int; while (_local1 < 10) { skiUnlocks.push(Boolean(false)); _local1++; }; skiUnlocks[0] = true; skiUnlocks[1] = true; skiUnlocks[2] = true; skiUnlocks[3] = true; } static function InitSnow(){ var _local1:int; var _local2:Snow; snowList = new Array(); _local1 = 0; while (_local1 < 200) { _local2 = new Snow(); FlashConnect.trace(((("snow " + _local2.xpos) + " ") + _local2.ypos)); snowList.push(_local2); _local1++; }; ResetSnow(); } static function UpdateGOsFromPhysics():void{ var _local2:GameObj; var _local3:b2Body; var _local4:PhysObj_BodyUserData; var _local5:int; var _local6:b2Vec2; var _local7:Number; var _local1:Number = p2w; _local3 = world.GetBodyList(); while (_local3) { _local4 = (_local3.GetUserData() as PhysObj_BodyUserData); if (_local4 != null){ _local5 = _local4.gameObjectID; if (_local5 != -1){ _local6 = _local3.GetPosition(); _local7 = _local3.GetAngle(); _local2 = GameObjects.objs[_local5]; _local2.xpos = ((_local6.x * _local1) + _local2.physObjOffsetX); _local2.ypos = ((_local6.y * _local1) + _local2.physObjOffsetY); _local2.dir = _local7; }; }; _local3 = _local3.GetNext(); }; } public static function PlayerCaught():void{ InitLevelState(levelState_PostRace); } static function InitCliffJump(){ cliffJumpFlag = false; cliffJumpLanded = false; cliffJumpRotCount = 0; } static function InitPhysicsFloorGO(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number):int{ var _local5:GameObj; _local5 = GameObjects.AddObj(_arg2, _arg3, 1000); _local5.InitPhysicsFloorObject(_arg1, _arg4); return (GameObjects.lastGenIndex); } public static function TestCrossedFinishLine(){ var _local1:PhysObj_Instance; var _local2:GameObj; var _local3:Point; if (playerHitFloor){ return; }; if (levelState == levelState_Play){ _local1 = _slot1.GetPhysObjInstanceByName("player"); if (_local1 == null){ return; }; _local2 = _local1.GetGameObject(0); if (_local2.xpos > endLineX){ SoundPlayer.Play("sfx_win"); _local3 = new Point(currentLevel, raceTimer); timesList.push(_local3); InitLevelState(levelState_PostRace); }; }; } static function UpdateJumpAdvisor(){ if (jumpAdvisorFlag == false){ return; }; } static function UpdateShakeCam(_arg1:Number):void{ var _local2:Number; shakeCamTimer--; if (shakeCamTimer <= 0){ shakeCamTimer = Utils.RandBetweenInt(5, 20); shakeCamTimerMax = shakeCamTimer; _local2 = Utils.ScaleTo(2, 20, 0, 30, _arg1); shakeCamToX = Utils.RandBetweenFloat(-(_local2), _local2); shakeCamToY = Utils.RandBetweenFloat(-(_local2), _local2); shakeCamDX = ((shakeCamToX - shakeCamX) / shakeCamTimer); shakeCamDY = ((shakeCamToY - shakeCamY) / shakeCamTimer); }; shakeCamX = (shakeCamX + shakeCamDX); shakeCamY = (shakeCamY + shakeCamDY); } static function GetLineByIndex(_arg1:int):PhysLine{ var _local2:Level = GetCurrentLevel(); return (_local2.lines[_arg1]); } static function PrintPlayerPosition(){ var _local1:PhysObj_Instance; _local1 = GetPhysObjInstanceByName("player"); if (_local1 == null){ return; }; var _local2:b2Vec2 = _local1.GetBodyWorldPos(0); trace((((("x=\"" + int((_local2.x * p2w))) + "\" y=\"") + int((_local2.y * p2w))) + "\"")); } static function InitPlayerUpdateRot(){ playerRotLeaveGround = playerRot; playerRotMode = 0; playerRotCount = 0; } public static function StartPlayerHitFloor():void{ if (playerRecordingFlag == 2){ return; }; if (levelState != levelState_Play){ return; }; if (playerHitFloor){ return; }; playerHitFloorTimer = (playerHitFloorTimerMax = (Defs.fps * 2)); playerHitFloorMaxRot = Utils.RandBetweenFloat(1, 3); if (Utils.RandBetweenInt(0, 1000) < 500){ playerHitFloorMaxRot = (playerHitFloorMaxRot * -1); }; playerHitFloor = true; numCrashes++; SoundPlayer.Play("sfx_die"); var _local1:PhysObj_Instance = GetPhysObjInstanceByName("player"); var _local2:GameObj = _local1.GetGameObject(0); _local2.controlMode = 5; } public static function RemoveObj_Snowball(_arg1:PhysObj_Instance){ physObjInstances.Remove(_arg1); numSnowballs--; } static function ResetSnow(){ var _local1:int; nextSnow = 0; _local1 = 0; while (_local1 < 200) { s = snowList[_local1]; s.active = true; s.visible = true; s.ypos = Utils.RandBetweenFloat(0, 800); _local1++; }; } public static function RemoveObj_BallDie(_arg1:PhysObj_Instance){ physObjInstances.Remove(_arg1); } static function GetLineIndexByTypeIndex(_arg1:int, _arg2:int):int{ var _local6:PhysLine; var _local3:int; var _local4:int; var _local5:Level = GetCurrentLevel(); for each (_local6 in _local5.lines) { if (_local6.type == _arg1){ if (_local3 == _arg2){ return (_local4); }; _local3++; }; _local4++; }; return (0); } static function CliffJumpLanded(){ if (cliffJumpFlag == false){ return; }; if (cliffJumpLanded == true){ return; }; cliffJumpLanded = true; FlashConnect.trace("Landed"); InitLevelState(levelState_PostRace); } public static function UpdatePlayerHitFloor():void{ var _local2:PhysObj_Instance; var _local5:GameObj; var _local6:int; var _local7:Number; var _local8:Number; if (playerHitFloor == false){ return; }; var _local1:Boolean; if (((((((cliffJumpLevel) || (skiJumpLevel))) || (penguinSmashLevel))) || (dontDieLevel))){ _local1 = false; }; playerHitFloorCount++; EndJumpAdvisor(); _local2 = GetPhysObjInstanceByName("player"); var _local3:b2Vec2 = _local2.GetBodyWorldPos(0); var _local4:Point = GetLastStartPoint((_local3.x * p2w)); if (playerHitFloorTimer == playerHitFloorTimerMax){ _local2.SetShapeCollisionMaskByName("roll", 15); _local2.SetShapeCollisionMaskByName("body", 0); _local2.SetShapeCollisionMaskByName("wheel", 0); _local2.SetAngularDamping(-1, 0.2); _local6 = currentSkiIndex; _local7 = (_local3.x * p2w); _local8 = (_local3.y * p2w); _local5 = GameObjects.AddObj(_local7, _local8, 0); _local5.InitHitPiece(GraphicObjects.GetIndexByName("LooseSki"), _local6); _local5 = GameObjects.AddObj(_local7, _local8, 0); _local5.InitHitPiece(GraphicObjects.GetIndexByName("LooseSki"), _local6); }; if (playerHitFloorTimer > 0){ ZeroStuntTimers(); ResetBoost(); playerHitFloorTimer--; if (playerHitFloorTimer <= 0){ _local2 = GetPhysObjInstanceByName("player"); if (_local1 == true){ _local2.SetLinearVelocity(0, 0); _local2.SetAngularVelocity(-1, 0); _local2.SetXForm((_local4.x * w2p), ((_local4.y - 10) * w2p), 0); _local5 = _local2.GetGameObject(0); _local5.controlMode = 0; _local5.SetAnim("pushIdle", 1, 1, true); _local5.leaning = false; _local5.pushing = false; _local5.crouching = false; _local5.uncrouching = false; _local5.posing = false; _local2.SetShapeCollisionMaskByName("wheel", 15); _local2.SetShapeCollisionMaskByName("roll", 0); _local2.SetShapeCollisionMaskByName("body", 15); _local2.SetAngularDamping(-1, 10); ResetSnow(); }; stopScroll = false; playerHitFloorTimer = 0; playerHitFloor = false; ResetBoost(); ZeroStuntTimers(); }; }; if (_local1 == false){ levelFailed = true; InitLevelState(levelState_PostRace); }; } static function GetCurrentLevelInstances():Array{ return (levels[currentLevel].instances); } static function GetPhysObjInstanceByTypeName(_arg1:String):PhysObj_Instance{ var _local2:PhysObj_Instance; for each (_local2 in physObjInstances.list) { if (_local2.typeName == _arg1){ return (_local2); }; }; return (null); } static function InitSnowballGenerator(){ var _local1:Number; var _local2:Array; var _local3:Number; var _local4:PhysLine; var _local5:int; var _local6:int; var _local7:Point; _local1 = 400; snowballList = new Array(); _local2 = GetLineListByType(0); _local3 = -9999; for each (_local4 in _local2) { _local5 = _local4.GetNumPoints(); _local6 = 0; while (_local6 < _local5) { _local7 = _local4.GetPoint(_local6).clone(); if (_local7.x > (_local3 + _local1)){ snowballList.push(_local7); _local3 = _local7.x; _local1 = Utils.RandBetweenInt(400, 800); }; _local6++; }; }; } public static function MoreGamesButtonPressed(_arg1:MouseEvent){ var _local2:LicSku = Lic.GetSku(Lic.licensor); if (_local2.linkFunction != null){ _local2.linkFunction(_arg1); }; } public static function DoSwitchToFront(){ var _local1:PhysObj_Instance; _local1 = GetPhysObjInstanceByName("player"); if (_local1 == null){ return; }; _local1.SetBodyCollisionMask(-1, 3); trace("SwitchToFront"); } static function ResetBoost(){ boostMode = 0; boostTimer = 0; boostLevel = 0; boostMultiplier = 0; } static function UpdateHelp(){ if (helpIsAvailable == false){ return; }; if (helpTimer > 0){ helpTimer--; if (helpTimer == 0){ InitHelp(true); }; }; } static function InitFloorOld(){ var _local1:b2BodyDef; var _local2:b2Body; var _local3:b2PolygonDef; var _local4:Point; var _local5:Point; var _local6:Point; var _local7:Point; var _local8:Point; var _local9:int; var _local15:Array; var _local16:int; var _local10:PhysObj_BodyUserData = new PhysObj_BodyUserData(); var _local11:Number = 50; var _local12:Level = GetCurrentLevel(); var _local13:b2FilterData = new b2FilterData(); _local13.categoryBits = 2; _local13.maskBits = 7; var _local14:int; for each (_local15 in _local12.lines) { _local16 = _local12.linetypes[_local14]; _local14++; if (_local15.length >= 2){ if (_local16 == 0){ _local9 = 0; while (_local9 < (_local15.length - 1)) { _local5 = _local15[_local9].clone(); _local6 = _local15[(_local9 + 1)].clone(); _local7 = _local6.clone(); _local6.clone().y = (_local7.y + _local11); _local8 = _local5.clone(); _local5.clone().y = (_local8.y + _local11); _local1 = new b2BodyDef(); _local1.position.Set(0, 0); _local2 = world.CreateBody(_local1); if (_local2 != null){ _local3 = new b2PolygonDef(); _local3.filter = _local13; _local3.vertexCount = 4; _local3.vertices[0].Set((_local5.x * w2p), (_local5.y * w2p)); _local3.vertices[1].Set((_local6.x * w2p), (_local6.y * w2p)); _local3.vertices[2].Set((_local7.x * w2p), (_local7.y * w2p)); _local3.vertices[3].Set((_local8.x * w2p), (_local8.y * w2p)); _local3.friction = 0.5; _local3.restitution = 0.2; _local3.density = 1; _local2.CreateShape(_local3); _local2.SetUserData(_local10); }; _local9++; }; }; if (_local16 == 1){ _local9 = 0; while (_local9 < (_local15.length - 1)) { _local5 = _local15[_local9].clone(); _local6 = _local15[(_local9 + 1)].clone(); _local7 = _local6.clone(); _local6.clone().y = (_local7.y - _local11); _local8 = _local5.clone(); _local5.clone().y = (_local8.y - _local11); _local1 = new b2BodyDef(); _local1.position.Set(0, 0); _local2 = world.CreateBody(_local1); if (_local2 != null){ _local3 = new b2PolygonDef(); _local3.filter = _local13; _local3.vertexCount = 4; _local3.vertices[3].Set((_local5.x * w2p), (_local5.y * w2p)); _local3.vertices[2].Set((_local6.x * w2p), (_local6.y * w2p)); _local3.vertices[1].Set((_local7.x * w2p), (_local7.y * w2p)); _local3.vertices[0].Set((_local8.x * w2p), (_local8.y * w2p)); _local3.friction = 0.5; _local3.restitution = 0.2; _local3.density = 1; _local2.CreateShape(_local3); _local2.SetUserData(_local10); }; _local9++; }; }; }; }; } static function StopRecordPlayer(){ var _local3:PlayerRecord; playerRecordingFlag = 0; var _local1 = ""; var _local2 = ""; _local1 = (((currentLevel.toString() + ", ") + int(playerRecording.length).toString()) + ", "); _local1 = (_local1 + "\n"); for each (_local3 in playerRecording) { _local1 = (_local1 + int(_local3.x)); _local1 = (_local1 + ", "); _local1 = (_local1 + int(_local3.y)); _local1 = (_local1 + ", "); _local1 = (_local1 + int((_local3.rot * 1000))); _local1 = (_local1 + ", "); }; trace("Player recording copied to clipboard"); System.setClipboard(_local1); return; if (_local7 != 0){ var _local6 = (_local6 + "));"); var _local7:int; _local2 = (_local2 + (_local6 + "\n")); _local6 = ""; }; _local6 = "StopData();"; _local2 = (_local2 + (_local6 + "\n")); trace("Player recording copied to clipboard"); System.setClipboard(_local2); } static function PostRaceStatTest(){ if (playerRacePosition == 0){ numFirstPlaces++; }; numRacesCompleted++; } static function StartRecordPlayer(){ playerRecording = new Array(); playerRecordingFlag = 1; } static function RenderFloor(){ var _local1:Level; var _local2:Graphics; var _local7:BitmapData; var _local8:BitmapData; var _local11:Number; var _local12:Number; var _local15:Matrix; var _local16:Point; var _local17:Point; var _local18:Point; var _local19:Point; var _local20:Point; var _local21:Point; var _local22:Point; var _local23:int; var _local24:int; var _local25:PhysLine; var _local26:*; _local1 = GetCurrentLevel(); _local2 = main.fillScreenMC.graphics; _local2.clear(); var _local3:Number = 500; var _local4:int = GraphicObjects.GetNumFrames(GraphicObjects.gfx_fills); var _local5:int = (_local1.fillFrame - 1); var _local6:int = (_local1.surfaceFrame - 1); _local7 = GraphicObjects.GetBitmapData(GraphicObjects.gfx_fills, _local5); _local8 = GraphicObjects.GetBitmapData(GraphicObjects.gfx_fills, _local6); var _local9:Number = _local7.width; var _local10:Number = _local7.height; _local11 = scrollX; _local12 = scrollY; var _local13:Number = (scrollX % _local9); var _local14:Number = (scrollY % _local10); _local15 = new Matrix(); _local15.translate(-(Math.floor(_local13)), -(Math.floor(_local14))); _local1 = GetCurrentLevel(); if (_local1.lines.length == 0){ return; }; _local24 = _local1.surfaceThickness; _local2.lineStyle(NaN, 0, 1, true); for each (_local25 in _local1.lines) { _local26 = _local25.type; if (_local25.points.length >= 2){ if (_local26 == 1){ _local2.beginBitmapFill(_local7, _local15); _local18 = _local25.points[0].clone(); _local25.points[0].clone().x = (_local18.x - _local11); _local18.y = (_local18.y - _local12); _local2.moveTo(_local18.x, _local18.y); _local23 = 1; while (_local23 < _local25.points.length) { _local17 = _local25.points[_local23].clone(); _local25.points[_local23].clone().x = (_local17.x - _local11); _local17.y = (_local17.y - _local12); _local2.lineTo(_local17.x, _local17.y); _local23++; }; _local2.lineTo(_local18.x, _local18.y); _local2.endFill(); }; if (_local26 == 0){ _local23 = 0; while (_local23 < (_local25.points.length - 1)) { _local17 = _local25.points[_local23].clone(); _local18 = _local25.points[(_local23 + 1)].clone(); _local17.x = (_local17.x - _local11); _local17.y = (_local17.y - _local12); _local18.x = (_local18.x - _local11); _local18.y = (_local18.y - _local12); _local17.x = Math.floor(_local17.x); _local17.y = Math.floor(_local17.y); _local18.x = Math.floor(_local18.x); _local18.y = Math.floor(_local18.y); _local17.y = (_local17.y + 2); _local18.y = (_local18.y + 2); if ((((_local17.y > (Defs.displayarea_h + 5))) && ((_local18.y > (Defs.displayarea_h + 5))))){ } else { _local19 = _local18.clone(); _local19.y = Defs.displayarea_h; _local20 = _local17.clone(); _local20.y = Defs.displayarea_h; if ((((_local18.x < -20)) || ((_local17.x > (Defs.displayarea_w + 10))))){ } else { _local2.beginBitmapFill(_local7, _local15); _local2.moveTo(_local17.x, _local17.y); _local2.lineTo(_local18.x, _local18.y); _local2.lineTo(_local19.x, _local19.y); _local2.lineTo(_local20.x, _local20.y); _local2.endFill(); }; _local19 = _local18.clone(); _local18.clone().y = (_local19.y + _local24); _local20 = _local17.clone(); _local17.clone().y = (_local20.y + _local24); if ((((_local18.x < -20)) || ((_local17.x > (Defs.displayarea_w + 10))))){ } else { _local2.beginBitmapFill(_local8, _local15); _local2.moveTo(_local17.x, _local17.y); _local2.lineTo(_local18.x, _local18.y); _local2.lineTo(_local19.x, _local19.y); _local2.lineTo(_local20.x, _local20.y); _local2.endFill(); }; }; _local23++; }; }; }; }; } static function EndJumpAdvisor(){ if (jumpAdvisorFlag == true){ SoundPlayer.Play("sfx_sequence_failed"); jumpAdvisorResult = 2; jumpAdvisorResultTimer = (Defs.fps * 2); }; jumpAdvisorFlag = false; } } }//package
Section 149
//GameCompleteMovie (GameCompleteMovie) package { import flash.display.*; public dynamic class GameCompleteMovie extends MovieClip { } }//package
Section 150
//GameCompleteScreen (GameCompleteScreen) package { import flash.display.*; public dynamic class GameCompleteScreen extends MovieClip { } }//package
Section 151
//GameObj (GameObj) package { import flash.events.*; import flash.geom.*; import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; import org.flashdevelop.utils.*; public class GameObj { public var graphicID:int; var collisionHitFunction:Function; var textMessage:String; var bikeBodyGraphicID:int; public var xvel:Number; var path:Poly; public var todir:Number; var minFrame:int; public var subControlMode:int; var rotVel:Number; public var speed:Number; public var colFlag_isEnemy:Boolean; public var yoffset:Number; var waveDef:WaveDef; var objectDef:ObjectDef; public var ypos1:Number; public var ypos2:Number; public var startz:Number; public var colFlag_canBeShot:Boolean; var health:Number; public var startx:Number; public var starty:Number; var aiRouteIndex:int; public var colFlag_playercanbekilled:Boolean; public var frame1:Number; public var movementVec:Vec; var maxFrame:int; var ct:ColorTransform; public var visible:Boolean; public var colFlag_isPlayer:Boolean; public var yvel:Number; var pushing:Boolean;// = false var hoopFrontGO:GameObj; public var name:String; public var dir:Number; public var graphicID1:int; public var radius:Number; public var colFlag_isPowerup:Boolean; var aiPlayerSpeed:Number; public var controlMode:int; public var colFlag_isHose:Boolean; public var colFlag_isCheckpoint:Boolean; public var origspeed:Number; var aiPlayerSpeedOffsetCountStep:Number; var uniqueID:int; var pushedStickTimer:int; var aiPlayerSpeedOffsetCount:Number; var EnemyHitByBulletFunctionCallback:Function; var aiWheelRot:Number; var leaning:Boolean;// = false var leaningCrouched:Boolean;// = false public var colFlag_isPhysObj:Boolean; public var xpos1:Number; public var xpos2:Number; var EnemyUpdateFunctionCallback:Function; public var xpos:Number; public var renderShadowFlag:Boolean; public var zvel:Number; var isChase:Boolean; var xflip:Boolean; var crouchedTimerMax:int; public var colFlag_isPlatform:Boolean; var crouchedTimer:int; var currentAnimName:String; var posingTimer:int; public var frameVel:Number; var currentWeapon:int; public var colFlag_killPlayer:Boolean; var renderSmooth:Boolean; var currentPoly:Poly; public var colFlag_canBePickedUp:Boolean; public var colFlag_isBullet:Boolean; var hopperIndex:int; var aiLegsFrame:Number; public var xacc:Number; public var xoffset:Number; var shotControllers:Array; public var active:Boolean; var posing:Boolean;// = false public var count:int; public var colFlag_jumpon:Boolean; var posingTimerMax:int; public var colFlag_isEnemyBullet:Boolean; var aiPlayerSpeedOffsetMul:Number; var flashTimer:int; var textMessageSlot:int; public var type:int; public var ypos:Number; var aiPhysObj:PhysObj; public var colFlag_isBall:Boolean; var maxSpeed:Number; public var timer:Number; var scale:Number; public var physObjInitVarString:String; var alpha:Number; var lean:Number; public var yacc:Number; public var frame:Number; var uncrouching:Boolean;// = false public var controlIndex:int; public var subtype:int; var flashFlag:Boolean; public var minimapID:int; public var hitTimer:Number; public var oldxpos:Number; var bulletTimer:int; var bikeBodyOffsetX:Number; var bikeBodyOffsetY:Number; public var timer1:Number; public var renderFunction:Function; var aiRoutePos:Number; var aiLegRotSpeed:Number; public var zpos:Number; public var toPosX:Number; public var toPosY:Number; public var colFlag_isBouncyPad:Boolean; var aiUpperBodyLean:Number; var aiBodyFrame:Number; var dist:Number; var aiBikeSpecialType:int; public var driveVec:Vec; var playerWeapons:Array; public var main:Main; public var updateFunction:Function; var jumpAdvisor_SeqLength:int; public var additive:Boolean; var inFrontZone:Poly; var oldAiPosX:Number; var oldAiPosY:Number; var aiBikeOffsets:Array; var crouched:Boolean;// = false var currentMaxSpeed:Number; public var timerMax:Number; public var physObjOffsetY:Number; public var oldypos:Number; var inAir:Boolean;// = false public var physObjOffsetX:Number; var crouching:Boolean;// = false public var colFlag_isShop:Boolean; var parentObj:GameObj; var flashTimerMax:int; var isPhysObj:Boolean; public function GameObj(_arg1, _arg2, _arg3){ ct = new ColorTransform(0.1, 0.1, 0.1, 0.3); super(); xpos = _arg2; ypos = _arg3; zpos = 1; starty = _arg2; startx = _arg2; active = false; main = _arg1; zpos = 0; graphicID = 0; frame = 0; frameVel = 0; controlIndex = 0; timer = 0; timer1 = 0; radius = 14; minFrame = 0; maxFrame = 0; movementVec = new Vec(); } function BouncerBounce(){ if (controlMode == 0){ timer = 0; controlMode = 1; }; } function HitSnowman(_arg1:GameObj):void{ SoundPlayer.Play("sfx_hit_snowman"); Game.numSnowmenHit++; _arg1.PlayerHitObject(this); GenerateHitObjects("Snowman_Hit", -30, 30, -120, 0, 20); active = false; } public function UpdatePellet(){ } function HitMelonBarrow(_arg1:GameObj):void{ colFlag_canBePickedUp = false; SoundPlayer.Play("sfx_hit_barrow"); _arg1.PlayerHitObject(this); GenerateHitObjects("MelonBarrow_Hit", -80, 80, -100, 0, 20); frame = 1; } function InitWheel():void{ visible = false; } function HitBonusPickup(_arg1:GameObj):void{ active = false; Game.bonusPickupCollected = true; SoundPlayer.Play("sfx_hit_bonuspickup"); Game.InitMessage("Bonus Collected"); } function InitJumpAdvisor2():void{ InitJumpAdvisor(); jumpAdvisor_SeqLength = 2; } function InitJumpAdvisor3():void{ InitJumpAdvisor(); jumpAdvisor_SeqLength = 3; } function InitSkiJumpStart():void{ Game.skiJumpLevel = true; name = "jumpstart"; FlashConnect.trace("init ski jump start"); colFlag_canBePickedUp = true; collisionHitFunction = HitSkiJumpStart; radius = 50; frame = 0; } function UpdateBouncer(){ var _local1:Number; if (controlMode == 1){ _local1 = (dir - (Math.PI * 0.5)); xoffset = ((Math.cos(_local1) * timer) * 2); yoffset = ((Math.sin(_local1) * timer) * 2); timer++; if (timer > 3){ yoffset = 0; xoffset = 0; controlMode = 0; }; }; } function InitEndLine(){ updateFunction = UpdateEndLine; Game.endLineX = xpos; } function InitCliffJumpStart():void{ Game.cliffJumpLevel = true; name = "jumpstart"; FlashConnect.trace("init cliff jump start"); colFlag_canBePickedUp = true; collisionHitFunction = HitCliffJumpStart; radius = 50; frame = 0; } function InitMelonBarrow():void{ collisionHitFunction = HitMelonBarrow; colFlag_canBePickedUp = true; frame = 0; radius = 100; } function InitBonusPickup():void{ minimapID = 5; colFlag_canBePickedUp = true; collisionHitFunction = HitBonusPickup; radius = 100; frame = 0; frameVel = 1; } function InitIgloo():void{ collisionHitFunction = HitIgloo; colFlag_canBePickedUp = true; frame = 0; radius = 100; } function InitPlayer():void{ colFlag_isPlayer = true; updateFunction = UpdatePlayer; renderFunction = RenderPlayer; frame = 0; frameVel = 0; frame1 = 7; renderSmooth = true; crouchedTimer = 0; var _local1:Array = physObjInitVarString.split(","); bikeBodyGraphicID = GraphicObjects.GetIndexByName((_local1[0] as String)); bikeBodyOffsetX = Number(_local1[1]); bikeBodyOffsetY = Number(_local1[2]); crouched = false; posing = false; posingTimer = 0; posingTimerMax = (Defs.fps * 1); SetAnim("pushIdle", 1, 1); lean = 0; crouchedTimerMax = (Defs.fps * 2); inAir = false; } public function UpdatePhysicsObject(){ } function RenderPlayer():void{ var _local1:PlayerBikeData = PlayerBikes.GetBikeData(Game.currentBikeIndex); if (_local1.inGameID == 1){ graphicID = GraphicObjects.GetIndexByName("Skiier01"); }; if (_local1.inGameID == 2){ graphicID = GraphicObjects.GetIndexByName("Skiier02"); }; if (_local1.inGameID == 3){ graphicID = GraphicObjects.GetIndexByName("Skiier03"); }; if (_local1.inGameID == 4){ graphicID = GraphicObjects.GetIndexByName("Skiier04"); }; if (_local1.inGameID == 5){ graphicID = GraphicObjects.GetIndexByName("Skiier05"); }; if (_local1.inGameID == 6){ graphicID = GraphicObjects.GetIndexByName("Skiier06"); }; RenderNormally(); } function HitPenguin(_arg1:GameObj):void{ if (controlMode != 0){ return; }; SoundPlayer.Play("sfx_hit_penguin"); _arg1.PlayerHitObject(this); frame = 1; controlMode = 1; } function PlayerLanded(){ crouched = false; leaning = false; posing = false; } function HitJumpAdvisor(_arg1:GameObj):void{ FlashConnect.trace("hit jump advisor"); Game.StartJumpAdvisor(jumpAdvisor_SeqLength); active = false; } function InitObj_Bouncer(){ xoffset = 0; yoffset = 0; updateFunction = UpdateBouncer; renderFunction = RenderBouncer; controlMode = 0; timer = 0; } function ClearColFlags(){ colFlag_jumpon = false; colFlag_killPlayer = false; colFlag_playercanbekilled = false; colFlag_canBePickedUp = false; colFlag_canBeShot = false; colFlag_isBullet = false; colFlag_isPlatform = false; colFlag_isPowerup = false; colFlag_isBouncyPad = false; colFlag_isCheckpoint = false; colFlag_isShop = false; colFlag_isEnemyBullet = false; colFlag_isEnemy = false; colFlag_isBall = false; colFlag_isHose = false; colFlag_isPlayer = false; colFlag_isPhysObj = false; } function UpdateEndLine(){ var _local1:Number = (xpos - 450); if (Game.scrollX > _local1){ Game.scrollX = _local1; Game.stopScroll = true; }; } public function GetOffsetObjectRectangle():Rectangle{ var _local1:Rectangle = objectDef.colRects[0].clone(); _local1.x = (_local1.x + xpos); _local1.y = (_local1.y + ypos); return (_local1); } function RenderBouncer(){ var _local1:Number = xpos; var _local2:Number = ypos; xpos = (xpos + xoffset); ypos = (ypos + yoffset); RenderNormally(); xpos = _local1; ypos = _local2; } function InitAIPlayer(_arg1:int, _arg2:int, _arg3:int, _arg4:Boolean=false):void{ isChase = _arg4; colFlag_isEnemy = true; aiBikeOffsets = new Array(); aiBikeOffsets.push(new Point(0, 0), 0); aiBikeOffsets.push(new Point(0, -10), 0); aiBikeOffsets.push(new Point(0, -8), 0); aiBikeOffsets.push(new Point(0, -10), 4); aiBikeOffsets.push(new Point(0, -7), 0); aiBikeOffsets.push(new Point(0, -7), 0); aiBikeOffsets.push(new Point(0, -4), -2); aiBikeOffsets.push(new Point(0, 7), -5); aiBikeOffsets.push(new Point(0, -10), 0); aiBikeOffsets.push(new Point(0, 0), 2); aiBikeOffsets.push(new Point(0, -3), -2); aiBikeOffsets.push(new Point(0, -8), -1); aiBikeOffsets.push(new Point(0, -8), 0); aiBikeOffsets.push(new Point(0, -8), -10); aiBikeOffsets.push(new Point(0, -10), -3); aiBikeOffsets.push(new Point(0, -10), 1); aiBikeOffsets.push(new Point(0, -3), 0); aiBikeOffsets.push(new Point(0, -9), -2); aiBikeOffsets.push(new Point(0, -9), -2); aiBikeOffsets.push(new Point(0, -10), -2); aiBikeOffsets.push(new Point(0, 0), 0); aiBikeOffsets.push(new Point(0, 0), 0); aiBikeOffsets.push(new Point(0, 0), 0); aiBikeOffsets.push(new Point(0, 0), 0); aiBikeOffsets.push(new Point(0, 0), 0); var _local5:Array = new Array(); var _local6:Array = new Array(); _local5.push(28.030303030303, 56.454545454545, 68.636363636364, 80.787878787879, 38.939393939394, 63.121212121212, 58.212121212121, 57.393939393939, 53.181818181818, 57.333333333333, 42.575757575758, 46.69696969697, 42.212121212121, 42.575757575758, 58.606060606061, 39.848484848485, 39.181818181818, 59.060606060606, 52.242424242424, 54.333333333333, 46.393939393939, 66.575757575758, 60.424242424242, 75.121212121212, 47.121212121212, 121.9696969697); _local6.push(33.525251515152, 61.034963636364, 81.953536363636, 85.737372727273, 38.939393939394, 70.931818181818, 60.340909090909, 66.109090909091, 55.654545454545, 57.333333333333, 48.975757575758, 52.787878787879, 55.007575757576, 51.404039393939, 58.606060606061, 40.287878787879, 43.929293939394, 60.310606060606, 56.854545454545, 54.333333333333, 53.797978787879, 74.929293939394, 65.310606060606, 81.163636363636, 54.136363636364, 140.37121212121); type = (_arg3 - 1); renderSmooth = true; zpos = (zpos + (50 + type)); var _local7:int = _arg1; aiRouteIndex = PlayerRecordings.GetRouteIndex(Game.currentLevel, _local7); aiRoutePos = 0; updateFunction = UpdateAIPlayer; renderFunction = RenderAIPlayer; frame = 0; frameVel = 1; if (type < 20){ aiPhysObj = Game.physObjs.FindByName(("bike" + int((type + 1)).toString())); }; trace(((("Initing AI bike. type: " + int((type + 1))) + " route: ") + _local7)); var _local8:Number = _local6[Game.currentLevel]; var _local9:Number = _local5[Game.currentLevel]; _local8 = (_local8 * 1.33); var _local10:Number = Utils.ScaleTo(_local8, _local9, 0, 9, (_arg2 % 12)); CalcAIPlaybackSpeed(_local10, aiRouteIndex); timer = 0; var _local11:PlayerRecord = PlayerRecordings.GetItem(aiRouteIndex, int(aiRoutePos)); xpos = (oldAiPosX = _local11.x); ypos = (oldAiPosY = _local11.y); aiRoutePos = 1; aiBodyFrame = 0; aiLegsFrame = 0; aiWheelRot = 0; aiUpperBodyLean = 0.5; aiLegRotSpeed = 0; aiPlayerSpeedOffsetMul = Utils.RandBetweenFloat(0.1, 0.2); aiPlayerSpeedOffsetCount = Utils.RandCircle(); aiPlayerSpeedOffsetCountStep = Utils.RandBetweenFloat(0.01, 0.03); if (isChase){ aiPlayerSpeed = 0; }; aiBikeSpecialType = 0; if (type == 20){ aiBikeSpecialType = 1; graphicID = GraphicObjects.GetIndexByName("Bubble"); frame = 0; frameVel = 1; renderFunction = RenderAIPlayerSpecial; }; if (type == 21){ aiBikeSpecialType = 2; graphicID = GraphicObjects.GetIndexByName("WallOfFire"); frame = 0; frameVel = 1; renderFunction = RenderAIPlayerSpecial; }; if (type == 22){ aiBikeSpecialType = 3; graphicID = GraphicObjects.GetIndexByName("Walrus"); frame = 0; frameVel = 1; renderFunction = RenderAIPlayerSpecial; }; if (type == 23){ aiBikeSpecialType = 4; graphicID = GraphicObjects.GetIndexByName("Piano"); frame = 0; frameVel = 1; renderFunction = RenderAIPlayerSpecial; }; if (type == 24){ aiBikeSpecialType = 5; graphicID = GraphicObjects.GetIndexByName("Haddock"); frame = 0; frameVel = 1; renderFunction = RenderAIPlayerSpecial; }; } function InitBrickWall():void{ collisionHitFunction = HitBrickWall; colFlag_canBePickedUp = true; frame = 0; radius = 100; } function InitJumpAdvisor():void{ name = "jumpstart"; Game.totalSequences++; FlashConnect.trace("init jump advisor"); colFlag_canBePickedUp = true; collisionHitFunction = HitJumpAdvisor; radius = 50; frame = 0; minimapID = 4; jumpAdvisor_SeqLength = 0; } function InitHoop():void{ minimapID = 3; Game.totalHoops++; name = "hoop"; colFlag_canBePickedUp = true; collisionHitFunction = HitHoop; radius = 50; frame = 0; zpos = 500; hoopFrontGO = GameObjects.AddObj(xpos, ypos, (zpos - 1000)); hoopFrontGO.InitHoopFront(); } function RenderWallCollision():void{ var _local2:Number; var _local3:Number; var _local4:Number; if ((Debug.debugMode & 8) == 0){ return; }; if (objectDef == null){ return; }; if (objectDef.collisionCircleOffsets.length == 0){ return; }; var _local1:int; while (_local1 < objectDef.collisionCircleOffsets.length) { _local2 = objectDef.collisionCircleOffsets[_local1].x; _local3 = objectDef.collisionCircleOffsets[_local1].y; _local4 = objectDef.collisionCircleRadii[_local1]; _local2 = (_local2 + xpos); _local2 = (_local2 - Game.scrollX); _local3 = (_local3 + ypos); _local3 = (_local3 - Game.scrollY); Utils.RenderCircle(main.scrollScreenBD, _local2, _local3, _local4, 4294967295); _local1++; }; } function RenderBlockCollision():void{ var _local1:Rectangle; var _local2:Rectangle; if ((Debug.debugMode & 4) == 0){ return; }; if (objectDef == null){ return; }; if (objectDef.colRects.length == 0){ return; }; for each (_local2 in objectDef.colRects) { _local1 = _local2.clone(); _local1.x = (_local1.x + xpos); _local1.y = (_local1.y + ypos); _local1.x = (_local1.x - Game.scrollX); _local1.y = (_local1.y - Game.scrollY); main.scrollScreenBD.fillRect(_local1, 1082163328); }; for each (_local2 in objectDef.shieldColRects) { _local1 = _local2.clone(); _local1.x = (_local1.x + xpos); _local1.y = (_local1.y + ypos); _local1.x = (_local1.x - Game.scrollX); _local1.y = (_local1.y - Game.scrollY); main.scrollScreenBD.fillRect(_local1, 1082163200); }; } public function PlayerHitEnemyBullet(_arg1:GameObj){ } function InitHitPiece(_arg1:int, _arg2:int):void{ graphicID = _arg1; frame = _arg2; updateFunction = UpdateHitPiece; xvel = Utils.RandBetweenFloat(10, 20); yvel = Utils.RandBetweenFloat(0, -10); timer = 50; dir = Utils.RandCircle(); rotVel = Utils.RandBetweenFloat(0.1, 0.3); } public function RenderShadow():void{ if (renderShadowFlag == false){ return; }; if (visible == false){ return; }; var _local1:Number = (xpos - Game.scrollX); var _local2:Number = (ypos - Game.scrollY); GraphicObjects.RenderAtRotScaled(graphicID, frame, main.scrollScreenBD, (_local1 + 5), (_local2 + 5), 1, dir); } function CalcAIPlaybackSpeed(_arg1:Number, _arg2:int){ var _local3:Number = PlayerRecordings.GetRouteLen(_arg2); var _local4:Number = (_local3 / Defs.fps); aiPlayerSpeed = (_local4 / _arg1); trace(((((("route. time: " + _arg1) + " ") + _local4) + " speed: ") + aiPlayerSpeed)); } public function PlayAnimation():Boolean{ var _local1:int = (GraphicObjects.GetNumFrames(graphicID) - 1); frame = (frame + frameVel); if (frame >= _local1){ frame = _local1; return (true); }; return (false); } function RenderNormally(){ var _local3:ColorTransform; var _local1:Number = ((xpos + xpos1) - Game.scrollX); var _local2:Number = ((ypos + ypos1) - Game.scrollY); if (_local1 < -1000){ return; }; if (_local1 > (Defs.displayarea_w + 500)){ return; }; if (_local2 < -1000){ return; }; if (_local2 > (Defs.displayarea_h + 500)){ return; }; if (((((!((scale == 1))) || (!((dir == 0))))) || (!((alpha == 1))))){ _local3 = new ColorTransform(); _local3.alphaMultiplier = alpha; GraphicObjects.RenderAtRotScaled(graphicID, frame, main.scrollScreenBD, _local1, _local2, scale, dir, _local3, renderSmooth); } else { if (additive){ GraphicObjects.RenderAtAdditive(graphicID, frame, main.scrollScreenBD, _local1, _local2, alpha); } else { GraphicObjects.RenderAt(graphicID, frame, main.scrollScreenBD, _local1, _local2); }; }; } function RenderTextMessage(){ var _local1:Number = GraphicObjects.GetStringWidth(Game.main.scrollScreenBD, GraphicObjects.gfx_font2, xpos, ypos, textMessage, null); GraphicObjects.RenderStringAt(Game.main.scrollScreenBD, GraphicObjects.gfx_font2, (xpos - (_local1 / 2)), ypos, textMessage, null); } function HitCrystals(_arg1:GameObj):void{ SoundPlayer.Play("sfx_hit_crystals"); _arg1.PlayerHitObject(this); GenerateHitObjects("Crystals_Hit", -80, 80, -100, 0, 20); active = false; } public function InitNextPieceGO(){ subtype = 0; frame = subtype; updateFunction = UpdateNextPieceGO; dir = 0; } public function GetDirBetween(_arg1, _arg2, _arg3, _arg4):Number{ var _local5:* = Math.atan2((_arg4 - _arg2), (_arg3 - _arg1)); return (_local5); } function UpdateObj_Ship(){ timer++; var _local1:Number = (Math.sin((timer * 0.1)) * 5); ypos1 = _local1; } public function InitPinDisappear_Broken(){ health = 32; frame = (health / 2); } public function CycleAnimationEx():Boolean{ var _local1:Boolean; frame = (frame + frameVel); var _local2:* = (maxFrame - minFrame); if (frame > maxFrame){ frame = (frame - _local2); _local1 = true; }; if (frame < minFrame){ frame = (frame + _local2); _local1 = true; }; return (_local1); } public function InitMessage(_arg1:int):void{ updateFunction = UpdateMessage; timer = (Defs.fps * 0.8); frame = _arg1; graphicID = GraphicObjects.GetIndexByName("StartRaceText"); } function PlayerHitObject(_arg1:GameObj){ var _local2 = 100; if (crouched){ _local2 = 500; }; Game.AddScore(_local2); Game.InitMessage(("+" + _local2), 0); } function IsInWorld(_arg1:Number):Boolean{ if (xpos < (0 - _arg1)){ return (false); }; if (ypos < (0 - _arg1)){ return (false); }; if (xpos > (Defs.displayarea_w + _arg1)){ return (false); }; if (ypos > (Defs.displayarea_h + _arg1)){ return (false); }; return (true); } function UpdatePickup():void{ CycleAnimation(); } function InitObj_Conveyor(){ frame = 0; frameVel = 0.5; updateFunction = UpdateObj_Conveyor; } function InitStalagmite():void{ collisionHitFunction = HitStalagmite; colFlag_canBePickedUp = true; frame = 0; radius = 100; } public function InitTextMessage(_arg1:String, _arg2:int):void{ textMessageSlot = _arg2; textMessage = _arg1; updateFunction = UpdateTextMessage; renderFunction = RenderTextMessage; timer = Defs.fps; controlMode = 0; xpos = (xpos - Game.scrollX); ypos = (ypos - Game.scrollY); ypos = (ypos - 80); xpos = (xpos + 30); yvel = 0; } function RenderHomingBullet(){ GraphicObjects.RenderAtRotScaled(graphicID, frame, main.screenBD, xpos, ypos, scale, movementVec.rot); } function InitHoopFront():void{ graphicID = GraphicObjects.GetIndexByName("HoopFront"); frame = 0; } function InitCheckpoint():void{ Game.startPoints.push(new Point(xpos, ypos)); if (Game.startPoints.length == 1){ graphicID = GraphicObjects.GetIndexByName("startline"); }; } function UpdateMessage(){ xpos = (320 + Game.scrollX); ypos = (100 + Game.scrollY); timer--; if (timer <= 0){ active = false; }; } function RenderAIPlayer(){ var _local9:PhysObj_Body; var _local11:PhysObj_Graphic; var _local1:Number = frame; var _local2:int = graphicID; var _local3:Number = xpos; var _local4:Number = ypos; var _local5:Number = xpos; var _local6:Number = ypos; var _local7:Number = dir; var _local8:Number = dir; var _local10:Point = new Point(0, 0); var _local12:Point = aiBikeOffsets[((type * 2) + 0)]; var _local13:Number = aiBikeOffsets[((type * 2) + 1)]; _local3 = (_local3 + _local12.x); _local4 = (_local4 + _local12.y); dir = (dir + Utils.DegToRad(_local13)); _local7 = dir; var _local14:Matrix = new Matrix(); _local14.rotate(dir); _local9 = aiPhysObj.BodyFromName("body"); _local11 = _local9.graphics[0]; _local10.x = _local9.pos.x; _local10.y = _local9.pos.y; _local10 = _local14.transformPoint(_local10); xpos = (_local3 + _local10.x); ypos = (_local4 + _local10.y); graphicID = _local11.graphicID; var _local15:int = GraphicObjects.GetNumFrames(graphicID); aiLegsFrame = (aiLegsFrame + aiLegRotSpeed); if (aiLegsFrame >= _local15){ aiLegsFrame = 0; }; frame = aiLegsFrame; RenderNormally(); _local9 = aiPhysObj.BodyFromName("wheel1"); _local11 = _local9.graphics[0]; _local10.x = _local9.pos.x; _local10.y = _local9.pos.y; _local10 = _local14.transformPoint(_local10); xpos = (_local3 + _local10.x); ypos = (_local4 + _local10.y); frame = _local11.frame; graphicID = _local11.graphicID; dir = aiWheelRot; RenderNormally(); _local9 = aiPhysObj.BodyFromName("wheel2"); _local11 = _local9.graphics[0]; _local10.x = _local9.pos.x; _local10.y = _local9.pos.y; _local10 = _local14.transformPoint(_local10); xpos = (_local3 + _local10.x); ypos = (_local4 + _local10.y); frame = _local11.frame; graphicID = _local11.graphicID; dir = aiWheelRot; RenderNormally(); dir = _local7; _local9 = aiPhysObj.BodyFromName("body"); _local11 = _local9.graphics[0]; var _local16:Array = _local11.goInitFuntionVarString.split(","); bikeBodyGraphicID = GraphicObjects.GetIndexByName((_local16[0] as String)); bikeBodyOffsetX = Number(_local16[1]); bikeBodyOffsetY = Number(_local16[2]); _local10.x = (_local9.pos.x + bikeBodyOffsetX); _local10.y = (_local9.pos.y + bikeBodyOffsetY); _local10 = _local14.transformPoint(_local10); xpos = (_local3 + _local10.x); ypos = (_local4 + _local10.y); graphicID = bikeBodyGraphicID; _local15 = GraphicObjects.GetNumFrames(graphicID); frame = Utils.ScaleTo(0, (_local15 - 1), 0, 1, aiUpperBodyLean); RenderNormally(); frame = _local1; graphicID = _local2; xpos = _local5; ypos = _local6; dir = _local8; } function HitGlassPane(_arg1:GameObj):void{ if (controlMode != 0){ return; }; SoundPlayer.Play("sfx_hit_glasspane"); _arg1.PlayerHitObject(this); GenerateHitObjects("IceShards", -50, 50, -100, 0, 20); frame = 1; controlMode = 1; } function RenderAIPlayerSpecial(){ RenderNormally(); } function InitParrot():void{ FlashConnect.trace("init parrot"); colFlag_canBePickedUp = true; collisionHitFunction = HitParrot; updateFunction = UpdateParrot; radius = 80; frame = 0; minimapID = 6; controlMode = 0; } public function Update():void{ oldxpos = xpos; oldypos = ypos; if (updateFunction != null){ updateFunction(); }; } function InitStickSnow():void{ frame = 0; updateFunction = UpdateStickSnow; controlMode = 0; xvel = Utils.RandBetweenFloat(-2, 2); yvel = Utils.RandBetweenFloat(-1, -5); timer = 20; frame = Utils.RandBetweenInt(0, 3); graphicID = GraphicObjects.GetIndexByName("SnowMC"); } public function RenderPellet(){ } function HitParrot(_arg1:GameObj):void{ var _local2:PhysObj_Instance; _local2 = Game.GetPhysObjInstanceByName("player"); var _local3:b2Vec2 = _local2.GetBodyLinearVelocity(0); if (_local3.y < 0){ return; }; FlashConnect.trace("hit parrot"); SoundPlayer.Play("sfx_hit_parrot"); var _local4:Number = Utils.RandBetweenFloat(50, 100); var _local5:Number = -(Utils.RandBetweenFloat(100, 300)); _local2.ApplyImpulse(_local4, _local5); colFlag_canBePickedUp = false; } function HitEasterStatue(_arg1:GameObj):void{ SoundPlayer.Play("sfx_hit_statue"); _arg1.PlayerHitObject(this); GenerateHitObjects("EasterStatue_Hit", -30, 30, -160, 0, 20); active = false; } function UpdateAIPlayer(){ var _local2:int; var _local3:Number; var _local4:PlayerRecord; var _local5:PlayerRecord; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local1:Number = dir; oldxpos = xpos; oldypos = ypos; if (Game.levelState == Game.levelState_Play){ _local2 = int(Math.floor(aiRoutePos)); _local3 = (aiRoutePos - Math.floor(aiRoutePos)); _local2 = int(Math.floor(aiRoutePos)); _local4 = PlayerRecordings.GetItem(aiRouteIndex, _local2); _local5 = PlayerRecordings.GetItem1(aiRouteIndex, (_local2 + 1)); if (_local4){ dir = _local4.rot; xpos = _local4.x; ypos = _local4.y; if (_local5 != null){ xpos = Utils.ScaleTo(_local4.x, _local5.x, 0, 1, _local3); ypos = Utils.ScaleTo(_local4.y, _local5.y, 0, 1, _local3); dir = Utils.ScaleTo(_local4.rot, _local5.rot, 0, 1, _local3); }; }; if (isChase == false){ _local6 = 1; if (xpos > (Game.playerX + 1000)){ _local6 = (xpos - (Game.playerX + 1000)); if (_local6 > 500){ _local6 = 500; }; _local6 = Utils.ScaleTo(0.6, 1, 0, 500, (500 - _local6)); }; aiRoutePos = (aiRoutePos + (aiPlayerSpeed * _local6)); _local7 = ((Math.sin(aiPlayerSpeedOffsetCount) * aiPlayerSpeed) * aiPlayerSpeedOffsetMul); aiRoutePos = (aiRoutePos + _local7); aiPlayerSpeedOffsetCount = (aiPlayerSpeedOffsetCount + aiPlayerSpeedOffsetCountStep); } else { aiRoutePos = (aiRoutePos + aiPlayerSpeed); _local8 = 200; _local9 = 0.4; if (type == 24){ _local8 = 350; _local9 = 0.25; }; _local10 = ((Game.playerX - _local8) - xpos); if (_local10 < -10){ _local10 = -10; }; if (_local10 > 10){ _local10 = 10; }; aiPlayerSpeed = (aiPlayerSpeed + (_local10 * _local8)); aiPlayerSpeed = Utils.LimitNumber(0.25, _local9, aiPlayerSpeed); }; }; if (aiBikeSpecialType == 0){ CycleAnimation(); _local10 = Utils.DistBetweenPoints(xpos, ypos, oldxpos, oldypos); _local10 = Utils.LimitNumber(0, 20, _local10); aiLegRotSpeed = Utils.ScaleTo(0, 1, 0, 3, _local10); aiWheelRot = (aiWheelRot + (_local10 * 0.1)); _local11 = (dir - _local1); if (Math.abs(_local11) < 0.2){ if (_local11 > 0){ aiUpperBodyLean = (aiUpperBodyLean + 0.11); if (aiUpperBodyLean > 1){ aiUpperBodyLean = 1; }; } else { if (_local11 < 0){ aiUpperBodyLean = (aiUpperBodyLean - 0.1); if (aiUpperBodyLean < 0){ aiUpperBodyLean = 0; }; } else { if (aiUpperBodyLean < 0.5){ aiUpperBodyLean = (aiUpperBodyLean + 0.1); if (aiUpperBodyLean > 0.5){ aiUpperBodyLean = 0.5; }; } else { if (aiUpperBodyLean > 0.5){ aiUpperBodyLean = (aiUpperBodyLean - 0.1); if (aiUpperBodyLean < 0.5){ aiUpperBodyLean = 0.5; }; }; }; }; }; }; } else { if (aiBikeSpecialType == 1){ dir = 0; CycleAnimation(); } else { if (aiBikeSpecialType == 2){ CycleAnimation(); dir = 0; ypos = Game.scrollY; } else { if (aiBikeSpecialType == 3){ CycleAnimation(); } else { if (aiBikeSpecialType == 4){ CycleAnimation(); } else { if (aiBikeSpecialType == 5){ CycleAnimation(); }; }; }; }; }; }; if (aiBikeSpecialType == 0){ _local12 = Utils.DistBetweenPoints(xpos, ypos, Game.playerX, Game.playerY); if (_local12 > 100){ _local12 = 100; }; alpha = Utils.ScaleTo(0.5, 1, 0, 100, _local12); } else { alpha = 1; }; } public function GetObjectRectangle():Rectangle{ return (objectDef.colRects[0]); } function RenderEnemyBullet(){ } public function PinDisappearHit():Boolean{ health++; frame = (health / 2); if (health > 40){ health = 40; frame = (health / 2); return (true); }; return (false); } public function InitPhysicsFloorObject(_arg1:int, _arg2:Number){ frame = _arg1; dir = _arg2; } function InitSmashPenguin():void{ minimapID = 7; } function HitCliffJumpStart(_arg1:GameObj):void{ FlashConnect.trace("hit cliff jump start"); active = false; Game.cliffJumpFlag = true; } function UpdatePlayer():void{ var _local11:PhysObj_Instance; var _local1:Boolean = inAir; inAir = (Game.bikeWheelUpTimer > 4); if (((inAir) && ((_local1 == false)))){ PlayerLanded(); }; if (Game.playerJumpingTimer > 0){ Game.playerJumpingTimer--; inAir = true; }; var _local2:Boolean; var _local3:Boolean; var _local4:Boolean; var _local5:Boolean; var _local6:Boolean; var _local7:Boolean; if (KeyReader.Down(KeyReader.KEY_LEFT)){ _local2 = true; }; if (KeyReader.Down(KeyReader.KEY_RIGHT)){ _local3 = true; }; if (KeyReader.Down(KeyReader.KEY_UP)){ _local4 = true; }; if (KeyReader.Down(KeyReader.KEY_DOWN)){ _local5 = true; }; if (KeyReader.Down(KeyReader.KEY_A)){ _local2 = true; }; if (KeyReader.Down(KeyReader.KEY_D)){ _local3 = true; }; if (KeyReader.Down(KeyReader.KEY_W)){ _local4 = true; }; if (KeyReader.Down(KeyReader.KEY_S)){ _local5 = true; }; if (KeyReader.Down(KeyReader.KEY_X)){ _local6 = true; }; if (KeyReader.Pressed(KeyReader.KEY_W)){ _local7 = true; }; if (KeyReader.Pressed(KeyReader.KEY_UP)){ _local7 = true; }; if (Game.usedebug == false){ if (KeyReader.Down(KeyReader.KEY_SPACE)){ _local6 = true; }; }; if (Game.levelState == Game.levelState_LevelStart){ if (_local7){ Game.AddToBoost(0.05); }; return; }; var _local8:Number = (450 * 8); var _local9:Number = (200 * 8); var _local10:Number = (50 * 8); if (Game.currentSkiIndex == 6){ _local8 = (_local8 + (_local8 * 0.05)); _local9 = (_local9 + (_local9 * 0.05)); _local10 = (_local10 + (_local10 * 0.05)); }; _local11 = Game.GetPhysObjInstanceByName("player"); _local11.WakeUp(); var _local12:Number = _local11.GetBodyAngle(0); if (controlMode == 5){ Game.playerState = 0; crouchedTimer = 0; SetAnim("die", 1, 1, true); if (PlayAnimationEx()){ }; return; }; if (inAir == false){ Game.playerState = 1; posing = false; if (pushing){ Game.playerState = 2; SetAnim("push", 1, 1, true); if (PlayAnimationEx()){ pushing = false; }; pushedStickTimer++; if (pushedStickTimer == 8){ PlayerPushStick(); }; } else { if (crouching){ Game.playerState = 3; SetAnim("crouch", 1, 1, true); crouchedTimer++; if (crouchedTimer >= crouchedTimerMax){ crouchedTimer = crouchedTimerMax; }; if (_local5 == false){ uncrouching = false; crouching = false; crouched = false; PlayerDoJump(); }; SetAnim("crouch", 1, 1, true); if (crouched){ Game.playerState = 4; SetAnim("crouchIdle", 1, 1, true); CycleAnimationEx(); } else { Game.playerState = 5; if (PlayAnimationEx()){ crouched = true; }; }; } else { if (uncrouching){ Game.playerState = 6; crouched = false; if (_local5 == true){ uncrouching = false; crouching = true; }; SetAnim("crouch", -1, -1, true); if (PlayAnimationEx()){ crouched = false; uncrouching = false; }; } else { if (leaning){ Game.playerState = 7; if (_local2){ Game.playerState = 8; SetAnim("backIdle", 1, 1, true); lean = (lean - 0.1); if (lean <= -1){ lean = -1; }; _local11.ApplyAngularVelocity(0, -(_local10)); _local11.LimitAngularVelocity(0, 10); } else { if (_local3){ Game.playerState = 9; SetAnim("forwardIdle", 1, 1, true); lean = (lean + 0.1); if (lean >= 1){ lean = 1; }; _local11.ApplyAngularVelocity(0, _local10); _local11.LimitAngularVelocity(0, 10); } else { SetAnim("pushIdle", 1, 1, true); if (lean < 0){ lean = (lean + 0.1); if (lean >= 0){ leaning = false; lean = 0; }; }; if (lean > 0){ lean = (lean - 0.1); if (lean <= 0){ leaning = false; lean = 0; }; }; if (_local4){ pushedStickTimer = 0; pushing = true; leaning = false; lean = 0; }; Game.playerState = 10; Game.playerLean = lean; Game.playerleaning = leaning; }; }; if (((((!((lean == 0))) && (!((lean == -1))))) && (!((lean == 1))))){ Game.playerState = 11; if (lean < 0){ Game.playerState = 12; SetAnim("back", 1, 0); frame = int(Utils.ScaleTo(minFrame, maxFrame, 0, -1, lean)); }; if (lean > 0){ Game.playerState = 13; SetAnim("forward", 1, 0); frame = int(Utils.ScaleTo(minFrame, maxFrame, 0, 1, lean)); }; } else { CycleAnimationEx(); }; } else { Game.playerState = 14; SetAnim("pushIdle", 1, 1, true); CycleAnimationEx(); if (_local4){ pushedStickTimer = 0; pushing = true; } else { if (_local5){ crouching = true; } else { if (((_local2) || (_local3))){ leaning = true; }; }; }; }; }; }; }; } else { Game.playerState = 15; if (_local5 == false){ crouchedTimer = 0; }; if (posing){ Game.playerState = 150; if (PlayAnimationEx()){ Game.playerState = 151; posingTimer = 0; posing = false; Game.InitMessage("Pose"); Game.JumpAdvisor_DoStunt("pose"); Game.AddToBoost(1); }; } else { if (leaning){ if (crouched == false){ SetAnim("pushIdle", 1, 1, true); if (_local2){ _local11.ApplyAngularVelocity(0, -(_local9)); _local11.LimitAngularVelocity(0, 10); } else { if (_local3){ _local11.ApplyAngularVelocity(0, _local9); _local11.LimitAngularVelocity(0, 10); } else { leaning = false; CycleAnimationEx(); }; }; } else { SetAnim("crouchIdle", 1, 1, true); if (_local2){ _local11.ApplyAngularVelocity(0, -(_local8)); _local11.LimitAngularVelocity(0, 10); } else { if (_local3){ _local11.ApplyAngularVelocity(0, _local8); _local11.LimitAngularVelocity(0, 10); } else { leaning = false; CycleAnimationEx(); }; }; }; if (_local5){ crouched = true; } else { crouched = false; }; } else { if (crouched){ SetAnim("crouchIdle", 1, 1, true); } else { SetAnim("pushIdle", 1, 1, true); }; CycleAnimationEx(); if (_local5){ crouched = true; } else { crouched = false; }; if (((_local2) || (_local3))){ leaning = true; }; }; }; if (!posing){ if (_local6){ posing = true; posingTimer = posingTimerMax; SetAnim("pose", 1.2, 1); }; }; }; var _local13:PlayerBikeData = PlayerBikes.GetBikeData(Game.currentBikeIndex); var _local14:Number = _local13.maxvel; if (_local13.bellAvailable){ _local14 = (_local14 + (_local14 * 0.05)); }; if (Game.currentSkiIndex == 5){ _local14 = (_local14 + (_local14 * 0.05)); }; if (Game.boostLevel == 0){ _local14 = (_local14 - 40); } else { _local14 = Utils.ScaleTo((_local14 - 30), _local14, 0, 1, Game.boostLevel); }; Game.dbg_maxvel = _local14; _local11.LimitLinearVelocity(_local14); Game.dbg_vel = _local11.GetBodyLinearVelocity(0).Length(); var _local15:b2Vec2 = _local11.GetBodyLinearVelocity(0); Game.oldPlayerRot = Game.playerRot; Game.playerRot = dir; Game.playerX = xpos; Game.playerY = ypos; if (((posing) && ((ypos < Game.highestPoint)))){ Game.highestPoint = ypos; }; } function UpdateHitPiece(){ yvel = (yvel + 0.5); xpos = (xpos + xvel); ypos = (ypos + yvel); timer--; if (timer <= 0){ active = false; }; dir = (dir + rotVel); } public function InitPhysicsObject(_arg1:int, _arg2:int, _arg3:Number=0, _arg4:Number=0, _arg5:String="", _arg6:Boolean=false){ colFlag_isPhysObj = true; physObjOffsetX = _arg3; physObjOffsetY = _arg4; isPhysObj = true; graphicID = _arg1; frame = _arg2; updateFunction = UpdatePhysicsObject; renderShadowFlag = _arg6; physObjInitVarString = _arg5; } function UpdateObj_Conveyor(){ CycleAnimation(); } public function Init(_arg1:int):void{ var _local2:int; var _local3:Number = 0; type = _arg1; controlMode = _local2; subControlMode = _local2; xvel = _local3; yvel = _local3; frame = _local3; frameVel = _local3; timer = _local3; hitTimer = _local3; flashTimer = _local2; flashFlag = false; dir = 0; todir = 0; health = 1; zvel = 0; name = ""; scale = 1; objectDef = null; xflip = false; updateFunction = null; renderFunction = null; collisionHitFunction = null; visible = true; renderShadowFlag = false; ClearColFlags(); isPhysObj = false; additive = false; alpha = 1; xpos1 = 0; ypos1 = 0; renderSmooth = false; minimapID = 0; } public function InitPinDisappear(){ health = 0; frame = (health / 2); } function InitObelisk():void{ collisionHitFunction = HitObelisk; colFlag_canBePickedUp = true; frame = 0; radius = 100; } public function UpdateNextPieceGO(){ var _local1:Number = MouseControl.x; var _local2:Number = MouseControl.y; xpos = (_local1 + Game.scrollX); ypos = (_local2 + Game.scrollY); if (MouseControl.delta != 0){ dir = (dir + (Number(MouseControl.delta) * 0.1)); MouseControl.delta = 0; }; } function HitHoop(_arg1:GameObj):void{ colFlag_canBePickedUp = false; var _local2 = 100; if (_arg1.posing){ Game.numHoopsComplete++; Game.InitMessage("Super Hoopla"); SoundPlayer.Play("sfx_superhoopla"); Game.AddToBoost(1); _local2 = 1000; frame = 2; hoopFrontGO.frame = 2; } else { SoundPlayer.Play("sfx_hoopla"); Game.InitMessage("Hoopla"); Game.AddToBoost(0.5); frame = 1; hoopFrontGO.frame = 1; }; Game.AddScore(_local2); } function InitCrystals():void{ collisionHitFunction = HitCrystals; colFlag_canBePickedUp = true; frame = 0; radius = 100; } function UpdateStickSnow():void{ yvel = (yvel + 0.5); xpos = (xpos + xvel); ypos = (ypos + yvel); timer--; if (timer <= 0){ active = false; }; } function HitStalagmite(_arg1:GameObj):void{ SoundPlayer.Play("sfx_hit_stalagmite"); _arg1.PlayerHitObject(this); GenerateHitObjects("Stalagmite_Hit", -80, 80, -100, 0, 20); active = false; } function InitEasterStatue():void{ frame = 0; collisionHitFunction = HitEasterStatue; colFlag_canBePickedUp = true; radius = 100; } function InitRamp():void{ minimapID = 2; } public function PlayAnimationEx():Boolean{ var _local1:Boolean; frame = (frame + frameVel); if (frame >= maxFrame){ frame = maxFrame; _local1 = true; }; if (frame <= minFrame){ frame = minFrame; _local1 = true; }; return (_local1); } function Anim_FromVel():void{ var _local1:int = GraphicObjects.GetNumFrames(graphicID); var _local2:Number = xvel; var _local3:Number = yvel; var _local4:* = Math.atan2(_local3, _local2); frame = ((_local1 / (Math.PI * 2)) * -(_local4)); if (frame < 0){ frame = (frame + _local1); }; if (frame > _local1){ frame = (frame - _local1); }; frame = (frame + (_local1 / 2)); if (frame > _local1){ frame = (frame - _local1); }; } function UpdateTextMessage(){ if (controlMode == 0){ yvel--; ypos = (ypos + yvel); if (ypos <= -20){ active = false; }; }; } function RenderEnemy(){ if (movementVec == null){ RenderNormally(); return; }; GraphicObjects.RenderAtRotScaled(graphicID, frame, main.scrollScreenBD, xpos, ypos, scale, movementVec.rot); } function SetAnim(_arg1:String, _arg2:Number, _arg3:int, _arg4:Boolean=false){ var _local5:AnimDef = Game.GetAnimDef(_arg1); if (_local5 != null){ minFrame = _local5.startFrame; maxFrame = _local5.endFrame; frameVel = _arg2; if (_arg4 == false){ if (_arg3 == 1){ frame = minFrame; }; if (_arg3 == -1){ frame = maxFrame; }; } else { if (currentAnimName != _arg1){ if (_arg3 == 1){ frame = minFrame; }; if (_arg3 == -1){ frame = maxFrame; }; }; }; currentAnimName = _arg1; } else { FlashConnect.trace(("anim not found " + _arg1)); }; } public function CycleAnimation():void{ var _local1:Number = frameVel; var _local2:int = GraphicObjects.GetNumFrames(graphicID); frame = (frame + _local1); if (frame >= _local2){ frame = (frame - _local2); }; if (frame < 0){ frame = (frame + _local2); }; } function HitBrickWall(_arg1:GameObj):void{ SoundPlayer.Play("sfx_hit_wall"); _arg1.PlayerHitObject(this); GenerateHitObjects("BrickWall_Hit", -80, 80, -100, 0, 20); active = false; } function GenerateHitObjects(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int){ var _local7:int; var _local8:Particle; var _local9:Number; var _local10:Number; var _local11:int; _local7 = 0; while (_local7 < _arg6) { _local9 = (xpos + Utils.RandBetweenFloat(_arg2, _arg3)); _local10 = (ypos + Utils.RandBetweenFloat(_arg4, _arg5)); _local8 = Particles.Add(_local9, _local10); _local11 = GraphicObjects.GetIndexByName(_arg1); _local8.InitHitPiece(_local11, Utils.RandBetweenInt(0, (GraphicObjects.GetNumFrames(_local11) - 1))); _local7++; }; } function InitCactus():void{ collisionHitFunction = HitCactus; colFlag_canBePickedUp = true; frame = 0; radius = 100; } function HitCactus(_arg1:GameObj):void{ SoundPlayer.Play("sfx_hit_cactus"); _arg1.PlayerHitObject(this); GenerateHitObjects("Cactus_Hit", -80, 80, -100, 0, 20); active = false; } function HitObelisk(_arg1:GameObj):void{ SoundPlayer.Play("sfx_hit_obelisk"); _arg1.PlayerHitObject(this); GenerateHitObjects("Obelisk_Hit", -80, 80, -100, 0, 20); active = false; } function PlayerPushStick(){ var _local1:PhysObj_Instance; var _local7:Number; var _local10:int; var _local11:Particle; _local1 = Game.GetPhysObjInstanceByName("player"); var _local2:Number = _local1.GetBodyAngle(0); var _local3:Number = (1 / 14); var _local4:Number = (200 * _local3); var _local5:Number = (300 * _local3); var _local6:Number = (500 * _local3); _local7 = _local4; if (Game.boostLevel > 0){ _local7 = Utils.ScaleTo(_local5, _local6, 0, 1, Game.boostLevel); }; _local7 = (_local7 * 0.5); var _local8:Point = new Point(_local7, 0); var _local9:Matrix = new Matrix(); _local9.rotate(_local2); _local8 = _local9.transformPoint(_local8); _local1.ApplyImpulse(_local8.x, _local8.y); SoundPlayer.PlayRandomBetween("sfx_push01", "sfx_push03", 0.2); _local10 = 0; while (_local10 < 20) { _local11 = Particles.Add(xpos, ypos); _local11.InitStickSnow(); _local10++; }; } function InitGlassPane():void{ frame = 0; collisionHitFunction = HitGlassPane; colFlag_canBePickedUp = true; controlMode = 0; radius = 50; } public function Render():void{ if (visible == false){ return; }; if (renderFunction != null){ renderFunction(); } else { RenderNormally(); }; RenderBlockCollision(); RenderWallCollision(); } function PlayerDoJump(){ var _local1:PhysObj_Instance; _local1 = Game.GetPhysObjInstanceByName("player"); var _local2:Number = _local1.GetBodyAngle(0); SoundPlayer.Play("sfx_jump"); var _local3:PlayerBikeData = PlayerBikes.GetBikeData(Game.currentBikeIndex); var _local4:Number = _local3.maxjumpvel; if (Game.currentSkiIndex == 4){ _local4 = (_local4 + (_local4 * 0.05)); }; var _local5:Number = Utils.ScaleToLimited((300 * Game.w2p), (_local4 * Game.w2p), 0, crouchedTimerMax, crouchedTimer); var _local6:Point = new Point(0, -(_local5)); var _local7:Matrix = new Matrix(); _local7.identity(); _local7.rotate(_local2); _local6 = _local7.transformPoint(_local6); _local1.ApplyImpulse(_local6.x, _local6.y); SetAnim("jump", 1, 1); posing = false; crouched = false; uncrouching = false; crouching = false; leaning = false; crouchedTimer = 0; Game.InitPlayerUpdateRot(); Game.bikeWheelUpTimer = 20; Game.bikeWheelDown = false; Game.playerJumpingTimer = 10; Game.playerHitFloorTimer = 0; } function HitIgloo(_arg1:GameObj):void{ SoundPlayer.Play("sfx_hit_igloo"); _arg1.PlayerHitObject(this); GenerateHitObjects("Igloo_Hit", -80, 80, -100, 0, 20); active = false; } function InitSnowman():void{ Game.totalSnowmen++; frame = 0; collisionHitFunction = HitSnowman; colFlag_canBePickedUp = true; radius = 100; } function HitPickup(_arg1:GameObj):void{ Game.numPickupsCollected++; FlashConnect.trace(("pickup " + Game.numPickupsCollected)); active = false; if (type == 0){ Game.pickupTimer = Game.pickupTimerMax; Game.pickupMultiplier = 1; } else { Game.pickupTimer = Game.pickupTimerMax; Game.pickupMultiplier++; if (Game.pickupMultiplier == 5){ }; }; var _local2 = ""; if (Game.pickupMultiplier == 1){ _local2 = "sfx_pickup1"; }; if (Game.pickupMultiplier == 2){ _local2 = "sfx_pickup2"; }; if (Game.pickupMultiplier == 3){ _local2 = "sfx_pickup3"; }; if (Game.pickupMultiplier == 4){ _local2 = "sfx_pickup4"; }; if (Game.pickupMultiplier == 5){ _local2 = "sfx_pickup5"; }; if (_local2 != ""){ SoundPlayer.Play(_local2, 0.2); }; var _local3 = 100; if (Game.pickupMultiplier == 5){ _local3 = 1000; }; Game.AddScore(_local3); } function InitPickup():void{ minimapID = 1; Game.totalPickups++; colFlag_canBePickedUp = true; collisionHitFunction = HitPickup; updateFunction = UpdatePickup; radius = 80; frame = Utils.RandBetweenInt(0, (GraphicObjects.GetNumFrames(graphicID) - 1)); frameVel = 1; } function HitSkiJumpStart(_arg1:GameObj):void{ FlashConnect.trace("hit ski jump start"); active = false; Game.skiJumpFlag = true; Game.skiJumpStartX = xpos; } function InitPenguin():void{ frame = 0; collisionHitFunction = HitPenguin; colFlag_canBePickedUp = true; controlMode = 0; radius = 50; } function UpdateParrot():void{ var _local1:PhysObj_Instance; _local1 = Game.GetPhysObjInstanceByName("player"); var _local2:GameObj = _local1.GetGameObject(0); if (controlMode == 0){ if (_local2.xpos > (xpos - 640)){ controlMode = 1; }; } else { if (controlMode == 1){ xpos = (xpos - 4); if (xpos <= (Game.scrollX - 500)){ active = false; }; }; }; } public function PlayerHitEnemy(_arg1:GameObj){ } function InitObj_Ship(){ updateFunction = UpdateObj_Ship; timer = 0; } function InitPickupA():void{ InitPickup(); type = 0; } function UpdateAIPlayer_Step(_arg1:int){ var _local2:int; var _local3:int; var _local4:PlayerRecord; _local2 = 0; while (_local2 < _arg1) { _local3 = int(aiRoutePos); _local4 = PlayerRecordings.GetItem(aiRouteIndex, _local3); xpos = _local4.x; ypos = _local4.y; aiRoutePos = (aiRoutePos + aiPlayerSpeed); _local2++; }; } public function GetVelFromDir(_arg1:Number){ xvel = (Math.cos(dir) * _arg1); yvel = (Math.sin(dir) * _arg1); } function InitPickupB():void{ InitPickup(); type = 1; } } }//package
Section 152
//GameObjects (GameObjects) package { import flash.events.*; class GameObjects { public static var numobjs; static var m:Main; public static var zorder:Array; public static var objs:Array; public static var lastGenIndex:int; public function GameObjGroup(){ } public static function Update():void{ var _local1:int; _local1 = 0; while (_local1 < objs.length) { if (objs[_local1].active == true){ objs[_local1].Update(); }; _local1++; }; } public static function Render():void{ var _local1:GameObj; var _local2:Array = new Array(); for each (_local1 in objs) { if (((_local1.active) && (_local1.visible))){ _local2.push(_local1); }; }; _local2.sortOn("zpos", (Array.NUMERIC | Array.DESCENDING)); for each (_local1 in _local2) { _local1.Render(); }; } public static function InitOnce(_arg1:Main, _arg2:int){ var _local3:*; numobjs = _arg2; m = _arg1; objs = new Array(); zorder = new Array(numobjs); _local3 = 0; while (_local3 < numobjs) { objs.push(new GameObj(m, 0, 0)); _local3++; }; } public static function ClearAll(){ var _local1:int; _local1 = 0; while (_local1 < numobjs) { objs[_local1].active = false; _local1++; }; } public static function CountActive():int{ var _local2:int; var _local1:int; _local2 = 0; while (_local2 < objs.length) { if (objs[_local2].active == true){ _local1++; }; _local2++; }; return (_local1); } public static function AddObj(_arg1:Number, _arg2:Number, _arg3:Number):GameObj{ var _local4:int; var _local5:GameObj; _local4 = 0; while (_local4 < numobjs) { if (objs[_local4].active == false){ _local5 = objs[_local4]; _local5.active = true; _local5.zpos = _arg3; _local5.xpos = _arg1; _local5.ypos = _arg2; _local5.startx = _arg1; _local5.starty = _arg2; _local5.startz = _arg3; _local5.Init(0); lastGenIndex = _local4; return (objs[_local4]); }; _local4++; }; trace("ERROR! NO FREE OBJECTS"); lastGenIndex = -1; return (null); } public static function ForEachActive(_arg1:Function):void{ var _local2:GameObj; var _local3:Array = new Array(); for each (_local2 in objs) { if (_local2.active){ _arg1(_local2); }; }; } public static function GetGOByIndex(_arg1:int):GameObj{ return (objs[_arg1]); } } }//package
Section 153
//GlassPane (GlassPane) package { import flash.display.*; public dynamic class GlassPane extends MovieClip { public var head:MovieClip; } }//package
Section 154
//GraphicObjects (GraphicObjects) package { import flash.text.*; import flash.display.*; import flash.geom.*; import flash.utils.*; public class GraphicObjects { public static var gfx_fills:int; public static var stringCharY:Number; public static var gfx_boostbar:int; public static var gfx_back01:int; public static var gfx_back02:int; public static var gfx_back03:int; public static var gfx_back04:int; public static var gfx_back05:int; public static var gfx_back06:int; public static var gfx_back07:int; public static var gfx_back08:int; public static var gfx_back09:int; public static var gfx_dust:int; static var main:Main; public static var gfx_font2black:int; public static var gfx_backgrounds:int; public static var stringCharX:Number; public static var gfx_boostlevel:int; public static var gfx_posmarker:int; static var nameList:Array; public static var gfx_fontblack:int; static var graphicobjs:Array; public static var gfx_back10:int; public static var gfx_back11:int; public static var gfx_back12:int; public static var gfx_back13:int; public static var gfx_back14:int; public static var gfx_back15:int; public static var gfx_back16:int; public static var gfx_back17:int; public static var gfx_back18:int; static var nextID:int; static var idList:Array; public static var gfx_stuntbar:int; public static var gfx_flame:int; public static var stringCharBitmapData:BitmapData; public static var gfx_speedline:int; public static var gfx_font1:int; public static var gfx_font2:int; public static function Add(_arg1:String, _arg2:int):int{ var _local3:* = nextID; nextID++; var _local4:Class = (getDefinitionByName(_arg1) as Class); var _local5:MovieClip = (new (_local4) as MovieClip); Add1(_local3, new DisplayObj(_arg1, _local5, 1, _arg2), _arg1); _local5 = null; return (_local3); } public static function GetStringWidth(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Object=null, _arg7:int=0):int{ var _local9:int; var _local10:int; stringCharX = _arg3; stringCharY = _arg4; var _local8:int; _local9 = 0; while (_local9 < _arg5.length) { _local10 = int(_arg5.charCodeAt(_local9)); if (_local10 < 0){ _local10 = 0; }; if (_local10 > 127){ _local10 = 127; }; stringCharBitmapData = GetBitmapData(_arg2, _local10); if (_arg6 != null){ } else { _local8 = (_local8 + (stringCharBitmapData.width - 3)); _local8 = (_local8 + _arg7); }; _local9++; }; return (_local8); } public static function GetHeight(_arg1:int, _arg2:int):int{ var _local3:DisplayObjFrame = graphicobjs[_arg1].frames[_arg2]; return (_local3.bitmapData.height); } public static function RenderNumberAt(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int){ var _local8:int; var _local10:int; var _local11:int; var _local12:BitmapData; var _local6:Array = new Array(); var _local7:int = _arg5; _local8 = 0; while (_local8 < 11) { _local10 = (_local7 % 10); _local6.push(_local10); _local7 = (_local7 / 10); _local8++; }; var _local9:Boolean; _local8 = (_local6.length - 1); while (_local8--) { _local11 = _local6[_local8]; if ((((_local9 == false)) && (!((_local11 == 0))))){ _local9 = true; }; if (_local9){ RenderAt(_arg2, (_local11 + 48), _arg1, _arg3, _arg4); _local12 = GetBitmapData(_arg2, (_local11 + 48)); _arg3 = (_arg3 + _local12.width); }; (_local8 >= 0); }; return (_arg3); } public static function RenderAt(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number){ var _local6:DisplayObjFrame = graphicobjs[_arg1].frames[_arg2]; _local6.RenderAt(_arg3, _arg4, _arg5); } public static function Recreate(_arg1:String, _arg2:int, _arg3:Function=null):int{ var _local4:int = GetIndexByName(_arg1); if (_local4 == -1){ return (-1); }; var _local5:Class = (getDefinitionByName(_arg1) as Class); var _local6:MovieClip = (new (_local5) as MovieClip); if (_arg3 != null){ _arg3(_local6); }; nameList[_local4] = _arg1; graphicobjs[_local4] = new DisplayObj(_arg1, _local6, 1, _arg2); return (_local4); } public static function RenderAtRotScaled(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number=1, _arg7:Number=0, _arg8:ColorTransform=null, _arg9:Boolean=false){ var _local10:DisplayObjFrame = graphicobjs[_arg1].frames[_arg2]; _local10.RenderAtRotScaled(_arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9); } public static function GetOffsetY(_arg1:int, _arg2:int):int{ var _local3:DisplayObjFrame = graphicobjs[_arg1].frames[_arg2]; return (_local3.yoffset); } public static function GetOffsetX(_arg1:int, _arg2:int):int{ var _local3:DisplayObjFrame = graphicobjs[_arg1].frames[_arg2]; return (_local3.xoffset); } public static function GetWidth(_arg1:int, _arg2:int):int{ var _local3:DisplayObjFrame = graphicobjs[_arg1].frames[_arg2]; return (_local3.bitmapData.width); } static function AddGraphics():void{ gfx_font1 = AddFont(main.tf_scorespr); gfx_fontblack = AddFont(main.tf_scoresprblack); gfx_font2 = AddFont(main.tf_scorespr1); gfx_font2black = AddFont(main.tf_scorespr2); Debug.StartImmediateTimer(); AddPlaceholder("Skiier01", 0); AddPlaceholder("Skiier02", 0); AddPlaceholder("Skiier03", 0); AddPlaceholder("Skiier04", 0); AddPlaceholder("Skiier05", 0); AddPlaceholder("Skiier06", 0); Add("Snowball01", 0); Add("Penguin", 0); Add("Igloo", 0); Add("Igloo_Hit", 0); Add("Snowman", 0); Add("Snowman_Hit", 0); Add("StuntTarget", 0); Add("Ramp", 0); Add("EasterStatue", 0); Add("EasterStatue_Hit", 0); Add("Checkpoint", 0); Add("Penguin_Physobj", 0); Add("Penguin_Plinth", 0); Add("BonusPickup", 0); Add("stuntIcon_backFlip", 0); Add("stuntIcon_frontFlip", 0); Add("stuntIcon_pose", 0); Add("IceShards", 0); Add("jumpPowerMeter", 0); Add("miniMap_icons", 0); gfx_fills = Add("Fills", 0); gfx_back01 = Add("sky1", 0); gfx_back02 = Add("sky2", 0); gfx_back03 = Add("sky3", 0); gfx_back04 = Add("sky4", 0); gfx_back05 = Add("sky5", 0); gfx_back06 = Add("sky6", 0); gfx_back07 = Add("background1", 0); gfx_back08 = Add("background2", 0); gfx_back09 = Add("background3", 0); gfx_back10 = Add("background4", 0); gfx_back11 = Add("background5", 0); gfx_back12 = Add("background6", 0); gfx_back13 = Add("frontground1", 0); gfx_back14 = Add("frontground2", 0); gfx_back15 = Add("frontground3", 0); gfx_back16 = Add("frontground4", 0); gfx_back17 = Add("frontground5", 0); gfx_back18 = Add("frontground6", 0); gfx_boostbar = Add("boostBar", 0); Add("LooseSki", 0); Add("arcticParrot", 0); Add("StartRaceText", 0); Add("SnowMC", 0); Add("Pickup01", 0); Add("Pickup02", 0); Add("Hoop", 0); Add("HoopFront", 0); Add("BrickWall", 0); Add("BrickWall_Hit", 0); Add("Cactus", 0); Add("Cactus_Hit", 0); Add("Cactus1", 0); Add("Crystals", 0); Add("Crystals_Hit", 0); Add("GlassPane", 0); Add("MelonBarrow", 0); Add("MelonBarrow_Hit", 0); Add("Obelisk", 0); Add("Obelisk_Hit", 0); Add("Stalagmite", 0); Add("Stalagmite1", 0); Add("Stalagmite_Hit", 0); Add("startline", 0); Debug.StopImmediateTimer("graphicobjects"); } public static function GetNumFrames(_arg1:int):int{ return (graphicobjs[_arg1].frames.length); } public static function GetPixelAt(_arg1:int, _arg2:int, _arg3:int, _arg4:int):uint{ var _local5:BitmapData = graphicobjs[_arg1].frames[_arg2].bitmapData; var _local6:uint = _local5.getPixel32(_arg3, _arg4); return (_local6); } public static function RenderAtRotScaled_SourceRect(_arg1:int, _arg2:int, _arg3:BitmapData, _arg4:Number, _arg5:Number, _arg6:Number=1, _arg7:Number=0, _arg8:ColorTransform=null, _arg9:Boolean=false, _arg10:Rectangle=null, _arg11:int=0, _arg12:int=0){ var _local13:DisplayObjFrame = graphicobjs[_arg1].frames[_arg2]; _local13.RenderAtRotScaled_SourceRect(_arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12); } public static function Add1(_arg1:int, _arg2:DisplayObj, _arg3:String=""):void{ nameList.push(_arg3); graphicobjs.push(_arg2); } public static function InitOnce(_arg1:Main):void{ main = _arg1; graphicobjs = new Array(); nameList = new Array(); nextID = 0; AddGraphics(); } public static function RenderStringAt(_arg1:BitmapData, _arg2:int, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Object=null, _arg7:int=0){ var _local8:int; var _local9:int; stringCharX = _arg3; stringCharY = _arg4; _local8 = 0; while (_local8 < _arg5.length) { _local9 = int(_arg5.charCodeAt(_local8)); if (_local9 < 0){ _local9 = 0; }; if (_local9 > 127){ _local9 = 127; }; RenderAt((_arg2 + 1), _local9, _arg1, (stringCharX + 1), (stringCharY + 1)); RenderAt(_arg2, _local9, _arg1, stringCharX, stringCharY); stringCharBitmapData = GetBitmapData(_arg2, _local9); if (_arg6 != null){ _arg6(); } else { stringCharX = (stringCharX + (stringCharBitmapData.width - 3)); stringCharX = (stringCharX + _arg7); }; _local8++; }; } public static function GetIndexByName(_arg1:String):int{ var _local3:String; var _local2:int; for each (_local3 in nameList) { if (_local3 == _arg1){ return (_local2); }; _local2++; }; trace(("cant find graphic obj by name: " + _arg1)); return (0); } public static function GetBitmapData(_arg1:int, _arg2:int):BitmapData{ var _local3:DisplayObjFrame = graphicobjs[_arg1].frames[_arg2]; return (_local3.bitmapData); } public static function AddPlaceholder(_arg1:String, _arg2:int):int{ var _local3:* = nextID; nextID++; nameList[_local3] = _arg1; graphicobjs[_local3] = null; mc = null; return (_local3); } public static function AddFont(_arg1:TextFormat):int{ var _local2:* = nextID; nextID++; var _local3:DisplayObj = new DisplayObj(_arg1.font, null, 0, 0); _local3.CreateFont(_arg1); nameList.push(_arg1.font); graphicobjs.push(_local3); return (_local2); } } }//package
Section 155
//Hoop (Hoop) package { import flash.display.*; public dynamic class Hoop extends MovieClip { } }//package
Section 156
//HoopFront (HoopFront) package { import flash.display.*; public dynamic class HoopFront extends MovieClip { } }//package
Section 157
//IceShards (IceShards) package { import flash.display.*; public dynamic class IceShards extends MovieClip { } }//package
Section 158
//Igloo (Igloo) package { import flash.display.*; public dynamic class Igloo extends MovieClip { } }//package
Section 159
//Igloo_Hit (Igloo_Hit) package { import flash.display.*; public dynamic class Igloo_Hit extends MovieClip { } }//package
Section 160
//Intro_ArmorGames (Intro_ArmorGames) package { import flash.display.*; public dynamic class Intro_ArmorGames extends MovieClip { public function Intro_ArmorGames(){ addFrameScript(216, frame217); } function frame217(){ stop(); } } }//package
Section 161
//Intro_FWG (Intro_FWG) package { import flash.events.*; import flash.text.*; import flash.display.*; import flash.geom.*; import flash.media.*; import flash.utils.*; import flash.filters.*; import flash.net.*; import flash.ui.*; import flash.accessibility.*; import flash.errors.*; import flash.system.*; public dynamic class Intro_FWG extends MovieClip { public function Intro_FWG(){ addFrameScript(321, frame322); } function frame322(){ stop(); } } }//package
Section 162
//Intro_Kongregate (Intro_Kongregate) package { import flash.display.*; public dynamic class Intro_Kongregate extends MovieClip { } }//package
Section 163
//Intro_MouseBreaker (Intro_MouseBreaker) package { import flash.display.*; public dynamic class Intro_MouseBreaker extends MovieClip { public var exp:MovieClip; } }//package
Section 164
//jumpPowerMeter (jumpPowerMeter) package { import flash.display.*; public dynamic class jumpPowerMeter extends MovieClip { } }//package
Section 165
//KeyReader (KeyReader) package { import flash.events.*; import flash.display.*; public class KeyReader { static const KEY_LEFT = 37; static const KEY_HASH = 222; static const KEY_LEFTSQUAREBRACKET = 219; static const KEY_0 = 58; static const KEY_1 = 49; static const KEY_2 = 50; static const KEY_3 = 51; static const KEY_4 = 52; static const KEY_5 = 53; static const KEY_7 = 55; static const KEY_8 = 56; static const KEY_9 = 57; static const KEY_6 = 54; static const KEY_A = 65; static const KEY_B = 66; static const KEY_C = 67; static const KEY_E = 69; static const KEY_F = 70; static const KEY_G = 71; static const KEY_H = 72; static const KEY_I = 73; static const KEY_J = 74; static const KEY_D = 68; static const KEY_L = 76; static const KEY_M = 77; static const KEY_N = 78; static const KEY_O = 79; static const KEY_P = 80; static const KEY_Q = 81; static const KEY_R = 82; static const KEY_S = 83; static const KEY_T = 84; static const KEY_U = 85; static const KEY_V = 86; static const KEY_W = 87; static const KEY_X = 88; static const KEY_Y = 89; static const KEY_K = 75; static const KEY_RIGHTSQUAREBRACKET = 221; static const KEY_Z = 90; static const KEY_SHIFT = 16; static const KEY_CONTROL = 17; static const KEY_SEMICOLON = 186; static const KEY_NUM_0 = 96; static const KEY_NUM_2 = 98; static const KEY_UP = 38; static const KEY_NUM_6 = 102; static const KEY_NUM_1 = 97; static const KEY_NUM_3 = 99; static const KEY_DOWN = 40; static const KEY_NUM_5 = 101; static const KEY_NUM_7 = 103; static const KEY_NUM_9 = 105; static const KEY_NUM_4 = 100; static const KEY_NUM_8 = 104; static const KEY_TOPLEFT = 223; static const KEY_BACKSLASH = 220; static const KEY_FORWARDSLASH = 191; static const KEY_SPACE = 32; static const KEY_RIGHT = 39; static var keysPressed:Array; static var keysDown:Array; public static function Pressed(_arg1:int):Boolean{ return (keysPressed[_arg1]); } static function keyUpListener(_arg1:KeyboardEvent):void{ var _local2:int = _arg1.keyCode; keysDown[_local2] = 0; } static function keyDownListener(_arg1:KeyboardEvent):void{ var _local2:int = _arg1.keyCode; var _local3 = keysDown; var _local4 = _local2; var _local5 = (_local3[_local4] + 1); _local3[_local4] = _local5; } public static function UpdateOncePerFrame():void{ var _local1:int; _local1 = 0; while (_local1 < 0x0100) { if (keysDown[_local1] == 1){ keysPressed[_local1] = true; var _local2 = keysDown; var _local3 = _local1; var _local4 = (_local2[_local3] + 1); _local2[_local3] = _local4; } else { keysPressed[_local1] = false; }; _local1++; }; } public static function Down(_arg1:int):Boolean{ return (!((keysDown[_arg1] == 0))); } public static function InitOnce(_arg1:Stage){ var _local2:int; _arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener); _arg1.addEventListener(KeyboardEvent.KEY_UP, keyUpListener); _arg1.focus = _arg1; keysDown = new Array(0x0100); keysPressed = new Array(0x0100); _local2 = 0; while (_local2 < 0x0100) { keysDown[_local2] = int(0); keysPressed[_local2] = Boolean(false); _local2++; }; } } }//package
Section 166
//Kong (Kong) package { import flash.events.*; import flash.display.*; import flash.net.*; public class Kong { static var root:Object; static var kongregate; static var isLoaded:Boolean = false; public static function InitOnce(_arg1:Object){ if (Lic.IsAtKongregate() == false){ return; }; root = _arg1; var _local2:Object = root.loaderInfo.loader; var _local3:Object = LoaderInfo(root.loaderInfo).parameters; var _local4:String = ((_local3.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf")); trace(("API path: " + _local4)); isLoaded = false; var _local5:URLRequest = new URLRequest(_local4); var _local6:Loader = new Loader(); _local6.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete); _local6.load(_local5); root.addChild(_local6); } static function loadComplete(_arg1:Event):void{ kongregate = _arg1.target.content; kongregate.services.connect(); trace(("\n" + kongregate.services)); trace(("\n" + kongregate.user)); trace(("\n" + kongregate.scores)); trace(("\n" + kongregate.stats)); isLoaded = true; } public static function SubmitScore(_arg1:Number, _arg2:String){ if (isLoaded == false){ return; }; trace(((("Kong Score: " + _arg2) + " ") + _arg1)); if (Lic.IsAtKongregate() == false){ return; }; kongregate.scores.submit(_arg1, _arg2); } public static function SubmitStat(_arg1:Number, _arg2:String){ if (isLoaded == false){ return; }; trace(((("Kong Stat: " + _arg2) + " ") + _arg1)); if (Lic.IsAtKongregate() == false){ return; }; kongregate.stats.submit(_arg2, _arg1); } } }//package
Section 167
//Level (Level) package { public class Level { var surfaceFrame:uint; var mapMinX:int; var linetypes:Array; var surfaceThickness:int; var available:Boolean; var name:String; var category:int; var played:Boolean; var eventOpponentsString:String; var exclusiveChar:int; var map:Array; var mapMaxY:int; var eventWinParam:Number; var mapMinY:int; var fillFrame:int; var mapMaxX:int; var mapCellH:int; var helpscreenFrames:Array; var eventType:String; var fullyLoaded:Boolean; var mapCellW:int; var instances:Array; var lines:Array; public function Level(){ var _local1:int; super(); name = ""; instances = new Array(); helpscreenFrames = new Array(); lines = new Array(); linetypes = new Array(); category = 0; fillFrame = 1; surfaceFrame = 5; surfaceThickness = 10; available = false; played = false; eventType = "none"; eventOpponentsString = ""; eventWinParam = 1; exclusiveChar = 1; map = new Array(); mapCellW = 16; mapCellH = 16; mapMinX = 0; mapMaxX = 0; mapMinY = 0; mapMaxY = 0; fullyLoaded = false; } public function Calculate(){ } } }//package
Section 168
//LevelEndScreen (LevelEndScreen) package { import flash.text.*; import flash.display.*; public dynamic class LevelEndScreen extends MovieClip { public var buttonHighscoresAtKongregate:SimpleButton; public var textScore:TextField; public var buttonMore:SimpleButton; public var buttonSubmitScore:SimpleButton; public var buttonSubmitData:SimpleButton; public var buttonRetry:SimpleButton; public var otherGames:MovieClip; public var sponsorBar:MovieClip; public var textTime:TextField; public var buttonNext:SimpleButton; public function LevelEndScreen(){ addFrameScript(56, frame57); } function frame57(){ stop(); } } }//package
Section 169
//levelSelect (levelSelect) package { import flash.text.*; import flash.display.*; public dynamic class levelSelect extends MovieClip { public var race1:MovieClip; public var race2:MovieClip; public var race3:MovieClip; public var race4:MovieClip; public var race6:MovieClip; public var race5:MovieClip; public var race7:MovieClip; public var race8:MovieClip; public var race9:MovieClip; public var textTrackName:TextField; public var buttonBack:SimpleButton; public var race10:MovieClip; public var race11:MovieClip; public var race12:MovieClip; public var buttonAchievements:SimpleButton; } }//package
Section 170
//LevelStartScreen (LevelStartScreen) package { import flash.text.*; import flash.display.*; public dynamic class LevelStartScreen extends MovieClip { public var buttonBack:SimpleButton; public var achievement1:MovieClip; public var achievement2:MovieClip; public var buttonNext:SimpleButton; public var achievement3:MovieClip; public var achievement4:MovieClip; public var sponsorBar:MovieClip; public var textTitle:TextField; } }//package
Section 171
//Lic (Lic) package { import flash.events.*; import flash.display.*; import org.flashdevelop.utils.*; import CPMStar.*; import flash.net.*; import flash.utils.*; import flash.system.*; public class Lic { public static const LICENSOR_ANDKON = 5; public static const LICENSOR_CANDYSTAND = 27; public static const ADTYPE_NONE = 0; public static const LICENSOR_DEVELOPMENT = 0; public static const LICENSOR_BIGFISH = 6; public static const ADTYPE_MOCHI_VC = 2; public static const LICENSOR_MINDJOLT = 4; public static const LICENSOR_ARMORGAMES = 8; public static const LICENSOR_MINIJUEGOS = 15; public static const ADTYPE_MOCHI = 1; public static const LICENSOR_BUBBLEBOX = 7; public static const LICENSOR_FGL = 24; public static const LICENSOR_GAMENINJA = 17; public static const LICENSOR_LONGANIMALS = 21; public static const LICENSOR_ROBOTJAM = 23; public static const LICENSOR_ADDICTINGGAMES = 19; public static const LICENSOR_KING = 10; public static const LICENSOR_FREEWORLDGROUP = 28; public static const LICENSOR_MOUSEBREAKER = 16; public static const ADTYPE_CPMSTAR = 3; public static const LICENSOR_NOBRANDING = 12; public static const LICENSOR_SIKIDS = 14; public static const LICENSOR_KONGREGATE = 1; public static const LICENSOR_MAXGAMES = 20; public static const LICENSOR_LONGANIMALS_SITELOCKED = 22; public static const LICENSOR_SHOCKWAVE = 11; public static const LICENSOR_KONGREGATE_ONSITE = 2; public static const LICENSOR_KIBA = 13; public static const ADTYPE_NEWGROUNDS = 4; public static const LICENSOR_MINICLIP = 3; public static const LICENSOR_NEWGROUNDS = 26; public static const LICENSOR_GAMEZHERO = 9; public static const LICENSOR_FOG = 25; public static const LICENSOR_SPIL = 18; static var devKey:String = "57e6ffa35f343197fbd276da0a94ccbb"; static var cpmStarLoadTimer:int; static var MochiBotID_Viral:String = "30a74df5"; static var ad:DisplayObject = null; static var stg:MovieClip; static var kongregateEmbedFlag:Boolean = false; static var CPMStarContentSpotIDs:Array = new Array(); static var cpmStarTimer:Timer; static var urlLoader:Loader; static var intro:MovieClip; static var cx:int; static var cy:int; static var MindJoltAPI:Object; static var CPMStarFixedTime:int = 8; static var candystand; static var localTest:Boolean = false; static var csLoader:Loader; static var domain:String; static var MochiBotID_Total:String = "afc8fba3"; static var showIntroCallback:Function; static var showAdFinishedCallback:Function; static var authorLinks:Array = new Array(); static var agi; static var skus:Array; static var gameKey:String = "zomgies"; static var cpmStarLoaderCounter:int; static var highscore_callback:Function; static var licensor:int = 1; static var oldFrameRate:int = 0; static var referral:String = "skimaniacs"; static var primary_sponsor = 1; public static function GetSku(_arg1:int):LicSku{ var _local2:LicSku; for each (_local2 in skus) { if (_local2.id == _arg1){ return (_local2); }; }; trace(("GetSku invalid SKU: " + _arg1)); return (null); } static function InitHighScores_ArmorGames_LoadComplete(_arg1:Event):void{ agi = _arg1.currentTarget.content; stg.addChild(agi); agi.init(devKey, gameKey); } public static function InitFromFlex(_arg1:MovieClip):void{ InitSkus(); oldFrameRate = 0; stg = _arg1; domain = GetDomain(); kongregateEmbedFlag = stg.stage.loaderInfo.parameters.kongregate; SkuModify(); trace(("Domain: " + domain)); intro = null; cx = (Defs.displayarea_w / 2); cy = (Defs.displayarea_h / 2); InitHighscores(); if (GetSku(licensor).initFunction != null){ GetSku(licensor).initFunction(); }; } static function SkuModify():void{ if (localTest == true){ return; }; if ((((licensor == LICENSOR_KONGREGATE)) && (IsAtKongregate()))){ licensor = LICENSOR_KONGREGATE_ONSITE; }; if ((((licensor == LICENSOR_FREEWORLDGROUP)) && ((IsOnCorrectSite() == false)))){ licensor = primary_sponsor; }; if ((((licensor == LICENSOR_CANDYSTAND)) && ((IsOnCorrectSite() == false)))){ licensor = primary_sponsor; }; if ((((licensor == LICENSOR_SIKIDS)) && ((IsOnCorrectSite() == false)))){ licensor = primary_sponsor; }; if ((((licensor == LICENSOR_MOUSEBREAKER)) && ((IsOnCorrectSite() == false)))){ licensor = primary_sponsor; }; if ((((licensor == LICENSOR_ADDICTINGGAMES)) && ((IsOnCorrectSite() == false)))){ licensor = primary_sponsor; }; if ((((licensor == LICENSOR_ROBOTJAM)) && ((IsOnCorrectSite() == false)))){ licensor = primary_sponsor; }; if ((((licensor == LICENSOR_LONGANIMALS)) && ((IsOnCorrectSite() == false)))){ licensor = primary_sponsor; }; } public static function ShowIntro_MiniJuegos():void{ AddIntro("Intro_MiniJuegos"); } public static function ShowAd(_arg1:Function){ showAdFinishedCallback = _arg1; var _local2:int = GetSku(licensor).adtype; if (_local2 == ADTYPE_NONE){ ShowNoAd(); } else { if (_local2 == ADTYPE_MOCHI_VC){ ShowNoAd(); } else { if (_local2 == ADTYPE_MOCHI){ ShowMochiAd(); return (true); }; if (_local2 == ADTYPE_CPMSTAR){ if (FilterAdForSites() == false){ ShowCPMStarAd(); } else { ShowNoAd(); }; } else { if (_local2 == ADTYPE_NEWGROUNDS){ showAdFinishedCallback(); } else { FlashConnect.trace("Lic.ShowAd undefined ad", TraceLevel.ERROR); }; }; }; }; } static function ShowSitelockedScreen(){ intro = new SitelockedScreen(); intro.x = cx; intro.y = cy; stg.addChild(intro); intro.addEventListener(MouseEvent.CLICK, SitelockScreen_Clicked); } static function AuthorLinkPressed(_arg1:MouseEvent):void{ if (authorLinks.length == 0){ return; }; var _local2:int = Utils.RandBetweenInt(0, (authorLinks.length - 1)); _local2 = Utils.LimitNumber(0, (authorLinks.length - 1), _local2); var _local3 = authorLinks; _local3[_local2](_arg1); } public static function Link_ArmorGames(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest("http://www.armorgames.com"), "_blank"); } static function SubmitHighscore_ArmorGames_CloseHandler():void{ stg.removeChild(agi); if (highscore_callback != null){ highscore_callback(); }; } static function CPMStarLoadingEventCallback(_arg1:Event){ var _local2:* = stg.stage.loaderInfo.bytesTotal; var _local3:* = stg.stage.loaderInfo.bytesLoaded; var _local4:Number = ((1 / _local2) * _local3); RenderLoaderBar(_local4); if (_local3 >= _local2){ stg.removeEventListener(Event.ENTER_FRAME, CPMStarLoadingEventCallback); cpmStarLoaderCounter++; CPMStarCompleteCallback(); }; } public static function SubmitScore_LongAnimals(_arg1:int, _arg2:String){ var s = _arg1; var name = _arg2; var key:int = s; key = (key + 84563); key = (key * 7); key = (key - 276483); trace(((("submit score " + s) + " key=") + key)); var path = "http://www.longanimalsgames.com/ViewHighScore.php"; var vars:URLVariables = new URLVariables(); vars.game = referral; vars.submit = 1; vars.score = s; vars.key = key; vars.name = name; var request:URLRequest = new URLRequest(path); request.method = URLRequestMethod.POST; request.data = vars; trace("Stats sent to server"); trace(request); try { sendToURL(request); } catch(e:Error) { trace(e.message); }; } public static function Link_Andkon(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest("http://www.andkon.com/arcade/"), "_blank"); } public static function Link_AddictingGames(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest("http://www.addictinggames.com"), "_blank"); } public static function Twitter_ArmorGames(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest(" http://twitter.com/armorgames"), "_blank"); } public static function InitSkus():void{ var _local1:LicSku; skus = new Array(); _local1 = new LicSku(LICENSOR_DEVELOPMENT, "Development"); skus.push(_local1); _local1 = new LicSku(LICENSOR_KONGREGATE, "Kongregate"); _local1.introFunction = ShowIntro_Kongregate; _local1.mainLogoName = "kongregate"; _local1.linkFunction = Link_Kongregate; _local1.adtype = ADTYPE_CPMSTAR; skus.push(_local1); _local1 = new LicSku(LICENSOR_KONGREGATE_ONSITE, "Kongregate OnSite"); _local1.introFunction = ShowIntro_Kongregate; _local1.mainLogoName = "kongregate"; skus.push(_local1); _local1 = new LicSku(LICENSOR_MINICLIP, "Miniclip"); _local1.AddSiteLock("miniclip.com"); skus.push(_local1); _local1 = new LicSku(LICENSOR_MINDJOLT, "Mindjolt"); skus.push(_local1); _local1 = new LicSku(LICENSOR_ANDKON, "Andkon"); _local1.AddSiteLock("andkon.com"); _local1.introFunction = ShowIntro_Andkon; _local1.mainLogoName = "andkon"; _local1.linkFunction = Link_Andkon; skus.push(_local1); _local1 = new LicSku(LICENSOR_BIGFISH, "BigFish"); _local1.AddSiteLock("bigfishgames.de"); _local1.AddSiteLock("bigfishgames.fr"); _local1.AddSiteLock("bigfishgames.es"); _local1.AddSiteLock("bigfishgames.mx"); _local1.AddSiteLock("bigfishgames.jp"); skus.push(_local1); _local1 = new LicSku(LICENSOR_BUBBLEBOX, "BubbleBox"); _local1.AddSiteLock("bubblebox.com"); _local1.introFunction = ShowIntro_BubbleBox; _local1.mainLogoName = "bubbleBox"; _local1.linkFunction = Link_BubbleBox; skus.push(_local1); _local1 = new LicSku(LICENSOR_ARMORGAMES, "Armor Games"); _local1.introFunction = ShowIntro_ArmorGames; _local1.adtype = ADTYPE_CPMSTAR; _local1.mainLogoName = "armorGames"; _local1.linkFunction = Link_ArmorGames; _local1.twitterFunction = Twitter_ArmorGames; _local1.allowAuthorLink = true; skus.push(_local1); _local1 = new LicSku(LICENSOR_GAMEZHERO, "GamezHero"); _local1.AddSiteLock("gamezhero.com"); skus.push(_local1); _local1 = new LicSku(LICENSOR_KING, "King"); _local1.AddSiteLock("king.com"); _local1.AddSiteLock("midasplayer.com"); skus.push(_local1); _local1 = new LicSku(LICENSOR_SHOCKWAVE, "Shockwave"); _local1.AddSiteLock("shockwave.com"); skus.push(_local1); _local1 = new LicSku(LICENSOR_NOBRANDING, "No branding"); skus.push(_local1); _local1 = new LicSku(LICENSOR_KIBA, "Kiba"); skus.push(_local1); _local1 = new LicSku(LICENSOR_SIKIDS, "SI Kids"); _local1.AddSiteLock("timeforkids.com"); _local1.AddSiteLock("sikids.com"); _local1.mainLogoName = "siKids"; _local1.linkFunction = Link_SIKids; skus.push(_local1); _local1 = new LicSku(LICENSOR_MINIJUEGOS, "MiniJuegos"); _local1.AddSiteLock("minijuegos.com"); _local1.AddSiteLock("minijuegosgratis.com"); _local1.AddSiteLock("72.36.157.12", true); _local1.AddSiteLock("72.36.157.13", true); _local1.AddSiteLock("72.36.157.16", true); _local1.AddSiteLock("72.36.157.14", true); _local1.AddSiteLock("72.36.157.26", true); _local1.AddSiteLock("72.36.157.50", true); _local1.AddSiteLock("72.36.157.11", true); _local1.AddSiteLock("72.36.157.10", true); _local1.AddSiteLock("72.36.157.9", true); _local1.AddSiteLock("72.36.157.8", true); _local1.introFunction = ShowIntro_MiniJuegos; _local1.mainLogoName = "miniJuegos"; _local1.linkFunction = Link_MiniJuegos; skus.push(_local1); _local1 = new LicSku(LICENSOR_MOUSEBREAKER, "MouseBreaker"); _local1.AddSiteLock("mousebreaker.com"); _local1.mainLogoName = "mousebreaker"; _local1.showMoreGamesButton = false; _local1.introFunction = ShowIntro_MouseBreaker; skus.push(_local1); _local1 = new LicSku(LICENSOR_GAMENINJA, "GameNinja"); _local1.AddSiteLock("gameninja.com"); skus.push(_local1); _local1 = new LicSku(LICENSOR_SPIL, "Spil"); skus.push(_local1); _local1 = new LicSku(LICENSOR_ADDICTINGGAMES, "Addicting Games"); _local1.introFunction = ShowIntro_AddictingGames; _local1.mainLogoName = "addictingGames"; _local1.linkFunction = Link_AddictingGames; _local1.AddSiteLock("addictinggames.com"); skus.push(_local1); _local1 = new LicSku(LICENSOR_MAXGAMES, "MaxGames"); _local1.AddSiteLock("maxgames.com"); _local1.introFunction = ShowIntro_MaxGames; _local1.mainLogoName = "maxGames"; _local1.linkFunction = Link_MaxGames; skus.push(_local1); _local1 = new LicSku(LICENSOR_LONGANIMALS, "LongAnimals"); _local1.introFunction = ShowIntro_LongAnimals; _local1.adtype = ADTYPE_CPMSTAR; _local1.mainLogoName = "longAnimals"; _local1.linkFunction = Link_LongAnimals; skus.push(_local1); _local1 = new LicSku(LICENSOR_LONGANIMALS_SITELOCKED, "LongAnimalsSitelocked"); _local1.AddSiteLock("longanimalsgames.com"); _local1.AddSiteLock("longanimals.com"); _local1.introFunction = ShowIntro_LongAnimals; _local1.mainLogoName = "longAnimals"; _local1.linkFunction = Link_LongAnimals; skus.push(_local1); _local1 = new LicSku(LICENSOR_ROBOTJAM, "RobotJam"); _local1.AddSiteLock("robotjam.com"); _local1.AddSiteLock("robotjamgames.com"); _local1.introFunction = ShowIntro_RobotJam; _local1.scaleIntroToStage = true; _local1.mainLogoName = "robotJam"; _local1.linkFunction = Link_RobotJam; _local1.adtype = ADTYPE_CPMSTAR; skus.push(_local1); _local1 = new LicSku(LICENSOR_FGL, "FlashGameLicense"); _local1.AddSiteLock("flashgamelicense.com"); skus.push(_local1); _local1 = new LicSku(LICENSOR_FOG, "Free Online Games (FOG)"); _local1.introFunction = ShowIntro_FOG; skus.push(_local1); _local1 = new LicSku(LICENSOR_CANDYSTAND, "CandyStand"); _local1.AddSiteLock("candystand.com"); _local1.initFunction = Init_Candystand; _local1.introFunction = ShowIntro_Candystand; _local1.mainLogoName = "candystand"; _local1.linkFunction = Link_Candystand; skus.push(_local1); _local1 = new LicSku(LICENSOR_FREEWORLDGROUP, "FreeWorldGroup"); _local1.AddSiteLock("freeworldgroup.com"); _local1.AddSiteLock("freeworldgroup.com.au"); _local1.introFunction = ShowIntro_FreeWorldGroup; _local1.mainLogoName = "freeworldgroup"; _local1.linkFunction = Link_FreeWorldGroup; skus.push(_local1); } static function IsOnCorrectSite():Boolean{ var _local2:String; if (localTest == true){ return (true); }; var _local1:LicSku = GetSku(licensor); if (_local1.sitelocks.length == 0){ return (true); }; for each (_local2 in _local1.sitelocks) { if (_local2 == domain){ return (true); }; }; return (false); } public static function ShowIntro_RobotJam():void{ AddIntro("Intro_RobotJam"); } public static function Link_MaxGames(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest("http://www.maxgames.com"), "_blank"); } public static function ShowIntro_AddictingGames():void{ AddIntro("Intro_AddictingGames"); } static function AddIntro(_arg1:String){ var _local2:LicSku = GetSku(licensor); var _local3:Class = (getDefinitionByName(_arg1) as Class); var _local4:MovieClip = (new (_local3) as MovieClip); intro = _local4; stg.addChild(intro); intro.x = cx; intro.y = cy; intro.addEventListener(Event.ENTER_FRAME, AddIntro_EnterFrame, false, 0, true); if (_local2.linkFunction != null){ intro.addEventListener(MouseEvent.CLICK, _local2.linkFunction, false, 0, true); }; if (_local2.scaleIntroToStage){ if (Defs.displayarea_w < 640){ intro.scaleX = (intro.scaleY = (640 / intro.width)); }; }; intro.gotoAndPlay(1); } public static function Link_MiniJuegos(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest("http://www.minijuegos.com"), "_blank"); } static function buttonSkipCPMStarAdPressed(_arg1:MouseEvent){ FlashConnect.trace("buttonSkipCPMStarAdPressed"); intro.buttonSkipCPMStarAd.removeEventListener(MouseEvent.CLICK, buttonSkipCPMStarAdPressed); if (ad != null){ intro.adBox.removeChild(ad); }; stg.removeChild(intro); intro = null; if (showAdFinishedCallback != null){ FlashConnect.trace("calling showAdFinishedCallback"); showAdFinishedCallback(); }; } public static function ShowNoAd(){ intro = new preloaderMC(); intro.x = 0; intro.y = 0; stg.addChild(intro); intro.adBox.visible = false; intro.buttonSkipCPMStarAd.visible = false; intro.buttonSkipCPMStarAd.addEventListener(MouseEvent.CLICK, buttonSkipCPMStarAdPressed); cpmStarLoadTimer = 0; cpmStarLoaderCounter = 1; stg.addEventListener(Event.ENTER_FRAME, CPMStarLoadingEventCallback); } public static function SubmitScore_MindJolt(_arg1:int):void{ MindJoltAPI.service.submitScore(_arg1); } public static function Link_FreeWorldGroup(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest("http://www.freeworldgroup.com"), "_blank"); } public static function SubmitScore_SIKids(_arg1:int, _arg2:int, _arg3=null):void{ var _local4:String = stg.stage.loaderInfo.parameters.sid; var _local5:String = stg.stage.loaderInfo.parameters.nid; var _local6 = "http://www.sikids.com/sikscores"; _local6 = (_local6 + "?"); var _local7 = ""; _local7 = ("sid=" + _local4); _local6 = (_local6 + _local7); _local6 = (_local6 + "&"); _local7 = ("nid=" + _local5); _local6 = (_local6 + _local7); _local6 = (_local6 + "&"); _local7 = "kid=1"; _local6 = (_local6 + _local7); _local6 = (_local6 + "&"); var _local8:String = _arg1.toString(); _local7 = "k="; _local7 = (_local7 + _local8.charAt(0)); var _local9:String = _local8.charAt(0); var _local10:String = _local8.charAt((_local8.length - 1)); var _local11:int = (int(_local9) + int(_local10)); _local7 = (_local7 + _local11.toString()); _local6 = (_local6 + _local7); _local6 = (_local6 + "&"); _local7 = ("s=" + _arg1.toString()); _local6 = (_local6 + _local7); FlashConnect.trace(("SIKIDS URL: " + _local6)); var _local12:URLRequest = new URLRequest(_local6); navigateToURL(_local12, "_blank"); _arg3(); } public static function ShowIntro_BubbleBox():void{ AddIntro("Intro_BubbleBox"); } public static function ShowIntro_FreeWorldGroup():void{ AddIntro("Intro_FWG"); } static function MoreGamesButton(_arg1:SimpleButton):void{ if (_arg1 == null){ return; }; if (HasMoreGamesButton() == false){ _arg1.visible = false; return; }; var _local2:LicSku = GetSku(licensor); if (_local2.linkFunction == null){ _arg1.visible = false; return; }; _arg1.addEventListener(MouseEvent.CLICK, _local2.linkFunction, false, 0, true); } public static function ShowIntro_MouseBreaker():void{ AddIntro("Intro_MouseBreaker"); } static function CPMStarCompleteCallback(){ if (cpmStarLoaderCounter >= 2){ intro.loaderBar.visible = false; intro.buttonSkipCPMStarAd.visible = true; }; } static function SubmitHighscore_ArmorGames(_arg1:int, _arg2:Function=null){ highscore_callback = _arg2; stg.addChild(agi); agi.initAGUI({onClose:SubmitHighscore_ArmorGames_CloseHandler}); agi.showScoreboardSubmit(_arg1); } static function AuthorButton(_arg1:SimpleButton):void{ if (_arg1 == null){ return; }; var _local2:LicSku = GetSku(licensor); if (_local2.allowAuthorLink == false){ _arg1.visible = false; return; }; _arg1.addEventListener(MouseEvent.CLICK, AuthorLinkPressed, false, 0, true); } public static function ShowIntro_LongAnimals():void{ AddIntro("Intro_LongAnimals"); } public static function ShowIntro_MaxGames():void{ AddIntro("Intro_MaxGames"); } public static function SubmitScore_Candystand(_arg1:int, _arg2:int, _arg3=null):void{ candystand.game.score = _arg1; FlashConnect.trace(("Current Score: " + candystand.game.score)); FlashConnect.trace(("High Score: " + candystand.game.highScore)); candystand.game.submitScore(); } public static function TimeLineComplete():void{ trace("Timeline complete"); if (intro != null){ stg.removeChild(intro); intro = null; trace("Timeline complete 1"); }; } public static function GetLicensor():int{ return (licensor); } public static function IsAtKongregate():Boolean{ if ((((domain == "kongregate.com")) && (kongregateEmbedFlag))){ return (true); }; return (false); } static function HasMoreGamesButton():Boolean{ if (_slot1.GetLicensor() == _slot1.LICENSOR_KONGREGATE_ONSITE){ return (false); }; var _local1:LicSku = GetSku(licensor); return (_local1.showMoreGamesButton); } static function Mochibot():void{ if (licensor == LICENSOR_KONGREGATE){ MochiBot.track(stg, MochiBotID_Viral); }; MochiBot.track(stg, MochiBotID_Total); } static function SitelockScreen_Clicked(_arg1:MouseEvent){ Link_Kongregate(null); } public static function ShowIntro_Kongregate():void{ AddIntro("Intro_Kongregate"); } static function InitHighScores_ArmorGames():void{ var _local1 = "http://agi.armorgames.com/assets/agi/AGI.swf"; Security.allowDomain(_local1); Security.allowInsecureDomain(_local1); var _local2:URLRequest = new URLRequest(_local1); var _local3:Loader = new Loader(); _local3.contentLoaderInfo.addEventListener(Event.COMPLETE, InitHighScores_ArmorGames_LoadComplete); _local3.load(_local2); } public static function MochiAdFinished(){ } public static function Link_LongAnimals(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest(("http://www.longanimalsgames.com?referral=" + referral)), "_blank"); } public static function IsAtMindjolt():Boolean{ if (domain == "mindjolt.com"){ return (true); }; return (false); } static function Init_Candystand(){ Security.allowDomain("www.candystand.com"); var _local1:String = ((stg.stage.loaderInfo.parameters.apiurl) || ("http://www.candystand.com/api/flash/cs_api_3.1.swf")); csLoader = new Loader(); csLoader = new Loader(); csLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCandystandAPILoadComplete); csLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onCandystandAPILoadError); csLoader.load(new URLRequest(_local1)); stg.addChild(csLoader); } public static function ShowCPMStarAd(){ var _local1:String; var _local3:int; intro = new preloaderMC(); intro.x = 0; intro.y = 0; stg.addChild(intro); intro.buttonSkipCPMStarAd.visible = false; intro.buttonSkipCPMStarAd.addEventListener(MouseEvent.CLICK, buttonSkipCPMStarAdPressed); var _local2:int = CPMStarContentSpotIDs.length; if (_local2 == 1){ _local1 = CPMStarContentSpotIDs[0]; }; if (_local2 == 2){ _local3 = Utils.RandBetweenInt(0, 1000); if (_local3 < 500){ _local1 = CPMStarContentSpotIDs[0]; } else { _local1 = CPMStarContentSpotIDs[1]; }; }; trace(("CPMStar ID " + _local1)); ad = new AdLoader(_local1); intro.adBox.addChild(ad); cpmStarLoadTimer = 0; cpmStarLoaderCounter = 0; stg.addEventListener(Event.ENTER_FRAME, CPMStarLoadingEventCallback); cpmStarTimer = new Timer(1000); cpmStarTimer.addEventListener(TimerEvent.TIMER, CPMStarTimerCallback); cpmStarTimer.start(); } public static function ShowIntro_Newgrounds():void{ trace(" ShowIntro_Newgrounds "); AddIntro("Intro_Newgrounds"); } public static function Link_Kongregate(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest(("http://www.kongregate.com?gamereferral=" + referral)), "_blank"); } public static function ViewScore_LongAnimals(){ navigateToURL(new URLRequest(("http://www.longanimalsgames.com/ViewHighScore.php?game=" + referral)), "_blank"); } public static function ShowIntro(_arg1:Function):void{ showIntroCallback = _arg1; if (IsOnCorrectSite() == false){ ShowSitelockedScreen(); return; }; if (GetSku(licensor).introFunction != null){ GetSku(licensor).introFunction(); } else { showIntroCallback(); }; } public static function ShowIntro_Andkon():void{ AddIntro("Intro_Andkon"); } static function TwitterButton(_arg1:SimpleButton):void{ if (_arg1 == null){ return; }; var _local2:LicSku = GetSku(licensor); if (_local2.twitterFunction == null){ _arg1.visible = false; return; }; _arg1.addEventListener(MouseEvent.CLICK, _local2.twitterFunction, false, 0, true); } static function MainLogoButton(_arg1:MovieClip):void{ var _local3:SimpleButton; if (_arg1 == null){ return; }; var _local2:LicSku = GetSku(licensor); var _local4:int = _arg1.numChildren; var _local5:int; while (_local5 < _local4) { _local3 = (_arg1.getChildAt(_local5) as SimpleButton); if (_local3 != null){ _local3.visible = false; } else { FlashConnect.trace("Lic: MainLogo Error. Null child found. (not a button?)"); }; _local5++; }; if (_local2.mainLogoName != ""){ _local3 = (_arg1.getChildByName(_local2.mainLogoName) as SimpleButton); if (_local3 != null){ _local3.visible = true; if (_local2.linkFunction != null){ _local3.addEventListener(MouseEvent.CLICK, _local2.linkFunction, false, 0, true); } else { _local3.useHandCursor = false; }; } else { FlashConnect.trace(("Lic: MainLogo Error. Can't find logo: " + _local2.mainLogoName)); }; }; } static function onCandystandAPILoadComplete(_arg1:Event):void{ candystand = _arg1.target.content; candystand.init("skm0211rry", "1.0.0"); FlashConnect.trace("Lic: Loaded CANDYSTAND API"); } static function ViewScore_ArmorGames(_arg1:Function=null){ highscore_callback = _arg1; stg.addChild(agi); agi.initAGUI({onClose:SubmitHighscore_ArmorGames_CloseHandler}); agi.showScoreboardList(); } public static function GetDomain():String{ var _local1:String = stg.loaderInfo.url; var _local2:Number = (_local1.indexOf("://") + 3); var _local3:Number = _local1.indexOf("/", _local2); var _local4:String = _local1.substring(_local2, _local3); var _local5:Number = (_local4.lastIndexOf(".") - 1); var _local6:Number = (_local4.lastIndexOf(".", _local5) + 1); _local4 = _local4.substring(_local6, _local4.length); return (_local4); } public static function Link_BubbleBox(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest("http://www.bubblebox.com"), "_blank"); } public static function InitHighscores(){ if (_slot1.IsAtMindjolt()){ LoadMindjoltAPI(); }; if (licensor == LICENSOR_ARMORGAMES){ InitHighScores_ArmorGames(); }; } public static function ShowMochiAd(){ MochiAd.showPreGameAd({clip:stg, id:"f26b6fbcebd54ddc", res:"640x480", ad_finished:MochiAdFinished}); } public static function ShowIntro_FOG():void{ AddIntro("Intro_FOG"); } static function ShowIntro_Candystand():void{ candystand.loadStinger(); candystand.stinger.addEventListener("STINGER_COMPLETE", onStingerComplete); } public static function Link_SIKids(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest("http://www.sikids.com"), "_blank"); } static function onCandystandAPILoadError(_arg1:Event):void{ FlashConnect.trace(("ERROR LOADING CANDYSTAND API: " + _arg1)); } private static function MJloadFinished(_arg1:Event){ MindJoltAPI = _arg1.currentTarget.content; MindJoltAPI.service.connect(); stg.stage.removeChild(urlLoader); FlashConnect.trace("Minjolt Initialised successfully"); } public static function FilterAdForSites():Boolean{ if (domain == "kongregate.com"){ return (true); }; if (domain == "agame.com"){ return (true); }; if (domain == "armorgames.com"){ return (true); }; return (false); } static function onStingerComplete(_arg1):void{ if (showIntroCallback != null){ showIntroCallback(); }; } public static function LoadMindjoltAPI(){ var _local1:Object = LoaderInfo(stg.loaderInfo).parameters; Security.allowDomain("static.mindjolt.com", "devstatic.mindjolt.com"); urlLoader = new Loader(); urlLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, MJloadFinished); var _local2:String = ((_local1.mjPath) || ("http://static.mindjolt.com/api/as3/scoreapi_as3_local.swf")); urlLoader.load(new URLRequest(_local2)); stg.stage.addChild(urlLoader); } static function CPMStarTimerCallback(_arg1:TimerEvent){ cpmStarLoadTimer++; if (cpmStarLoadTimer >= CPMStarFixedTime){ cpmStarLoaderCounter++; trace("timer complete"); cpmStarTimer.stop(); CPMStarCompleteCallback(); } else { cpmStarTimer.start(); }; } public static function ShowIntro_ArmorGames():void{ AddIntro("Intro_ArmorGames"); } static function AddIntro_EnterFrame(_arg1:Event){ var _local2:LicSku; if (intro.totalFrames == intro.currentFrame){ _local2 = GetSku(licensor); if (_local2.linkFunction != null){ intro.removeEventListener(MouseEvent.CLICK, _local2.linkFunction); }; intro.removeEventListener(Event.ENTER_FRAME, AddIntro_EnterFrame); stg.removeChild(intro); intro = null; if (showIntroCallback != null){ showIntroCallback(); }; }; } public static function Link_RobotJam(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest(("http://www.robotjamgames.com?referral=" + referral)), "_blank"); } public static function Link_Candystand(_arg1:MouseEvent, _arg2:String="intro"){ navigateToURL(new URLRequest("http://www.candystand.com"), "_blank"); } static function RenderLoaderBar(_arg1:Number){ intro.loaderBar.scaleX = _arg1; } authorLinks.push(Link_LongAnimals); authorLinks.push(Link_RobotJam); CPMStarContentSpotIDs.push(String("1610Q84692A35")); } }//package
Section 172
//LicSku (LicSku) package { public class LicSku { var sitelocks:Array; var name:String; var allowAuthorLink:Boolean; var initFunction:Function; var showMoreGamesButton:Boolean; var id:int; var scaleIntroToStage:Boolean; var introFunction:Function; var twitterFunction:Function; var adtype:int; var mainLogoName:String; var linkFunction:Function; public function LicSku(_arg1:int, _arg2:String){ id = _arg1; name = _arg2; introFunction = null; sitelocks = new Array(); adtype = 0; mainLogoName = ""; linkFunction = null; twitterFunction = null; scaleIntroToStage = false; allowAuthorLink = true; showMoreGamesButton = true; initFunction = null; } public function AddSiteLock(_arg1:String, _arg2:Boolean=false){ sitelocks.push(_arg1); } } }//package
Section 173
//Line (Line) package { import flash.geom.*; public class Line { public var udx:Number; public var udy:Number; public var ny:Number; public var dir:Number; public var nx:Number; public var dy:Number; public var y0:Number; public var y1:Number; public var dx:Number; public var normalDir:Number; public var length:Number; public var boundingRect:Rectangle; public var x0:Number; public var x1:Number; public function Line(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){ x0 = _arg1; y0 = _arg2; x1 = _arg3; y1 = _arg4; CalcNormal(); CalcBoundingRect(); } function CalcNormal():void{ dir = Math.atan2((y1 - y0), (x1 - x0)); normalDir = (dir - (Math.PI * 0.5)); nx = Math.cos(normalDir); ny = Math.sin(normalDir); dx = (x1 - x0); dy = (y1 - y0); length = Math.sqrt(((dx * dx) + (dy * dy))); udx = Math.cos(dir); udy = Math.sin(dir); } function CalcBoundingRect():void{ var _local1:Number; var _local2:Number; var _local3:Number; var _local4:Number; _local1 = x0; _local2 = x1; if (_local1 > _local2){ _local1 = x1; _local2 = x0; }; _local3 = y0; _local4 = y1; if (_local3 > _local4){ _local3 = y1; _local4 = y0; }; boundingRect = new Rectangle(_local1, _local3, ((_local2 - _local1) + 1), ((_local4 - _local3) + 1)); } } }//package
Section 174
//LooseSki (LooseSki) package { import flash.display.*; public dynamic class LooseSki extends MovieClip { } }//package
Section 175
//Main (Main) package { import flash.events.*; import flash.text.*; import flash.display.*; import flash.geom.*; import flash.utils.*; import flash.net.*; import flash.ui.*; import org.flashdevelop.utils.*; public class Main extends MovieClip { var levelTimerMax:Number; public var snowTestScreenBD:BitmapData; public var tf_scorespr:TextFormat; var cheatMode:Boolean; public var scrollScreenBD:BitmapData; var levelTimer:Number; public var fillScreenMC:MovieClip; public var tf_scorespr1:TextFormat; public var tf_scorespr2:TextFormat; public var screenBD:BitmapData; public var mochiScores; public var fillScreenMC1:MovieClip; var ftime:Number; var gameState:int;// = 0 public var scrollScreenB:Bitmap; public var backgroundMC:MovieClip; var scrollY:Number;// = 0 public var screenB:Bitmap; var currentTime:Number;// = 0 var secondCounter:Number;// = 0 public var fps:Number; public var tf_scoresprblack:TextFormat; private var Font20:Class; var framecounter:int;// = 0 static const gameState_HIGHSCORES = 5; static const gameState_TITLE = 0; static const gameState_LEVEL_PLAY = 2; public static var theStage:Stage; static var theRoot:MovieClip; public function Main(){ Font20 = Main_Font20; super(); if (stage){ init(null); } else { addEventListener(Event.ADDED_TO_STAGE, init); }; } function calcFrameTime(){ var _local1:Number = currentTime; currentTime = getTimer(); if (currentTime < _local1){ _local1 = (currentTime - 100); }; if (currentTime > (_local1 + (100 * 10))){ _local1 = (100 * 10); }; ftime = ((1 / (1000 / Defs.fps)) * (currentTime - _local1)); framecounter++; secondCounter = (secondCounter + (currentTime - _local1)); if (secondCounter > 1000){ fps = ((Number(framecounter) / secondCounter) * 1000); framecounter = 0; secondCounter = 0; }; ftime = 1; } function run(_arg1:Event):void{ KeyReader.UpdateOncePerFrame(); SoundPlayer.UpdateOncePerFrame(); MusicPlayer.UpdateOncePerFrame(); calcFrameTime(); switch (gameState){ case gameState_TITLE: TitleScreenState.Update(this); Game.RenderTitleScreen(); break; case gameState_HIGHSCORES: break; case gameState_LEVEL_PLAY: RunLevel(); break; }; } private function CreateTextField(_arg1:TextFormat, _arg2:Number, _arg3:Number, _arg4:String):TextField{ var _local5:TextField = new TextField(); _local5.selectable = false; _local5.embedFonts = true; _local5.autoSize = TextFieldAutoSize.CENTER; _local5.x = _arg2; _local5.y = _arg3; _local5.text = _arg4; _local5.setTextFormat(_arg1); addChild(_local5); return (_local5); } function init(_arg1:Event){ removeEventListener(Event.ADDED_TO_STAGE, init); theRoot = this; theStage = this.root.stage; FlashConnect.trace("Main start"); SetEverythingUpOnce(); } function InitStageNoBackground(){ var _local1:int; _local1 = (this.numChildren - 1); while (_local1 >= 0) { removeChildAt(_local1); _local1--; }; } function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{ _arg3.x = _arg1; _arg3.y = _arg2; addChild(_arg3); return (_arg3); } function SetEverythingUpOnce3(){ InitStage(); Game.Init(this); Game.LoadLevels(); Game.achievements = new Achievements(); SetGameState(gameState_TITLE); } function addedToStage(_arg1:Event){ SetEverythingUpOnce2(); } function SetGameState(_arg1:int):void{ gameState = _arg1; Mouse.show(); switch (gameState){ case gameState_TITLE: TitleScreenState.Init(this); break; case gameState_LEVEL_PLAY: InitLevel(); break; }; } function InitDrawScreen():void{ screenBD = new BitmapData(Defs.displayarea_w, Defs.displayarea_h, true, 0); screenB = new Bitmap(screenBD); scrollScreenBD = new BitmapData(Defs.displayarea_w, Defs.displayarea_w, true, 0); scrollScreenB = new Bitmap(scrollScreenBD); snowTestScreenBD = new BitmapData(Defs.displayarea_w, Defs.displayarea_w, true, 0); fillScreenMC = new MovieClip(); fillScreenMC.x = 0; fillScreenMC.y = 0; fillScreenMC1 = new MovieClip(); fillScreenMC1.x = 0; fillScreenMC1.y = 0; } function RunTitle(){ } function SetEverythingUpOnce():void{ if (stage == null){ addEventListener(Event.ADDED_TO_STAGE, addedToStage); } else { SetEverythingUpOnce2(); }; } function InitFonts():void{ var _local1:Font = new Font20(); tf_scorespr = new TextFormat(); tf_scorespr1 = new TextFormat(); tf_scorespr2 = new TextFormat(); tf_scoresprblack = new TextFormat(); tf_scorespr.font = _local1.fontName; tf_scorespr.size = 12; tf_scorespr.color = 4294967295; tf_scorespr1.font = _local1.fontName; tf_scorespr1.size = 20; tf_scorespr1.color = 4294967295; tf_scorespr2.font = _local1.fontName; tf_scorespr2.size = 20; tf_scorespr2.color = 0; tf_scoresprblack.font = _local1.fontName; tf_scoresprblack.size = 12; tf_scoresprblack.color = 0; } function InitStage(){ var _local1:int; _local1 = (this.numChildren - 1); while (_local1 >= 0) { removeChildAt(_local1); _local1--; }; addChild(screenB); screenB.x = 0; screenB.y = 0; } function SetEverythingUpOnce2():void{ Kong.InitOnce(this.root); MusicPlayer.InitOnce(); KeyReader.InitOnce(theStage); MouseControl.InitOnce(theStage); SoundPlayer.InitOnce(this); PauseMenu.InitOnce(this); Particles.InitOnce(this, 1000); GameObjects.InitOnce(this, 1000); InitDrawScreen(); InitFonts(); FlashConnect.trace("Main start1"); GraphicObjects.InitOnce(this); Stats.InitOnce(); addEventListener(Event.ENTER_FRAME, run); ExternalData.Load(SetEverythingUpOnce3); } function Render(){ this.x = 0; this.y = 0; Game.Render(); } function InitLevel(){ InitStageForGame(); Particles.Reset(); MouseControl.Reset(); Particles.Reset(); GameObjects.ClearAll(); Game.InitLevel(); } function InitStageForGame(){ var _local1:int; _local1 = (this.numChildren - 1); while (_local1 >= 0) { removeChildAt(_local1); _local1--; }; addChild(screenB); screenB.x = 0; screenB.y = 0; } function RunLevel(){ if (PauseMenu.IsPaused() == false){ Game.UpdateGameplay(); }; Render(); } } }//package
Section 176
//Main_Font20 (Main_Font20) package { import mx.core.*; public class Main_Font20 extends FontAsset { } }//package
Section 177
//MainLogo (MainLogo) package { import flash.display.*; public dynamic class MainLogo extends MovieClip { public var armorGames:SimpleButton; public var miniJuegos:SimpleButton; public var robotJam:SimpleButton; public var candystand:SimpleButton; public var andkon:SimpleButton; public var maxGames:SimpleButton; public var freeworldgroup:SimpleButton; public var kongregate:SimpleButton; public var bubbleBox:SimpleButton; public var siKids:SimpleButton; public var mousebreaker:SimpleButton; public var longAnimals:SimpleButton; } }//package
Section 178
//MelonBarrow (MelonBarrow) package { import flash.display.*; public dynamic class MelonBarrow extends MovieClip { } }//package
Section 179
//MelonBarrow_Hit (MelonBarrow_Hit) package { import flash.display.*; public dynamic class MelonBarrow_Hit extends MovieClip { } }//package
Section 180
//miniMap_icons (miniMap_icons) package { import flash.display.*; public dynamic class miniMap_icons extends MovieClip { } }//package
Section 181
//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.3"); } public static function showTimedAd(_arg1:Object):void{ trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0"); _slot1.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 = _slot1._parseOptions(options, DEFAULTS); options.swfv = 9; options.mav = _slot1.getVersion(); clip = options.clip; if (!_slot1._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 = _slot1._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); _slot1.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 = _slot1._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.")); }; }, ad_loaded:function (_arg1:Number, _arg2:Number):void{ }, ad_failed:function ():void{ trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software"); }}; options = _slot1._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 (!_slot1.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ _slot1._cleanup(mc); options.ad_finished(); }; var wh:Array = _slot1._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 { _slot1.unload(clip); delete this["onEnterFrame"]; }; }; mc.unloadAd = function ():void{ _slot1.unload(clip); }; mc.adLoaded = options.ad_loaded; 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){ options.ad_failed(); _local3 = true; }; }; }; if (this.parent._mochiad_ctr_failed){ options.ad_failed(); _local3 = true; }; if (_local2 > chk.ad_msec){ _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 = _slot1._parseOptions(options, DEFAULTS); options.swfv = 9; options.mav = _slot1.getVersion(); var clip:Object = options.clip; var clipname:String = ("_mochiad_com_" + options.id); if (!_slot1._isNetworkAvailable()){ return (null); }; if (clip[clipname]){ return (clip[clipname]); }; var server:String = (options.com_server + options.id); _slot1._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.")); }; }, ad_loaded:function (_arg1:Number, _arg2:Number):void{ }, ad_failed:function ():void{ trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software"); }}; options = _slot1._parseOptions(options, DEFAULTS); if ("5cc6f7dfb67f2f08341c831480f7c2a7".length == 0){ options.ad_started(); options.ad_finished(); return; }; 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 (!_slot1.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ _slot1._cleanup(mc); var fn:Function = function ():void{ options.ad_finished(); }; setTimeout(fn, 100); }; var wh:Array = _slot1._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 { _slot1.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){ _slot1.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){ _slot1.unload(clip); }; }; mc.adLoaded = options.ad_loaded; 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)) || (!(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){ options.ad_failed(); _local4 = true; }; }; }; if (this.parent._mochiad_ctr_failed){ options.ad_failed(); _local4 = true; }; if (_local3 > chk.ad_msec){ _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{ trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0"); _slot1.showPreGameAd(_arg1); } public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{ var _local4:MovieClip = _slot1._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
Section 182
//MochiBot (MochiBot) package { import flash.display.*; import flash.net.*; import flash.system.*; public dynamic class MochiBot extends Sprite { public static function track(_arg1:Sprite, _arg2:String):MochiBot{ if (Security.sandboxType == "localWithFile"){ return (null); }; var _local3:MochiBot = new (MochiBot); _arg1.addChild(_local3); Security.allowDomain("*"); Security.allowInsecureDomain("*"); var _local4 = "http://core.mochibot.com/my/core.swf"; var _local5:URLVariables = new URLVariables(); _local5["sb"] = Security.sandboxType; _local5["v"] = Capabilities.version; _local5["swfid"] = _arg2; _local5["mv"] = "8"; _local5["fv"] = "9"; var _local6:String = _local3.root.loaderInfo.loaderURL; if (_local6.indexOf("http") == 0){ _local5["url"] = _local6; } else { _local5["url"] = "local"; }; var _local7:URLRequest = new URLRequest(_local4); _local7.contentType = "application/x-www-form-urlencoded"; _local7.method = URLRequestMethod.POST; _local7.data = _local5; var _local8:Loader = new Loader(); _local3.addChild(_local8); _local8.load(_local7); return (_local3); } } }//package
Section 183
//MouseControl (MouseControl) package { import flash.events.*; import flash.display.*; public class MouseControl { public static var buttonReleased:Boolean = false; public static var buttonPressed:Boolean = false; public static var wheelFunction:Function = null; public static var dy:Number = 0; public static var dx:Number = 0; public static var mouseVelX:Number = 0; public static var mouseVelY:Number = 0; public static var ox:Number = 0; public static var oy:Number = 0; public static var x:Number = 0; public static var y:Number = 0; public static var delta:int = 0; public static function MouseHandler(_arg1:MouseEvent):void{ x = _arg1.stageX; y = _arg1.stageY; mouseVelX = (x - ox); mouseVelY = (y - oy); dx = (x - ox); dy = (y - oy); ox = x; oy = y; } public static function MouseClickHandler(_arg1:MouseEvent):void{ buttonPressed = true; buttonReleased = false; } public static function MouseUpHandler(_arg1:MouseEvent):void{ buttonPressed = false; buttonReleased = true; } public static function SetWheelHandler(_arg1:Function):void{ wheelFunction = _arg1; } public static function InitOnce(_arg1:Stage):void{ _arg1.addEventListener(MouseEvent.MOUSE_MOVE, MouseHandler); _arg1.addEventListener(MouseEvent.MOUSE_DOWN, MouseClickHandler); _arg1.addEventListener(MouseEvent.MOUSE_UP, MouseUpHandler); _arg1.addEventListener(MouseEvent.MOUSE_WHEEL, MouseWheelHandler); wheelFunction = null; } public static function ResetDxDy():void{ dx = 0; dy = 0; } public static function MouseWheelHandler(_arg1:MouseEvent):void{ delta = _arg1.delta; if (wheelFunction != null){ wheelFunction(delta); }; } public static function Reset():void{ buttonPressed = false; buttonReleased = false; } } }//package
Section 184
//MusicPlayer (MusicPlayer) package { import flash.media.*; import flash.utils.*; public class MusicPlayer { static var musicSound1:Sound; static var volumeMod:Number = 0.5; static var lastMusicID = -1; static var musicSoundTransform1:SoundTransform; static var musicChannel1:SoundChannel = null; static var currentMusicID:int = -1; static var doMusic:Boolean; static var musicChannel:SoundChannel = null; static var streamChannelFlags:Array; static var musicSoundTransform:SoundTransform; static var musicSound:Sound; static var streamSound:Sound = null; static var streamChannels:Array; static var streamChannelVolumes:Array; public static var currentStreamID:int = -1; public static function StartMusic(_arg1:String){ var classRef:Class; var m:Sound; var musicName = _arg1; if (doMusic == false){ return; }; if (musicChannel != null){ musicChannel.stop(); }; try { classRef = (getDefinitionByName(musicName) as Class); } catch(e:Object) { classRef = null; }; if (classRef == null){ trace(("Music Error: Can't find sound " + musicName)); } else { m = (new (classRef) as Sound); musicSoundTransform = new SoundTransform(1, 0); musicSound = m; musicChannel = musicSound.play(0, 999999, musicSoundTransform); }; lastMusicID = 0; } public static function InitOnce():void{ doMusic = Game.soundon; lastMusicID = -1; currentMusicID = -1; streamChannels = new Array(); streamChannelFlags = new Array(); streamChannelVolumes = new Array(); } public static function StopMusic(){ var _local1:int; var _local2:SoundChannel; var _local3:int; _local1 = 0; while (_local1 < streamChannels.length) { _local3 = streamChannelFlags[_local1]; if ((((_local3 == 0)) || ((_local3 == 1)))){ _local3 = 2; }; streamChannelFlags[_local1] = _local3; _local1++; }; if (musicChannel != null){ musicChannel.stop(); }; } public static function ToggleMute(){ doMusic = (doMusic == false); } public static function StartStream(_arg1:int){ var _local3:Class; if (doMusic == false){ return; }; var _local2 = ""; if (_arg1 == 0){ _local2 = "track02"; }; if (_arg1 == 1){ _local2 = "track03"; }; if (_arg1 == 2){ _local2 = "track04"; }; if (_arg1 == 5){ _local2 = "track03"; }; if (_arg1 == 6){ _local2 = "track03"; }; _local3 = (getDefinitionByName(_local2) as Class); var _local4:Sound = (new (_local3) as Sound); var _local5:SoundTransform = new SoundTransform(0); streamChannels.push(_local4.play(0, 999999, _local5)); streamChannelFlags.push(int(0)); streamChannelVolumes.push(Number(0)); } public static function UpdateOncePerFrame(){ var _local3:SoundTransform; var _local4:int; var _local5:SoundChannel; var _local6:int; var _local7:Number; var _local8:*; var _local9:*; var _local10:*; var _local1:Number = 0.02; var _local2:Boolean; _local4 = 0; while (_local4 < streamChannels.length) { _local5 = streamChannels[_local4]; _local6 = streamChannelFlags[_local4]; _local7 = streamChannelVolumes[_local4]; if (_local6 == 0){ _local3 = _local5.soundTransform; _local7 = (_local7 + _local1); if (_local7 >= 1){ _local7 = 1; _local6 = 1; }; _local3.volume = (_local7 * volumeMod); _local5.soundTransform = _local3; } else { if (_local6 == 1){ _local3 = _local5.soundTransform; _local3.volume = (_local7 * volumeMod); _local5.soundTransform = _local3; } else { if (_local6 == 2){ _local3 = _local5.soundTransform; _local7 = (_local7 - _local1); if (_local7 <= 0){ _local5.stop(); _local6 = 3; _local2 = true; }; _local3.volume = (_local7 * volumeMod); _local5.soundTransform = _local3; } else { if (_local6 == 3){ }; }; }; }; streamChannelFlags[_local4] = _local6; streamChannels[_local4] = _local5; streamChannelVolumes[_local4] = _local7; if (!doMusic){ _local3 = _local5.soundTransform; _local3.volume = 0; _local5.soundTransform = _local3; }; _local4++; }; if (_local2){ _local8 = new Array(); _local9 = new Array(); _local10 = new Array(); _local4 = 0; while (_local4 < streamChannels.length) { _local5 = streamChannels[_local4]; _local6 = streamChannelFlags[_local4]; _local7 = streamChannelVolumes[_local4]; if (_local6 != 3){ _local8.push(_local6); _local9.push(_local5); _local10.push(_local7); }; _local4++; }; streamChannelFlags = _local8; streamChannels = _local9; streamChannelVolumes = _local10; }; if (!doMusic){ if (musicChannel != null){ _local3 = musicChannel.soundTransform; _local3.volume = 0; musicChannel.soundTransform = _local3; }; } else { if (musicChannel != null){ _local3 = musicChannel.soundTransform; _local3.volume = 1; musicChannel.soundTransform = _local3; }; }; } } }//package
Section 185
//Obelisk (Obelisk) package { import flash.display.*; public dynamic class Obelisk extends MovieClip { } }//package
Section 186
//Obelisk_Hit (Obelisk_Hit) package { import flash.display.*; public dynamic class Obelisk_Hit extends MovieClip { } }//package
Section 187
//ObjectDef (ObjectDef) package { import flash.geom.*; public class ObjectDef { var type:int; var animNames:Array; var animIDs:Array; var exportName:String; var particleExplodeID:int; var initFuncName:String; var maxHealth:Number; var colRects:Array; var pathAnimType:int; var collisionCircleRadii:Array; var shieldColRects:Array; var shotControllers:Array; var collisionCircleOffsets:Array; public function ObjectDef(_arg1:String, _arg2:int, _arg3:Rectangle){ animNames = new Array(); animIDs = new Array(); colRects = new Array(); shieldColRects = new Array(); collisionCircleOffsets = new Array(); collisionCircleRadii = new Array(); exportName = _arg1; type = _arg2; colRects.push(_arg3.clone()); maxHealth = 1; initFuncName = ""; shotControllers = new Array(); } public function AddColRect(_arg1:Rectangle){ colRects.push(_arg1.clone()); } public function GetAnimIDFromName(_arg1:String):int{ var _local3:int; var _local2:int = animNames.length; _local3 = 0; while (_local3 < _local2) { if (animNames[_local3] == _arg1){ return (animIDs[_local3]); }; _local3++; }; trace(((("ERROR: Can't find anim name " + _arg1) + " on object ") + exportName)); return (40); } public function SetPathAnimType(_arg1:int){ pathAnimType = _arg1; } public function AddShotController(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number){ var _local5:ShotController = new ShotController(); _local5.Set(_arg1, _arg2, _arg3, _arg4); shotControllers.push(_local5); } public function DoesAnimIDExist(_arg1:String):Boolean{ var _local3:int; var _local2:int = animNames.length; _local3 = 0; while (_local3 < _local2) { if (animNames[_local3] == _arg1){ return (true); }; _local3++; }; return (false); } public function AddShieldColRect(_arg1:Rectangle){ shieldColRects.push(_arg1.clone()); } public function SetInitFunc(_arg1:String){ initFuncName = _arg1; } public function AddCollisionCircle(_arg1:Number, _arg2:Number, _arg3:Number){ collisionCircleOffsets.push(new Point(_arg1, _arg2)); collisionCircleRadii.push(_arg3); } public function SetParticle(_arg1:int){ particleExplodeID = _arg1; } public function SetHealth(_arg1:Number){ maxHealth = _arg1; } public function AddAnim(_arg1:String, _arg2:int){ animNames.push(_arg1); animIDs.push(_arg2); } } }//package
Section 188
//ObjectDefs (ObjectDefs) package { import flash.geom.*; public class ObjectDefs { static var list:Array; public static function Init(){ var _local1:ObjectDef; list = new Array(); _local1 = new ObjectDef("Player", 0, new Rectangle(-10, -30, 20, 40)); _local1.AddCollisionCircle(0, -17, 15); _local1.AddCollisionCircle(0, -31, 15); _local1.AddCollisionCircle(0, -45, 15); list.push(_local1); } public static function GetObjectDefByExportName(_arg1:String){ var _local2:ObjectDef; var _local3:int; var _local4:int = list.length; _local3 = 0; while (_local3 < _local4) { _local2 = list[_local3]; if (_local2.exportName == _arg1){ return (_local2); }; _local3++; }; trace(("ERROR: ObjectDefs can't find object exportname " + _arg1)); return (null); } } }//package
Section 189
//Particle (Particle) package { class Particle { var graphicID:int; public var yvel:Number; var active:Boolean; var maxframe:int; var dir:Number; var mode:int; public var xvel:Number; var ypos:Number; var updateFunction:Function; var timer:Number; var speed:Number; var angle:Number; var startx:Number; var starty:Number; var xpos:Number; var alpha:Number; var color:uint; var rotVel:Number; var alphaAdd:Number; var frame:Number; var frameVel:Number; var visible:Boolean; var counter:int; public function UpdateFireTrail():void{ if (PlayAnimation()){ active = false; }; } public function InitSpeedLine(_arg1:Number, _arg2:int):void{ angle = _arg1; frame = 0; frameVel = Utils.RandBetweenFloat(1, 2); updateFunction = UpdateSpeedLine; graphicID = (GraphicObjects.gfx_speedline + _arg2); maxframe = GraphicObjects.GetNumFrames(graphicID); timer = 10; } public function InitSlime():void{ var _local1:Number = (Utils.RandBetweenFloat(-1, 1) - (Math.PI * 0.5)); var _local2:Number = Utils.RandBetweenFloat(11, 19); xvel = (Math.cos(_local1) * _local2); yvel = (Math.sin(_local1) * _local2); frame = 0; graphicID = 0; updateFunction = UpdateSlime; mode = 0; } public function InitDust():void{ frame = 0; updateFunction = UpdateDust; graphicID = GraphicObjects.gfx_dust; timer = 50; frame = Utils.RandBetweenInt(0, (GraphicObjects.GetNumFrames(graphicID) - 1)); xvel = Utils.RandBetweenFloat(0, 2); yvel = Utils.RandBetweenFloat(-0.5, 0.5); } function PlayAnimation():Boolean{ frame = (frame + frameVel); if (frame >= maxframe){ frame = maxframe; return (true); }; return (false); } function UpdateVelsTimer(){ xpos = (xpos + xvel); ypos = (ypos + yvel); timer--; if (timer <= 0){ active = false; }; } public function InitFireTrail():void{ frame = 0; frameVel = 1; updateFunction = UpdateFireTrail; graphicID = GraphicObjects.gfx_flame; maxframe = GraphicObjects.GetNumFrames(graphicID); } function UpdateHitPiece(){ yvel = (yvel + 0.5); xpos = (xpos + xvel); ypos = (ypos + yvel); angle = (angle + rotVel); timer--; if (timer <= 0){ active = false; }; } public function UpdateWater():void{ xpos = (xpos + xvel); ypos = (ypos + yvel); yvel = (yvel + 0.3); timer--; if (timer <= 0){ }; frame++; if (frame >= 29){ frame = 29; active = false; }; } public function UpdateDust():void{ xpos = (xpos + xvel); ypos = (ypos + yvel); timer--; if (timer < 0){ active = false; }; } public function InitWater():void{ var _local1:Number = Utils.RandCircle(); var _local2:Number = Utils.RandBetweenFloat(3, 5); xvel = (Math.cos(_local1) * _local2); yvel = (Math.sin(_local1) * _local2); frame = 0; updateFunction = UpdateWater; mode = 0; color = 4278190335; timer = 10; frame = 20; } function UpdateStickSnow():void{ yvel = (yvel + 0.5); xpos = (xpos + xvel); ypos = (ypos + yvel); timer--; if (timer <= 0){ active = false; }; } function UpdateSlime():void{ } function CycleAnimation():Boolean{ frame = (frame + frameVel); if (frame >= maxframe){ frame = 0; return (true); }; return (false); } function InitHitPiece(_arg1:int, _arg2:int):void{ graphicID = _arg1; frame = _arg2; updateFunction = UpdateHitPiece; xvel = Utils.RandBetweenFloat(10, 20); yvel = Utils.RandBetweenFloat(0, -10); timer = 50; angle = Utils.RandCircle(); rotVel = Utils.RandBetweenFloat(-0.3, 0.3); } function InitSnowballSnow(_arg1:Number):void{ frame = 0; updateFunction = UpdateStickSnow; controlMode = 0; xvel = Utils.RandBetweenFloat(10, 20); yvel = Utils.RandBetweenFloat(0, -10); timer = 50; _arg1 = Utils.RandBetweenFloat(5, _arg1); frame = Utils.RandBetweenInt(3, 4); angle = Utils.RandCircle(); xpos = (xpos + (Math.cos(angle) * _arg1)); ypos = (ypos + (Math.sin(angle) * _arg1)); graphicID = GraphicObjects.GetIndexByName("Snowball01"); } public function UpdateSpeedLine():void{ if (PlayAnimation()){ active = false; }; } function InitStickSnow():void{ frame = 0; updateFunction = UpdateStickSnow; controlMode = 0; xvel = Utils.RandBetweenFloat(-2, 2); yvel = Utils.RandBetweenFloat(-1, -5); timer = 20; frame = Utils.RandBetweenInt(0, 3); graphicID = GraphicObjects.GetIndexByName("SnowMC"); } function UpdateAnimAndStop(){ xpos = (xpos + xvel); ypos = (ypos + yvel); if (PlayAnimation()){ active = false; }; } } }//package
Section 190
//Particles (Particles) package { import flash.display.*; import flash.geom.*; public class Particles { public static const type_dust = 0; static var max:int; static var list:Array; static var main:Main; static var nextIndex:int; public function Particles():void{ } public static function Add(_arg1:Number, _arg2:Number):Particle{ var _local3:Number; var _local4:Number; var _local5:Particle = list[nextIndex]; nextIndex++; if (nextIndex >= max){ nextIndex = 0; }; _local5.active = true; _local5.timer = 0; _local5.alpha = 1; _local5.alphaAdd = 0; _local5.visible = true; _local5.xpos = _arg1; _local5.ypos = _arg2; _local5.angle = 0; return (_local5); } public static function GetNextIndex():int{ return (nextIndex); } public static function Reset(){ var _local1:int; nextIndex = 0; _local1 = 0; while (_local1 < max) { list[_local1].active = false; _local1++; }; } public static function Update(_arg1:Number){ var _local2:int; var _local3:Particle; _local2 = 0; while (_local2 < max) { _local3 = list[_local2]; if (_local3.active == true){ _local3.updateFunction(); }; _local2++; }; } public static function InitOnce(_arg1:Main, _arg2:int):void{ var _local3:int; var _local4:int; main = _arg1; max = _arg2; nextIndex = 0; list = new Array(max); _local3 = 0; while (_local3 < max) { list[_local3] = new Particle(); list[_local3].active = false; _local3++; }; } public static function CountActive():int{ var _local2:int; var _local1:int; _local2 = 0; while (_local2 < max) { if (list[_local2].active){ _local1++; }; _local2++; }; return (_local1); } public static function Render(_arg1:Main){ var _local8:int; var _local9:int; var _local11:Particle; var _local12:Number; var _local13:Number; var _local2:Number = (0 - 16); var _local3:Number = (Defs.displayarea_w + 16); var _local4:Number = (0 - 16); var _local5:Number = (Defs.displayarea_h + 16); var _local6:Number = Game.scrollX; var _local7:Number = Game.scrollY; var _local10:BitmapData = Game.main.scrollScreenBD; _local8 = 0; while (_local8 < max) { _local11 = list[_local8]; if (((_local11.active) && (_local11.visible))){ _local12 = (_local11.xpos - _local6); _local13 = (_local11.ypos - _local7); if (_local11.angle == 0){ GraphicObjects.RenderAt(_local11.graphicID, int(_local11.frame), _local10, _local12, _local13); } else { GraphicObjects.RenderAtRotScaled(_local11.graphicID, int(_local11.frame), _local10, _local12, _local13, 1, _local11.angle); }; }; _local8++; }; } } }//package
Section 191
//PauseMenu (PauseMenu) package { import flash.events.*; import flash.text.*; import flash.display.*; import flash.geom.*; import flash.net.*; import flash.ui.*; public class PauseMenu { static var active:Boolean; static var pauseMC:MovieClip; static var main:Main; public function PauseMenu():void{ } public static function pressed_buttonRestartLevel(_arg1:MouseEvent){ Unpause(); Game.StartLevelPlay(); } public static function pressed_buttonMusic(_arg1:MouseEvent){ MusicPlayer.ToggleMute(); SetTicks(); } public static function IsPaused():Boolean{ return (active); } public static function pressed_buttonContinue(_arg1:MouseEvent){ Unpause(); } public static function pressed_buttonHelp(_arg1:MouseEvent){ Game.InitHelp(true); } public static function InitOnce(_arg1:Main):void{ main = _arg1; active = false; } static function SetTicks(){ if (SoundPlayer.doSFX){ pauseMC.tickSFX.gotoAndStop(2); } else { pauseMC.tickSFX.gotoAndStop(1); }; if (MusicPlayer.doMusic){ pauseMC.tickMusic.gotoAndStop(2); } else { pauseMC.tickMusic.gotoAndStop(1); }; } public static function Unpause():void{ active = false; main.removeChild(pauseMC); pauseMC = null; KeyReader.InitOnce(Game.main.stage); } public static function pressed_buttonSFX(_arg1:MouseEvent){ SoundPlayer.ToggleMute(); SetTicks(); } public static function Pause():void{ pauseMC = AddMovieClip(0, 0, new PauseMenuScreen()); main.addChild(pauseMC); pauseMC.buttonSFX.addEventListener(MouseEvent.CLICK, pressed_buttonSFX); pauseMC.buttonMusic.addEventListener(MouseEvent.CLICK, pressed_buttonMusic); pauseMC.buttonQuit.addEventListener(MouseEvent.CLICK, pressed_buttonQuit); pauseMC.buttonRestartLevel.addEventListener(MouseEvent.CLICK, pressed_buttonRestartLevel); pauseMC.buttonContinue.addEventListener(MouseEvent.CLICK, pressed_buttonContinue); pauseMC.buttonHelp.addEventListener(MouseEvent.CLICK, pressed_buttonHelp); active = true; SetTicks(); } public static function pressed_buttonQuit(_arg1:MouseEvent){ Unpause(); Game.QuietLoops(); Game.main.SetGameState(Main.gameState_TITLE); } static function AddMovieClip(_arg1:Number, _arg2:Number, _arg3:MovieClip):MovieClip{ _arg3.x = _arg1; _arg3.y = _arg2; main.addChild(_arg3); return (_arg3); } } }//package
Section 192
//PauseMenuScreen (PauseMenuScreen) package { import flash.display.*; public dynamic class PauseMenuScreen extends MovieClip { public var buttonQuit:SimpleButton; public var buttonRestartLevel:SimpleButton; public var tickSFX:MovieClip; public var buttonHelp:SimpleButton; public var tickMusic:MovieClip; public var buttonMusic:SimpleButton; public var buttonContinue:SimpleButton; public var buttonSFX:SimpleButton; } }//package
Section 193
//Penguin (Penguin) package { import flash.display.*; public dynamic class Penguin extends MovieClip { } }//package
Section 194
//Penguin_Physobj (Penguin_Physobj) package { import flash.display.*; public dynamic class Penguin_Physobj extends MovieClip { } }//package
Section 195
//Penguin_Plinth (Penguin_Plinth) package { import flash.display.*; public dynamic class Penguin_Plinth extends MovieClip { } }//package
Section 196
//PhysEditor (PhysEditor) package { import flash.display.*; import flash.geom.*; import flash.ui.*; import org.flashdevelop.utils.*; import flash.system.*; public class PhysEditor { static const editMode_Library:int = 1; static const editMode_PickPiece:int = 7; static const editMode_GridCommands:int = 8; static const editMode_Adjust:int = 5; static const editMode_Commands1:int = 4; static const editMode_Normal:int = 0; static const editMode_Map:int = 10; static const editMode_Commands:int = 3; static const editMode_ObjCol:int = 9; static const editMode_Lines:int = 6; static var objCol_ShowOtherCol:Boolean; static var gridMode_active:Boolean = false; static var newLineType:int; static var renderMiniMap:Boolean = false; static var gridsnap:int = 8; static var libraryFilter:String = ""; static var prevEditMode:int = 0; static var objCol_index:int; static var mapColNames:Array; static var scrollX:Number = 0; static var scrollY:Number = 0; static var currentPieceList:Array; static var boxNumW:Number = 5; static var numLibrarySizes:int; static var linesScreen:MovieClip; static var mapper_brushType:int = 0; static var boxSizeH:Number = (Defs.displayarea_h / boxNumH); static var hoverLineIndex:int; static var guideLines:Array; static var boxSizeW:Number = (Defs.displayarea_w / boxNumW); static var brushes:Array; static var currentPointIndex:int; static var objectZSortMode:Boolean = false; static var mapper_currentCell:int = 1; static var hoverPointIndex:int; static var libraryFilterIndex:int = 0; static var addlineActive:Boolean; static var lineColors:Array; static var currentLevel:int = 0; static var library_page:int = 0; static var mapper_transparency:int = 5; static var renderObjects:Boolean = true; static var undoList:Array; static var librarySizes:Array; static var mapCols:Array; static var libraryFilters:Array; public static var currentAdjustObject:PhysObj_Instance; static var fillList:Array; static var fillList1:Array; static var currentLineIndex:int; static var editMode:int = 0; static var objCol_points:Array; static var librarySizeIndex:int; static var libraryPieces:Array; static var lineTypes:Array; static var gridMode_renderGrid:Boolean = false; static var boxNumH:Number = 4; static var fillOrigCell:int; static var updateTimer:int = 0; public static function HitTestPhysObjGraphics(_arg1:Number, _arg2:Number):PhysObj_Instance{ var _local4:int; var _local5:PhysObj_Instance; var _local6:BitmapData; var _local7:PhysObj; var _local8:uint; var _local3:Array = GetCurrentLevelInstances(); _local4 = (_local3.length - 1); while (_local4 >= 0) { _local5 = _local3[_local4]; _local6 = Game.main.screenBD; _local6.fillRect(Defs.screenRect, 0); _local7 = Game.physObjs.FindByName(_local5.typeName); PhysObj.RenderAt(_local7, (_local5.x - scrollX), (_local5.y - scrollY), _local5.rot, _local6); _local8 = _local6.getPixel32(_arg1, _arg2); if (_local8 != 0){ return (_local5); }; _local4--; }; return (null); } static function FillRectangle(_arg1:Rectangle, _arg2:uint, _arg3:Number=1, _arg4:Number=1){ var _local5:Number = 0; var _local6:Number = (_local5 + Defs.displayarea_w); if (_arg1.left > _local6){ return; }; if (_arg1.right < _local5){ return; }; var _local7:Number = 0; var _local8:Number = (_local7 + Defs.displayarea_h); if (_arg1.top > _local8){ return; }; if (_arg1.bottom < _local7){ return; }; var _local9:Graphics = linesScreen.graphics; _local9.lineStyle(null, 0, 0); _local9.beginFill(_arg2, _arg4); _local9.moveTo(_arg1.left, _arg1.top); _local9.lineTo(_arg1.right, _arg1.top); _local9.lineTo(_arg1.right, _arg1.bottom); _local9.lineTo(_arg1.left, _arg1.bottom); _local9.endFill(); } static function Editor_GetNearbyGuidelines(_arg1:PhysObj_Instance, _arg2:Number, _arg3:Number, _arg4:Number=50){ var _local6:PhysObj_Body; var _local7:PhysObj_Shape; var _local8:Point; var _local9:Point; var _local13:PhysObj_Instance; var _local14:PhysObj; var _local15:Point; var _local16:Point; var _local17:PhysObj; var _local18:Point; var _local19:Number; var _local20:Number; var _local21:Boolean; var _local22:PhysEd_GuideLine; var _local5:Number = 3; var _local10:Array = GetCurrentLevelInstances(); var _local11:Matrix = new Matrix(); var _local12:Array = new Array(); if (_arg1 != null){ _local14 = Game.physObjs.FindByName(_arg1.typeName); if (_local14 != null){ for each (_local6 in _local14.bodies) { for each (_local7 in _local6.shapes) { if (_local7.type == PhysObj_Shape.Type_Poly){ for each (_local8 in _local7.poly_points) { _local11.identity(); _local11.rotate(Utils.DegToRad(_arg1.rot)); _local15 = new Point(_local8.x, _local8.y); _local15 = _local11.transformPoint(_local15); _local16 = new Point(((_local15.x + _arg1.x) + _local6.pos.x), ((_local15.y + _arg1.y) + _local6.pos.y)); _local12.push(_local16); }; }; }; }; }; } else { _local12.push(new Point(_arg2, _arg3)); }; guideLines = new Array(); for each (_local13 in _local10) { if (_local13 != _arg1){ _local17 = Game.physObjs.FindByName(_local13.typeName); if (_local17 != null){ for each (_local6 in _local17.bodies) { for each (_local7 in _local6.shapes) { if (_local7.type == PhysObj_Shape.Type_Poly){ for each (_local8 in _local7.poly_points) { _local11.identity(); _local11.rotate(Utils.DegToRad(_local13.rot)); _local15 = new Point(_local8.x, _local8.y); _local15 = _local11.transformPoint(_local15); _local18 = new Point(((_local15.x + _local13.x) + _local6.pos.x), ((_local15.y + _local13.y) + _local6.pos.y)); for each (_local9 in _local12) { _local19 = Math.abs((_local18.x - _local9.x)); _local20 = Math.abs((_local18.y - _local9.y)); _local21 = false; if ((((_local20 < _local5)) && ((_local19 < _arg4)))){ _local21 = false; if (Math.floor(_local18.y) == Math.floor(_local9.y)){ _local21 = true; }; _local22 = new PhysEd_GuideLine((_local18.x - 100), (_local18.x + 100), _local18.y, 0, _local21); guideLines.push(_local22); }; if ((((_local19 < _local5)) && ((_local20 < _arg4)))){ _local21 = false; if (Math.floor(_local18.x) == Math.floor(_local9.x)){ _local21 = true; }; _local22 = new PhysEd_GuideLine((_local18.y - 100), (_local18.y + 100), _local18.x, 1, _local21); guideLines.push(_local22); }; }; }; }; }; }; }; }; }; } static function SetCurrentLevelInstances(_arg1:Array):void{ Game.levels[currentLevel].instances = _arg1; } static function Editor_RenderGrid(_arg1:BitmapData){ var _local9:int; var _local10:int; if (gridMode_active == false){ return; }; if (gridMode_renderGrid == false){ return; }; var _local2:int = scrollX; var _local3:int = scrollY; _local2 = Math.floor(_local2); _local3 = Math.floor(_local3); _local2 = (int((_local2 / gridsnap)) * int(gridsnap)); _local3 = (int((_local3 / gridsnap)) * int(gridsnap)); var _local4:Number = 0; var _local5:Number = Defs.displayarea_w; var _local6:Number = 0; var _local7:Number = Defs.displayarea_h; var _local8:Graphics = linesScreen.graphics; _local8.lineStyle(1, 4286611584, 1); var _local11:Number = scrollX; var _local12:Number = scrollY; _local9 = _local2; while (_local9 < (_local2 + Defs.displayarea_w)) { _local8.moveTo((_local9 - _local11), _local6); _local8.lineTo((_local9 - _local11), _local7); _local9 = (_local9 + gridsnap); }; _local10 = _local3; while (_local10 < (_local3 + Defs.displayarea_h)) { _local8.moveTo(_local4, (_local10 - _local12)); _local8.lineTo(_local5, (_local10 - _local12)); _local10 = (_local10 + gridsnap); }; } static function ObjCol_ToggleDisplay(){ objCol_ShowOtherCol = (objCol_ShowOtherCol == false); } static function Editor_RenderObjects_AdjustMode(){ var _local3:PhysObj_Instance; var _local4:PhysObj; var _local1:Array = GetCurrentLevelInstances(); if (objectZSortMode){ _local1 = SortInstancesByZ(_local1); }; var _local2:BitmapData = Game.main.screenBD; for each (_local3 in _local1) { _local4 = Game.physObjs.FindByName(_local3.typeName); if (_local3 == currentAdjustObject){ if ((updateTimer & 2)){ PhysObj.RenderAt(_local4, (_local3.x - scrollX), (_local3.y - scrollY), _local3.rot, _local2, linesScreen.graphics, true); }; } else { PhysObj.RenderAt(_local4, (_local3.x - scrollX), (_local3.y - scrollY), _local3.rot, _local2, linesScreen.graphics, true); }; }; } static function GetCurrentPieceInitialPos():Point{ if (currentPieceList.length == 0){ return (new Point(0, 0)); }; var _local1:Object = currentPieceList[0]; return (new Point(_local1.origx, _local1.origy)); } static function AddCurrentPiece(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0){ var _local7:Object = new Object(); _local7.id = _arg1; _local7.rot = Number(_arg2); _local7.xoff = Number(_arg3); _local7.yoff = Number(_arg4); _local7.origx = Number(_arg5); _local7.origy = Number(_arg6); currentPieceList.push(_local7); } static function GetLineTypeColor(_arg1:int):uint{ if (_arg1 < 0){ return (0xFFFFFF); }; if (_arg1 >= lineColors.length){ return (0xFFFFFF); }; return (lineColors[_arg1]); } static function Mapper_PlotCell(_arg1:int){ var _local4:Point; var _local5:int; var _local6:int; var _local7:int; var _local2:Array = brushes[mapper_brushType]; var _local3:Level = GetCurrentLevel(); for each (_local4 in _local2) { _local5 = MouseControl.x; _local6 = MouseControl.y; _local5 = (_local5 + scrollX); _local6 = (_local6 + scrollY); _local5 = (_local5 / _local3.mapCellW); _local6 = (_local6 / _local3.mapCellH); _local5 = (_local5 + _local4.x); _local6 = (_local6 + _local4.y); if ((((((((_local5 < _local3.mapMinX)) || ((_local5 > _local3.mapMaxX)))) || ((_local6 < _local3.mapMinY)))) || ((_local6 > _local3.mapMaxY)))){ mapper_ExpandMap(_local5, _local6); }; _local7 = ((_local3.mapMaxX - _local3.mapMinX) + 1); _local5 = (_local5 - _local3.mapMinX); _local6 = (_local6 - _local3.mapMinY); _local3.map[(_local5 + (_local6 * _local7))] = _arg1; }; } static function Lines_DeletePoint(_arg1:Number, _arg2:Number){ var _local7:PhysLine; var _local8:int; var _local9:Point; var _local10:Array; var _local11:Array; var _local12:int; var _local13:Array; var _local3:Level = GetCurrentLevel(); var _local4:int; var _local5 = -1; var _local6 = -1; for each (_local7 in _local3.lines) { _local8 = 0; for each (_local9 in _local7.points) { if (Utils.DistBetweenPoints(_local9.x, _local9.y, _arg1, _arg2) < 3){ _local5 = _local4; _local6 = _local8; }; _local8++; }; _local4++; }; if (((!((_local5 == -1))) && (!((_local6 == -1))))){ _local10 = _local3.lines[_local5].points; _local11 = new Array(); _local12 = 0; while (_local12 < _local10.length) { if (_local12 != _local6){ _local11.push(_local10[_local12].clone()); }; _local12++; }; _local3.lines[_local5].points = _local11; _local13 = new Array(); for each (_local7 in _local3.lines) { if (_local7.points.length != 0){ _local13.push(_local7.Clone()); } else { currentLineIndex = -1; }; }; _local3.lines = _local13; currentPointIndex = -1; }; } static function Editor_RenderNearbyGuidelines(){ var _local2:PhysEd_GuideLine; var _local3:uint; var _local1:BitmapData = Game.main.screenBD; for each (_local2 in guideLines) { _local3 = 4294901760; if (_local2.level){ _local3 = 4278255615; }; RenderLine((_local2.x0 - scrollX), (_local2.y0 - scrollY), (_local2.x1 - scrollX), (_local2.y1 - scrollY), _local3); }; } static function Lines_ScrollToLastPointOfSelectedLine(){ if (currentLineIndex == -1){ return; }; var _local1:Level = GetCurrentLevel(); var _local2:Array = _local1.lines[currentLineIndex].points; var _local3:Point = _local2[(_local2.length - 1)]; scrollX = (_local3.x - (Defs.displayarea_w * 0.5)); scrollY = (_local3.y - (Defs.displayarea_h * 0.5)); } static function CurrenPiece_AddRot(_arg1:Number){ var _local2:Object; for each (_local2 in currentPieceList) { _local2.rot = (_local2.rot + Number(_arg1)); }; } static function Lines_NewLine(){ var _local1:PhysLine = new PhysLine(); _local1.type = newLineType; var _local2:Level = GetCurrentLevel(); _local2.lines.push(_local1); currentLineIndex = (_local2.lines.length - 1); FlashConnect.trace(("New line " + currentLineIndex)); } public static function DoUndo(){ var _local5:PhysLine; var _local6:PhysLine; var _local7:Array; var _local8:PhysObj_Instance; var _local9:PhysObj_Instance; var _local1:Level = GetCurrentLevel(); if (undoList.length == 0){ return; }; var _local2:Object = undoList.pop(); var _local3:Array = _local2.lines; var _local4:Array = _local2.objects; _local1.lines = new Array(); for each (_local5 in _local3) { _local6 = _local5.Clone(); _local1.lines.push(_local6); }; if (_local4.length != 0){ _local7 = new Array(); for each (_local8 in _local4) { _local9 = _local8.Clone(); _local7.push(_local9); }; Game.levels[currentLevel].instances = _local7; }; currentLineIndex = -1; currentPointIndex = -1; } static function Editor_RenderLines(){ var _local7:PhysLine; var _local8:uint; var _local9:int; var _local10:int; var _local11:int; var _local12:int; var _local1:Point = new Point(); var _local2:Point = new Point(); var _local3:Rectangle = new Rectangle(); var _local4:Level = GetCurrentLevel(); var _local5:BitmapData = Game.main.screenBD; var _local6:int; for each (_local7 in _local4.lines) { _local8 = GetLineTypeColor(_local7.type); _local9 = 1; if (_local6 == currentLineIndex){ _local9 = 2; }; if (_local7.points.length >= 2){ _local10 = 0; while (_local10 < (_local7.points.length - 1)) { _local1 = _local7.points[_local10]; _local2 = _local7.points[(_local10 + 1)]; RenderLine((_local1.x - scrollX), (_local1.y - scrollY), (_local2.x - scrollX), (_local2.y - scrollY), _local8, _local9); _local10++; }; }; _local10 = 0; while (_local10 < _local7.points.length) { _local8 = 4294901760; if ((((_local6 == currentLineIndex)) && ((currentPointIndex == _local10)))){ _local8 = 4294967040; }; _local11 = 2; _local12 = 4; if ((((_local6 == hoverLineIndex)) && ((hoverPointIndex == _local10)))){ _local11 = 3; _local12 = 6; }; _local3.x = ((_local7.points[_local10].x - _local11) - scrollX); _local3.y = ((_local7.points[_local10].y - _local11) - scrollY); _local3.width = _local12; _local3.height = _local12; RenderRectangle(_local3, _local8); _local10++; }; _local6++; }; } static function Lines_Subdivide(_arg1:Number, _arg2:Number){ var _local7:PhysLine; var _local8:int; var _local9:Point; var _local10:int; var _local11:int; var _local12:Array; var _local13:int; var _local14:Array; var _local15:Array; var _local16:int; var _local17:Point; var _local18:Point; var _local19:Point; if ((((currentLineIndex == -1)) || ((currentPointIndex == -1)))){ return; }; var _local3:Level = GetCurrentLevel(); var _local4:int; var _local5 = -1; var _local6 = -1; for each (_local7 in _local3.lines) { _local8 = 0; for each (_local9 in _local7.points) { if (Utils.DistBetweenPoints(_local9.x, _local9.y, _arg1, _arg2) < 3){ _local5 = _local4; _local6 = _local8; }; _local8++; }; _local4++; }; if (((!((_local5 == -1))) && (!((_local6 == -1))))){ if (_local6 == currentPointIndex){ return; }; _local10 = currentPointIndex; _local11 = _local6; if (_local11 < _local10){ _local16 = _local10; _local11 = _local10; _local10 = _local16; }; _local12 = new Array(); _local14 = _local3.lines[_local5].points; _local13 = _local10; while (_local13 < _local11) { _local17 = _local14[_local13].clone(); _local18 = _local14[(_local13 + 1)].clone(); _local19 = new Point(((_local17.x + _local18.x) / 2), ((_local17.y + _local18.y) / 2)); _local12.push(_local19); _local12.push(_local18); _local13++; }; _local15 = new Array(); _local13 = 0; while (_local13 <= _local10) { _local15.push(_local14[_local13].clone()); _local13++; }; for each (_local19 in _local12) { _local15.push(_local19.clone()); }; _local13 = (_local11 + 1); while (_local13 < _local14.length) { _local15.push(_local14[_local13].clone()); _local13++; }; _local3.lines[_local5].points = _local15; }; } static function DoesLibraryFilterListContain(_arg1:String):Boolean{ var _local2:String; for each (_local2 in libraryFilters) { if (_local2 == _arg1){ return (true); }; }; return (false); } static function UpdateScroll(){ var _local1:Number; var _local2:Number; var _local3:Number; if (KeyReader.Down(KeyReader.KEY_SHIFT) == false){ _local1 = 32; _local2 = 0; _local3 = 0; if (KeyReader.Down(KeyReader.KEY_CONTROL)){ _local1 = 4; }; if (KeyReader.Down(KeyReader.KEY_LEFT)){ _local2 = -(_local1); }; if (KeyReader.Down(KeyReader.KEY_RIGHT)){ _local2 = _local1; }; if (KeyReader.Down(KeyReader.KEY_UP)){ _local3 = -(_local1); }; if (KeyReader.Down(KeyReader.KEY_DOWN)){ _local3 = _local1; }; scrollX = (scrollX + _local2); scrollY = (scrollY + _local3); }; } static function NextLibrarySize(){ librarySizeIndex++; if (librarySizeIndex >= numLibrarySizes){ librarySizeIndex = 0; }; var _local1:Point = librarySizes[librarySizeIndex]; boxNumW = _local1.x; boxNumH = _local1.y; boxSizeW = (Defs.displayarea_w / boxNumW); boxSizeH = (Defs.displayarea_h / boxNumH); if (library_page > GetNumLibraryPages()){ library_page = (GetNumLibraryPages() - 1); }; GetLibraryPieces(); } static function GetLibraryPieces(){ var _local1:PhysObj; libraryPieces = new Array(); for each (_local1 in Game.physObjs.list) { if (((_local1.displayInLibrary) && (TestLibraryFilter(_local1.libraryClass)))){ libraryPieces.push(_local1); }; }; } static function Mapper_PutCell(_arg1:int, _arg2:int, _arg3:int){ var _local4:Level = GetCurrentLevel(); var _local5:int = ((_local4.mapMaxX - _local4.mapMinX) + 1); _arg1 = (_arg1 - _local4.mapMinX); _arg2 = (_arg2 - _local4.mapMinY); _local4.map[(_arg1 + (_arg2 * _local5))] = _arg3; } static function Mapper_GetCell(_arg1:int, _arg2:int):int{ var _local3:Level = GetCurrentLevel(); var _local4:int = ((_local3.mapMaxX - _local3.mapMinX) + 1); _arg1 = (_arg1 - _local3.mapMinX); _arg2 = (_arg2 - _local3.mapMinY); return (_local3.map[(_arg1 + (_arg2 * _local4))]); } static function Lines_ScrollToFirstPointOfSelectedLine(){ if (currentLineIndex == -1){ return; }; var _local1:Level = GetCurrentLevel(); var _local2:Array = _local1.lines[currentLineIndex].points; var _local3:Point = _local2[0]; scrollX = (_local3.x - (Defs.displayarea_w * 0.5)); scrollY = (_local3.y - (Defs.displayarea_h * 0.5)); } static function CountLibraryPieces():int{ var _local2:PhysObj; var _local1:int; for each (_local2 in Game.physObjs.list) { if (((_local2.displayInLibrary) && (TestLibraryFilter(_local2.libraryClass)))){ _local1++; }; }; return (_local1); } static function Mapper_Init(){ var _local1:Array; mapCols = new Array(); mapColNames = new Array(); mapCols.push(0); mapColNames.push("blank"); mapCols.push(0xFFFF00); mapColNames.push("rough01"); mapCols.push(0xFF00FF); mapColNames.push("water"); mapCols.push(0xFFFF); mapColNames.push("cliff"); mapCols.push(0xFF); mapColNames.push("undefined"); mapCols.push(0xFFFF00); mapColNames.push("undefined"); mapCols.push(0xFF00FF); mapColNames.push("undefined"); mapCols.push(0xFFFFFF); mapColNames.push("undefined"); mapCols.push(0xFF0000); mapColNames.push("undefined"); brushes = new Array(); _local1 = new Array(); _local1.push(new Point(0, 0)); brushes.push(_local1); _local1 = new Array(); _local1.push(new Point(0, 0)); _local1.push(new Point(1, 0)); _local1.push(new Point(0, 1)); _local1.push(new Point(1, 1)); brushes.push(_local1); _local1 = new Array(); _local1.push(new Point(0, 0)); _local1.push(new Point(-1, 0)); _local1.push(new Point(1, 0)); _local1.push(new Point(0, 1)); _local1.push(new Point(0, -1)); brushes.push(_local1); _local1 = new Array(); _local1.push(new Point(-1, 0)); _local1.push(new Point(0, 0)); _local1.push(new Point(1, 0)); _local1.push(new Point(-1, 1)); _local1.push(new Point(0, 1)); _local1.push(new Point(1, 1)); _local1.push(new Point(-1, -1)); _local1.push(new Point(0, -1)); _local1.push(new Point(1, -1)); brushes.push(_local1); mapper_currentCell = 1; mapper_brushType = 0; mapper_transparency = 2; } static function GetNumLibraryPages():int{ var _local1:int = (boxNumW * boxNumH); var _local2:int = CountLibraryPieces(); var _local3:int = (_local2 / _local1); var _local4:int = (_local2 % _local1); if (_local4 != 0){ _local3++; }; return (_local3); } static function Editor_RenderObjects(){ var _local3:PhysObj_Instance; var _local4:PhysObj; var _local1:Array = GetCurrentLevelInstances(); if (objectZSortMode){ _local1 = SortInstancesByZ(_local1); }; var _local2:BitmapData = Game.main.screenBD; for each (_local3 in _local1) { _local4 = Game.physObjs.FindByName(_local3.typeName); if (_local4 != null){ PhysObj.RenderAt(_local4, (_local3.x - scrollX), (_local3.y - scrollY), _local3.rot, _local2, linesScreen.graphics, true); }; }; } static function SnapToObjects(_arg1:Number, _arg2:Number):Point{ var _local3:PhysObj; var _local10:PhysEd_GuideLine; var _local11:Point; if (currentPieceList.length != 1){ return (null); }; var _local4:Object = currentPieceList[0]; _local3 = Game.physObjs.GetByIndex(_local4.id); if (_local3 == null){ return (null); }; var _local5:PhysObj_Instance = Game.CreatePhysObjInstanceAt(_local3.name, (_arg1 + _local4.xoff), (_arg2 + _local4.yoff), _local4.rot, ""); Editor_GetNearbyGuidelines(null, _arg1, _arg2, 20); var _local6:BitmapData = Game.main.screenBD; var _local7 = 99999999; var _local8:Number = _local7; var _local9:Number = _local7; for each (_local10 in guideLines) { if (_local10.type == 1){ if (Math.abs((_local10.x0 - _arg1)) < _local8){ _local8 = _local10.x0; }; } else { if (Math.abs((_local10.y0 - _arg2)) < _local9){ _local9 = _local10.y0; }; }; }; if (((!((_local8 == _local7))) && (!((_local9 == _local7))))){ _local11 = new Point(_local8, _local9); return (_local11); }; return (null); } static function RenderLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:uint, _arg6:Number=1, _arg7:Number=1){ var _local8:Number = 0; var _local9:Number = (_local8 + Defs.displayarea_w); if ((((_arg1 > _local9)) && ((_arg3 > _local9)))){ return; }; if ((((_arg1 < _local8)) && ((_arg3 < _local8)))){ return; }; var _local10:Number = 0; var _local11:Number = (_local10 + Defs.displayarea_h); if ((((_arg2 > _local11)) && ((_arg4 > _local11)))){ return; }; if ((((_arg2 < _local10)) && ((_arg4 < _local10)))){ return; }; var _local12:Graphics = linesScreen.graphics; _local12.lineStyle(_arg6, _arg5, _arg7); _local12.moveTo(_arg1, _arg2); _local12.lineTo(_arg3, _arg4); } public static function ExportLevelAsXml():String{ var _local4:int; var _local5:Array; var _local6:String; var _local7:Point; var _local8:PhysLine; var _local9:int; var _local10:int; var _local11:Boolean; var _local12:Boolean; var _local13:PhysObj_Instance; var _local14:PhysObj; var _local15:int; var _local16:int; var _local17:Array; var _local18:int; var _local19:int; var _local20:int; var _local21:int; var _local22:int; var _local23:String; var _local1:Level = GetCurrentLevel(); var _local2 = ""; var _local3 = ""; _local2 = (("<level name=\"" + _local1.name) + "\""); _local2 = (_local2 + ((" fillframe=\"" + _local1.fillFrame.toString()) + "\"")); _local2 = (_local2 + ((" surfaceframe=\"" + _local1.surfaceFrame.toString()) + "\"")); _local2 = (_local2 + ((" surfacethickness=\"" + _local1.surfaceThickness.toString()) + "\"")); _local2 = (_local2 + " >"); _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); for each (_local4 in _local1.helpscreenFrames) { _local2 = (("\t<helpscreen frame=\"" + _local4) + "\" />"); _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); }; _local5 = GetCurrentLevelInstances(); for each (_local6 in libraryFilters) { _local12 = false; for each (_local13 in _local5) { _local14 = Game.physObjs.FindByName(_local13.typeName); if (((!((_local14 == null))) && ((_local14.libraryClass == _local6)))){ _local12 = true; }; }; if (_local12){ _local2 = (("\t<objgroup name=\"" + _local6) + "\">"); _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); for each (_local13 in _local5) { _local14 = Game.physObjs.FindByName(_local13.typeName); if (((!((_local14 == null))) && ((_local14.libraryClass == _local6)))){ _local2 = (((((((((("\t\t<obj type=\"" + _local13.typeName) + "\" x=\"") + _local13.x) + "\" y=\"") + _local13.y) + "\" rot=\"") + _local13.rot) + "\" params=\"") + _local13.initParams) + "\" />"); _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); }; }; _local2 = "\t</objgroup>"; _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); }; }; for each (_local8 in _local1.lines) { _local2 = (((((((("<line type=\"" + _local8.type) + "\" name=\"") + _local8.name) + "\" fill=\"") + _local8.fill) + "\" fillscale=\"") + _local8.fillScaleX) + "\">"); _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); _local17 = _local8.points; _local18 = _local17.length; _local19 = 10; _local20 = (_local18 / _local19); _local21 = (_local18 % _local19); _local22 = 0; _local15 = 0; while (_local15 < _local20) { _local23 = "<points a=\""; _local16 = 0; while (_local16 < _local19) { var _temp1 = _local22; _local22 = (_local22 + 1); _local7 = _local17[_temp1]; _local23 = (_local23 + ((_local7.x + ",") + _local7.y)); if (_local16 != (_local19 - 1)){ _local23 = (_local23 + ", "); }; _local16++; }; _local23 = (_local23 + "\" />"); _local2 = _local23; _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); _local15++; }; if (_local21 != 0){ _local23 = "<points a=\""; _local16 = 0; while (_local16 < _local21) { var _temp2 = _local22; _local22 = (_local22 + 1); _local7 = _local17[_temp2]; _local23 = (_local23 + ((_local7.x + ",") + _local7.y)); if (_local16 != (_local21 - 1)){ _local23 = (_local23 + ", "); }; _local16++; }; _local23 = (_local23 + "\" />"); _local2 = _local23; _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); }; _local2 = "</line>"; _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); }; _local2 = "<map"; _local2 = (_local2 + ((" minx=\"" + _local1.mapMinX) + "\"")); _local2 = (_local2 + ((" maxx=\"" + _local1.mapMaxX) + "\"")); _local2 = (_local2 + ((" miny=\"" + _local1.mapMinY) + "\"")); _local2 = (_local2 + ((" maxy=\"" + _local1.mapMaxY) + "\"")); _local2 = (_local2 + ((" cellw=\"" + _local1.mapCellW) + "\"")); _local2 = (_local2 + ((" cellh=\"" + _local1.mapCellH) + "\"")); _local2 = (_local2 + " >"); _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); _local9 = _local1.map.length; _local10 = 0; _local11 = false; _local19 = 600; do { if (_local9 >= _local19){ _local2 = "<mapdata a=\""; _local15 = _local10; while (_local15 < (_local10 + _local19)) { _local2 = (_local2 + _local1.map[_local15].toString()); _local15++; }; _local2 = (_local2 + "\"/>"); _local3 = (_local3 + (_local2 + "\n")); _local10 = (_local10 + _local19); _local9 = (_local9 - _local19); } else { _local2 = "<mapdata a=\""; _local15 = _local10; while (_local15 < (_local10 + _local9)) { _local2 = (_local2 + _local1.map[_local15].toString()); _local15++; }; _local2 = (_local2 + "\"/>"); _local3 = (_local3 + (_local2 + "\n")); _local11 = true; }; } while (_local11 == false); _local2 = "</map>"; _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); _local2 = "</level>"; _local3 = (_local3 + (_local2 + "\n")); FlashConnect.trace(_local2); return (_local3); } static function Mapper_RenderMap(){ var _local3:int; var _local4:int; var _local8:int; if (mapper_transparency == 0){ return; }; var _local1:Number = Utils.ScaleTo(0, 1, 0, 5, mapper_transparency); var _local2:Level = GetCurrentLevel(); var _local5:Rectangle = new Rectangle(0, 0, (_local2.mapCellW - 1), (_local2.mapCellH - 1)); var _local6:int = ((_local2.mapMaxX - _local2.mapMinX) + 1); var _local7:int = ((_local2.mapMaxY - _local2.mapMinY) + 1); _local3 = 0; while (_local3 < _local7) { _local4 = 0; while (_local4 < _local6) { _local8 = _local2.map[((_local3 * _local6) + _local4)]; if (_local8 != 0){ _local5.x = (((_local4 + _local2.mapMinX) * _local2.mapCellW) - scrollX); _local5.y = (((_local3 + _local2.mapMinY) * _local2.mapCellH) - scrollY); FillRectangle(_local5, mapCols[_local8], 0, _local1); }; _local4++; }; _local3++; }; } static function Lines_Reverse(){ if (currentLineIndex == -1){ return; }; var _local1:Level = GetCurrentLevel(); var _local2:Array = _local1.lines[currentLineIndex].points; var _local3:Array = _local2.reverse(); _local1.lines[currentLineIndex].points = _local3; } static function SortInstancesByZ(_arg1:Array):Array{ var _local2:PhysObj_Instance; var _local3:PhysObj; var _local4:PhysObj_Graphic; var _local5:PhysObj_Body; for each (_local2 in _arg1) { _local2.sortZ = 0; _local3 = Game.physObjs.FindByName(_local2.typeName); for each (_local4 in _local3.graphics) { _local2.sortZ = _local4.zoffset; }; for each (_local5 in _local3.bodies) { for each (_local4 in _local5.graphics) { _local2.sortZ = _local4.zoffset; }; }; }; _arg1.sortOn("sortZ", (Array.NUMERIC | Array.DESCENDING)); return (_arg1); } static function Editor_RenderPickedObjectsHilight():void{ var _local3:Object; var _local4:PhysObj; var _local5:Number; var _local6:Number; var _local1:BitmapData = Game.main.screenBD; var _local2:Point = GetCurrentPieceInitialPos(); for each (_local3 in currentPieceList) { _local4 = Game.physObjs.GetByIndex(_local3.id); if (_local4 != null){ _local5 = _local3.origx; _local6 = _local3.origy; PhysObj.RenderOutline(_local4, (_local5 - scrollX), (_local6 - scrollY), 9, linesScreen.graphics); }; }; } static function RenderRectangle(_arg1:Rectangle, _arg2:uint, _arg3:Number=1, _arg4:Number=1){ var _local5:Number = 0; var _local6:Number = (_local5 + Defs.displayarea_w); if (_arg1.left > _local6){ return; }; if (_arg1.right < _local5){ return; }; var _local7:Number = 0; var _local8:Number = (_local7 + Defs.displayarea_h); if (_arg1.top > _local8){ return; }; if (_arg1.bottom < _local7){ return; }; RenderLine(_arg1.left, _arg1.top, _arg1.right, _arg1.top, _arg2, _arg3, _arg4); RenderLine(_arg1.left, _arg1.bottom, _arg1.right, _arg1.bottom, _arg2, _arg3, _arg4); RenderLine(_arg1.left, _arg1.top, _arg1.left, _arg1.bottom, _arg2, _arg3, _arg4); RenderLine(_arg1.right, _arg1.top, _arg1.right, _arg1.bottom, _arg2, _arg3, _arg4); } static function Lines_SelectPoint(_arg1:Number, _arg2:Number){ var _local5:PhysLine; var _local6:int; var _local7:Point; var _local3:Level = GetCurrentLevel(); var _local4:int; currentLineIndex = -1; currentPointIndex = -1; for each (_local5 in _local3.lines) { _local6 = 0; for each (_local7 in _local5.points) { if (Utils.DistBetweenPoints(_local7.x, _local7.y, _arg1, _arg2) < 3){ currentLineIndex = _local4; currentPointIndex = _local6; return; }; _local6++; }; _local4++; }; } static function RemoveFromLevelInstances(_arg1:PhysObj_Instance){ var _local4:PhysObj_Instance; var _local2:Array = GetCurrentLevelInstances(); var _local3:Array = new Array(); for each (_local4 in _local2) { if (_local4 == _arg1){ } else { _local3.push(_local4); }; }; _local2 = _local3; Game.levels[currentLevel].instances = _local2; } static function Lines_GetCurrentPointUnderCursor(_arg1:Number, _arg2:Number){ var _local5:PhysLine; var _local6:int; var _local7:Point; var _local3:Level = GetCurrentLevel(); var _local4:int; hoverLineIndex = -1; hoverPointIndex = -1; for each (_local5 in _local3.lines) { _local6 = 0; for each (_local7 in _local5.points) { if (Utils.DistBetweenPoints(_local7.x, _local7.y, _arg1, _arg2) < 3){ hoverLineIndex = _local4; hoverPointIndex = _local6; return; }; _local6++; }; _local4++; }; } static function ObjCol_Init(){ objCol_points = new Array(); objCol_index = 0; objCol_ShowOtherCol = true; } static function TestLibraryFilter(_arg1:String):Boolean{ if (libraryFilter == ""){ return (true); }; if (libraryFilter == _arg1){ return (true); }; return (false); } static function Library_PickPiece(){ var _local1:int = MouseControl.x; var _local2:int = MouseControl.y; var _local3:int = (_local1 / boxSizeW); var _local4:int = (_local2 / boxSizeH); var _local5:int = (_local3 + (_local4 * boxNumW)); var _local6:int = (boxNumW * boxNumH); _local5 = (_local5 + (library_page * _local6)); var _local7:int = (libraryPieces.length - 1); if (_local5 > _local7){ _local5 = _local7; }; var _local8:PhysObj = libraryPieces[_local5]; ClearCurrentPieces(); AddCurrentPiece(Game.physObjs.FindIndexByName(_local8.name), 0, 0, 0); } static function Editor_RenderLineToCursor(){ if (addlineActive == false){ return; }; var _local1:Level = GetCurrentLevel(); if (currentLineIndex == -1){ return; }; var _local2:PhysLine = _local1.lines[currentLineIndex]; var _local3:int = MouseControl.x; var _local4:int = MouseControl.y; var _local5:int = (_local2.points.length - 1); var _local6:Point = _local2.points[_local5].clone(); _local2.points[_local5].clone().x = (_local6.x - scrollX); _local6.y = (_local6.y - scrollY); var _local7:BitmapData = Game.main.screenBD; RenderLine(_local3, _local4, _local6.x, _local6.y, 4278255615); } static function ObjCol_Trace(){ var _local3:Point; var _local1 = "vertices=\""; var _local2:int; for each (_local3 in objCol_points) { _local1 = (_local1 + ((int(_local3.x) + ",") + int(_local3.y))); _local2++; if (_local2 == objCol_points.length){ _local1 = (_local1 + "\""); } else { _local1 = (_local1 + ", "); }; }; FlashConnect.trace(_local1); System.setClipboard(_local1); } static function Lines_SelectLine(_arg1:Number, _arg2:Number){ var _local5:PhysLine; var _local6:Point; var _local3:Level = GetCurrentLevel(); var _local4:int; currentLineIndex = -1; for each (_local5 in _local3.lines) { for each (_local6 in _local5.points) { if (Utils.DistBetweenPoints(_local6.x, _local6.y, _arg1, _arg2) < 3){ currentLineIndex = _local4; return; }; }; _local4++; }; } static function Lines_ChangeType(){ if (currentLineIndex == -1){ return; }; var _local1:Level = GetCurrentLevel(); var _local2:PhysLine = _local1.lines[currentLineIndex]; _local2.type++; if (_local2.type >= lineTypes.length){ _local2.type = 0; }; newLineType = _local2.type; } static function ObjCol_Reset(){ objCol_points = new Array(); } static function Lines_MovePoints(_arg1:Number, _arg2:Number){ var _local6:Number; var _local7:Point; if (currentLineIndex == -1){ return; }; var _local3:Level = GetCurrentLevel(); var _local4:Array = _local3.lines[currentLineIndex].points; var _local5:Number = 100; for each (_local7 in _local4) { _local6 = Utils.DistBetweenPoints(_local7.x, _local7.y, _arg1, _arg2); if (_local6 < _local5){ _local6 = (_local5 - _local6); _local6 = Utils.ScaleTo(0, 5, 0, _local5, _local6); if (_local7.y < _arg2){ _local7.y = (_local7.y - _local6); } else { if (_local7.y > _arg2){ _local7.y = (_local7.y + _local6); }; }; }; }; } static function EditorWheelHandler(_arg1:int){ var _local2:int; if (editMode == editMode_Normal){ if (_arg1 > 0){ IncCurrentPiece(); }; if (_arg1 < 0){ DecCurrentPiece(); }; }; if (editMode == editMode_Map){ if (_arg1 > 0){ Mapper_IncCurrentCell(); }; if (_arg1 < 0){ Mapper_DecCurrentCell(); }; }; if (editMode == editMode_Adjust){ if (currentAdjustObject != null){ if (_arg1 > 0){ UndoTakeSnapshot(); _local2 = Game.physObjs.FindIndexByName(currentAdjustObject.typeName); _local2++; if (_local2 >= Game.physObjs.GetNum()){ _local2 = 0; }; currentAdjustObject.typeName = Game.physObjs.GetByIndex(_local2).name; }; if (_arg1 < 0){ UndoTakeSnapshot(); _local2 = Game.physObjs.FindIndexByName(currentAdjustObject.typeName); _local2--; if (_local2 < 0){ _local2 = (Game.physObjs.GetNum() - 1); }; currentAdjustObject.typeName = Game.physObjs.GetByIndex(_local2).name; }; }; }; if (editMode == editMode_Library){ if (_arg1 > 0){ library_page++; if (library_page >= GetNumLibraryPages()){ library_page = 0; }; }; if (_arg1 < 0){ library_page--; if (library_page < 0){ library_page = (GetNumLibraryPages() - 1); }; }; }; } public static function UndoTakeSnapshot(){ var _local5:PhysLine; var _local6:Array; var _local7:PhysObj_Instance; var _local8:PhysLine; var _local9:PhysObj_Instance; var _local1:Level = GetCurrentLevel(); var _local2:Object = new Object(); var _local3:Array = new Array(); var _local4:Array = new Array(); for each (_local5 in _local1.lines) { _local8 = _local5.Clone(); _local3.push(_local8); }; _local2.lines = _local3; _local6 = GetCurrentLevelInstances(); for each (_local7 in _local6) { _local9 = _local7.Clone(); _local4.push(_local9); }; _local2.objects = _local4; undoList.push(_local2); } static function GenerateFloorTileGrid(){ var _local2:int; var _local3:int; var _local1:Array = GetCurrentLevelInstances(); _local2 = 0; while (_local2 < 3000) { _local3 = -2000; while (_local3 < 2000) { _local1.push(Game.CreatePhysObjInstanceAt("floortile01", _local2, _local3, 0, "")); _local3 = (_local3 + 104); }; _local2 = (_local2 + 160); }; SetCurrentLevelInstances(_local1); } static function RenderBackground(_arg1:BitmapData){ } static function GetCurrentLevelInstances():Array{ return (Game.levels[currentLevel].instances); } public static function InitEditor(_arg1:Number, _arg2:Number):void{ Mouse.show(); Game.InitBox2D(); GameObjects.ClearAll(); updateTimer = 0; editMode = editMode_Normal; currentLineIndex = -1; currentPointIndex = -1; currentPieceList = new Array(); AddCurrentPiece(0, 0, 0, 0, 0, 0); currentLevel = Game.currentLevel; var _local3:Level = GetCurrentLevel(); currentLineIndex = (_local3.lines.length - 1); MouseControl.SetWheelHandler(EditorWheelHandler); InitLibraryFilter(); lineTypes = new Array(); lineColors = new Array(); lineTypes.push("wall"); lineColors.push(0xFFFFFF); lineTypes.push("route"); lineColors.push(2105599); lineTypes.push("checkpoint"); lineColors.push(0xFFFF00); lineTypes.push("jump"); lineColors.push(0xFF0000); lineTypes.push("hump"); lineColors.push(16744576); lineTypes.push("routechange"); lineColors.push(0xFF00FF); lineTypes.push("bigjump"); lineColors.push(16744703); newLineType = 0; undoList = new Array(); linesScreen = new MovieClip(); linesScreen.graphics.clear(); addlineActive = false; hoverLineIndex = -1; hoverPointIndex = -1; scrollX = _arg1; scrollY = _arg2; Mapper_Init(); } static function Mapper_IncCurrentCell(){ mapper_currentCell++; if (mapper_currentCell >= mapCols.length){ mapper_currentCell = 0; }; } static function InitLibraryFilter(){ var _local1:PhysObj; var _local2:String; libraryFilterIndex = -1; libraryFilter = ""; libraryFilters = new Array(); libraryFilters.push(""); librarySizeIndex = -1; librarySizes = new Array(); librarySizes.push(new Point(5, 4), new Point(7, 5), new Point(9, 7), new Point(12, 10)); numLibrarySizes = librarySizes.length; for each (_local1 in Game.physObjs.list) { if (_local1.displayInLibrary){ if (DoesLibraryFilterListContain(_local1.libraryClass) == false){ libraryFilters.push(_local1.libraryClass); }; }; }; for each (_local2 in libraryFilters) { FlashConnect.trace(("filter: " + _local2)); }; NextLibraryFilter(); NextLibrarySize(); } public static function UpdateEditor():void{ var _local7:PhysObj; var _local9:String; var _local10:PhysObj_Instance; var _local11:Point; 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:Point; var _local21:Object; var _local22:Array; var _local23:Number; var _local24:Number; var _local25:String; var _local26:Point; updateTimer++; var _local1:int = MouseControl.x; var _local2:int = MouseControl.y; if (gridMode_active){ _local1 = Math.floor(_local1); _local2 = Math.floor(_local2); _local1 = (int((_local1 / gridsnap)) * int(gridsnap)); _local2 = (int((_local2 / gridsnap)) * int(gridsnap)); }; var _local3:Number = scrollX; var _local4:Number = scrollY; if (gridMode_active){ _local3 = Math.floor(_local3); _local4 = Math.floor(_local4); _local3 = (int((_local3 / gridsnap)) * int(gridsnap)); _local4 = (int((_local4 / gridsnap)) * int(gridsnap)); }; var _local5:int = (_local1 + _local3); var _local6:int = (_local2 + _local4); var _local8:Level = GetCurrentLevel(); Lines_GetCurrentPointUnderCursor(_local5, _local6); if (editMode == editMode_Commands){ if (KeyReader.Pressed(KeyReader.KEY_1)){ editMode = editMode_Normal; }; if (KeyReader.Pressed(KeyReader.KEY_2)){ editMode = editMode_Library; }; if (KeyReader.Pressed(KeyReader.KEY_3)){ editMode = editMode_Map; }; if (KeyReader.Pressed(KeyReader.KEY_4)){ ObjCol_Init(); editMode = editMode_ObjCol; }; if (KeyReader.Pressed(KeyReader.KEY_5)){ currentAdjustObject = null; editMode = editMode_Adjust; }; if (KeyReader.Pressed(KeyReader.KEY_6)){ editMode = editMode_Lines; }; if (KeyReader.Pressed(KeyReader.KEY_7)){ editMode = editMode_PickPiece; ClearCurrentPieces(); }; if (KeyReader.Pressed(KeyReader.KEY_SPACE)){ editMode = editMode_Commands1; }; return; }; if (editMode == editMode_Commands1){ if (KeyReader.Pressed(KeyReader.KEY_9)){ Game.StartLevelPlay(); return; }; if (KeyReader.Pressed(KeyReader.KEY_4)){ _local9 = ExportLevelAsXml(); ExternalData.OutputString(_local9); editMode = prevEditMode; }; if (KeyReader.Pressed(KeyReader.KEY_5)){ ExportAllLevelsAsXml(); editMode = prevEditMode; }; if (KeyReader.Pressed(KeyReader.KEY_SPACE)){ editMode = editMode_GridCommands; }; return; }; if (editMode == editMode_GridCommands){ if (KeyReader.Pressed(KeyReader.KEY_1)){ gridMode_active = (gridMode_active == false); }; if (KeyReader.Pressed(KeyReader.KEY_2)){ gridMode_renderGrid = (gridMode_renderGrid == false); }; if (KeyReader.Pressed(KeyReader.KEY_3)){ objectZSortMode = (objectZSortMode == false); }; if (KeyReader.Pressed(KeyReader.KEY_4)){ renderMiniMap = (renderMiniMap == false); }; if (KeyReader.Pressed(KeyReader.KEY_5)){ renderObjects = (renderObjects == false); }; if (KeyReader.Pressed(KeyReader.KEY_9)){ GenerateFloorTileGrid(); }; if (KeyReader.Pressed(KeyReader.KEY_SPACE)){ editMode = prevEditMode; }; return; }; if (KeyReader.Pressed(KeyReader.KEY_X)){ DoUndo(); }; if (KeyReader.Pressed(KeyReader.KEY_SPACE)){ prevEditMode = editMode; editMode = editMode_Commands; }; if (editMode == editMode_ObjCol){ if (KeyReader.Pressed(KeyReader.KEY_1)){ ObjCol_Reset(); }; if (KeyReader.Pressed(KeyReader.KEY_2)){ ObjCol_ToggleDisplay(); }; if (KeyReader.Pressed(KeyReader.KEY_3)){ ObjCol_Trace(); }; if (KeyReader.Pressed(KeyReader.KEY_4)){ DecCurrentPiece(); ObjCol_Reset(); }; if (KeyReader.Pressed(KeyReader.KEY_5)){ IncCurrentPiece(); ObjCol_Reset(); }; if (MouseControl.buttonPressed){ MouseControl.buttonPressed = false; ObjCol_AddPoint(); ObjCol_Trace(); }; }; if (editMode == editMode_Library){ if (MouseControl.buttonPressed){ MouseControl.buttonPressed = false; Library_PickPiece(); editMode = editMode_Normal; }; if (KeyReader.Pressed(KeyReader.KEY_DOWN)){ library_page++; if (library_page >= GetNumLibraryPages()){ library_page = 0; }; }; if (KeyReader.Pressed(KeyReader.KEY_UP)){ library_page--; if (library_page < 0){ library_page = (GetNumLibraryPages() - 1); }; }; if (KeyReader.Pressed(KeyReader.KEY_1)){ NextLibraryFilter(); }; if (KeyReader.Pressed(KeyReader.KEY_2)){ NextLibrarySize(); }; return; }; if (editMode == editMode_PickPiece){ if (MouseControl.buttonPressed){ MouseControl.buttonPressed = false; _local10 = HitTestPhysObjGraphics(_local1, _local2); if (_local10){ if (KeyReader.Down(KeyReader.KEY_CONTROL)){ if (currentPieceList.length == 0){ AddCurrentPiece(Game.physObjs.FindIndexByName(_local10.typeName), 0, 0, 0, _local10.x, _local10.y); } else { _local11 = GetCurrentPieceInitialPos(); AddCurrentPiece(Game.physObjs.FindIndexByName(_local10.typeName), 0, (_local10.x - _local11.x), (_local10.y - _local11.y), _local10.x, _local10.y); }; } else { AddCurrentPiece(Game.physObjs.FindIndexByName(_local10.typeName), 0, 0, 0, _local10.x, _local10.y); editMode = editMode_Normal; }; }; }; UpdateScroll(); return; }; if (editMode == editMode_Adjust){ if (MouseControl.buttonPressed){ MouseControl.buttonPressed = false; _local10 = HitTestPhysObjGraphics(_local1, _local2); if (_local10){ currentAdjustObject = _local10; } else { currentAdjustObject = null; }; }; if (currentAdjustObject != null){ _local12 = 1; _local13 = 1; _local14 = 0; _local15 = 0; _local16 = 0; if (KeyReader.Down(KeyReader.KEY_CONTROL)){ _local12 = (_local12 * 10); _local13 = (_local13 * 10); }; if (KeyReader.Down(KeyReader.KEY_SHIFT)){ if (KeyReader.Down(KeyReader.KEY_LEFT)){ _local15 = -(_local12); }; if (KeyReader.Down(KeyReader.KEY_RIGHT)){ _local15 = _local12; }; if (KeyReader.Down(KeyReader.KEY_UP)){ _local16 = -(_local12); }; if (KeyReader.Down(KeyReader.KEY_DOWN)){ _local16 = _local12; }; if (((!((_local15 == 0))) || (!((_local16 == 0))))){ UndoTakeSnapshot(); }; currentAdjustObject.x = (currentAdjustObject.x + _local15); currentAdjustObject.y = (currentAdjustObject.y + _local16); }; if (KeyReader.Down(KeyReader.KEY_6)){ _local14 = -(_local13); }; if (KeyReader.Down(KeyReader.KEY_7)){ _local14 = _local13; }; if (_local14 != 0){ UndoTakeSnapshot(); }; currentAdjustObject.rot = (currentAdjustObject.rot + _local14); if (KeyReader.Pressed(KeyReader.KEY_1)){ UndoTakeSnapshot(); RemoveFromLevelInstances(currentAdjustObject); currentAdjustObject = null; }; }; UpdateScroll(); return; }; if (editMode == editMode_Lines){ if (MouseControl.buttonPressed){ MouseControl.buttonPressed = false; if (KeyReader.Down(KeyReader.KEY_7)){ UndoTakeSnapshot(); Lines_MovePoints(_local5, _local6); return; }; if (KeyReader.Down(KeyReader.KEY_5)){ UndoTakeSnapshot(); addlineActive = true; currentPointIndex = -1; Lines_NewLine(); Lines_AddPoint(_local5, _local6); return; }; if (addlineActive){ UndoTakeSnapshot(); Lines_AddPoint(_local5, _local6); }; }; if (KeyReader.Pressed(KeyReader.KEY_1)){ Lines_SelectLine(_local5, _local6); return; }; if (KeyReader.Pressed(KeyReader.KEY_D)){ UndoTakeSnapshot(); Lines_DeleteSelectedLine(); return; }; if (KeyReader.Pressed(KeyReader.KEY_2)){ UndoTakeSnapshot(); Lines_DeletePoint(_local5, _local6); return; }; if (KeyReader.Pressed(KeyReader.KEY_3)){ UndoTakeSnapshot(); Lines_InsertPoint(_local5, _local6); return; }; if (KeyReader.Pressed(KeyReader.KEY_4)){ Lines_SelectPoint(_local5, _local6); return; }; if (KeyReader.Pressed(KeyReader.KEY_6)){ UndoTakeSnapshot(); Lines_Subdivide(_local5, _local6); return; }; if (KeyReader.Pressed(KeyReader.KEY_8)){ UndoTakeSnapshot(); Lines_ChangeType(); return; }; if (KeyReader.Pressed(KeyReader.KEY_9)){ addlineActive = (addlineActive == false); return; }; if (KeyReader.Pressed(KeyReader.KEY_R)){ UndoTakeSnapshot(); Lines_Reverse(); return; }; if (KeyReader.Pressed(KeyReader.KEY_LEFTSQUAREBRACKET)){ Lines_ScrollToFirstPointOfSelectedLine(); }; if (KeyReader.Pressed(KeyReader.KEY_RIGHTSQUAREBRACKET)){ Lines_ScrollToLastPointOfSelectedLine(); }; if (currentLineIndex != -1){ _local17 = 1; _local18 = 0; _local19 = 0; if (KeyReader.Down(KeyReader.KEY_CONTROL)){ _local17 = (_local17 * 10); }; if (KeyReader.Down(KeyReader.KEY_SHIFT)){ if (KeyReader.Down(KeyReader.KEY_LEFT)){ _local18 = -(_local17); }; if (KeyReader.Down(KeyReader.KEY_RIGHT)){ _local18 = _local17; }; if (KeyReader.Down(KeyReader.KEY_UP)){ _local19 = -(_local17); }; if (KeyReader.Down(KeyReader.KEY_DOWN)){ _local19 = _local17; }; }; if (KeyReader.Down(KeyReader.KEY_SHIFT)){ _local18 = (_local18 + MouseControl.dx); _local19 = (_local19 + MouseControl.dy); MouseControl.ResetDxDy(); }; if (((!((_local18 == 0))) || (!((_local19 == 0))))){ UndoTakeSnapshot(); }; if (currentPointIndex == -1){ for each (_local20 in _local8.lines[currentLineIndex].points) { _local20.x = (_local20.x + _local18); _local20.y = (_local20.y + _local19); }; } else { _local20 = _local8.lines[currentLineIndex].points[currentPointIndex]; _local8.lines[currentLineIndex].points[currentPointIndex].x = (_local20.x + _local18); _local20.y = (_local20.y + _local19); }; }; UpdateScroll(); return; }; if (editMode == editMode_ObjCol){ if (currentPieceList.length == 1){ _local21 = currentPieceList[0]; _local7 = Game.physObjs.GetByIndex(_local21.id); }; }; if (editMode == editMode_Map){ if (MouseControl.buttonPressed){ Mapper_PlotCell(mapper_currentCell); }; if (KeyReader.Down(KeyReader.KEY_1) == true){ Mapper_PlotCell(0); }; if (KeyReader.Pressed(KeyReader.KEY_2) == true){ Mapper_DecCurrentCell(); }; if (KeyReader.Pressed(KeyReader.KEY_3) == true){ Mapper_IncCurrentCell(); }; if (KeyReader.Pressed(KeyReader.KEY_4) == true){ Mapper_Fill(mapper_currentCell); }; if (KeyReader.Pressed(KeyReader.KEY_5) == true){ Mapper_CycleBrush(); }; if (KeyReader.Pressed(KeyReader.KEY_6) == true){ Mapper_CycleTransparency(); }; UpdateScroll(); }; if (editMode == editMode_Normal){ if (KeyReader.Down(KeyReader.KEY_SHIFT) == true){ if (KeyReader.Pressed(KeyReader.KEY_UP)){ UndoTakeSnapshot(); IncCurrentPiece(); }; if (KeyReader.Pressed(KeyReader.KEY_DOWN)){ UndoTakeSnapshot(); DecCurrentPiece(); }; _local13 = 1; if (KeyReader.Down(KeyReader.KEY_CONTROL) == false){ _local13 = (_local13 * 10); }; if (KeyReader.Down(KeyReader.KEY_LEFT)){ UndoTakeSnapshot(); CurrenPiece_AddRot(-(_local13)); }; if (KeyReader.Down(KeyReader.KEY_RIGHT)){ UndoTakeSnapshot(); CurrenPiece_AddRot(_local13); }; }; if (MouseControl.buttonPressed){ MouseControl.buttonPressed = false; UndoTakeSnapshot(); _local22 = GetCurrentLevelInstances(); _local23 = _local5; _local24 = _local6; for each (_local21 in currentPieceList) { _local7 = Game.physObjs.GetByIndex(_local21.id); _local25 = _local7.name; if (KeyReader.Down(KeyReader.KEY_1)){ _local26 = SnapToObjects(_local5, _local6); if (_local26 != null){ FlashConnect.trace(((((((("snapped to point :" + _local5) + " ") + _local6) + " -> ") + _local26.x) + " ") + _local26.y)); _local23 = _local26.x; _local24 = _local26.y; }; }; _local22.push(Game.CreatePhysObjInstanceAt(_local25, (_local23 + _local21.xoff), (_local24 + _local21.yoff), _local21.rot, "")); SetCurrentLevelInstances(_local22); }; }; UpdateScroll(); }; } static function mapper_ExpandMap(_arg1:int, _arg2:int){ var _local3:Array; var _local11:int; var _local16:int; var _local17:int; var _local18:int; var _local4:Level = GetCurrentLevel(); var _local5:int = _local4.mapMinX; var _local6:int = _local4.mapMaxX; var _local7:int = _local4.mapMinY; var _local8:int = _local4.mapMaxY; var _local9:int; var _local10:int; if (_arg1 < _local4.mapMinX){ _local5 = _arg1; }; if (_arg2 < _local4.mapMinY){ _local7 = _arg2; }; if (_arg1 > _local4.mapMaxX){ _local6 = _arg1; }; if (_arg2 > _local4.mapMaxY){ _local8 = _arg2; }; _local9 = (_local5 - _local4.mapMinX); _local10 = (_local7 - _local4.mapMinY); var _local12:int = ((_local6 - _local5) + 1); var _local13:int = ((_local8 - _local7) + 1); var _local14:int = ((_local4.mapMaxX - _local4.mapMinX) + 1); var _local15:int = ((_local4.mapMaxY - _local4.mapMinY) + 1); _local3 = new Array((_local12 * _local13)); _local11 = 0; while (_local11 < (_local12 * _local13)) { _local3[_local11] = 0; _local11++; }; _local16 = 0; while (_local16 < _local15) { _local17 = 0; while (_local17 < _local14) { _local18 = _local4.map[(_local17 + (_local16 * _local14))]; _local3[((_local17 - _local9) + ((_local16 - _local10) * _local12))] = _local18; _local17++; }; _local16++; }; _local4.mapMinX = _local5; _local4.mapMaxX = _local6; _local4.mapMinY = _local7; _local4.mapMaxY = _local8; _local4.map = _local3; } static function Mapper_PutFillCell(_arg1:int, _arg2:int, _arg3:int, _arg4:Array){ var _local5:Level = GetCurrentLevel(); if (_arg1 < _local5.mapMinX){ return; }; if (_arg2 < _local5.mapMinY){ return; }; if (_arg1 > _local5.mapMaxX){ return; }; if (_arg2 > _local5.mapMaxY){ return; }; var _local6:int = ((_local5.mapMaxX - _local5.mapMinX) + 1); _arg1 = (_arg1 - _local5.mapMinX); _arg2 = (_arg2 - _local5.mapMinY); var _local7:int = _local5.map[(_arg1 + (_arg2 * _local6))]; if (_local7 != fillOrigCell){ return; }; _local5.map[(_arg1 + (_arg2 * _local6))] = _arg3; _arg1 = (_arg1 + _local5.mapMinX); _arg2 = (_arg2 + _local5.mapMinY); var _local8:Object = new Object(); _local8.x = _arg1; _local8.y = _arg2; _arg4.push(_local8); } static function NextLibraryFilter(){ libraryFilterIndex++; if (libraryFilterIndex >= libraryFilters.length){ libraryFilterIndex = 0; }; libraryFilter = libraryFilters[libraryFilterIndex]; library_page = 0; GetLibraryPieces(); } static function RenderEditor(){ var _local1:int; var _local2:int; var _local3:Number; var _local4:String; var _local12:int; var _local13:int; var _local14:int; var _local15:int; var _local16:int; var _local17:int; var _local18:int; var _local19:int; var _local20:int; var _local21:PhysObj; var _local22:Object; var _local23:Point; var _local24:Point; var _local25:PhysObj; linesScreen.graphics.clear(); var _local5:BitmapData = Game.main.screenBD; var _local6:int = MouseControl.x; var _local7:int = MouseControl.y; if (gridMode_active){ _local6 = Math.floor(_local6); _local7 = Math.floor(_local7); _local6 = (int((_local6 / gridsnap)) * int(gridsnap)); _local7 = (int((_local7 / gridsnap)) * int(gridsnap)); }; var _local8:Number = scrollX; var _local9:Number = scrollY; if (gridMode_active){ _local8 = Math.floor(_local8); _local9 = Math.floor(_local9); _local8 = (int((_local8 / gridsnap)) * int(gridsnap)); _local9 = (int((_local9 / gridsnap)) * int(gridsnap)); }; var _local10:int = (_local6 + _local8); var _local11:int = (_local7 + _local9); if (editMode == editMode_Commands){ _local5.fillRect(Defs.screenRect, 4285542576); }; if (editMode == editMode_Commands1){ _local5.fillRect(Defs.screenRect, 4285542592); }; if (editMode == editMode_GridCommands){ _local5.fillRect(Defs.screenRect, 4285542592); }; if (editMode == editMode_Library){ _local5.fillRect(Defs.screenRect, 4284498112); _local12 = 0; _local13 = 0; _local12 = 0; while (_local12 < Defs.displayarea_w) { RenderLine(_local12, 0, _local12, 640, 4282433600); _local12 = (_local12 + boxSizeW); }; _local12 = 0; while (_local12 < Defs.displayarea_h) { RenderLine(0, _local12, 640, _local12, 4282433600); _local12 = (_local12 + boxSizeH); }; _local14 = (boxNumW * boxNumH); _local15 = (library_page * _local14); _local16 = (_local15 + (_local14 - 1)); _local12 = 0; _local13 = 0; _local17 = Game.physObjs.GetNum(); _local18 = 0; _local19 = 0; _local20 = 0; for each (_local21 in libraryPieces) { if ((((_local18 >= _local15)) && ((_local18 <= _local16)))){ PhysObj.RenderAt(_local21, (_local12 + (boxSizeW / 2)), (_local13 + (boxSizeH / 2)), 0, _local5, linesScreen.graphics, true, 1, new Rectangle((_local12 + 8), (_local13 + 8), (boxSizeW - 16), (boxSizeH - 16))); _local4 = _local21.name; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, (_local12 + 8), ((_local13 + boxSizeH) - 16), _local4, null); _local12 = (_local12 + boxSizeW); _local19++; if (_local19 >= boxNumW){ _local12 = 0; _local13 = (_local13 + boxSizeH); _local19 = 0; }; }; _local18++; }; }; if (editMode == editMode_PickPiece){ _local5.fillRect(Defs.screenRect, 4281549909); RenderBackground(_local5); if (renderObjects){ Editor_RenderObjects(); Editor_RenderPickedObjectsHilight(); }; if (renderMiniMap){ Editor_RenderMiniMap(); }; Editor_RenderLines(); }; if (editMode == editMode_ObjCol){ if (currentPieceList.length == 1){ _local5.fillRect(Defs.screenRect, 4282668390); _local22 = currentPieceList[0]; _local25 = Game.physObjs.GetByIndex(_local22.id); PhysObj.RenderAt(_local25, (Defs.displayarea_w / 2), (Defs.displayarea_h / 2), 0, _local5, linesScreen.graphics, objCol_ShowOtherCol); for each (_local23 in objCol_points) { _local24 = _local23.clone(); _local23.clone().x = (_local24.x + (Defs.displayarea_w / 2)); _local24.y = (_local24.y + (Defs.displayarea_h / 2)); Utils.RenderCircle(_local5, _local24.x, _local24.y, 5, 4294901760); }; }; }; if (editMode == editMode_Normal){ _local5.fillRect(Defs.screenRect, 4282668390); RenderBackground(_local5); if (renderObjects){ Editor_RenderObjects(); }; if (renderMiniMap){ Editor_RenderMiniMap(); }; Editor_RenderLines(); for each (_local22 in currentPieceList) { _local25 = Game.physObjs.GetByIndex(_local22.id); PhysObj.RenderAt(_local25, ((_local10 - scrollX) + _local22.xoff), ((_local11 - scrollY) + _local22.yoff), _local22.rot, _local5, linesScreen.graphics, true); if (_local25 != null){ }; }; Editor_RenderGrid(_local5); }; if (editMode == editMode_Map){ _local5.fillRect(Defs.screenRect, 4282668390); RenderBackground(_local5); if (renderObjects){ Editor_RenderObjects(); }; if (renderMiniMap){ Editor_RenderMiniMap(); }; Editor_RenderLines(); Mapper_RenderMap(); Mapper_RenderCursor(); }; if (editMode == editMode_Adjust){ _local5.fillRect(Defs.screenRect, 4282668390); RenderBackground(_local5); if (renderObjects){ Editor_RenderObjects_AdjustMode(); }; if (renderMiniMap){ Editor_RenderMiniMap(); }; Editor_RenderLines(); if (currentAdjustObject != null){ Editor_GetNearbyGuidelines(currentAdjustObject, 0, 0); Editor_RenderNearbyGuidelines(); }; Editor_RenderGrid(_local5); }; if (editMode == editMode_Lines){ _local5.fillRect(Defs.screenRect, 4282668390); RenderBackground(_local5); if (renderObjects){ Editor_RenderObjects(); }; if (renderMiniMap){ Editor_RenderMiniMap(); }; Editor_RenderLines(); Editor_RenderLineToCursor(); Editor_RenderGrid(_local5); }; _local5.draw(linesScreen); RenderPanel_Editor(); } static function IncCurrentPiece(){ var _local1:Object; for each (_local1 in currentPieceList) { _local1.id++; if (_local1.id > (Game.physObjs.GetNum() - 1)){ _local1.id = 0; }; }; } static function Mapper_CycleBrush(){ mapper_brushType++; if (mapper_brushType >= brushes.length){ mapper_brushType = 0; }; } static function GetLineTypeString(_arg1:int):String{ if (_arg1 < 0){ return ("UNDEFINED"); }; if (_arg1 >= lineTypes.length){ return ("UNDEFINED"); }; return (lineTypes[_arg1]); } static function Lines_InsertPoint(_arg1:Number, _arg2:Number){ var _local7:PhysLine; var _local8:int; var _local9:Point; var _local10:Array; var _local11:Point; var _local12:Point; var _local13:Point; var _local3:Level = GetCurrentLevel(); var _local4:int; var _local5 = -1; var _local6 = -1; for each (_local7 in _local3.lines) { _local8 = 0; for each (_local9 in _local7.points) { if (Utils.DistBetweenPoints(_local9.x, _local9.y, _arg1, _arg2) < 3){ _local5 = _local4; _local6 = _local8; }; _local8++; }; _local4++; }; if (((!((_local5 == -1))) && (!((_local6 == -1))))){ _local10 = _local3.lines[_local5].points; if (_local6 == (_local10.length - 1)){ return; }; _local11 = _local10[_local6].clone(); _local12 = _local10[(_local6 + 1)].clone(); _local13 = new Point(0, 0); _local13.x = ((_local11.x + _local12.x) * 0.5); _local13.y = ((_local11.y + _local12.y) * 0.5); _local10.splice((_local6 + 1), 0, _local13); _local3.lines[_local5].points = _local10; }; } static function Editor_RenderMiniMap(){ var _local4:PhysObj_Instance; var _local5:PhysObj; var _local1:Number = (1 / 20); var _local2:Array = GetCurrentLevelInstances(); var _local3:BitmapData = Game.main.screenBD; for each (_local4 in _local2) { _local5 = Game.physObjs.FindByName(_local4.typeName); if (_local5 != null){ PhysObj.RenderAt(_local5, (_local4.x - scrollX), ((_local4.y - scrollY) + (240 / _local1)), _local4.rot, _local3, linesScreen.graphics, false, _local1); }; }; } static function Mapper_RenderCursor(){ var _local3:Point; var _local4:int; var _local5:int; var _local1:Level = GetCurrentLevel(); var _local2:Array = brushes[mapper_brushType]; for each (_local3 in _local2) { _local4 = MouseControl.x; _local5 = MouseControl.y; _local4 = (_local4 + scrollX); _local5 = (_local5 + scrollY); _local4 = (_local4 / _local1.mapCellW); _local5 = (_local5 / _local1.mapCellH); _local4 = (_local4 + _local3.x); _local5 = (_local5 + _local3.y); _local4 = (_local4 * _local1.mapCellW); _local5 = (_local5 * _local1.mapCellH); _local4 = (_local4 - scrollX); _local5 = (_local5 - scrollY); RenderRectangle(new Rectangle(_local4, _local5, (_local1.mapCellW - 1), (_local1.mapCellH - 1)), 4294934656, 2); }; } static function Mapper_Fill(_arg1:int){ var _local6:*; var _local2:Level = GetCurrentLevel(); var _local3:int = MouseControl.x; var _local4:int = MouseControl.y; _local3 = (_local3 + scrollX); _local4 = (_local4 + scrollY); _local3 = (_local3 / _local2.mapCellW); _local4 = (_local4 / _local2.mapCellH); fillList = new Array(); fillOrigCell = Mapper_GetCell(_local3, _local4); Mapper_PutCell(_local3, _local4, _arg1); Mapper_PutFillCell((_local3 - 1), _local4, _arg1, fillList); Mapper_PutFillCell((_local3 + 1), _local4, _arg1, fillList); Mapper_PutFillCell(_local3, (_local4 - 1), _arg1, fillList); Mapper_PutFillCell(_local3, (_local4 + 1), _arg1, fillList); var _local5:Boolean; do { fillList1 = new Array(); for each (_local6 in fillList) { Mapper_PutFillCell((_local6.x - 1), _local6.y, _arg1, fillList1); Mapper_PutFillCell((_local6.x + 1), _local6.y, _arg1, fillList1); Mapper_PutFillCell(_local6.x, (_local6.y - 1), _arg1, fillList1); Mapper_PutFillCell(_local6.x, (_local6.y + 1), _arg1, fillList1); }; if (fillList1.length != 0){ fillList = fillList1; } else { _local5 = true; }; } while (_local5 == false); } static function Mapper_DecCurrentCell(){ mapper_currentCell--; if (mapper_currentCell < 0){ mapper_currentCell = (mapCols.length - 1); }; } static function Mapper_CycleTransparency(){ mapper_transparency++; if (mapper_transparency >= 6){ mapper_transparency = 0; }; } static function GetCurrentLevel():Level{ return (Game.GetLevel(currentLevel)); } static function ObjCol_AddPoint(){ var _local1:Number = (MouseControl.x - (Defs.displayarea_w / 2)); var _local2:Number = (MouseControl.y - (Defs.displayarea_h / 2)); objCol_points.push(new Point(_local1, _local2)); } static function Lines_AddPoint(_arg1:Number, _arg2:Number){ if (currentLineIndex == -1){ return; }; var _local3:Level = GetCurrentLevel(); var _local4:Point = new Point(_arg1, _arg2); var _local5:Array = _local3.lines[currentLineIndex].points; _local5.push(_local4); _local3.lines[currentLineIndex].points = _local5; } public static function ExportAllLevelsAsXml(){ var _local2:int; var _local1 = ""; var _local3:int = currentLevel; _local2 = 0; while (_local2 < Game.levels.length) { currentLevel = _local2; _local1 = (_local1 + ExportLevelAsXml()); _local1 = (_local1 + "\n\n"); _local2++; }; currentLevel = _local3; ExternalData.OutputString(_local1); } static function ClearCurrentPieces():void{ currentPieceList = new Array(); } static function DecCurrentPiece(){ var _local1:Object; for each (_local1 in currentPieceList) { _local1.id--; if (_local1.id < 0){ _local1.id = (Game.physObjs.GetNum() - 1); }; }; } static function Lines_DeleteSelectedLine(){ var _local2:Array; var _local3:int; var _local4:PhysLine; var _local1:Level = GetCurrentLevel(); if (currentLineIndex != -1){ _local2 = new Array(); _local3 = 0; for each (_local4 in _local1.lines) { if (_local3 != currentLineIndex){ _local2.push(_local4.Clone()); }; _local3++; }; _local1.lines = _local2; currentPointIndex = -1; currentLineIndex = -1; }; } static function RenderPanel_Editor(){ var _local1:Number; var _local2:Number; var _local3:String; var _local4:Number; var _local7:Object; var _local8:PhysObj; var _local9:PhysLine; var _local10:Level; var _local5:BitmapData = Game.main.screenBD; _local1 = (Defs.displayarea_w - 3); _local2 = (Defs.displayarea_h - 15); var _local6:int = (System.totalMemory / 0x0400); _local3 = ((("FPS: " + Utils.DP2(Game.main.fps).toString()) + " Mem: ") + _local6); _local4 = GraphicObjects.GetStringWidth(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, (_local1 - _local4), _local2, _local3, null); _local1 = 10; _local3 = (((("Level: " + currentLevel) + " [ ") + GetCurrentLevel().name) + " ]"); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); if (editMode == editMode_Commands){ _local3 = "Editor: Mode = Commands"; _local1 = 10; _local2 = 10; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local1 = 50; _local2 = 50; _local3 = "1: Placement"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "2: Library"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "3: Mapper"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "4: Object Collision"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "5: Adjust Placement"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "6: Edit Lines"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "7: Pick Piece"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); return; }; if (editMode == editMode_Commands1){ _local3 = "Editor: Mode = Commands1"; _local1 = 10; _local2 = 10; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local1 = 50; _local2 = 50; _local3 = "4: Export current level"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "5: Export all levels"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "9: Quit To Game"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); return; }; if (editMode == editMode_GridCommands){ _local3 = "Editor: Mode = Grid Commands / Misc"; _local1 = 10; _local2 = 10; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local1 = 50; _local2 = 50; _local3 = ("1: Grid Active: " + gridMode_active); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = ("2: Render Grid: " + gridMode_renderGrid); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = ("3: Z Sort objects: " + objectZSortMode); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = ("4: Minimap: " + renderMiniMap); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); return; }; _local3 = "Editor: Mode = "; if (editMode == editMode_Normal){ _local3 = (_local3 + "Placement"); }; if (editMode == editMode_Map){ _local3 = (_local3 + "Mapper"); }; if (editMode == editMode_Library){ _local3 = (_local3 + ((("Library Page " + int((library_page + 1)).toString()) + " / ") + int(GetNumLibraryPages()).toString())); }; if (editMode == editMode_ObjCol){ _local3 = (_local3 + "Object Collision"); }; if (editMode == editMode_Adjust){ _local3 = (_local3 + "Adjust"); }; if (editMode == editMode_Lines){ _local3 = (_local3 + "Lines"); }; if (editMode == editMode_PickPiece){ _local3 = (_local3 + "PickPiece"); }; _local1 = 10; _local2 = 10; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); if (editMode == editMode_ObjCol){ if (currentPieceList.length == 1){ _local7 = currentPieceList[0]; _local8 = Game.physObjs.GetByIndex(_local7.id); _local3 = ("Piece: " + _local8.name); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); }; _local3 = "1: Start Trace new poly"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "2: Toggle show other collision"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "3: Export"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "4: Previous Piece"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "5: Next Piece"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); }; if (editMode == editMode_Library){ _local3 = ((((("1: Filter [" + libraryFilter) + "] ") + int((libraryFilterIndex + 1))) + "/") + libraryFilters.length); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = ((("2: Scale " + int((librarySizeIndex + 1))) + "/") + numLibrarySizes); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); }; if (editMode == editMode_PickPiece){ _local3 = "CTRL: Pick multiple pieces"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); }; if (editMode == editMode_Lines){ _local3 = "1: Select Line"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "D: Delete Selected Line"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "2: Delete Point"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "3: Insert Point after clicked point"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "4: Select Point for editing with arrow keys"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "5: New line (hold and click new point)"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "6: Subdivide between this point and selected point"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "7: Push line points"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "8: Change Type"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "9: Toggle Addline "; if (addlineActive){ _local3 = (_local3 + "[ON]"); }; if (addlineActive == false){ _local3 = (_local3 + "[OFF]"); }; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "R: Reverse Line Direction"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "[ and ]: Move to first / last point of selected line"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = ((("ScrollPos: " + scrollX) + " ") + scrollY); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = ((("CursorPos: " + int((MouseControl.x + scrollX))) + " ") + int((MouseControl.y + scrollY))); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); if (currentLineIndex != -1){ _local9 = GetCurrentLevel().lines[currentLineIndex]; _local3 = ("Type: " + GetLineTypeString(_local9.type)); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); }; }; if (editMode == editMode_Adjust){ _local3 = "1: Delete Selected"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "Shift + Arrows: Move Piece"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "6: Rotate Left"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "7: Rotate Right"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); }; if (editMode == editMode_Normal){ _local3 = ((("ScrollPos: " + scrollX) + " ") + scrollY); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = ((("CursorPos: " + int((MouseControl.x + scrollX))) + " ") + int((MouseControl.y + scrollY))); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "1: Snap to nearby objects"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); }; if (editMode == editMode_Map){ _local10 = GetCurrentLevel(); _local3 = ((("ScrollPos: " + scrollX) + " ") + scrollY); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = ((("CursorPos: " + int((MouseControl.x + scrollX))) + " ") + int((MouseControl.y + scrollY))); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = ((((((("Offset / Size: " + _local10.mapMinX) + ",") + _local10.mapMinY) + " ") + ((_local10.mapMaxX - _local10.mapMinX) + 1)) + ",") + ((_local10.mapMaxY - _local10.mapMinY) + 1)); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "1: Erase cell(s)"; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = (((((("2/3: Current Piece: " + int((mapper_currentCell + 1))) + " / ") + mapCols.length) + " (") + mapColNames[mapper_currentCell]) + ") "); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = "4: Fill "; GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = ((("5: Brush: " + int((mapper_brushType + 1))) + " / ") + brushes.length); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); _local3 = (("6: Display : " + mapper_transparency) + " / 5"); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); }; if (editMode == editMode_Adjust){ if (currentAdjustObject != null){ _local3 = ((((("Pos: " + currentAdjustObject.x) + " ") + currentAdjustObject.y) + " Rot: ") + currentAdjustObject.rot); GraphicObjects.RenderStringAt(_local5, GraphicObjects.gfx_font1, _local1, _local2, _local3, null); _local2 = (_local2 + 15); }; }; } } }//package class PhysEd_GuideLine { private var level:Boolean; private var y1:Number; private var y0:Number; private var x0:Number; private var x1:Number; private var type:int; private function PhysEd_GuideLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean){ type = _arg4; level = _arg5; if (type == 0){ x0 = _arg1; x1 = _arg2; y0 = _arg3; y1 = _arg3; } else { y0 = _arg1; y1 = _arg2; x0 = _arg3; x1 = _arg3; }; } }
Section 197
//PhysLine (PhysLine) package { import flash.display.*; import flash.geom.*; public class PhysLine { var fill:int; public var points:Array; var name:String; var fillScaleX:Number; var fillScaleY:Number; var type:int; var catmullRomLength:Number; public function PhysLine(){ name = "undefined"; type = 0; points = new Array(); fill = 0; fillScaleX = 1; fillScaleY = 1; } function PointOnCurve(_arg1:Number, _arg2:Point, _arg3:Point, _arg4:Point, _arg5:Point):Point{ var _local6:Point = new Point(); var _local7:Number = (_arg1 * _arg1); var _local8:Number = (_local7 * _arg1); _local6.x = (0.5 * ((((2 * _arg3.x) + ((-(_arg2.x) + _arg4.x) * _arg1)) + (((((2 * _arg2.x) - (5 * _arg3.x)) + (4 * _arg4.x)) - _arg5.x) * _local7)) + ((((-(_arg2.x) + (3 * _arg3.x)) - (3 * _arg4.x)) + _arg5.x) * _local8))); _local6.y = (0.5 * ((((2 * _arg3.y) + ((-(_arg2.y) + _arg4.y) * _arg1)) + (((((2 * _arg2.y) - (5 * _arg3.y)) + (4 * _arg4.y)) - _arg5.y) * _local7)) + ((((-(_arg2.y) + (3 * _arg3.y)) - (3 * _arg4.y)) + _arg5.y) * _local8))); return (_local6); } public function GetPoint(_arg1:int):Point{ return (points[_arg1]); } public function DrawCatmullRom(_arg1:BitmapData, _arg2:uint, _arg3:Number, _arg4:Number){ var _local6:Number; var _local7:Point; var _local5:int = GetNumPoints(); if (_local5 < 4){ return; }; _local6 = 0; while (_local6 < 1) { _local7 = GetPointOnCatmullRom(_local6); _arg1.setPixel32((_local7.x + _arg3), (_local7.y + _arg4), _arg2); _local6 = (_local6 + 0.001); }; } public function GetPointOnCatmullRom(_arg1:Number):Point{ var _local4:Point; var _local5:Point; var _local6:Point; var _local7:Point; var _local2:int = GetNumPoints(); if (_local2 < 4){ return (new Point(0, 0)); }; var _local3:int = (_local2 - 1); var _local8:Number = (Number(_local3) * _arg1); var _local9:int = _local8; var _local10:int = (_local9 - 1); var _local11:int = _local9; var _local12:int = (_local9 + 1); var _local13:int = (_local9 + 2); if (_local10 < 0){ _local10 = 0; }; if (_local12 > (_local2 - 1)){ _local12 = (_local2 - 1); }; if (_local13 > (_local2 - 1)){ _local13 = (_local2 - 1); }; _local4 = points[_local10]; _local5 = points[_local11]; _local6 = points[_local12]; _local7 = points[_local13]; var _local14:int = (_local9 + 1); var _local15:Number = ((1 / Number(_local3)) * _local9); var _local16:Number = ((1 / Number(_local3)) * _local14); var _local17:Number = ((1 / (_local16 - _local15)) * (_arg1 - _local15)); var _local18:Point = PointOnCurve(_local17, _local4, _local5, _local6, _local7); return (_local18); } public function GetNumPoints():int{ return (points.length); } public function GetInterpolatedPoint(_arg1:Number, _arg2:Boolean):Point{ var _local3:int; var _local4:Number; var _local5:int; var _local6:int; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Point; if (type == 2){ return (GetPointOnCatmullRom(_arg1)); }; if (_arg2 == true){ _local3 = points.length; _local4 = (1 / _local3); _local5 = Math.floor((_local3 * _arg1)); _local6 = ((_local5 + 1) % _local3); _local7 = (_local5 * _local4); _local8 = ((_local5 + 1) * _local4); _local9 = Utils.ScaleTo(points[_local5].x, points[_local6].x, _local7, _local8, _arg1); _local10 = Utils.ScaleTo(points[_local5].y, points[_local6].y, _local7, _local8, _arg1); _local11 = new Point(_local9, _local10); return (_local11); }; _local3 = points.length; _local4 = (1 / (_local3 - 1)); _local5 = Math.floor(((_local3 - 1) * _arg1)); _local6 = ((_local5 + 1) % _local3); _local7 = (_local5 * _local4); _local8 = ((_local5 + 1) * _local4); _local9 = Utils.ScaleTo(points[_local5].x, points[_local6].x, _local7, _local8, _arg1); _local10 = Utils.ScaleTo(points[_local5].y, points[_local6].y, _local7, _local8, _arg1); _local11 = new Point(_local9, _local10); return (_local11); } public function SetPointArray(_arg1:Array){ points = _arg1; } public function Clone():PhysLine{ var _local2:Point; var _local1:PhysLine = new PhysLine(); _local1.name = name; _local1.type = type; _local1.fill = fill; _local1.fillScaleX = fillScaleX; _local1.fillScaleY = fillScaleY; for each (_local2 in points) { _local1.points.push(_local2.clone()); }; return (_local1); } public function CalculateCatmullRomLength(){ var _local2:int; var _local4:Number; var _local5:Point; var _local6:Point; var _local7:Point; var _local1:Array = new Array(); var _local3:int = GetNumPoints(); if (_local3 < 4){ catmullRomLength = 0; } else { _local4 = 0; while (_local4 < 1) { _local5 = GetPointOnCatmullRom(_local4); _local1.push(_local5); _local4 = (_local4 + 0.025); }; }; catmullRomLength = 0; _local2 = 0; while (_local2 < (_local1.length - 2)) { _local6 = _local1[_local2]; _local7 = _local1[(_local2 + 1)]; catmullRomLength = (catmullRomLength + Utils.DistBetweenPoints(_local6.x, _local6.y, _local7.x, _local7.y)); _local2++; }; _local1 = null; } } }//package
Section 198
//PhysObj (PhysObj) package { import flash.display.*; import flash.geom.*; public class PhysObj { public var bodies:Array; public var initFunctionName:String; public var hitballsound:int; public var name:String; public var hasPhysics:Boolean; public var graphics:Array; public var joints:Array; public var displayInLibrary:Boolean; public var libraryClass:String; static var p0:Point = new Point(); static var p1:Point = new Point(); static var renderMatrix:Matrix = new Matrix(); static var renderPoint:Point = new Point(); public function PhysObj(){ hitballsound = 0; } function BooleanFromString(_arg1:String):Boolean{ var _local2:Boolean; _arg1 = _arg1.toUpperCase(); if (_arg1 == "1"){ _local2 = true; }; if (_arg1 == "TRUE"){ _local2 = true; }; return (_local2); } public function JointIndexFromName(_arg1:String):int{ var _local3:PhysObj_Joint; var _local2:int; while (_local2 < joints.length) { _local3 = joints[_local2]; if (_local3.name == _arg1){ return (_local2); }; _local2++; }; trace(("ERROR PhysObj JointIndexFromName " + _arg1)); return (0); } function PointArrayFromString(_arg1:String):Array{ var _local4:int; var _local6:Point; var _local2:Array = new Array(); var _local3:Array = _arg1.split(","); if ((((_local3.length < 2)) || (((_local3.length % 2) == 1)))){ trace(((("PointArrayFromString. Error, numpoints=" + _local3.length) + " , string= ") + _arg1)); return (_local2); }; var _local5:int = (_local3.length / 2); _local4 = 0; while (_local4 < _local5) { _local6 = new Point(0, 0); _local6.x = Number(_local3[((_local4 * 2) + 0)]); _local6.y = Number(_local3[((_local4 * 2) + 1)]); _local2.push(_local6); _local4++; }; return (_local2); } function GetGraphic(_arg1:XML):PhysObj_Graphic{ var _local2:PhysObj_Graphic = new PhysObj_Graphic(); _local2.goInitFuntion = _arg1.@gameobjfunction; _local2.goInitFuntionVarString = _arg1.@gameobjvars; _local2.graphicName = _arg1.@clip; _local2.graphicID = 0; _local2.frame = (XmlHelper.GetAttrInt(_arg1.@frame) - 1); _local2.offset = PointFromString(XmlHelper.GetAttrString(_arg1.@pos)); _local2.zoffset = XmlHelper.GetAttrNumber(_arg1.@zoffset, 0); _local2.hasShadow = XmlHelper.GetAttrBoolean(_arg1.@shadow, true); _local2.rot = Number(_arg1.@rot); _local2.Calculate(); return (_local2); } public function BodyIndexFromName(_arg1:String):int{ var _local3:PhysObj_Body; var _local2:int; while (_local2 < bodies.length) { _local3 = bodies[_local2]; if (_local3.name == _arg1){ return (_local2); }; _local2++; }; trace(("ERROR PhysObj BodyIndexFromName " + _arg1)); return (0); } function PointFromString(_arg1:String):Point{ var _local2:Array = _arg1.split(","); var _local3:Point = new Point(0, 0); if (_local2.length != 2){ trace(((("PointfromString. Error, numpoints=" + _local2.length) + " ") + _arg1)); return (_local3); }; _local3.x = Number(_local2[0]); _local3.y = Number(_local2[1]); return (_local3); } public function FromXml(_arg1:XML):void{ var _local2:int; var _local3:int; var _local4:int; var _local5:PhysObj_Graphic; var _local6:XML; var _local7:String; var _local8:XML; var _local9:PhysObj_Body; var _local10:XML; var _local11:PhysObj_Shape; var _local12:Point; var _local13:XML; var _local14:PhysObj_Joint; bodies = new Array(); joints = new Array(); graphics = new Array(); name = _arg1.@name; displayInLibrary = XmlHelper.GetAttrBoolean(_arg1.@inlibrary, false); initFunctionName = XmlHelper.GetAttrString(_arg1.@initfunction, null); libraryClass = XmlHelper.GetAttrString(_arg1.@libclass, ""); hasPhysics = XmlHelper.GetAttrBoolean(_arg1.@hasphysics, false); _local2 = 0; while (_local2 < _arg1.graphic.length()) { _local6 = _arg1.graphic[_local3]; graphics.push(GetGraphic(_local6)); _local2++; }; _local2 = 0; while (_local2 < _arg1.body.length()) { _local8 = _arg1.body[_local2]; _local9 = new PhysObj_Body(); _local9.name = _local8.@name; _local9.fixed = BooleanFromString(_local8.@fixed); _local9.sensor = BooleanFromString(_local8.@sensor); _local9.pos = PointFromString(XmlHelper.GetAttrString(_local8.@pos)); _local9.linearDamping = XmlHelper.GetAttrNumber(_local8.@lineardamping, _local9.linearDamping); _local9.angularDamping = XmlHelper.GetAttrNumber(_local8.@angulardamping, _local9.angularDamping); _local3 = 0; while (_local3 < _local8.graphic.length()) { _local6 = _local8.graphic[_local3]; _local9.graphics.push(GetGraphic(_local6)); _local3++; }; _local3 = 0; while (_local3 < _local8.shape.length()) { _local10 = _local8.shape[_local3]; _local11 = new PhysObj_Shape(); _local11.name = _local10.@name; _local7 = _local10.@type; _local12 = PointFromString(XmlHelper.GetAttrString(_local10.@col)); _local11.collisionCategory = XmlHelper.GetAttrInt(_local12.x); _local11.collisionMask = XmlHelper.GetAttrInt(_local12.y); _local11.density = XmlHelper.GetAttrNumber(_local10.@density); _local11.friction = XmlHelper.GetAttrNumber(_local10.@friction); _local11.restitution = XmlHelper.GetAttrNumber(_local10.@restitution); if (_local7 == "circle"){ _local11.type = PhysObj_Shape.Type_Circle; _local11.circle_pos = PointFromString(XmlHelper.GetAttrString(_local10.@pos)); _local11.circle_radius = XmlHelper.GetAttrNumber(_local10.@radius); } else { if (_local7 == "poly"){ _local11.type = PhysObj_Shape.Type_Poly; _local11.poly_points = PointArrayFromString(_local10.@vertices); _local11.poly_rot = Utils.DegToRad(XmlHelper.GetAttrNumber(_local10.@rot)); }; }; _local11.Caclulate(); _local9.shapes.push(_local11); _local3++; }; bodies.push(_local9); _local2++; }; _local2 = 0; while (_local2 < _arg1.joint.length()) { _local13 = _arg1.joint[_local2]; _local14 = new PhysObj_Joint(); _local14.name = _local13.@name; _local14.obj0Name = _local13.@body0; _local14.obj1Name = _local13.@body1; _local7 = _local13.@type; if (_local7 == "rev"){ _local14.type = PhysObj_Joint.Type_Rev; _local14.rev_pos = PointFromString(XmlHelper.GetAttrString(_local13.@pos)); _local14.rev_enableLimit = BooleanFromString(_local13.@enablelimit); _local14.rev_lowerAngle = Utils.DegToRad(XmlHelper.GetAttrNumber(_local13.@lowerangle)); _local14.rev_upperAngle = Utils.DegToRad(XmlHelper.GetAttrNumber(_local13.@upperangle)); _local14.rev_enableMotor = BooleanFromString(_local13.@enablemotor); _local14.rev_motorSpeed = Number(_local13.@motorspeed); _local14.rev_maxMotorTorque = Number(_local13.@maxmotortorque); } else { if (_local7 == "distance"){ _local14.type = PhysObj_Joint.Type_Distance; _local14.dist_pos0 = PointFromString(XmlHelper.GetAttrString(_local13.@pos)); _local14.dist_pos1 = PointFromString(XmlHelper.GetAttrString(_local13.@pos1)); _local14.dist_distance = Number(_local13.@distance); } else { if (_local7 == "mouse"){ _local14.type = PhysObj_Joint.Type_Mouse; } else { if (_local7 == "prismatic"){ _local14.type = PhysObj_Joint.Type_Prismatic; _local14.prism_pos = PointFromString(XmlHelper.GetAttrString(_local13.@pos)); _local14.prism_enableLimit = BooleanFromString(_local13.@enablelimit); _local14.prism_lowerTranslation = Number(_local13.@lowertranslation); _local14.prism_upperTranslation = Number(_local13.@uppertranslation); _local14.prism_enableMotor = BooleanFromString(_local13.@enablemotor); _local14.prism_axisangle = (Number(_local13.@axisangle) - Number(90)); _local14.prism_motorSpeed = Number(_local13.@motorspeed); _local14.prism_maxMotorForce = Number(_local13.@maxmotorforce); }; }; }; }; joints.push(_local14); _local2++; }; } public function BodyFromName(_arg1:String):PhysObj_Body{ var _local3:PhysObj_Body; var _local2:int; while (_local2 < bodies.length) { _local3 = bodies[_local2]; if (_local3.name == _arg1){ return (_local3); }; _local2++; }; trace(("ERROR PhysObj BodyFromName " + _arg1)); return (null); } static function RenderCircle(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:uint, _arg6:Number=1, _arg7:Number=1){ _arg1.lineStyle(_arg6, _arg5, _arg7); _arg1.drawCircle(_arg2, _arg3, _arg4); } public static function RenderAt(_arg1:PhysObj, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:BitmapData, _arg6:Graphics=null, _arg7:Boolean=false, _arg8:Number=1, _arg9:Rectangle=null){ var _local12:Number; var _local13:Number; var _local14:Matrix; var _local15:PhysObj_Body; var _local16:PhysObj_Graphic; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:BitmapData; var _local24:Number; var _local25:int; var _local26:int; var _local27:PhysObj_Shape; var _local28:Number; var _local29:Array; var _local30:int; var _local10:Boolean = _arg7; var _local11:Number = _arg8; _local12 = _arg2; _local13 = _arg3; var _local17:Array = new Array(); for each (_local15 in _arg1.bodies) { for each (_local16 in _local15.graphics) { _local17.push(_local16); }; }; for each (_local16 in _arg1.graphics) { _local17.push(_local16); }; for each (_local16 in _local17) { if (GraphicObjects.GetBitmapData(_local16.graphicID, _local16.frame) != null){ if (_arg9 != null){ _local18 = GraphicObjects.GetWidth(_local16.graphicID, _local16.frame); _local19 = GraphicObjects.GetHeight(_local16.graphicID, _local16.frame); _local20 = (_arg9.width / _local18); _local21 = (_arg9.height / _local19); _local22 = _local20; if (_local21 < _local20){ _local22 = _local21; }; _local12 = (_local12 - (_arg9.width / 2)); _local13 = (_local13 - (_arg9.height / 2)); _local23 = GraphicObjects.GetBitmapData(_local16.graphicID, _local16.frame); renderMatrix.identity(); renderMatrix.scale(_local22, _local22); renderMatrix.translate(_local12, _local13); if (_local23 != null){ _arg5.draw(_local23, renderMatrix, null, null, null, true); }; } else { _local24 = Utils.DegToRad((_arg4 + _local16.rot)); if (((!((_local11 == 1))) || (!((_local24 == 0))))){ renderPoint.x = _local16.offset.x; renderPoint.y = _local16.offset.y; renderMatrix.identity(); renderMatrix.rotate(Utils.DegToRad(_arg4)); renderMatrix.scale(_local11, _local11); renderPoint = renderMatrix.transformPoint(renderPoint); _local12 = ((_arg2 * _local11) + renderPoint.x); _local13 = ((_arg3 * _local11) + renderPoint.y); GraphicObjects.RenderAtRotScaled(_local16.graphicID, _local16.frame, _arg5, _local12, _local13, _local11, _local24); } else { _local12 = (_arg2 + renderPoint.x); _local13 = (_arg3 + renderPoint.y); GraphicObjects.RenderAt(_local16.graphicID, _local16.frame, _arg5, _local12, _local13); }; }; }; }; for each (_local15 in _arg1.bodies) { if (_local10){ if (_arg6 != null){ renderMatrix.identity(); _local24 = Utils.DegToRad(_arg4); if (_local24 != 0){ renderMatrix.rotate(_local24); }; for each (_local27 in _local15.shapes) { if (_local27.type == PhysObj_Shape.Type_Circle){ _local28 = _local27.circle_radius; RenderCircle(_arg6, (_arg2 + _local27.circle_pos.x), (_arg3 + _local27.circle_pos.y), _local28, 4294967295, 2); }; if (_local27.type == PhysObj_Shape.Type_Poly){ _local29 = _local27.poly_points; _local30 = _local27.poly_points.length; _local25 = 0; while (_local25 < _local30) { _local26 = (_local25 + 1); if (_local26 >= _local30){ _local26 = 0; }; p0.x = _local29[_local25].x; p0.y = _local29[_local25].y; p1.x = _local29[_local26].x; p1.y = _local29[_local26].y; p0 = renderMatrix.transformPoint(p0); p1 = renderMatrix.transformPoint(p1); p0.x = (p0.x + _arg2); p1.x = (p1.x + _arg2); p0.y = (p0.y + _arg3); p1.y = (p1.y + _arg3); RenderLine(_arg6, p0.x, p0.y, p1.x, p1.y, 4294967295, 2); _local25++; }; }; }; }; }; }; } static function RenderLine(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:uint, _arg7:Number=1, _arg8:Number=1){ _arg1.lineStyle(_arg7, _arg6, _arg8); _arg1.moveTo(_arg2, _arg3); _arg1.lineTo(_arg4, _arg5); } public static function RenderOutline(_arg1:PhysObj, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Graphics){ var _local6:PhysObj_Graphic; var _local8:PhysObj_Body; var _local9:Number; var _local10:Number; var _local11:Rectangle; var _local7:Array = new Array(); for each (_local8 in _arg1.bodies) { for each (_local6 in _local8.graphics) { _local7.push(_local6); }; }; for each (_local6 in _arg1.graphics) { _local7.push(_local6); }; for each (_local6 in _local7) { _local9 = GraphicObjects.GetWidth(_local6.graphicID, _local6.frame); _local10 = GraphicObjects.GetHeight(_local6.graphicID, _local6.frame); _local11 = new Rectangle((_arg2 + _local6.offset.x), (_arg3 + _local6.offset.y), _local9, _local10); RenderRectangle(_arg5, _local11, 16736384, 2); }; } static function RenderRectangle(_arg1:Graphics, _arg2:Rectangle, _arg3:uint, _arg4:Number=1, _arg5:Number=1){ RenderLine(_arg1, _arg2.left, _arg2.top, _arg2.right, _arg2.top, _arg3, _arg4, _arg5); RenderLine(_arg1, _arg2.left, _arg2.bottom, _arg2.right, _arg2.bottom, _arg3, _arg4, _arg5); RenderLine(_arg1, _arg2.left, _arg2.top, _arg2.left, _arg2.bottom, _arg3, _arg4, _arg5); RenderLine(_arg1, _arg2.right, _arg2.top, _arg2.right, _arg2.bottom, _arg3, _arg4, _arg5); } } }//package
Section 199
//PhysObj_Body (PhysObj_Body) package { import flash.geom.*; public class PhysObj_Body { public var angularDamping:Number; public var name:String; public var graphics:Array; public var pos:Point; public var shapes:Array; public var fixed:Boolean; public var sensor:Boolean; public var linearDamping:Number; public function PhysObj_Body(){ shapes = new Array(); graphics = new Array(); name = ""; pos = new Point(); fixed = true; sensor = false; linearDamping = 0.1; angularDamping = 0.1; } } }//package
Section 200
//PhysObj_BodyUserData (PhysObj_BodyUserData) package { public class PhysObj_BodyUserData { public var type:String; public var instance:PhysObj_Instance; public var gameObjectID:int; public var bodyName:String; public function PhysObj_BodyUserData(){ type = ""; bodyName = ""; gameObjectID = -1; instance = null; } } }//package
Section 201
//PhysObj_Graphic (PhysObj_Graphic) package { import flash.geom.*; public class PhysObj_Graphic { public var offset:Point; public var graphicID:int; public var hasShadow:Boolean; public var graphicName:String; public var frame:int; public var rot:Number; public var goInitFuntion:String; public var zoffset:Number; public var goInitFuntionVarString:String; public function PhysObj_Graphic(){ graphicName = ""; graphicID = 0; frame = 0; offset = new Point(0, 0); rot = 0; goInitFuntion = ""; goInitFuntionVarString = ""; zoffset = 0; hasShadow = true; } public function Calculate(){ graphicID = GraphicObjects.GetIndexByName(graphicName); if (frame < 0){ trace("ERROR: PhysObj Graphic has negative frame. Are you counting from 0 or 1?"); frame = 0; }; } } }//package
Section 202
//PhysObj_Instance (PhysObj_Instance) package { import flash.geom.*; import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import Box2D.Collision.Shapes.*; import Box2D.Collision.*; import Box2D.Common.*; import Box2D.Dynamics.Contacts.*; public class PhysObj_Instance { var paramValues:Array; public var removeFlag:Boolean; var switchName1:String; public var collideFunction:Function; var gateTime:int; public var hitballsound:int; var stopcount:int; public var movementVec:Vec; public var x:Number; public var y:Number; var vehicleSpeed:Number; public var sortZ:Number; var magnet_time:int; var radius:Number; public var doSwitchFunction:Function; var switch_timer:int; var controlMode:int; var posy:Number; var posx:Number; var lineResetAtEnd:Boolean; var lineSpeed:Number; public var initParams:String; var paramNames:Array; var lineLoop:Boolean; public var instanceName:String; var gateVel:Number; public var collideWithInstance:PhysObj_Instance; var ai_nextLineNode:int; var mover_xvel:Number; public var typeName:String; var cannon_firing:Boolean; var mover_x0:Number; var mover_x1:Number; var cannon_angvel:Number; var colflags:int; var gateMode:String; var portalName:String; public var joints:Array; var oldx:Number; var oldy:Number; public var switchFunction:Function; public var type:int; var lineIndex:int; public var preUpdateFunction:Function; public var timer:int; var lineLinearPos:Number; var vehicleCheckpointIndex:int; var cannon_maxang:Number; var ai_maxSpeed:Number; var magnet_mode:String; var cannon_ang:Number; var ball_hitcount:int; var cannon_mode:String; public var driveVec:Vec; var vehicleCurrentLap:int; public var bodies:Array; public var updateFunction:Function; public var collidetimer:int; var cannon_minang:Number; public var rot:Number; var magnet_polarity:Boolean; var switchName:String; var ai_lineIndex:int; public var updateFunctionName:String; public function PhysObj_Instance(){ bodies = new Array(); joints = new Array(); timer = 0; collidetimer = 0; collideFunction = null; updateFunction = null; preUpdateFunction = null; switchFunction = null; doSwitchFunction = null; hitballsound = 0; removeFlag = false; updateFunctionName = null; initParams = ""; type = 0; } function InitPhysObj_Penguin(){ Game.penguinSmashLevel = true; updateFunction = UpdatePhysObj_Penguin; WakeUp(); timer = 0; controlMode = 0; } public function SetLinearVelocity(_arg1:Number, _arg2:Number):void{ var _local3:b2Body; for each (_local3 in bodies) { _local3.SetLinearVelocity(new b2Vec2(_arg1, _arg2)); }; } function UpdatePhysObj_Mover(){ var _local1:b2Vec2 = GetBodyWorldPos(0); this.ApplyForce(mover_xvel, 0); this.LimitLinearVelocity(10); if (mover_xvel > 0){ if (_local1.x > mover_x1){ mover_xvel = (mover_xvel * -1); }; } else { if (_local1.x < mover_x0){ mover_xvel = (mover_xvel * -1); }; }; } function SwitchFunction_Path_2way(){ if (controlMode == 0){ controlMode = 1; } else { if (controlMode == 1){ controlMode = 2; } else { controlMode = 1; }; }; } function UpdatePhysObj_Path_2way(){ var _local1:Point; if (controlMode == 0){ _local1 = UpdateLine(0); SetBodyXForm(0, (_local1.x * Game.w2p), (_local1.y * Game.w2p), 0); } else { if (controlMode == 1){ _local1 = UpdateLine(lineSpeed); SetBodyXForm(0, (_local1.x * Game.w2p), (_local1.y * Game.w2p), 0); } else { if (controlMode == 2){ _local1 = UpdateLine(-(lineSpeed)); SetBodyXForm(0, (_local1.x * Game.w2p), (_local1.y * Game.w2p), 0); }; }; }; } function SwitchedPhysObj_Switch():Boolean{ var _local1:GameObj = GetGameObject(0); if (_local1.controlMode == 0){ SoundPlayer.Play("switchwav"); _local1.controlMode = 1; return (true); }; return (false); } function InitPhysObj_Breakable(){ colflags = 2; updateFunction = UpdatePhysObj_Breakable; } function UpdateVehicleGameObject(_arg1:Number){ var _local2:GameObj = GetGameObject(0); _local2.graphicID = GraphicObjects.GetIndexByName("DRCar01"); _local2.frame = 0; _arg1 = NormalizeDir(_arg1); _local2.dir = 0; var _local3:uint = ((36 / (Math.PI * 2)) * _arg1); _local3 = (_local3 + 9); _local3 = (_local3 % 36); _local3 = (_local3 * 7); _local2.frame = _local3; } public function SetXForm(_arg1:Number, _arg2:Number, _arg3:Number):void{ var _local5:b2Body; var _local4:b2Vec2 = new b2Vec2(_arg1, _arg2); for each (_local5 in bodies) { _local5.SetXForm(_local4, _arg3); }; } function UpdatePhysObj_TwoWaySwitch(){ var _local1:GameObj = GetGameObject(0); if (controlMode == 0){ _local1.controlMode = 2; } else { _local1.controlMode = 1; }; } public function ApplyForce(_arg1:Number, _arg2:Number):void{ var _local3:b2Body; for each (_local3 in bodies) { _local3.ApplyForce(new b2Vec2(_arg1, _arg2), _local3.GetWorldCenter()); }; } function GetLineIndexByName(_arg1:String):int{ var _local4:PhysLine; var _local2:Level = Game.GetCurrentLevel(); var _local3:int; for each (_local4 in _local2.lines) { if (_local4.name == _arg1){ return (_local3); }; _local3++; }; return (-1); } public function SetAngularVelocity(_arg1:int, _arg2:Number):void{ var _local3:b2Body; if (_arg1 == -1){ for each (_local3 in bodies) { _local3.SetAngularVelocity(_arg2); }; } else { _local3 = bodies[_arg1]; _local3.SetAngularVelocity(_arg2); }; } public function GetNumBodies():int{ return (bodies.length); } function GetParams(_arg1:String):void{ var _local3:String; var _local4:Array; paramNames = new Array(); paramValues = new Array(); _arg1 = Utils.RemoveWhiteSpace(_arg1); _arg1 = _arg1.toLowerCase(); var _local2:Array = _arg1.split(","); trace(_local2.length); for each (_local3 in _local2) { _local4 = _local3.split("="); paramNames.push(_local4[0]); paramValues.push(_local4[1]); }; } function NormalizeDir(_arg1:Number):Number{ while (_arg1 < 0) { _arg1 = (_arg1 + (Math.PI * 2)); }; while (_arg1 > (Math.PI * 2)) { _arg1 = (_arg1 - (Math.PI * 2)); }; return (_arg1); } public function NearRot(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{ var _local4:Number = (_arg1 - _arg2); var _local5:Number = Math.abs(_local4); if (_local4 > Math.PI){ if (_arg2 < _arg1){ _arg2 = (_arg2 + (Math.PI * 2)); } else { _arg2 = (_arg2 - (Math.PI * 2)); }; _local4 = (_arg1 - _arg2); }; if (Math.abs(_local4) <= _arg3){ return (true); }; return (false); } function UpdatePhysObj_BubbleSplat(){ timer--; if (timer <= 0){ collideFunction = Game.RemoveObj_Standard; collidetimer = 10; }; } function UpdatePhysObj_Springboard(){ var _local1:GameObj = GetGameObject(0); if (controlMode == 0){ _local1.frame = 0; }; if (controlMode == 1){ if (_local1.PlayAnimation()){ controlMode = 0; }; }; } function InitPhysObj_StartPos(){ trace("Adding Start Pos"); } function UpdateLine(_arg1:Number):Point{ lineLinearPos = (lineLinearPos + _arg1); if (lineLinearPos > 1){ if (lineLoop == true){ lineLinearPos = (lineLinearPos - 1); } else { lineLinearPos = 1; }; }; if (lineLinearPos < 0){ if (lineLoop == true){ lineLinearPos = (lineLinearPos + 1); } else { lineLinearPos = 0; }; }; var _local2:PhysLine = Game.GetCurrentLevel().lines[lineIndex]; if (_local2 == null){ return (new Point(0, 0)); }; var _local3:Point = _local2.GetInterpolatedPoint(lineLinearPos, lineLoop); return (_local3); } function SwitchedPhysObj_TimedSwitch():Boolean{ var _local1:GameObj = GetGameObject(0); var _local2:Boolean; if (controlMode == 0){ _local1.controlMode = 1; controlMode = 1; timer = switch_timer; SoundPlayer.Play("switchwav"); _local2 = true; } else { _local2 = false; }; return (_local2); } function GetParamBool(_arg1:String, _arg2:Boolean=false):Boolean{ var _local4:String; var _local3:int = paramNames.indexOf(_arg1); if (_local3 != -1){ _local4 = paramValues[_local3]; if (_local4 == "true"){ return (true); }; return (false); }; return (_arg2); } function RotateToRequiredRot(_arg1:Number, _arg2:Number):Boolean{ var _local3:Number = (_arg2 + (Math.PI / 2)); var _local4:Number = Utils.DotProduct(Math.cos(movementVec.rot), Math.sin(movementVec.rot), Math.cos(_local3), Math.sin(_local3)); if (movementVec.NearRot(_arg2, _arg1)){ movementVec.rot = _arg2; return (true); }; if (_local4 < 0){ movementVec.AddRot(_arg1); } else { movementVec.AddRot(-(_arg1)); }; return (false); } public function GetBodyAngleFromLinearVelocity(_arg1:int):Number{ var _local2:b2Vec2 = new b2Vec2(0, 0); var _local3:b2Body = bodies[_arg1]; var _local4:b2Vec2 = _local3.GetLinearVelocity(); var _local5:Number = Math.atan2(_local4.y, _local4.x); return (_local5); } public function GetDirBetween(_arg1, _arg2, _arg3, _arg4):Number{ var _local5:* = Math.atan2((_arg4 - _arg2), (_arg3 - _arg1)); return (_local5); } public function SetBodyCollisionMask(_arg1:int, _arg2:int):void{ var _local3:b2Body; var _local4:b2Shape; var _local5:b2FilterData; if (_arg1 == -1){ for each (_local3 in bodies) { _local4 = _local3.GetShapeList(); while (_local4) { _local5 = _local4.GetFilterData(); _local5.maskBits = _arg2; _local4.SetFilterData(_local5); Game.world.Refilter(_local4); _local4 = _local4.GetNext(); }; }; } else { _local3 = bodies[_arg1]; _local4 = _local3.GetShapeList(); while (_local4) { _local5 = _local4.GetFilterData(); _local5.maskBits = _arg2; _local4.SetFilterData(_local5); Game.world.Refilter(_local4); _local4 = _local4.GetNext(); }; }; } public function Remove(){ var _local1:b2Joint; var _local2:b2Body; var _local3:PhysObj_BodyUserData; var _local4:int; var _local5:GameObj; for each (_local1 in joints) { Game.world.DestroyJoint(_local1); }; for each (_local2 in bodies) { _local3 = (_local2.GetUserData() as PhysObj_BodyUserData); if (_local3 != null){ _local4 = _local3.gameObjectID; if (_local4 != -1){ _local5 = GameObjects.objs[_local4]; _local5.active = false; }; }; Game.world.DestroyBody(_local2); }; } public function SetPos(_arg1:Number, _arg2:Number):void{ var _local3:b2Body; var _local4:b2Vec2; var _local5:Number; var _local6:b2Vec2; x = _arg1; y = _arg2; for each (_local3 in bodies) { _local4 = _local3.GetPosition(); _local5 = Utils.DistBetweenPoints(x, y, _local4.x, _local4.y); if (_local5 > 1){ _local5 = 1; }; _local6 = new b2Vec2(((x - _local4.x) * 0.1), ((y - _local4.y) * 0.01)); _local3.ApplyImpulse(_local6, new b2Vec2(0, 0)); }; } public function SetBodyXForm(_arg1:int, _arg2:Number, _arg3:Number, _arg4:Number):void{ var _local5:b2Vec2 = new b2Vec2(_arg2, _arg3); var _local6:b2Body = bodies[_arg1]; _local6.SetXForm(_local5, _arg4); } function UpdatePhysObj_AIVehicle(){ var _local1:b2Body = bodies[0]; var _local2:PhysLine = Game.GetLineByIndex(ai_lineIndex); var _local3:Point = _local2.points[ai_nextLineNode].clone(); _local3.x = (_local3.x * Game.w2p); _local3.y = (_local3.y * Game.w2p); var _local4:b2Vec2 = GetBodyWorldPos(0); var _local5:Number = Math.atan2((_local3.y - _local4.y), (_local3.x - _local4.x)); var _local6:Number = _local1.GetMass(); var _local7:Number = (1 / _local6); var _local8:Number = _local1.GetAngle(); AIVehicle_FollowPath(); var _local9:Number = (0.5 * _local7); _local5 = GetBodyAngle(0); var _local10:Number = Math.cos(_local5); var _local11:Number = Math.sin(_local5); _local1.m_linearVelocity.Add(new b2Vec2((_local10 * _local9), (_local11 * _local9))); LimitLinearVelocity(ai_maxSpeed); if (AIVehicle_CheckCrossedPoint()){ ai_nextLineNode++; if (ai_nextLineNode >= _local2.points.length){ ai_nextLineNode = 0; }; }; UpdateCheckpoints(); UpdateVehicleGameObject(_local8); } function UpdatePhysObj_TimedSwitch(){ var _local1:GameObj; if (controlMode == 1){ timer--; if (timer <= 0){ SoundPlayer.Play("switchwav"); _local1 = GetGameObject(0); _local1.controlMode = 2; controlMode = 0; }; }; } function InitPhysObj_BubbleSplat(){ colflags = 1; timer = 10; updateFunction = UpdatePhysObj_BubbleSplat; } function InitPhysObj_Springboard(){ GetParams(initParams); updateFunction = UpdatePhysObj_Springboard; controlMode = 0; } function AIVehicle_FollowPath():void{ var _local1:PhysLine = Game.GetLineByIndex(ai_lineIndex); var _local2:Point = _local1.points[ai_nextLineNode].clone(); _local2.x = (_local2.x * Game.w2p); _local2.y = (_local2.y * Game.w2p); var _local3:b2Vec2 = GetBodyWorldPos(0); var _local4:Number = GetBodyAngle(0); var _local5:Number = 3; var _local6:Number = GetDirBetween(_local3.x, _local3.y, _local2.x, _local2.y); var _local7:Number = (_local4 + (Math.PI / 2)); _local7 = NormalizeDir(_local7); var _local8:Number = Utils.DotProduct(Math.cos(_local6), Math.sin(_local6), Math.cos(_local7), Math.sin(_local7)); if (NearRot(_local4, _local6, 0.1)){ SetAngularVelocity(0, 0); } else { if (_local8 > 0){ SetAngularVelocity(0, _local5); } else { SetAngularVelocity(0, -(_local5)); }; }; } public function Update(){ if (updateFunction != null){ updateFunction(); }; } function InitPhysObj_Snowball01(){ InitPhysObj_Snowball(); radius = 30; } function InitPhysObj_Snowball02(){ InitPhysObj_Snowball(); radius = 40; } function InitPhysObj_Snowball03(){ InitPhysObj_Snowball(); radius = 50; } function GetParam(_arg1:String, _arg2:String=""):String{ var _local3:int = paramNames.indexOf(_arg1); if (_local3 != -1){ return (paramValues[_local3]); }; return (_arg2); } function BreakObject(_arg1:Number){ if ((_arg1 * Game.p2w) > 100){ return; }; var _local2:PhysObj_BodyUserData = (bodies[0].GetUserData() as PhysObj_BodyUserData); var _local3:GameObj = GameObjects.objs[_local2.gameObjectID]; _local3.frame++; var _local4:int = GraphicObjects.GetNumFrames(_local3.graphicID); if (_local3.frame >= _local4){ _local3.frame = (_local4 - 1); collideFunction = Game.RemoveObj_Standard; collidetimer = 10; }; SoundPlayer.Play("objectbreakwav"); } function InitPhysObj_Path(){ GetParams(initParams); var _local1:String = GetParam("line", ""); if (_local1 == ""){ lineIndex = -1; } else { lineIndex = GetLineIndexByName(_local1); }; if (lineIndex == -1){ updateFunction = null; }; trace(("lineIndex" + lineIndex)); lineSpeed = Number(GetParam("speed")); lineLoop = GetParamBool("loop"); switchName = GetParam("switch", ""); lineResetAtEnd = GetParamBool("endreset"); lineLinearPos = 0; var _local2:Number = GetParamNumber("startpos", 0); lineLinearPos = _local2; var _local3:Boolean = GetParamBool("2way"); controlMode = 1; switchFunction = null; updateFunction = null; if (lineIndex != -1){ if (switchName != ""){ controlMode = 0; switchFunction = SwitchFunction_Path; } else { controlMode = 1; }; updateFunction = UpdatePhysObj_Path; }; if (_local3){ if (switchName != ""){ switchFunction = SwitchFunction_Path_2way; }; updateFunction = UpdatePhysObj_Path_2way; }; } function InitPhysObj_Mover(){ updateFunction = UpdatePhysObj_Mover; mover_x0 = (249 * Game.w2p); mover_x1 = (250 * Game.w2p); mover_xvel = 350; } function GetParamNumber(_arg1:String, _arg2:Number=0):Number{ var _local3:int = paramNames.indexOf(_arg1); if (_local3 != -1){ return (Number(paramValues[_local3])); }; return (_arg2); } public function PreUpdate(){ if (preUpdateFunction != null){ preUpdateFunction(); }; } public function Init(){ switchName = ""; switchName1 = ""; colflags = 0; var _local1:PhysObj = Game.physObjs.FindByName(typeName); if (_local1.initFunctionName != null){ var _local2 = this; _local2[_local1.initFunctionName](); }; } function UpdatePhysObj_BadguyTimed(){ timer--; if (timer <= 0){ collideFunction = Game.RemoveObj_Standard; collidetimer = 10; }; } function InitPhysObj_PortalEntry(){ GetParams(initParams); } public function Clone():PhysObj_Instance{ var _local1:PhysObj_Instance = new PhysObj_Instance(); _local1.instanceName = instanceName; _local1.initParams = initParams; _local1.typeName = typeName; _local1.x = x; _local1.y = y; _local1.rot = rot; _local1.bodies = bodies; _local1.joints = joints; return (_local1); } public function GetBodyLinearVelocity(_arg1:int):b2Vec2{ var _local2:b2Vec2 = new b2Vec2(0, 0); var _local3:b2Body = bodies[_arg1]; var _local4:b2Vec2 = _local3.GetLinearVelocity(); return (_local4); } function UpdateCheckpoints(){ var _local10:int; var _local1:Array = Game.GetLineListByType(2); var _local2:PhysLine = _local1[vehicleCheckpointIndex]; var _local3:b2Vec2 = GetBodyWorldPos(0); var _local4:Point = new Point((_local3.x * Game.p2w), (_local3.y * Game.p2w)); var _local5:Number = _local2.points[0].x; var _local6:Number = _local2.points[0].y; var _local7:Number = _local2.points[1].x; var _local8:Number = _local2.points[1].y; var _local9:Boolean = Utils.SideOfLine(_local5, _local6, _local7, _local8, _local4.x, _local4.y); if (_local9 == false){ if (vehicleCheckpointIndex == 0){ vehicleCurrentLap++; }; vehicleCheckpointIndex++; _local10 = Game.GetNumLinesByType(2); if (vehicleCheckpointIndex >= _local10){ vehicleCheckpointIndex = 0; }; }; } function UpdatePhysObj_PlayerVehicle(){ var _local5:b2Body; var _local1:Boolean; var _local2:Boolean; var _local3:Boolean; var _local4:Boolean; if (KeyReader.Down(KeyReader.KEY_UP)){ _local1 = true; }; if (KeyReader.Down(KeyReader.KEY_DOWN)){ _local4 = true; }; if (KeyReader.Down(KeyReader.KEY_LEFT)){ _local2 = true; }; if (KeyReader.Down(KeyReader.KEY_RIGHT)){ _local3 = true; }; _local5 = bodies[0]; var _local6:Number = _local5.GetMass(); var _local7:Number = (1 / _local6); var _local8:Number = GetBodyAngle(0); var _local9:Number = Math.cos(_local8); var _local10:Number = Math.sin(_local8); var _local11:Number = (0.5 * _local7); var _local12:Number = (10 * _local7); if (_local1){ vehicleSpeed = (vehicleSpeed + 1); if (vehicleSpeed >= 17){ vehicleSpeed = 17; }; _local5.m_linearVelocity.Add(new b2Vec2((_local9 * _local11), (_local10 * _local11))); } else { if (_local4){ vehicleSpeed = (vehicleSpeed + 1); if (vehicleSpeed >= 6){ vehicleSpeed = 6; }; _local5.m_linearVelocity.Add(new b2Vec2((_local9 * -(_local11)), (_local10 * -(_local11)))); } else { if (vehicleSpeed < 0){ vehicleSpeed = (vehicleSpeed + 1); if (vehicleSpeed >= 0){ vehicleSpeed = 0; }; } else { vehicleSpeed = (vehicleSpeed - 1); if (vehicleSpeed <= 0){ vehicleSpeed = 0; }; }; _local5.m_linearVelocity.Multiply(0.9); }; }; var _local13:Number = 0.1; _local5 = bodies[0]; if (_local2){ driveVec.AddRot(-(_local13)); } else { if (_local3){ driveVec.AddRot(_local13); }; }; RotateToRequiredRot(0.07, driveVec.rot); _local5.SetXForm(null, movementVec.rot); SetAngularVelocity(0, 0); LimitLinearVelocity(vehicleSpeed); UpdateCheckpoints(); UpdateVehicleGameObject(driveVec.rot); } function SwitchedPhysObj_TwoWaySwitch():Boolean{ var _local1:GameObj = GetGameObject(0); SoundPlayer.Play("switchwav"); if (controlMode == 0){ controlMode = 1; return (true); }; controlMode = 0; return (true); } function UpdatePhysObj_Penguin(){ var _local1:GameObj; var _local2:b2Vec2; var _local3:GameObj; var _local4:Number; var _local5:Number; var _local6:int; if (controlMode == 0){ _local1 = GetGameObject(0); _local2 = GetBodyLinearVelocity(0); if (_local2.Length() > 10){ _local1.frame = 1; SetBodyCollisionMask(0, 1); timer = 2000; controlMode = 1; Game.numPenguinsSmashed++; SoundPlayer.Play("sfx_hit_penguinice"); i = 0; while (i < 20) { _local4 = (_local1.xpos + Utils.RandBetweenFloat(-20, 20)); _local5 = (_local1.ypos + Utils.RandBetweenFloat(-80, 0)); _local3 = GameObjects.AddObj(_local4, _local5, _local1.zpos); _local6 = GraphicObjects.GetIndexByName("IceShards"); _local3.InitHitPiece(_local6, Utils.RandBetweenInt(0, (GraphicObjects.GetNumFrames(_local6) - 1))); i++; }; }; } else { if (controlMode == 1){ timer--; if (timer <= 0){ collideFunction = Game.RemoveObj_Standard; collidetimer = 10; }; }; }; } function UpdatePhysObj_Path(){ var _local1:Point; if (controlMode == 0){ _local1 = UpdateLine(0); SetBodyXForm(0, (_local1.x * Game.w2p), (_local1.y * Game.w2p), 0); } else { _local1 = UpdateLine(lineSpeed); SetBodyXForm(0, (_local1.x * Game.w2p), (_local1.y * Game.w2p), 0); if (lineLoop == false){ if (lineLinearPos >= 1){ lineLinearPos = 1; if (lineResetAtEnd){ lineLinearPos = 0; }; controlMode = 0; }; }; }; } function SwitchFunction_Path(){ if (controlMode == 0){ controlMode = 1; }; } function InitPhysObj_AIVehicle(){ updateFunction = UpdatePhysObj_AIVehicle; ai_nextLineNode = 0; ai_maxSpeed = Utils.RandBetweenFloat(10, 15); var _local1:int = Game.GetNumLinesByType(1); ai_lineIndex = Utils.RandBetweenInt(0, (_local1 - 1)); ai_lineIndex = Game.GetLineIndexByTypeIndex(1, ai_lineIndex); vehicleCheckpointIndex = 0; vehicleCurrentLap = 0; } function AIVehicle_CheckCrossedPoint():Boolean{ var _local1:PhysLine = Game.GetLineByIndex(ai_lineIndex); var _local2:int = (ai_nextLineNode - 1); if (_local2 < 0){ _local2 = (_local1.points.length - 1); }; var _local3:Point = _local1.points[_local2].clone(); var _local4:Point = _local1.points[ai_nextLineNode].clone(); var _local5:Number = Math.atan2((_local4.y - _local3.y), (_local4.x - _local3.x)); _local5 = (_local5 + (Math.PI / 2)); var _local6:Number = Math.cos(_local5); var _local7:Number = Math.sin(_local5); var _local8:b2Vec2 = GetBodyWorldPos(0); var _local9:Boolean = Utils.SideOfLine(_local4.x, _local4.y, (_local4.x + _local6), (_local4.y + _local7), (_local8.x * Game.p2w), (_local8.y * Game.p2w)); return ((_local9 == false)); } function UpdatePhysObj_Cannonball(){ timer--; if (timer <= 0){ collideFunction = Game.RemoveObj_Standard; collidetimer = 10; }; } function UpdatePhysObj_Cannon(){ if (controlMode == 0){ } else { if (controlMode == 1){ cannon_ang = (cannon_ang + cannon_angvel); } else { if (controlMode == 2){ cannon_ang = (cannon_ang - cannon_angvel); }; }; }; if (cannon_ang >= cannon_maxang){ cannon_ang = cannon_maxang; }; if (cannon_ang <= cannon_minang){ cannon_ang = cannon_minang; }; var _local1:b2Body = bodies[0]; var _local2:b2Vec2 = GetBodyWorldPos(0); _local1.SetXForm(_local2, cannon_ang); var _local3:GameObj = GetGameObject(0); if (cannon_firing){ _local3.frameVel = 1; if (_local3.PlayAnimation()){ cannon_firing = false; _local3.frame = 1; }; }; } public function SetShapeCollisionMaskByName(_arg1:String, _arg2:int):void{ var _local3:b2Body; var _local4:b2Shape; var _local5:b2FilterData; for each (_local3 in bodies) { _local4 = _local3.GetShapeList(); while (_local4) { if (_local4.GetUserData() == _arg1){ _local5 = _local4.GetFilterData(); _local5.maskBits = _arg2; _local4.SetFilterData(_local5); Game.world.Refilter(_local4); }; _local4 = _local4.GetNext(); }; }; } function TriggerPhysObj_Springboard(){ controlMode = 1; var _local1:GameObj = GetGameObject(0); _local1.frame = 0; _local1.frameVel = 1; SoundPlayer.Play("springboardwav"); } function InitPhysObj_PlayerVehicle(){ type = 1; updateFunction = UpdatePhysObj_PlayerVehicle; vehicleCheckpointIndex = 0; vehicleCurrentLap = 0; vehicleSpeed = 0; movementVec = new Vec(); driveVec = new Vec(); } function InitPhysObj_Cannon(){ GetParams(initParams); updateFunction = UpdatePhysObj_Cannon; switchFunction = SwitchFunction_Cannon; cannon_minang = Utils.DegToRad(GetParamNumber("minang")); cannon_maxang = Utils.DegToRad(GetParamNumber("maxang")); cannon_angvel = GetParamNumber("speed"); switchName = GetParam("switch"); cannon_mode = GetParam("mode"); cannon_ang = cannon_minang; cannon_firing = false; controlMode = 0; } function SwitchFunction_Cannon(){ if (controlMode == 0){ controlMode = 1; } else { if (controlMode == 1){ controlMode = 2; } else { if (controlMode == 2){ controlMode = 1; }; }; }; } public function WakeUp():void{ var _local1:b2Body; for each (_local1 in bodies) { _local1.WakeUp(); }; } public function GetBodyWorldPos(_arg1:int):b2Vec2{ var _local4:b2Body; var _local2:b2Vec2 = new b2Vec2(0, 0); var _local3:int; for each (_local4 in bodies) { if (_local3 == _arg1){ _local2 = _local4.GetWorldCenter().Copy(); }; _local3++; }; return (_local2); } function InitPhysObj_BadguyTimed(){ updateFunction = UpdatePhysObj_BadguyTimed; timer = (Defs.fps * 3); } public function LimitLinearVelocity(_arg1:Number):void{ var _local2:b2Body; var _local3:b2Vec2; for each (_local2 in bodies) { _local3 = _local2.GetLinearVelocity(); if (_local3.Length() > _arg1){ _local3.Normalize(); _local3.Multiply(_arg1); _local2.SetLinearVelocity(_local3); }; }; } function InitPhysObj_Switch(){ GetParams(initParams); var _local1:String = GetParam("type"); if (_local1 == ""){ _local1 = "once"; }; if (_local1 == "once"){ doSwitchFunction = SwitchedPhysObj_Switch; updateFunction = null; }; if (_local1 == "timed"){ switch_timer = (GetParamNumber("time") * Defs.fps); doSwitchFunction = SwitchedPhysObj_TimedSwitch; updateFunction = UpdatePhysObj_TimedSwitch; }; if (_local1 == "2way"){ doSwitchFunction = SwitchedPhysObj_TwoWaySwitch; updateFunction = UpdatePhysObj_TwoWaySwitch; controlMode = 0; }; } public function SetAngularDamping(_arg1:int, _arg2:Number):void{ var _local3:b2Body; if (_arg1 == -1){ for each (_local3 in bodies) { _local3.m_angularDamping = _arg2; }; } else { _local3 = bodies[_arg1]; _local3.m_angularDamping = _arg2; }; } public function GetGameObject(_arg1:int):GameObj{ var _local2:PhysObj_BodyUserData = (bodies[_arg1].GetUserData() as PhysObj_BodyUserData); var _local3:GameObj = GameObjects.objs[_local2.gameObjectID]; return (_local3); } function UpdatePhysObj_Snowball(){ var _local2:PhysObj_Instance; var _local5:int; var _local6:Particle; var _local7:Number; var _local8:Number; var _local9:b2Body; var _local10:Number; var _local11:Number; var _local1:Number = (GetBodyWorldPos(0).x * Game.p2w); if (_local1 < (Game.scrollX - 30)){ collideFunction = Game.RemoveObj_Snowball; collidetimer = 10; }; if (_local1 > (Game.scrollX + 800)){ collideFunction = Game.RemoveObj_Snowball; collidetimer = 10; }; _local2 = Game.GetPhysObjInstanceByName("player"); if (_local2 == null){ return; }; var _local3:b2Vec2 = GetBodyWorldPos(0); var _local4:b2Vec2 = _local2.GetBodyWorldPos(0); if (Utils.DistBetweenPoints(_local3.x, _local3.y, _local4.x, _local4.y) < (50 * Game.w2p)){ collideFunction = Game.RemoveObj_Snowball; collidetimer = 10; SoundPlayer.Play("sfx_hit_snowball"); _local5 = 0; while (_local5 < 5) { _local7 = (_local3.x * Game.p2w); _local8 = (_local3.y * Game.p2w); _local6 = Particles.Add(_local7, _local8); _local6.InitSnowballSnow(radius); _local5++; }; }; timer++; if (timer == 1){ _local9 = bodies[0]; _local10 = _local9.GetMass(); _local11 = (Utils.RandBetweenFloat(20, 50) * _local10); ApplyImpulse(_local11, 0); SetAngularVelocity(0, Utils.RandBetweenFloat(10, 20)); }; } public function ApplyAngularVelocity(_arg1:int, _arg2:Number):void{ var _local3:b2Body; if (_arg1 == -1){ for each (_local3 in bodies) { _local3.ApplyTorque(_arg2); }; } else { bodies[_arg1].ApplyTorque(_arg2); }; } function UpdatePhysObj_Breakable(){ } public function GetBodyAngle(_arg1:int):Number{ var _local2:b2Vec2 = new b2Vec2(0, 0); var _local3:b2Body = bodies[_arg1]; return (_local3.GetAngle()); } function InitPhysObj_Gate(){ GetParams(initParams); switchName = GetParam("switch"); switchName1 = GetParam("switch1"); var _local1:String = GetParam("start"); gateMode = GetParam("mode", "once"); gateTime = (GetParamNumber("timer", 1) * Defs.fps); updateFunction = UpdatePhysObj_Gate; switchFunction = SwitchFunction_Gate; controlMode = 0; if (_local1 == "left"){ controlMode = 0; }; if (_local1 == "right"){ controlMode = 1; }; gateVel = GetParamNumber("strength", 100); } public function LimitAngularVelocity(_arg1:int, _arg2:Number):void{ var _local3:b2Body; var _local4:Number; if (_arg1 == -1){ for each (_local3 in bodies) { _local4 = _local3.GetAngularVelocity(); if (_local4 >= _arg2){ _local4 = _arg2; }; if (_local4 <= -(_arg2)){ _local4 = -(_arg2); }; _local3.SetAngularVelocity(_local4); }; } else { _local3 = bodies[_arg1]; _local4 = _local3.GetAngularVelocity(); if (_local4 >= _arg2){ _local4 = _arg2; }; if (_local4 <= -(_arg2)){ _local4 = -(_arg2); }; _local3.SetAngularVelocity(_local4); }; } public function GetXForm(_arg1:int):b2XForm{ var _local2:b2Body = bodies[_arg1]; return (_local2.GetXForm()); } function UpdatePhysObj_Magnet(){ if (magnet_mode == "static"){ } else { if (magnet_mode == "timed"){ timer++; if (timer >= magnet_time){ timer = 0; magnet_polarity = (magnet_polarity == false); SoundPlayer.Play("magnetwav"); }; }; }; var _local1:GameObj = GetGameObject(0); if (magnet_polarity == false){ _local1.frameVel = -0.5; }; if (magnet_polarity == true){ _local1.frameVel = 0.5; }; _local1.CycleAnimation(); } public function ApplyImpulse(_arg1:Number, _arg2:Number):void{ var _local3:b2Body; for each (_local3 in bodies) { _local3.ApplyImpulse(new b2Vec2(_arg1, _arg2), _local3.GetWorldCenter()); }; } function InitPhysObj_Magnet(){ GetParams(initParams); magnet_polarity = GetParamBool("polarity"); magnet_mode = GetParam("mode", "static"); magnet_time = (Defs.fps * GetParamNumber("time")); switchName = ""; switchFunction = null; if (magnet_mode == "switch"){ switchName = GetParam("switch"); switchFunction = SwitchFunction_Magnet; }; updateFunction = UpdatePhysObj_Magnet; timer = 0; } public function GetBodyAngularVelocity(_arg1:int):Number{ var _local2:b2Body = bodies[_arg1]; return (_local2.GetAngularVelocity()); } public function AddToPos(_arg1:int, _arg2:b2Vec2):void{ var _local3:b2XForm; var _local4:b2Body; if (_arg1 == -1){ for each (_local4 in bodies) { _local3 = _local4.GetXForm(); _local3.position.Add(_arg2); _local4.SetXForm(_local3.position, 0); }; } else { _local3 = _local4.GetXForm(); _local3.position.Add(_arg2); _local4.SetXForm(_local3.position, 0); }; } function SwitchFunction_Magnet(){ SoundPlayer.Play("magnetwav"); magnet_polarity = (magnet_polarity == false); } function InitPhysObj_Cannonball(){ timer = (Defs.fps * 3); updateFunction = UpdatePhysObj_Cannonball; } function UpdatePhysObj_Gate(){ if (controlMode == 1){ ApplyAngularVelocity(1, -(gateVel)); }; if (controlMode == 2){ ApplyAngularVelocity(1, gateVel); }; } function InitPhysObj_Snowball(){ updateFunction = UpdatePhysObj_Snowball; WakeUp(); timer = 0; Game.numSnowballs++; } function SwitchFunction_Gate(){ if (controlMode == 0){ controlMode = 1; } else { if (controlMode == 1){ controlMode = 2; } else { if (controlMode == 2){ controlMode = 1; }; }; }; } } }//package
Section 203
//PhysObj_Instances (PhysObj_Instances) package { public class PhysObj_Instances { public var list:Array; public function PhysObj_Instances(){ list = new Array(); } public function Remove(_arg1:PhysObj_Instance):Boolean{ var _local3:PhysObj_Instance; if (Exists(_arg1) == false){ return (false); }; _arg1.Remove(); var _local2:Array = new Array(); for each (_local3 in list) { if (_local3 == _arg1){ } else { _local2.push(_local3); }; }; list = _local2; return (true); } public function Exists(_arg1:PhysObj_Instance):Boolean{ var _local2:PhysObj_Instance; for each (_local2 in list) { if (_local2 == _arg1){ return (true); }; }; return (false); } public function GetByIndex(_arg1:int):PhysObj_Instance{ return (list[_arg1]); } public function RemoveByName(_arg1:String):void{ var _local2:PhysObj_Instance = FindByName(_arg1); if (_local2 == null){ return; }; Remove(_local2); } public function FindByName(_arg1:String):PhysObj_Instance{ var _local2:PhysObj_Instance; for each (_local2 in list) { if (_local2.instanceName == _arg1){ return (_local2); }; }; return (null); } } }//package
Section 204
//PhysObj_Joint (PhysObj_Joint) package { import flash.geom.*; public class PhysObj_Joint { public var prism_enableLimit:Boolean; public var prism_pos:Point; public var obj0Name:String; public var obj1Name:String; public var dist_distance:Number; public var name:String; public var prism_lowerTranslation:Number; public var prism_maxMotorForce:Number; public var dist_pos0:Point; public var dist_pos1:Point; public var prism_enableMotor:Boolean; public var prism_axisangle:Number; public var prism_motorSpeed:Number; public var rev_enableLimit:Boolean; public var rev_enableMotor:Boolean; public var rev_upperAngle:Number; public var rev_lowerAngle:Number; public var rev_maxMotorTorque:Number; public var type:int; public var prism_upperTranslation:Number; public var rev_motorSpeed:Number; public var rev_pos:Point; public static const Type_Mouse:int = 3; public static const Type_Prismatic:int = 2; public static const Type_Distance:int = 1; public static const Type_Rev:int = 0; public function PhysObj_Joint(){ type = 0; name = ""; obj0Name = ""; obj1Name = ""; rev_pos = new Point(0, 0); rev_enableLimit = false; rev_lowerAngle = 0; rev_upperAngle = 0; rev_enableMotor = false; rev_motorSpeed = 0; rev_maxMotorTorque = 0; prism_pos = new Point(0, 0); prism_lowerTranslation = 0; prism_upperTranslation = 0; prism_enableLimit = false; prism_enableMotor = false; prism_motorSpeed = 0; prism_maxMotorForce = 0; prism_axisangle = 0; dist_pos0 = new Point(0, 0); dist_pos1 = new Point(0, 0); dist_distance = 1; } } }//package
Section 205
//PhysObj_Shape (PhysObj_Shape) package { import flash.geom.*; public class PhysObj_Shape { public var type:int; public var poly_rot:Number; public var circle_pos:Point; public var density:Number; public var restitution:Number; public var name:String; public var collisionCategory:int; public var circle_radius:Number; public var friction:Number; public var poly_points:Array; public var collisionMask:int; public static const Type_Poly:int = 0; public static const Type_Circle:int = 1; public function PhysObj_Shape(){ type = 0; name = ""; poly_points = new Array(); circle_pos = new Point(); circle_radius = 0; poly_rot = 0; collisionCategory = 0; collisionMask = 0; } public function Caclulate(){ var _local1:Matrix; var _local2:Array; var _local3:Point; var _local4:Point; if (type == Type_Poly){ _local1 = new Matrix(); _local1.rotate(poly_rot); _local2 = new Array(); for each (_local3 in poly_points) { _local4 = _local1.transformPoint(_local3); _local2.push(_local4); }; poly_points = _local2; }; } } }//package
Section 206
//PhysObjs (PhysObjs) package { public class PhysObjs { public var list:Array; public function PhysObjs(){ list = new Array(); } public function GetNum():int{ return (list.length); } public function FindIndexByName(_arg1:String):int{ var _local3:PhysObj; var _local2:int; for each (_local3 in list) { if (_local3.name == _arg1){ return (_local2); }; _local2++; }; trace(("ERROR PhysObjs FindByName " + _arg1)); return (0); } public function GetByIndex(_arg1:int):PhysObj{ return (list[_arg1]); } public function FindByName(_arg1:String):PhysObj{ var _local2:PhysObj; for each (_local2 in list) { if (_local2.name == _arg1){ return (_local2); }; }; trace(("ERROR PhysObjs FindByName " + _arg1)); return (null); } public function InitFromXml(_arg1:XML):void{ var _local2:int; var _local3:XML; var _local4:PhysObj; list = new Array(); _local2 = 0; while (_local2 < _arg1.physobj.length()) { _local3 = _arg1.physobj[_local2]; _local4 = new PhysObj(); _local4.FromXml(_local3); list.push(_local4); _local2++; }; } } }//package
Section 207
//Pickup01 (Pickup01) package { import flash.display.*; public dynamic class Pickup01 extends MovieClip { } }//package
Section 208
//Pickup02 (Pickup02) package { import flash.display.*; public dynamic class Pickup02 extends MovieClip { } }//package
Section 209
//Player (Player) package { public class Player { static const upg_total:int = 5; static const upg_speed:int = 0; static const upg_accel:int = 1; static const upg_boost:int = 3; static const upg_brake:int = 2; static const upg_spin:int = 4; public static var costs:Array; static var levels:Array; public static function GetCost(_arg1):int{ var _local2:int = levels[_arg1]; var _local3:int = costs[(_local2 + 1)]; return (_local3); } public static function LevelsCheat():void{ levels[0] = 10; levels[1] = 10; levels[2] = 10; levels[3] = 10; levels[4] = 10; } public static function Upgrade(_arg1):void{ var _local2:int = levels[_arg1]; _local2++; if (_local2 > 10){ _local2 = 0; }; levels[_arg1] = _local2; } public static function GetLevel(_arg1:int):int{ return (levels[_arg1]); } public static function InitOnce(){ var _local1:int; levels = new Array(); costs = new Array(); levels.push(0, 0, 0, 0, 0); costs.push(0); _local1 = 1; while (_local1 <= 10) { costs.push(((_local1 * _local1) * _local1)); _local1++; }; costs[0] = 0; costs[1] = 5; costs[2] = 10; costs[3] = 30; costs[4] = 60; costs[5] = 120; costs[6] = 200; costs[7] = 330; costs[8] = 500; costs[9] = 1000; costs[10] = 2000; } public static function SetLevel(_arg1:int, _arg2:int):void{ levels[_arg1] = _arg2; } } }//package
Section 210
//PlayerBikeData (PlayerBikeData) package { public class PlayerBikeData { var acc:Number; var name:String; var bellAvailable:Boolean; var bio:String; var inGameID:int; var maxjumpvel:Number; var physObjIndex:int; var selectFrame:int; var available:Boolean; var maxvel:Number; public function PlayerBikeData(){ name = ""; physObjIndex = 0; inGameID = 0; acc = 200; maxvel = 30; maxjumpvel = 30; selectFrame = 1; bio = ""; available = false; bellAvailable = false; } } }//package
Section 211
//PlayerBikes (PlayerBikes) package { public class PlayerBikes { static var bikes:Array; public static function GetBikeData(_arg1:int):PlayerBikeData{ return (bikes[_arg1]); } static function InitOnce(){ var _local3:int; var _local4:XML; var _local5:PlayerBikeData; bikes = new Array(); var _local1:XML = ExternalData.xml; var _local2:int = _local1.playerbike.length(); _local3 = 0; while (_local3 < _local2) { _local4 = _local1.playerbike[_local3]; _local5 = new PlayerBikeData(); _local5.name = XmlHelper.GetAttrString(_local4.@name, "undefined"); _local5.physObjIndex = XmlHelper.GetAttrInt(_local4.@bike, 1); _local5.acc = XmlHelper.GetAttrNumber(_local4.@acc, 200); _local5.maxvel = XmlHelper.GetAttrNumber(_local4.@vel, 30); _local5.maxjumpvel = XmlHelper.GetAttrNumber(_local4.@jumpvel, 30); _local5.selectFrame = XmlHelper.GetAttrInt(_local4.@selectframe, 1); _local5.inGameID = XmlHelper.GetAttrInt(_local4.@ingameid, 1); _local5.bio = XmlHelper.GetAttrString(_local4.@bio, "undefined"); bikes.push(_local5); _local3++; }; bikes[0].available = true; } public static function GetNumHornsUnlocked():int{ var _local2:PlayerBikeData; var _local1:int; for each (_local2 in bikes) { if (_local2.bellAvailable == true){ _local1++; }; }; return (_local1); } public static function GetNumBikesUnlocked():int{ var _local2:PlayerBikeData; var _local1:int; for each (_local2 in bikes) { if (_local2.available == true){ _local1++; }; }; return (_local1); } public static function BikesCheat(){ var _local1:PlayerBikeData; for each (_local1 in bikes) { _local1.available = true; }; } public static function HornsCheat(){ var _local1:PlayerBikeData; for each (_local1 in bikes) { _local1.bellAvailable = true; }; } } }//package
Section 212
//PlayerControls (PlayerControls) package { import flash.display.*; public dynamic class PlayerControls extends MovieClip { public var buttonNoMoreHelp:SimpleButton; public var buttonNext:SimpleButton; } }//package
Section 213
//PlayerRecord (PlayerRecord) package { public class PlayerRecord { var rot:Number; var x:Number; var y:Number; var frame:int; public function PlayerRecord(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:int){ x = _arg1; y = _arg2; rot = _arg3; frame = _arg4; } } }//package
Section 214
//PlayerRecordings (PlayerRecordings) package { import flash.display.*; public class PlayerRecordings { static var pr:PlayerRecord = new PlayerRecord(0, 0, 0, 0); static var currentData:Array; static var outputstring:String; static var routeInfo:Array; static var arrayindex:int = 0; static var currenty:Number; static var recordings:Array; static var currentx:Number; static var pr1:PlayerRecord = new PlayerRecord(0, 0, 0, 0); static var firsttime:Boolean; static function AddData(_arg1:Array){ var _local2:int; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local3:int = (_arg1.length / 3); _local2 = 0; while (_local2 < _local3) { _local5 = _arg1[((_local2 * 3) + 0)]; _local6 = _arg1[((_local2 * 3) + 1)]; _local7 = _arg1[((_local2 * 3) + 2)]; if (firsttime){ firsttime = false; currentData.push(_local5); currentData.push(_local6); currentData.push(_local7); currentx = _local5; currenty = _local6; } else { currentx = (currentx + _local5); currenty = (currenty + _local6); currentData.push(currentx); currentData.push(currenty); currentData.push(_local7); }; _local2++; }; for each (_local4 in _arg1) { if (firsttime == true){ currentData.push(_local4); }; }; } static function StartData(_arg1:int){ currentData = new Array(); routeInfo.push(_arg1); firsttime = true; } static function Load(){ InitOnce(); } static function InitOnce(){ recordings = new Array(); routeInfo = new Array(); outputstring = ""; arrayindex = 0; } static function GetNumRoutes(_arg1:int):int{ var _local3:int; if ((((_arg1 < 0)) || ((_arg1 >= recordings.length)))){ return (0); }; var _local2:int; for each (_local3 in routeInfo) { if (_local3 == _arg1){ _local2++; }; }; return (_local2); } public static function GetRouteIndex(_arg1:int, _arg2:int){ var _local6:int; var _local7:int; var _local3:int; var _local4:int; var _local5:Array = new Array(); _local4 = 0; while (_local4 < 100) { _local5.push(0); _local4++; }; for each (_local6 in routeInfo) { var _local10 = _local5; var _local11 = _local6; var _local12 = (_local10[_local11] + 1); _local10[_local11] = _local12; }; _local4 = 0; _local7 = _local5[_arg1]; for each (_local6 in routeInfo) { if (_local6 == _arg1){ if (_local3 == _arg2){ return (_local4); }; _local3++; if (_local3 >= _local7){ _local3 = 0; }; }; _local4++; }; return (0); } static function GetDataFromBitmap(){ var _local5:Boolean; var _local7:uint; var _local8:uint; var _local9:int; var _local10:int; var _local11:int; var _local12:*; var _local13:*; var _local14:*; var _local15:*; var _local1:BitmapData = GraphicObjects.GetBitmapData(GraphicObjects.GetIndexByName("Routes"), 0); trace(((("bitmap: " + _local1.width) + " x ") + _local1.height)); var _local2:int = _local1.width; var _local3:int = _local1.height; var _local4:int; var _local6:int; do { _local5 = false; if (_local6 == 0){ _local7 = _local1.getPixel((_local4 % _local2), (_local4 / _local2)); _local4++; _local8 = _local1.getPixel((_local4 % _local2), (_local4 / _local2)); _local4++; if (_local8 == 0){ _local5 = false; } else { _local5 = true; currentData = new Array(); routeInfo.push(_local7); _local12 = 0; while (_local12 < _local8) { _local9 = _local1.getPixel((_local4 % _local2), (_local4 / _local2)); _local4++; _local10 = _local1.getPixel((_local4 % _local2), (_local4 / _local2)); _local4++; _local11 = _local1.getPixel((_local4 % _local2), (_local4 / _local2)); _local4++; _local13 = (_local9 & 0x800000); _local9 = (_local9 & 8388607); if (_local13 != 0){ _local9 = -(_local9); }; _local13 = (_local10 & 0x800000); _local10 = (_local10 & 8388607); if (_local13 != 0){ _local10 = -(_local10); }; _local13 = (_local11 & 0x800000); _local11 = (_local11 & 8388607); if (_local13 != 0){ _local11 = -(_local11); }; _local14 = false; if ((_local12 % 3) == 0){ _local14 = true; }; _local14 = true; if (_local14){ currentData.push(_local9); currentData.push(_local10); _local15 = (Number(_local11) / 1000); currentData.push(_local15); }; _local12++; }; recordings.push(currentData); }; }; } while (_local5 == true); } static function StopData(){ recordings.push(currentData); } static function GetItem(_arg1:int, _arg2:int):PlayerRecord{ var _local3:PlayerRecord = new PlayerRecord(0, 0, 0, 0); if ((((_arg1 < 0)) || ((_arg1 >= recordings.length)))){ return (null); }; var _local4:Array = recordings[_arg1]; if ((((_arg2 < 0)) || ((_arg2 >= (_local4.length / 3))))){ return (null); }; _local3.x = (_local4[((_arg2 * 3) + 0)] as Number); _local3.y = (_local4[((_arg2 * 3) + 1)] as Number); _local3.rot = (_local4[((_arg2 * 3) + 2)] as Number); _local3.frame = 0; return (_local3); } static function GetRouteLen(_arg1:int):int{ if ((((_arg1 < 0)) || ((_arg1 >= recordings.length)))){ return (-1); }; var _local2:Array = recordings[_arg1]; return ((_local2.length / 3)); } static function GetItem1(_arg1:int, _arg2:int):PlayerRecord{ if ((((_arg1 < 0)) || ((_arg1 >= recordings.length)))){ return (null); }; var _local3:Array = recordings[_arg1]; if ((((_arg2 < 0)) || ((_arg2 >= (_local3.length / 3))))){ return (null); }; pr1.x = (_local3[((_arg2 * 3) + 0)] as Number); pr1.y = (_local3[((_arg2 * 3) + 1)] as Number); pr1.rot = (_local3[((_arg2 * 3) + 2)] as Number); pr1.frame = 0; return (pr1); } } }//package
Section 215
//Poly (Poly) package { import flash.display.*; import flash.geom.*; public class Poly { var param0:String; var param1:String; var subTypeName:String; var active:Boolean; var name:String; var pointList:Array; var typeName:String; var boundingRectangle:Rectangle; var closed:Boolean; var lineList:Array; var iparam0:int; var hitCallback:Object; var type:int; var catmullRomLengt