Frame 1
function onGameDataLoaded() {
_root.game = new com.king.bbbathtub.BBBathtub(_root);
_root.game.init(_root.gda);
}
function onEnd() {
}
function onBegin() {
}
_root.gda = new com.midasplayer.util.GameDataAcquirer();
_root.gda.beginWait(mx.utils.Delegate.create(this, onGameDataLoaded));
var dummy;
dummy = new com.king.bbbathtub.Aeroplane();
dummy = new com.king.bbbathtub.Brush();
dummy = new com.king.bbbathtub.Champagne();
dummy = new com.king.bbbathtub.Duck();
dummy = new com.king.bbbathtub.FloatingSoap();
dummy = new com.king.bbbathtub.HangingSoap();
dummy = new com.king.bbbathtub.InflatableBall();
dummy = new com.king.bbbathtub.Sandwich();
dummy = new com.king.bbbathtub.Shampoo();
dummy = new com.king.bbbathtub.Sponge();
dummy = new com.king.bbbathtub.Strawberry();
dummy = new com.king.bbbathtub.Shark();
dummy = new com.king.bbbathtub.Diver();
dummy = new com.king.bbbathtub.GoldenHits();
dummy = new com.king.bbbathtub.GoldbarAeroplane();
dummy = new com.king.bbbathtub.Submarine();
dummy = new com.king.bbbathtub.Goldbar();
dummy = new com.king.bbbathtub.Treasure();
dummy = new com.king.bbbathtub.Gull();
dummy = new com.king.bbbathtub.TubCamera();
dummy = new com.king.bbbathtub.RingGull();
dummy = new com.king.bbbathtub.RingShark();
dummy = new com.king.bbbathtub.DietCoke();
dummy = new com.king.bbbathtub.Tire();
Symbol 29 MovieClip [pow] Frame 10
stop();
this.removeMovieClip();
Symbol 40 MovieClip [gameoverslab] Frame 1
#initclip 104
Object.registerClass("gameoverslab", com.king.bbbathtub.GameOverPlate);
#endinitclip
Symbol 47 MovieClip [levelslab] Frame 1
#initclip 100
Object.registerClass("levelslab", com.king.bbbathtub.LevelOverPlate);
#endinitclip
Symbol 57 MovieClip [boat] Frame 1
#initclip 101
Object.registerClass("boat", com.king.bbbathtub.Boat);
#endinitclip
Symbol 91 MovieClip [ploink] Frame 7
this.removeMovieClip();
Symbol 102 MovieClip [bb_select_plate] Frame 1
#initclip 102
Object.registerClass("bb_select_plate", com.king.bbbathtub.BBPlate);
#endinitclip
Symbol 109 MovieClip [headbubble] Frame 1
stop();
Symbol 144 MovieClip Frame 1
stop();
Symbol 153 MovieClip [shark_tail] Frame 1
stop();
Symbol 158 MovieClip [shark_mouth] Frame 2
stop();
Symbol 186 MovieClip Frame 1
stop();
Symbol 197 MovieClip Frame 1
stop();
Symbol 241 MovieClip [intro_plate] Frame 1
#initclip 103
Object.registerClass("intro_plate", com.king.bbbathtub.IntroPlate);
#endinitclip
Instance of Symbol 254 MovieClip "exitbutton" in Symbol 255 MovieClip [exitbutton] Frame 1
on (press) {
_root.game.onExitButton();
}
Instance of Symbol 254 MovieClip "soundbutton" in Symbol 276 MovieClip Frame 1
on (press) {
_root.game.onToggleSoundButton();
}
Symbol 278 MovieClip [__Packages.com.king.bbbathtub.Collidable] Frame 0
class com.king.bbbathtub.Collidable
{
var m_fx, m_fy, m_fr, m_xpos, m_ypos, m_rotation, m_isMovingAround, m_collisionEnabled, m_lxpos, m_lypos, m_lrotation, m_shape;
function Collidable () {
m_fx = new com.midasplayer.timing.IFloat();
m_fy = new com.midasplayer.timing.IFloat();
m_fr = new com.midasplayer.timing.IFloat();
m_xpos = 0;
m_ypos = 0;
m_rotation = 0;
m_isMovingAround = false;
m_collisionEnabled = true;
m_lxpos = -1;
m_lypos = -1;
m_lrotation = -1;
}
function getPosX() {
return(m_xpos);
}
function getPosY() {
return(m_ypos);
}
function getRotation() {
return(m_rotation);
}
function setPosition2n(x, y) {
m_fx.set((m_xpos = x));
m_fy.set((m_ypos = y));
m_fr.set(m_rotation);
m_shape.setPosition2n(x, y);
}
function setPosition(x, y, r) {
m_fx.set((m_xpos = x));
m_fy.set((m_ypos = y));
m_fr.set((m_rotation = r));
m_shape.setPosition(x, y, r * DEGREE_TO_RADIAN);
}
function getBounds() {
return(m_shape);
}
function getSphereVal() {
return(m_shape.getSphereVal());
}
function getCenterX() {
return(m_shape.getCenterX());
}
function getCenterY() {
return(m_shape.getCenterY());
}
function recomputeShape() {
m_shape.recompute();
}
function getCollisionScore(other) {
if (!m_collisionEnabled) {
return(0);
}
var _local3 = 0;
var _local4 = m_shape;
_local4.recompute();
var _local5 = other.m_shape;
_local5.recompute();
if (_local4.intersectsWith(_local5)) {
var _local6 = _local5.getArea();
var _local7 = _local4.getOverlapArea();
_local3 = 1 - ((_local6 - _local7) / _local6);
}
return(_local3);
}
function toString() {
return((((m_shape + " | ") + m_xpos) + ", ") + m_ypos);
}
static var RADIAN_TO_DEGREE = 57.2957795;
static var DEGREE_TO_RADIAN = 0.0174532925;
}
Symbol 279 MovieClip [__Packages.com.midasplayer.timing.IFloat] Frame 0
class com.midasplayer.timing.IFloat
{
static var alpha;
var ivalue, lastValue;
function IFloat (initial) {
ivalue = initial;
lastValue = initial;
alpha = 0;
}
function setTo(initial) {
ivalue = initial;
lastValue = initial;
}
function set(newValue) {
lastValue = ivalue;
ivalue = newValue;
}
function get(lalpha) {
return(lastValue + ((ivalue - lastValue) * lalpha));
}
static function setAlpha(na) {
alpha = na;
}
function get value() {
return(lastValue + ((ivalue - lastValue) * alpha));
}
function set value(v) {
ivalue = v;
lastValue = v;
//return(value);
}
}
Symbol 280 MovieClip [__Packages.com.king.bbbathtub.BoundShape] Frame 0
class com.king.bbbathtub.BoundShape
{
var m_line, m_px, m_py, m_intersects, m_scale, m_x, m_y, m_w, m_h, m_r, m_cy, m_cx, m_changed;
function BoundShape () {
m_line = new Array();
m_px = new Array();
m_py = new Array();
m_intersects = new Array();
m_scale = 1;
m_x = 0;
m_y = 0;
m_w = 0;
m_h = 0;
m_r = 0;
m_cy = 0;
m_cx = 0;
m_changed = true;
}
function drawShape(context) {
var _local3 = [];
var _local4 = 0;
for ( ; _local4 < getNumPoints() ; _local4++) {
var _local5 = getPoint(_local4);
_local3.push(_local5[0]);
_local3.push(_local5[1]);
}
context.fillPolygon(_local3);
}
function isInside(x, y) {
var _local4 = getNumPoints();
var _local7 = false;
var _local5 = 0;
var _local6 = _local4 - 1;
for ( ; _local5 < _local4 ; _local6 = _local5++) {
if ((((m_py[_local5] <= y) && (y < m_py[_local6])) || ((m_py[_local6] <= y) && (y < m_py[_local5]))) && (x < ((((m_px[_local6] - m_px[_local5]) * (y - m_py[_local5])) / (m_py[_local6] - m_py[_local5])) + m_px[_local5]))) {
_local7 = !_local7;
}
}
return(_local7);
}
function intersectsWith(aShape) {
m_intersects = new Array();
var _local3 = false;
var _local4 = 0;
for ( ; _local4 < aShape.getNumLines() ; _local4++) {
var _local5 = aShape.getLine(_local4);
var _local6 = _local5.x1;
var _local7 = _local5.y1;
var _local8 = _local5.x2;
var _local9 = _local5.y2;
var _local10 = 0;
for ( ; _local10 < getNumLines() ; _local10++) {
var _local11 = getLine(_local10);
var _local12 = _local11.x1;
var _local13 = _local11.x2;
var _local14 = _local11.y1;
var _local15 = _local11.y2;
var _local16 = _local6 - _local12;
var _local17 = _local7 - _local14;
var _local18 = _local13 - _local12;
var _local19 = _local15 - _local14;
var _local20 = _local8 - _local6;
var _local21 = _local9 - _local7;
var _local22 = (_local19 * _local20) - (_local18 * _local21);
var _local23 = ((_local18 * _local17) - (_local19 * _local16)) / _local22;
var _local24 = ((_local20 * _local17) - (_local21 * _local16)) / _local22;
if (((_local23 > 0) && (_local23 < 1)) && ((_local24 > 0) && (_local24 < 1))) {
var _local25 = [0, 0];
_local25[0] = _local6 + (_local23 * (_local8 - _local6));
_local25[1] = _local7 + (_local23 * (_local9 - _local7));
_local3 = true;
m_intersects.push({x:_local25[0], y:_local25[1], s:(_local25[0] * 10000) + (_local25[1] * 100)});
}
}
}
var _local26 = 0;
for ( ; _local26 < aShape.getNumPoints() ; _local26++) {
var _local27 = aShape.getPoint(_local26);
if (isInside(_local27[0], _local27[1])) {
m_intersects.push({x:_local27[0], y:_local27[1], s:(_local27[0] * 10000) + (_local27[1] * 100)});
}
}
var _local28 = 0;
for ( ; _local28 < getNumPoints() ; _local28++) {
var _local29 = getPoint(_local28);
if (aShape.isInside(_local29[0], _local29[1])) {
m_intersects.push({x:_local29[0], y:_local29[1], s:(_local29[0] * 10000) + (_local29[1] * 100)});
}
}
return(_local3);
}
function getOverlapArea() {
var _local2 = m_intersects.length;
if (_local2 == 0) {
return(0);
}
var _local3 = new Array(_local2);
var _local4 = 0;
for ( ; _local4 < _local2 ; _local4++) {
_local3[_local4] = m_intersects[_local4];
}
var _local5 = 0;
for ( ; _local5 < _local3.length ; _local5++) {
var _local6 = 0;
for ( ; _local6 < _local3.length ; _local6++) {
if (_local3[_local5].s > _local3[_local6].s) {
var _local7 = _local3[_local5];
_local3[_local5] = _local3[_local6];
_local3[_local6] = _local7;
}
}
}
var _local8 = new Array(_local2 + 4);
var _local9 = computeChainHull(_local3, _local3.length, _local8);
_local8[_local9] = _local8[0];
_local8[_local9 + 1] = _local8[1];
var _local10 = 0;
var _local11 = 1;
var _local12 = 2;
var _local13 = 0;
for ( ; _local11 <= _local9 ; _local11++ , _local12++ , _local13++) {
_local10 = _local10 + (_local8[_local11].x * (_local8[_local12].y - _local8[_local13].y));
}
return(Math.floor(_local10 / 2));
}
function isLeft(P0, P1, P2) {
return(((P1.x - P0.x) * (P2.y - P0.y)) - ((P2.x - P0.x) * (P1.y - P0.y)));
}
function computeChainHull(P, n, H) {
var _local5 = 0;
var _local6 = -1;
var _local8 = 0;
var _local10 = P[0].x;
var _local7 = 1;
// unexpected jump
do {
_local7++;
if (_local7 >= n) {
break;
}
} while (P[_local7].x == _local10);
var _local9 = _local7 - 1;
if (_local9 == (n - 1)) {
_local6++;
H[_local6] = P[_local8];
if (P[_local9].y != P[_local8].y) {
_local6++;
H[_local6] = P[_local9];
}
_local6++;
H[_local6] = P[_local8];
return(_local6 + 1);
}
var _local12 = n - 1;
var _local13 = P[n - 1].x;
_local7 = n - 2;
// unexpected jump
do {
_local7--;
if (_local7 < 0) {
break;
}
} while (P[_local7].x == _local13);
var _local11 = _local7 + 1;
_local6++;
H[_local6] = P[_local8];
_local7 = _local9;
while (_local7++ , _local7 <= _local11) {
if ((isLeft(P[_local8], P[_local11], P[_local7]) >= 0) && (_local7 < _local11)) {
continue;
}
while (_local6 > 0) {
if (isLeft(H[_local6 - 1], H[_local6], P[_local7]) > 0) {
break;
}
_local6--;
}
_local6++;
H[_local6] = P[_local7];
}
if (_local12 != _local11) {
_local6++;
H[_local6] = P[_local12];
}
_local5 = _local6;
_local7 = _local11;
while (_local7-- , _local7 >= _local9) {
if ((isLeft(P[_local12], P[_local9], P[_local7]) >= 0) && (_local7 > _local9)) {
continue;
}
while (_local6 > _local5) {
if (isLeft(H[_local6 - 1], H[_local6], P[_local7]) > 0) {
break;
}
_local6--;
}
_local6++;
H[_local6] = P[_local7];
}
if (_local9 != _local8) {
_local6++;
H[_local6] = P[_local8];
}
return(_local6 + 1);
}
function setPosition(x, y, r) {
m_cx = (m_x = x);
m_cy = (m_y = y);
m_r = r;
m_changed = true;
}
function setPosition2n(x, y) {
m_cx = (m_x = x);
m_cy = (m_y = y);
m_changed = true;
}
function getPoint(p) {
return([m_px[p], m_py[p]]);
}
function getNumPoints() {
return(m_px.length);
}
function getLine(n) {
return(m_line[n]);
}
function getNumLines() {
return(m_line.length);
}
function getWidth() {
return(m_w);
}
function getHeight() {
return(m_h);
}
function getCenterX() {
return(m_cx);
}
function getCenterY() {
return(m_cy);
}
function getRotation() {
return(m_r);
}
function rescale(factor) {
m_scale = factor;
m_changed = true;
}
function recompute() {
m_changed = false;
}
function getSphereVal() {
return(-1);
}
function getArea() {
return(0);
}
function getRadius() {
return(0);
}
}
Symbol 281 MovieClip [__Packages.com.midasplayer.fx.Draw] Frame 0
class com.midasplayer.fx.Draw
{
var clip, colorVal, thicknessVal, alphaVal, __get__color, __get__alpha, __get__thickness;
function Draw (mc) {
clip = mc;
colorVal = 16777215 /* 0xFFFFFF */;
thicknessVal = 1.5;
alphaVal = 255;
}
function clone() {
var _local2 = new com.midasplayer.fx.Draw();
_local2.clip = clip;
_local2.thicknessVal = thicknessVal;
_local2.colorVal = colorVal;
_local2.alphaVal = alphaVal;
return(_local2);
}
function createClip(parent) {
var _local3 = parent.getNextHighestDepth();
clip = parent.createEmptyMovieClip("fx_draw_" + count, _local3);
count++;
}
function set color(v) {
colorVal = v;
//return(__get__color());
}
function set alpha(v) {
alphaVal = v;
//return(__get__alpha());
}
function set thickness(v) {
thicknessVal = v;
//return(__get__thickness());
}
function clear() {
clip.clear();
}
function fillInverseRect(param) {
var _local3 = param[0];
var _local4 = param[1];
var _local5 = _local3 + param[2];
var _local6 = _local4 + param[3];
var _local7 = param[4];
var _local8 = param[5];
var _local9 = _local7 + param[6];
var _local10 = _local8 + param[7];
if (_local8 > _local4) {
fillRect(_local3, _local4, _local5, _local8);
}
if (_local10 < _local6) {
fillRect(_local3, _local10, _local5, _local6 - _local10);
}
if (_local7 > _local3) {
fillRect(_local3, _local8, _local7 - _local3, _local10 - _local8);
}
if (_local9 < _local5) {
fillRect(_local9, _local8, _local5 - _local9, _local10 - _local8);
}
}
function fillRect(left, top, width, height) {
clip.endFill();
clip.beginFill(colorVal, alphaVal);
clip.moveTo(left, top);
clip.lineTo(left + width, top);
clip.lineTo(left + width, top + height);
clip.lineTo(left, top + height);
clip.lineTo(left, top);
clip.endFill();
}
function fillRectangle(r) {
fillRect(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1);
}
function drawBox(left, top, width, height) {
drawLine(left, top, left + width, top);
drawLine(left, top, left, top + height);
drawLine(left + width, top + height, left + width, top);
drawLine(left + width, top + height, left, top + height);
}
function drawLine(x1, y1, x2, y2) {
clip.lineStyle(thicknessVal, colorVal, alphaVal);
clip.moveTo(x1, y1);
clip.lineTo(x2, y2);
}
function fillPolygon(points) {
clip.beginFill(colorVal, alphaVal);
clip.moveTo(points[0], points[1]);
var _local3 = 1;
var _local4 = points.length / 2;
for ( ; _local3 < _local4 ; _local3++) {
var _local5 = _local3 << 1;
clip.lineTo(points[_local5], points[_local5 + 1]);
}
clip.lineTo(points[0], points[1]);
clip.endFill();
}
function get mc() {
return(clip);
}
static var count = 1;
}
Symbol 282 MovieClip [__Packages.com.midasplayer.geom.Rectangle] Frame 0
class com.midasplayer.geom.Rectangle
{
var px, py, width, height;
function Rectangle (x, y, w, h) {
px = x;
py = y;
width = w;
height = h;
}
function get x1() {
return(px);
}
function get y1() {
return(py);
}
function get x2() {
return(px + width);
}
function get y2() {
return(py + height);
}
function get isValid() {
return((width > 0) && (height > 0));
}
function setPosition(x, y) {
px = x;
py = y;
}
function isInside(x, y) {
return((x >= px) && ((x < (px + width)) && ((y >= py) && (y < (py + height)))));
}
function isIntersect(other) {
var _local3 = px;
var _local4 = other.px;
var _local5 = px + width;
var _local6 = other.px + other.width;
var _local7 = py;
var _local8 = other.py;
var _local9 = py + height;
var _local10 = other.py + other.height;
return(!((_local9 < _local8) || ((_local7 > _local10) || ((_local5 < _local4) || (_local3 > _local6)))));
}
function getIntersection(other) {
var _local3 = px;
var _local4 = other.px;
var _local5 = px + width;
var _local6 = other.px + other.width;
var _local7 = py;
var _local8 = other.py;
var _local9 = py + height;
var _local10 = other.py + other.height;
if ((_local9 < _local8) || ((_local7 > _local10) || ((_local5 < _local4) || (_local3 > _local6)))) {
return(INVALID);
}
var _local11 = ((_local9 > _local10) ? (_local10) : (_local9));
var _local12 = ((_local7 < _local8) ? (_local8) : (_local7));
var _local13 = ((_local5 > _local6) ? (_local6) : (_local5));
var _local14 = ((_local3 < _local4) ? (_local4) : (_local3));
var _local15 = _local13 - _local14;
var _local16 = _local11 - _local12;
return(new com.midasplayer.geom.Rectangle(_local14, _local12, _local15, _local16));
}
function toString() {
return(((((((("Rectangle[" + x1) + ",") + y1) + " -- ") + x2) + ",") + y2) + "]");
}
static var INVALID = new com.midasplayer.geom.Rectangle(0, 0, -1000, -1000);
}
Symbol 283 MovieClip [__Packages.com.midasplayer.geom.Line] Frame 0
class com.midasplayer.geom.Line
{
var x1, y1, x2, y2;
function Line (x1, y1, x2, y2) {
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
}
function distance(px, py) {
var _local4 = x2 - x1;
var _local5 = y2 - y1;
var _local6 = px - x1;
var _local7 = py - y1;
var _local8 = (_local6 * _local4) + (_local7 * _local5);
var _local9 = (_local4 * _local4) + (_local5 * _local5);
var _local10 = _local8 / _local9;
var _local11 = x1 + (_local10 * _local4);
var _local12 = y1 + (_local10 * _local5);
var _local13 = px - _local11;
var _local14 = py - _local12;
return(Math.sqrt((_local13 * _local13) + (_local14 * _local14)));
}
function distanceSegment(px, py) {
var _local4 = x2 - x1;
var _local5 = y2 - y1;
var _local6 = px - x1;
var _local7 = py - y1;
var _local8 = _local6;
var _local9 = _local7;
var _local10 = (_local6 * _local4) + (_local7 * _local5);
if (_local10 > 0) {
var _local11 = (_local4 * _local4) + (_local5 * _local5);
if (_local11 <= _local10) {
_local8 = px - x2;
_local9 = py - y2;
} else {
var _local12 = _local10 / _local11;
_local8 = px - (x1 + (_local12 * _local4));
_local9 = py - (y1 + (_local12 * _local5));
}
}
return(Math.sqrt((_local8 * _local8) + (_local9 * _local9)));
}
function getMiddle() {
return(new com.midasplayer.geom.Pt((x2 + x1) * 0.5, (y2 + y1) * 0.5));
}
function getAngle() {
var _local2 = x2 - x1;
var _local3 = y2 - y1;
return(Math.atan2(_local3, _local2));
}
function getLength() {
var _local2 = x1 - x2;
var _local3 = y1 - y2;
return(Math.sqrt((_local2 * _local2) + (_local3 * _local3)));
}
function getIntersect(other) {
var _local3 = null;
var _local4 = other.x1;
var _local5 = other.x2;
var _local6 = other.y1;
var _local7 = other.y2;
var _local8 = x1 - _local4;
var _local9 = y1 - _local6;
var _local10 = _local5 - _local4;
var _local11 = _local7 - _local6;
var _local12 = x2 - x1;
var _local13 = y2 - y1;
var _local14 = (_local11 * _local12) - (_local10 * _local13);
var _local15 = ((_local10 * _local9) - (_local11 * _local8)) / _local14;
var _local16 = ((_local12 * _local9) - (_local13 * _local8)) / _local14;
if (((_local15 > 0) && (_local15 < 1)) && ((_local16 > 0) && (_local16 < 1))) {
var _local17 = [0, 0];
_local17[0] = x1 + (_local15 * (x2 - x1));
_local17[1] = y1 + (_local15 * (y2 - y1));
_local3 = new com.midasplayer.geom.Pt(_local17[0], _local17[1]);
}
return(_local3);
}
function toString() {
return(((("[" + [x1, y1]) + "]--[") + [x2, y2]) + "]");
}
}
Symbol 284 MovieClip [__Packages.com.midasplayer.geom.Pt] Frame 0
class com.midasplayer.geom.Pt
{
var x, y, t;
function Pt (x, y) {
this.x = x;
this.y = y;
t = 0;
}
function toString() {
return(((("Pt[" + x) + ",") + y) + "]");
}
}
Symbol 285 MovieClip [__Packages.com.king.bbbathtub.TankItem] Frame 0
class com.king.bbbathtub.TankItem extends com.king.bbbathtub.Collidable
{
var m_yoffset, m_moffset, m_clipFlipped, m_fadeIn, m_scaleOnCreate, m_isCaught, m_swX, m_swY, m_startDelay, m_numUpd, m_hasSw, m_itemMgr, m_clip, m_sxp, m_syp, m_itemId, m_avglevel, m_collisionEnabled, m_xpos, m_ypos, m_rotation, m_isMovingAround, m_fx, m_fy, m_fr, m_shape, m_lxpos, m_lypos, m_lrotation, m_drawContext, setPosition;
function TankItem (aClip, im) {
super();
m_yoffset = -8;
m_moffset = 0;
m_clipFlipped = false;
m_fadeIn = true;
m_scaleOnCreate = true;
m_isCaught = false;
m_swX = 0;
m_swY = 0;
m_startDelay = 0;
m_numUpd = 0;
m_hasSw = false;
m_itemMgr = im;
m_clip = aClip;
m_sxp = 0;
m_syp = 0;
m_itemId = 0;
m_avglevel = m_itemMgr.getWaterLine().getAvgLevel();
}
function getYOffset() {
return(m_yoffset);
}
function destroy() {
m_clip.swapDepths(1048000);
m_clip.removeMovieClip();
m_clip = undefined;
}
function updateShock() {
if (!m_collisionEnabled) {
return(false);
}
var _local2 = Math.abs(m_swX);
var _local3 = Math.abs(m_swY);
var _local4 = _local2 + _local3;
if (_local4 < 0.01) {
m_swX = 0;
m_swY = 0;
m_hasSw = false;
} else {
m_xpos = m_xpos + m_swX;
m_ypos = m_ypos + m_swY;
m_rotation = m_rotation + (_local4 * 2);
var _local5 = 0.875;
if (m_ypos > m_avglevel) {
_local5 = 0.8;
}
m_swX = m_swX * _local5;
m_swY = m_swY * _local5;
if (isCollision()) {
m_swX = 0;
m_swY = 0;
}
}
if (!m_isMovingAround) {
m_fx.set(m_xpos);
m_fy.set(m_ypos);
m_fr.set(m_rotation);
}
m_shape.setPosition(m_xpos, m_ypos, m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN);
return(m_hasSw);
}
function isCollision() {
return(!m_itemMgr.getBoundaries().isInside(m_xpos, m_ypos));
}
function update(tick) {
com.king.bbbathtub.Collidable.m_cTick = tick;
}
function flip() {
m_rotation = m_rotation + 180;
m_rotation = m_rotation % 360;
m_clip._yscale = -m_clip._yscale;
m_clipFlipped = !m_clipFlipped;
}
function flipImage() {
m_clipFlipped = !m_clipFlipped;
m_clip._yscale = -m_clip._yscale;
}
function setMagicOffset(n) {
m_moffset = n;
}
function isFadeInOnCreate() {
return(m_fadeIn);
}
function isScaleOnCreate() {
return(m_scaleOnCreate);
}
function prepareSpikes(radiiFactor, r) {
var _local4 = new Array(2);
var _local5 = (m_shape.getWidth() * radiiFactor) / 2;
var _local6 = (m_shape.getHeight() * radiiFactor) / 2;
var _local7 = [[-_local5, -_local6], [_local5, _local6], [-_local5, _local6], [_local5, -_local6]];
var _local8 = Math.sin(r);
var _local9 = Math.cos(r);
var _local10 = _local7[0][0];
var _local11 = _local7[0][1];
_local7[0][0] = (_local9 * _local10) + (_local8 * _local11);
_local7[0][1] = (_local8 * _local10) - (_local9 * _local11);
_local10 = _local7[1][0];
_local11 = _local7[1][1];
_local7[1][0] = (_local9 * _local10) + (_local8 * _local11);
_local7[1][1] = (_local8 * _local10) - (_local9 * _local11);
_local4[0] = new com.midasplayer.geom.Line(_local7[0][0], _local7[0][1], _local7[1][0], _local7[1][1]);
_local10 = _local7[2][0];
_local11 = _local7[2][1];
_local7[2][0] = (_local9 * _local10) + (_local8 * _local11);
_local7[2][1] = (_local8 * _local10) - (_local9 * _local11);
_local10 = _local7[3][0];
_local11 = _local7[3][1];
_local7[3][0] = (_local9 * _local10) + (_local8 * _local11);
_local7[3][1] = (_local8 * _local10) - (_local9 * _local11);
_local4[1] = new com.midasplayer.geom.Line(_local7[2][0], _local7[2][1], _local7[3][0], _local7[3][1]);
return(_local4);
}
function render() {
if ((!m_hasSw) && (!m_isMovingAround)) {
if ((m_xpos != m_lxpos) || ((m_ypos != m_lypos) || (m_rotation != m_lrotation))) {
m_clip._x = m_xpos;
m_clip._y = m_ypos;
m_clip._rotation = m_rotation;
m_lypos = m_ypos;
m_lxpos = m_xpos;
m_lrotation = m_rotation;
m_itemMgr.onParked(this);
}
return(undefined);
}
m_clip._x = m_fx.value;
m_clip._y = m_fy.value;
m_clip._rotation = m_rotation;
}
function setDebugDraw(cx) {
m_drawContext = cx;
}
function setScale(percent) {
m_clip._xscale = percent;
m_clip._yscale = (m_clipFlipped ? (-percent) : (percent));
}
function setDirectAlpha(amount) {
m_clip._alpha = amount;
}
function setCaught(b) {
m_isCaught = b;
}
function isMovingAround() {
return(m_isMovingAround);
}
function getWeight() {
return(1);
}
function getScore() {
return(0);
}
function applyShockwave(sx, sy, force) {
m_hasSw = true;
if ((m_swY == 0) && (m_swX == 0)) {
m_swX = sx;
m_swY = sy;
return(undefined);
}
var _local5 = (sx * sx) + (sy * sy);
if (_local5 == 0) {
return(undefined);
}
var _local6 = ((m_swX * sx) + (m_swY * sy)) / _local5;
m_swX = _local6 * sx;
m_swY = _local6 * sy;
}
function onHit() {
return(true);
}
function getItemId() {
return(m_itemId);
}
function setStartDelay(valueMs) {
m_startDelay = int((valueMs * 1000) / m_itemMgr.getMillisPerTick());
}
function updateCaught(hookX, hookY, hookAngle) {
m_isMovingAround = true;
var _local5 = 0.65;
var _local6 = 0.35;
var _local7 = (-m_xpos) + hookX;
var _local8 = (-m_ypos) + hookY;
m_sxp = (m_sxp * _local5) + (_local7 * _local6);
m_syp = (m_syp * _local5) + (_local8 * _local6);
var _local9 = m_xpos + m_sxp;
var _local10 = m_ypos + m_syp;
var _local11 = hookAngle;
setPosition(_local9, _local10, _local11);
}
function get movieClip() {
return(m_clip);
}
}
Symbol 286 MovieClip [__Packages.com.king.bbbathtub.ItemManager] Frame 0
class com.king.bbbathtub.ItemManager
{
function ItemManager () {
}
}
Symbol 287 MovieClip [__Packages.com.king.bbbathtub.Waterline] Frame 0
class com.king.bbbathtub.Waterline
{
var m_parent, m_waterY, m_width, m_height, m_wave, m_per, m_perpwidth, m_canvas, m_ppts, m_pts, m_rad;
function Waterline (parent, width, height, waterY) {
m_parent = parent;
m_waterY = waterY;
m_width = width;
m_height = height;
m_wave = 4;
m_per = Math.PI * 6;
m_perpwidth = m_per / m_width;
resetLevel();
var _local6 = 38;
var _local7 = 60;
var _local8 = 19933;
var _local9 = 10;
m_canvas = new com.midasplayer.fx.Draw();
m_canvas.createClip(m_parent);
m_canvas.mc._x = 0;
m_canvas.mc._y = 0;
m_canvas.color = _local8;
m_canvas.alpha = _local6;
var _local10 = m_waterY + (m_wave * 2);
var _local11 = m_height - (m_waterY + (m_wave * 2));
m_ppts = [];
m_ppts.push(m_width);
m_ppts.push(m_waterY + (m_wave * 2));
m_ppts.push(0);
m_ppts.push(m_waterY + (m_wave * 2));
m_ppts.push(0);
m_ppts.push(m_waterY);
}
function getAvgLevel() {
return(m_waterY);
}
function update() {
var _local2 = m_per / PTS;
var _local3 = 0;
for ( ; _local3 < PTS ; _local3++) {
var _local4 = m_pts[_local3];
var _local5 = m_waterY + (Math.sin(m_rad + (_local2 * _local3)) * m_wave);
_local4[1] = _local5;
_local4[2].set(_local5);
}
m_rad = m_rad + 0.11;
}
function getWaterLevel(x) {
return(m_waterY + (Math.sin(m_rad + (m_perpwidth * x)) * m_wave));
}
function resetLevel() {
m_rad = 0;
var _local2 = m_width / (PTS - 1);
m_pts = new Array(PTS);
var _local3 = 0;
for ( ; _local3 < PTS ; _local3++) {
var _local4 = _local3 * _local2;
m_pts[_local3] = [_local4, 0, new com.midasplayer.timing.IFloat()];
m_pts[_local3][2].set(_local4);
m_pts[_local3][2].set(_local4);
}
update();
}
function render(tick) {
var _local3 = [];
var _local4 = 0;
for ( ; _local4 < PTS ; _local4++) {
var _local5 = m_pts[_local4];
_local3.push(_local5[0]);
_local3.push(_local5[2].value);
}
m_canvas.clear();
m_canvas.fillPolygon(_local3.concat(m_ppts));
}
var PTS = 8;
}
Symbol 288 MovieClip [__Packages.com.king.bbbathtub.Boundaries] Frame 0
class com.king.bbbathtub.Boundaries
{
var m_numPts, m_lines, m_tmpln, m_waterY;
function Boundaries (avgWater) {
m_numPts = m_px.length;
m_lines = [];
m_tmpln = new com.king.bbbathtub.InterLine();
var _local3 = m_px[0];
var _local4 = m_py[0];
m_minX = Math.min(m_minX, _local3);
m_minY = Math.min(m_minY, _local4);
m_maxX = Math.max(m_maxX, _local3);
m_maxY = Math.max(m_maxY, _local4);
var _local5 = 1;
for ( ; _local5 < m_px.length ; _local5++) {
m_lines.push(new com.king.bbbathtub.InterLine(_local3, _local4, m_px[_local5], m_py[_local5]));
_local3 = m_px[_local5];
_local4 = m_py[_local5];
m_minX = Math.min(m_minX, _local3);
m_minY = Math.min(m_minY, _local4);
m_maxX = Math.max(m_maxX, _local3);
m_maxY = Math.max(m_maxY, _local4);
}
m_lines.push(new com.king.bbbathtub.InterLine(_local3, _local4, m_px[0], m_py[0]));
m_minX = m_minX + 100;
m_minY = m_minY + 70;
m_maxX = m_maxX - 80;
m_maxY = m_maxY - 100;
m_waterY = avgWater;
}
function getLines() {
return(m_lines);
}
function mayCollide(x, y) {
return(!((x >= m_minX) && ((x < m_maxX) && ((y >= m_minY) && (y < m_maxY)))));
}
function minEdgeDistance(x, y) {
var _local4 = 1250000 /* 0x1312D0 */;
var _local5 = 0;
var _local6 = m_lines.length;
for ( ; _local5 < _local6 ; _local5++) {
_local4 = Math.min(_local4, m_lines[_local5].distanceSquared(x, y));
}
return(_local4);
}
function testSpikesWater(spikes, x, y) {
var _local5 = false;
var _local6 = 0;
var _local8 = m_lines.length;
var _local9 = spikes.length;
for ( ; (!_local5) && (_local6 < _local9) ; _local6++) {
var _local10 = spikes[_local6];
m_tmpln.x1 = _local10.x1 + x;
m_tmpln.x2 = _local10.x2 + x;
m_tmpln.y1 = _local10.y1 + y;
m_tmpln.y2 = _local10.y2 + y;
_local5 = ((m_tmpln.y1 <= m_waterY) && (m_tmpln.y2 > m_waterY)) || ((m_tmpln.y1 > m_waterY) && (m_tmpln.y2 <= m_waterY));
var _local7 = 0;
for ( ; (!_local5) && (_local7 < _local8) ; _local7++) {
_local5 = m_lines[_local7].intersects(m_tmpln);
}
}
return(_local5);
}
function testSpikes(spikes, x, y) {
var _local5 = false;
var _local6 = 0;
var _local8 = m_lines.length;
var _local9 = spikes.length;
for ( ; (!_local5) && (_local6 < _local9) ; _local6++) {
var _local10 = spikes[_local6];
m_tmpln.x1 = _local10.x1 + x;
m_tmpln.x2 = _local10.x2 + x;
m_tmpln.y1 = _local10.y1 + y;
m_tmpln.y2 = _local10.y2 + y;
var _local7 = 0;
for ( ; (!_local5) && (_local7 < _local8) ; _local7++) {
_local5 = m_lines[_local7].intersects(m_tmpln);
}
}
return(_local5);
}
function isInside(x, y) {
var _local4 = false;
var _local5 = 0;
var _local6 = m_numPts - 1;
for ( ; _local5 < m_numPts ; _local6 = _local5++) {
if ((((m_py[_local5] <= y) && (y < m_py[_local6])) || ((m_py[_local6] <= y) && (y < m_py[_local5]))) && (x < ((((m_px[_local6] - m_px[_local5]) * (y - m_py[_local5])) / (m_py[_local6] - m_py[_local5])) + m_px[_local5]))) {
_local4 = !_local4;
}
}
return(_local4);
}
function paint(context) {
context.color = 0;
context.drawLine(m_minX, m_minY, m_maxX, m_minY);
context.drawLine(m_maxX, m_minY, m_maxX, m_maxY);
context.drawLine(m_maxX, m_maxY, m_minX, m_maxY);
context.drawLine(m_minX, m_maxY, m_minX, m_minY);
var _local3 = m_px[0];
var _local4 = m_py[0];
var _local5 = 1;
for ( ; _local5 < m_numPts ; _local5++) {
context.drawLine(_local3, _local4, m_px[_local5], m_py[_local5]);
_local3 = m_px[_local5];
_local4 = m_py[_local5];
}
context.drawLine(_local3, _local4, m_px[0], m_py[0]);
}
static var m_px = [0, 80, 184, 561, 648, 686, 686, 0];
static var m_py = [268, 422, 464, 464, 400, 272, 0, 0];
var m_minX = 10000;
var m_minY = 10000;
var m_maxX = 0;
var m_maxY = 0;
}
Symbol 289 MovieClip [__Packages.com.king.bbbathtub.InterLine] Frame 0
class com.king.bbbathtub.InterLine extends com.midasplayer.geom.Line
{
var vx, vy, c2, x1, y1;
function InterLine (x1, y1, x2, y2) {
super(x1, y1, x2, y2);
vx = x2 - x1;
vy = y2 - y1;
c2 = (vx * vx) + (vy * vy);
}
function distanceSquared(px, py) {
var _local4 = px - x1;
var _local5 = py - y1;
var _local6 = ((_local4 * vx) + (_local5 * vy)) / c2;
var _local7 = px - (x1 + (_local6 * vx));
_local7 = _local7 * _local7;
var _local8 = py - (y1 + (_local6 * vy));
_local8 = _local8 * _local8;
return(_local7 + _local8);
}
function intersects(o) {
var _local3 = o.x2 - o.x1;
var _local4 = o.y2 - o.y1;
var _local5 = (_local4 * vx) - (_local3 * vy);
if (_local5 == 0) {
return(false);
}
var _local6 = x1 - o.x1;
var _local7 = y1 - o.y1;
var _local8 = ((_local3 * _local7) - (_local4 * _local6)) / _local5;
if ((_local8 > 0) && (_local8 < 1)) {
var _local9 = ((vx * _local7) - (vy * _local6)) / _local5;
return((_local9 > 0) && (_local9 < 1));
}
return(false);
}
}
Symbol 290 MovieClip [__Packages.com.king.bbbathtub.Level] Frame 0
class com.king.bbbathtub.Level
{
var m_itemMgr, m_playingOrder, m_timeLimit, m_objects, m_prestep, m_displacement, m_scoreLimit;
function Level (xml, itemMgr) {
m_itemMgr = itemMgr;
m_playingOrder = xml.attributes.order;
m_timeLimit = xml.attributes.time;
var _local4 = [];
for (var i in xml.childNodes) {
var _local5 = new Object();
var _local6 = xml.childNodes[i];
var _local7 = _local6.attributes;
_local5.id = _global.parseInt(_local7.id);
_local5.type = _global.parseInt(_local7.type);
_local5.x = _global.parseFloat(_local7.x);
_local5.y = _global.parseFloat(_local7.y);
_local5.r = _global.parseInt(_local7.r);
_local5.delay = _global.parseInt(_local7.delay);
_local5.flip = _local7.flip == "true";
_local4.push(_local5);
}
qsort(_local4);
m_objects = new com.midasplayer.util.ArrayList(_local4);
}
function getNumPreStep() {
return(m_prestep);
}
function activate() {
var _local2 = m_objects.iterator;
while (_local2.hasNext()) {
var _local3 = _local2.next();
createItem(_local3.type, _local3.x, _local3.y, _local3.r, _local3.delay, _local3.flip);
}
}
function init(generator) {
m_displacement = new com.king.bbbathtub.RandTable(generator, 0, 1, 25, true);
m_prestep = int(m_displacement.nextValue() * 125);
}
function createItem(itemId, x, y, r, delay, flip, annouce) {
if (annouce == undefined) {
annouce = true;
}
var _local9 = m_typeToName[itemId - 1];
var _local10 = "com.king.bbbathtub." + _local9.cl;
var _local11 = mx.utils.ClassFinder.findClass(_local10);
if (!_local11) {
// unexpected jump
}
var _local12 = m_itemMgr.getParentClip();
var _local13 = _local12.getNextHighestDepth();
var _local14 = _local12.attachMovie(_local9.mc, "titm" + _local13, _local13);
_local14.clipName = _local9.mc;
var _local15 = new _local11[undefined](_local14, m_itemMgr);
var _local16 = _local15.getBounds();
var _local17 = Math.min(16, _local16.getWidth());
var _local18 = Math.min(16, _local16.getHeight());
var _local19 = _local17 / 2;
var _local20 = _local18 / 2;
var _local21 = (m_displacement.nextValue() * _local17) - _local19;
var _local22 = (m_displacement.nextValue() * _local18) - _local20;
_local15.setDirectAlpha(0);
_local15.setStartDelay(delay);
_local15.setPosition(x + _local21, y + _local22, r);
_local15.setMagicOffset(int(m_displacement.nextValue() * 100));
var _local23 = 318;
var _local24 = 256;
var _local25 = _local23 - (x + _local21);
var _local26 = _local24 - (y + _local22);
var _local27 = com.midasplayer.util.XPMath.atan2(_local23 - (x + _local21), _local24 - (y + _local22));
var _local28 = Math.sqrt((_local25 * _local25) + (_local26 * _local26));
var _local29 = 8;
while ((_local28 > 0) && (_local15.isCollision())) {
_local15.setPosition((x + _local21) + (Math.sin(_local27) * _local29), (y + _local22) + (Math.cos(_local27) * _local29), r);
_local29 = _local29 + 8;
_local28 = _local28 - 8;
}
if (flip) {
_local15.flipImage();
}
_local15.update(1);
_local15.update(1);
if (annouce) {
m_itemMgr.onInitItem(_local15, _local15.isMovingAround());
}
return(_local15);
}
function getTimeLimit() {
return(m_timeLimit);
}
function getScoreLimit() {
return(m_scoreLimit);
}
function setScoreLimit(value) {
m_scoreLimit = value;
}
function getPlayingOrder() {
return(m_playingOrder);
}
function qsort(a) {
qsort_r(a, 0, a.length - 1);
}
function qsort_r(a, l, r) {
var _local5 = l;
var _local6 = r;
var _local8 = a[(l + r) >> 1].id;
do {
while (a[_local5].id < _local8) {
_local5++;
}
while (_local8 < a[_local6].id) {
_local6--;
}
if (_local5 <= _local6) {
var _local7 = a[_local5];
a[_local5++] = a[_local6];
a[_local6--] = _local7;
}
} while (_local5 <= _local6);
if (l < _local6) {
qsort_r(a, l, _local6);
}
if (_local5 < r) {
qsort_r(a, _local5, r);
}
}
var m_typeToName = [{cl:"Aeroplane", mc:"item_aeroplane"}, {cl:"Brush", mc:"item_brush"}, {cl:"Champagne", mc:"item_champagne"}, {cl:"Duck", mc:"item_duck"}, {cl:"FloatingSoap", mc:"item_floatingsoap"}, {cl:"HangingSoap", mc:"item_hangingsoap"}, {cl:"InflatableBall", mc:"item_inflatableball"}, {cl:"Sandwich", mc:"item_sandwich"}, {cl:"Shampoo", mc:"item_shampoo"}, {cl:"Sponge", mc:"item_sponge"}, {cl:"Strawberry", mc:"item_strawberry"}, {cl:"Diver", mc:"item_diver"}, {cl:"Shark", mc:"item_shark"}, {cl:"GoldenHits", mc:"item_goldenhits"}, {cl:"Submarine", mc:"item_submarine"}, {cl:"GoldbarAeroplane", mc:"item_goldaeroplane"}, {cl:"Treasure", mc:"item_treasure"}, {cl:"Goldbar", mc:"item_goldbar"}, {cl:"Gull", mc:"item_gull"}, {cl:"TubCamera", mc:"item_camera"}, {cl:"RingGull", mc:"item_gull_ring"}, {cl:"RingShark", mc:"item_shark_ring"}, {cl:"DietCoke", mc:"item_dietcoke"}, {cl:"Tire", mc:"item_tire"}];
}
Symbol 291 MovieClip [__Packages.com.midasplayer.util.ArrayList] Frame 0
class com.midasplayer.util.ArrayList
{
var value;
function ArrayList (ar) {
if (ar == undefined) {
value = new Array();
} else {
value = ar;
}
}
function insert(obj, pos) {
var _local4 = value.length;
if ((pos == undefined) || (pos >= _local4)) {
value.push(obj);
return(_local4);
}
value.splice(pos, 0, obj);
return(pos);
}
function get(pos) {
return(value[pos]);
}
function set(pos, o) {
value[pos] = o;
}
function indexOf(obj) {
var _local3 = 0;
var _local4 = value.length;
for ( ; _local3 < _local4 ; _local3++) {
if (obj == value[_local3]) {
return(_local3);
}
}
return(-1);
}
function remove(obj) {
return(removeByIndex(indexOf(obj)));
}
function removeByIndex(pos) {
var _local3;
var _local4 = value.length;
if ((pos < _local4) && (pos >= 0)) {
_local3 = value[pos];
value.splice(pos, 1);
}
return(_local3);
}
function size() {
return(value.length);
}
function clear() {
value = new Array();
}
function toArray() {
return(value);
}
function foreach(fn) {
var _local3 = 0;
var _local4 = value.length;
// unexpected jump
do {
_local3++;
if (_local3 >= _local4) {
break;
}
} while (fn(_local3, value[_local3]) != false);
}
function sortOn(field) {
value.sortOn(field);
}
function sort() {
value.sort();
}
function get iterator() {
return(new com.midasplayer.util.ArrayListIterator(this));
}
function get dump() {
var _local2 = "";
var _local3 = 0;
for ( ; _local3 < value.length ; _local3++) {
_local2 = _local2 + (((_local3 + " : ") + value[_local3]) + newline);
}
return(_local2);
}
function subList(from, to) {
if ((to > value.length) || (!to)) {
to = value.length;
}
var _local4 = value.slice(from, to);
var _local5 = new com.midasplayer.util.ArrayList(_local4);
return(_local5);
}
}
Symbol 292 MovieClip [__Packages.com.midasplayer.util.Iterator] Frame 0
class com.midasplayer.util.Iterator
{
function Iterator () {
}
}
Symbol 293 MovieClip [__Packages.com.midasplayer.util.ArrayListIterator] Frame 0
class com.midasplayer.util.ArrayListIterator implements com.midasplayer.util.Iterator
{
var ptr, list, sz;
function ArrayListIterator (list) {
ptr = 0;
this.list = list;
sz = list.size();
}
function next() {
var _local2;
if (ptr < sz) {
_local2 = list.get(ptr);
ptr++;
}
return(_local2);
}
function hasNext() {
return(ptr < sz);
}
function remove() {
if (ptr == 0) {
return(undefined);
}
list.removeByIndex(ptr - 1);
}
}
Symbol 294 MovieClip [__Packages.com.king.bbbathtub.RandTable] Frame 0
class com.king.bbbathtub.RandTable
{
var m_ptr, m_sz, m_values;
function RandTable (generator, min, max, count, isFloat) {
m_ptr = 0;
m_sz = count;
m_values = new Array(count);
if (isFloat) {
var _local7 = max - min;
var _local8 = 0;
for ( ; _local8 < count ; _local8++) {
m_values[_local8] = (generator.nextDouble() * _local7) + min;
}
} else {
var _local9 = (max - min) + 1;
var _local10 = 0;
for ( ; _local10 < count ; _local10++) {
m_values[_local10] = int(generator.nextInt(_local9) + min);
}
}
}
function nextValue() {
return(m_values[(++m_ptr) % m_sz]);
}
function toString() {
var _local2 = "RandTable: size=" + m_values.length;
_local2 = _local2 + ((", offset=" + m_ptr) + " [");
var _local3 = 0;
for ( ; _local3 < m_values.length ; _local3++) {
_local2 = _local2 + m_values[_local3];
if ((m_values.length - 1) != _local3) {
_local2 = _local2 + ", ";
}
}
_local2 = _local2 + "]";
return(_local2);
}
}
Symbol 295 MovieClip [__Packages.com.midasplayer.util.Random] Frame 0
class com.midasplayer.util.Random
{
var mta, mti, lastSeed;
function Random (aSeed) {
mta = new Array(N);
mti = N + 1;
if (aSeed != undefined) {
init_genrand(aSeed);
}
}
function set seed(s) {
init_genrand(s);
//return(seed);
}
function get seed() {
return(lastSeed);
}
function nextInt(n) {
return((genrand_int32() & 2147483647) % n);
}
function nextFloat() {
return(next(24) / (1 << 24));
}
function nextDouble() {
return(next(24) / (1 << 24));
}
function next(bits) {
if (bits < 32) {
return(genrand_int32() & ((1 << bits) - 1));
}
return(genrand_int32());
}
function init_genrand(s) {
s = int(s);
var _local3 = getTimer();
lastSeed = s;
mta[0] = s;
var _local4 = s;
var _local5 = new com.midasplayer.util.Integer64();
var _local6 = N;
mti = 1;
for ( ; mti < _local6 ; mti++) {
_local5.init32((_local4 >>> 30) ^ _local4);
_local5.mulu32(1812433253);
_local4 = (mta[mti] = int(_local5.lsb + mti));
}
var _local7 = getTimer();
}
function genrand_int32() {
var _local2 = N;
var _local3 = 0;
if (mti >= _local2) {
if (mti == (_local2 + 1)) {
init_genrand(5489);
}
var _local4 = M;
var _local5 = UPPER_MASK;
var _local6 = LOWER_MASK;
var _local7 = mag01;
var _local8 = getTimer();
var _local9 = 0;
var _local10 = _local2 - _local4;
var _local11 = _local4 - _local2;
_local9 = 0;
for ( ; _local9 < _local10 ; _local9++) {
_local3 = (mta[_local9] & _local5) | (mta[_local9 + 1] & _local6);
mta[_local9] = (mta[_local9 + _local4] ^ (_local3 >>> 1)) ^ _local7[_local3 & 1];
}
_local10 = _local2 - 1;
for ( ; _local9 < _local10 ; _local9++) {
_local3 = (mta[_local9] & _local5) | (mta[_local9 + 1] & _local6);
mta[_local9] = (mta[_local9 + _local11] ^ (_local3 >>> 1)) ^ _local7[_local3 & 1];
}
_local3 = (mta[_local2 - 1] & _local5) | (mta[0] & _local6);
mta[_local2 - 1] = (mta[_local4 - 1] ^ (_local3 >>> 1)) ^ _local7[_local3 & 1];
mti = 0;
var _local12 = getTimer();
}
_local3 = mta[mti++];
_local3 = _local3 ^ (_local3 >>> 11);
_local3 = _local3 ^ ((_local3 << 7) & -1658038656);
_local3 = _local3 ^ ((_local3 << 15) & -272236544);
_local3 = _local3 ^ (_local3 >>> 18);
return(_local3);
}
static var N = 624;
static var M = 397;
static var MATRIX_A = -1727483681;
static var UPPER_MASK = -2147483648;
static var LOWER_MASK = 2147483647;
static var mag01 = [0, -1727483681];
}
Symbol 296 MovieClip [__Packages.com.midasplayer.util.Integer64] Frame 0
class com.midasplayer.util.Integer64
{
var r, p, s;
function Integer64 (lowInt) {
r = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]];
p = [0, 0, 0, 0, 0];
s = [0, 0, 0];
if (lowInt != undefined) {
merge(lowInt);
}
}
function init(v) {
var _local3 = 0;
for ( ; _local3 < p.length ; _local3++) {
p[_local3] = v.p[_local3];
}
}
function init32(n) {
p[0] = n & 32767;
n = n >>> 15;
p[1] = n & 32767;
n = n >>> 15;
p[2] = n & 3;
p[3] = 0;
p[4] = 0;
}
function get lsb() {
return((p[0] | (p[1] << 15)) | ((p[2] & 3) << 30));
}
function get msb() {
return((((p[2] >> 2) | ((p[3] << 15) >> 2)) | ((p[4] << (15 * 2)) >> 2)) & 2147483647);
}
function binaryShiftLeft(step) {
var _local3 = 0;
for ( ; _local3 < step ; _local3++) {
shl();
}
}
function binaryShiftRight(step) {
var _local3 = (step / 15) >> 0;
var _local4 = step - (_local3 * 15);
var _local5 = p.length - 1;
for ( ; _local5 > 0 ; p[_local5--] = 0) {
var _local6 = 0;
for ( ; _local6 < _local3 ; _local6++) {
p[_local6] = p[_local6 + 1];
}
}
if (_local4 > 0) {
var _local7 = 0;
for ( ; _local7 < _local4 ; _local7++) {
shr();
}
}
}
function binaryNot(o) {
p[0] = p[0] ^ o.p[0];
p[1] = p[1] ^ o.p[1];
p[2] = p[2] ^ o.p[2];
p[3] = p[3] ^ o.p[3];
p[4] = p[4] ^ o.p[4];
}
function add64(o) {
var _local3 = 0;
var _local4 = 1;
var _local5 = 0;
for ( ; (_local4 < p.length) && (o.p[_local5] != 0) ; _local4++) {
}
_local5 = 0;
for ( ; _local5 < _local4 ; _local5++) {
_local3 = _local3 + (p[_local5] + o.p[_local5]);
p[_local5] = _local3 & 32767;
_local3 = _local3 >> 15;
}
}
function add32(num) {
var _local3 = 0;
var _local4 = num & 32767;
num = num >> 15;
var _local5 = num & 32767;
num = num >> 15;
var _local6 = num & 3;
_local3 = _local3 + (p[0] + _local4);
p[0] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + (p[1] + _local5);
p[1] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + (p[2] + _local6);
p[2] = _local3 & 32767;
}
function mulu32(num) {
var _local3 = 0;
s[0] = num & 32767;
num = num >>> 15;
s[1] = num & 32767;
num = num >>> 15;
s[2] = num & 3;
var _local4 = 0;
for ( ; _local4 < 3 ; _local4++) {
var _local5 = s[_local4];
_local3 = _local5 * p[0];
r[_local4][0] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + (_local5 * p[1]);
r[_local4][1] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + (_local5 * p[2]);
r[_local4][2] = _local3 & 3;
}
_local3 = r[0][0];
p[0] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + (r[0][1] + r[1][0]);
p[1] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local3 & 3;
p[3] = 0;
p[4] = 0;
}
function mul64(o) {
var _local3 = 0;
var _local4 = 0;
for ( ; _local4 < 5 ; _local4++) {
var _local5 = o.p[_local4];
_local3 = _local5 * p[0];
r[_local4][0] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + (_local5 * p[1]);
r[_local4][1] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + (_local5 * p[2]);
r[_local4][2] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + (_local5 * p[3]);
r[_local4][3] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + (_local5 * p[4]);
r[_local4][4] = _local3 & 32767;
}
_local3 = r[0][0];
p[0] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + (r[0][1] + r[1][0]);
p[1] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + (((r[0][3] + r[1][2]) + r[2][1]) + r[3][0]);
p[3] = _local3 & 32767;
_local3 = _local3 >> 15;
_local3 = _local3 + ((((r[0][4] + r[1][3]) + r[2][2]) + r[3][1]) + r[4][0]);
p[4] = _local3 & 7;
}
function mul32(value) {
mul64(new com.midasplayer.util.Integer64(value));
}
function merge(a) {
var _local3 = 0;
for ( ; _local3 < 3 ; _local3++) {
p[_local3] = p[_local3] + (a & 32767);
a = a >>> 15;
}
return(a);
}
function shl() {
var _local2 = 0;
var _local3 = 0;
var _local4 = 0;
var _local5 = p.length;
for ( ; _local4 < _local5 ; _local4++ , _local3 = _local2) {
_local2 = (p[_local4] & 16384) >> 14;
p[_local4] = p[_local4] << 1;
p[_local4] = (p[_local4] | _local3) & 32767;
}
}
function shr() {
var _local2 = 0;
var _local3 = 0;
var _local4 = p.length - 1;
for ( ; _local4 >= 0 ; _local4-- , _local3 = _local2) {
_local2 = (p[_local4] & 1) << 14;
p[_local4] = p[_local4] >> 1;
p[_local4] = (p[_local4] | _local3) & 32767;
}
}
}
Symbol 297 MovieClip [__Packages.mx.utils.ClassFinder] Frame 0
class mx.utils.ClassFinder
{
function ClassFinder () {
}
static function findClass(fullClassName) {
if (fullClassName == null) {
return(null);
}
var _local3 = _global;
var _local4 = fullClassName.split(".");
var _local2 = 0;
while (_local2 < _local4.length) {
_local3 = _local3[_local4[_local2]];
_local2++;
}
if (_local3 == null) {
_global.__dataLogger.logData(null, "Could not find class '<classname>'", {classname:fullClassName}, mx.data.binding.Log.BRIEF);
}
return(_local3);
}
}
Symbol 298 MovieClip [__Packages.mx.data.binding.Log] Frame 0
class mx.data.binding.Log
{
var level, name;
function Log (logLevel, logName) {
level = ((logLevel == undefined) ? (BRIEF) : (logLevel));
name = ((name == undefined) ? "" : (name));
}
function logInfo(msg, level) {
if (level == undefined) {
level = BRIEF;
}
onLog((((getDateString() + " ") + name) + ": ") + mx.data.binding.ObjectDumper.toString(msg));
}
function logData(target, message, info, level) {
if (level == undefined) {
level = VERBOSE;
}
var _local6 = ((name.length > 0) ? ((" " + name) + ": ") : " ");
var _local4 = ((target == null) ? "" : (target + ": "));
if (_local4.indexOf("_level0.") == 0) {
_local4 = _local4.substr(8);
}
var _local3 = ((getDateString() + _local6) + _local4) + substituteIntoString(message, info, 50);
if (showDetails && (info != null)) {
_local3 = _local3 + ("\n " + mx.data.binding.ObjectDumper.toString(info));
} else {
var _local2 = 0;
while (_local2 < nestLevel) {
_local3 = " " + _local3;
_local2++;
}
}
onLog(_local3);
}
function onLog(message) {
trace(message);
}
function getDateString() {
var _local1 = new Date();
return(((((((((_local1.getMonth() + 1) + "/") + _local1.getDate()) + " ") + _local1.getHours()) + ":") + _local1.getMinutes()) + ":") + _local1.getSeconds());
}
static function substituteIntoString(message, info, maxlen, rawDataType) {
var _local9 = "";
if (info == null) {
return(message);
}
var _local11 = message.split("<");
if (_local11 == null) {
return(message);
}
_local9 = _local9 + _local11[0];
var _local7 = 1;
while (_local7 < _local11.length) {
var _local8 = _local11[_local7].split(">");
var _local5 = _local8[0].split(".");
var _local1 = info;
var _local4 = rawDataType;
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2];
if (_local3 != "") {
_local4 = mx.data.binding.FieldAccessor.findElementType(_local4, _local3);
var _local6 = new mx.data.binding.FieldAccessor(null, null, _local1, _local3, _local4, null, null);
_local1 = _local6.getValue();
}
_local2++;
}
if (typeof(_local1) != "string") {
_local1 = mx.data.binding.ObjectDumper.toString(_local1);
}
if (_local1.indexOf("_level0.") == 0) {
_local1 = _local1.substr(8);
}
if ((maxlen != null) && (_local1.length > maxlen)) {
_local1 = _local1.substr(0, maxlen) + "...";
}
_local9 = _local9 + _local1;
_local9 = _local9 + _local8[1];
_local7++;
}
var _local14 = _local9.split(">");
_local9 = _local14.join(">");
_local14 = _local9.split("<");
_local9 = _local14.join("<");
return(_local9);
}
static var NONE = -1;
static var BRIEF = 0;
static var VERBOSE = 1;
static var DEBUG = 2;
static var INFO = 2;
static var WARNING = 1;
static var ERROR = 0;
var showDetails = false;
var nestLevel = 0;
}
Symbol 299 MovieClip [__Packages.mx.data.binding.ObjectDumper] Frame 0
class mx.data.binding.ObjectDumper
{
var inProgress;
function ObjectDumper () {
inProgress = new Array();
}
static function toString(obj, showFunctions, showUndefined, showXMLstructures, maxLineLength, indent) {
var _local3 = new mx.data.binding.ObjectDumper();
if (maxLineLength == undefined) {
maxLineLength = 100;
}
if (indent == undefined) {
indent = 0;
}
return(_local3.realToString(obj, showFunctions, showUndefined, showXMLstructures, maxLineLength, indent));
}
function realToString(obj, showFunctions, showUndefined, showXMLstructures, maxLineLength, indent) {
var _local8 = 0;
while (_local8 < inProgress.length) {
if (inProgress[_local8] == obj) {
return("***");
}
_local8++;
}
inProgress.push(obj);
indent++;
var _local16 = typeof(obj);
var _local5;
if ((obj instanceof XMLNode) && (showXMLstructures != true)) {
_local5 = obj.toString();
} else if (obj instanceof Date) {
_local5 = obj.toString();
} else if (_local16 == "object") {
var _local4 = new Array();
if (obj instanceof Array) {
_local5 = "[";
var _local15 = 0;
while (_local15 < obj.length) {
_local4.push(_local15);
_local15++;
}
} else {
_local5 = "{";
for (var _local15 in obj) {
_local4.push(_local15);
}
_local4.sort();
}
var _local9 = "";
var _local3 = 0;
while (_local3 < _local4.length) {
var _local6 = obj[_local4[_local3]];
var _local7 = true;
if (typeof(_local6) == "function") {
_local7 = showFunctions == true;
}
if (typeof(_local6) == "undefined") {
_local7 = showUndefined == true;
}
if (_local7) {
_local5 = _local5 + _local9;
if (!(obj instanceof Array)) {
_local5 = _local5 + (_local4[_local3] + ": ");
}
_local5 = _local5 + realToString(_local6, showFunctions, showUndefined, showXMLstructures, maxLineLength, indent);
_local9 = ", `";
}
_local3++;
}
if (obj instanceof Array) {
_local5 = _local5 + "]";
} else {
_local5 = _local5 + "}";
}
} else if (_local16 == "function") {
_local5 = "function";
} else if (_local16 == "string") {
_local5 = ("\"" + obj) + "\"";
} else {
_local5 = String(obj);
}
if (_local5 == "undefined") {
_local5 = "-";
}
inProgress.pop();
return(replaceAll(_local5, "`", ((_local5.length < maxLineLength) ? "" : (newline + doIndent(indent)))));
}
static function replaceAll(str, from, to) {
var _local3 = str.split(from);
var _local4 = "";
var _local2 = "";
var _local1 = 0;
while (_local1 < _local3.length) {
_local4 = _local4 + (_local2 + _local3[_local1]);
_local2 = to;
_local1++;
}
return(_local4);
}
function doIndent(indent) {
var _local2 = "";
var _local1 = 0;
while (_local1 < indent) {
_local2 = _local2 + " ";
_local1++;
}
return(_local2);
}
}
Symbol 300 MovieClip [__Packages.mx.data.binding.FieldAccessor] Frame 0
class mx.data.binding.FieldAccessor
{
var component, property, parentObj, fieldName, m_location, type, index, xpath;
function FieldAccessor (component, property, parentObj, fieldName, type, index, parentField) {
this.component = component;
this.property = property;
this.parentObj = parentObj;
this.fieldName = fieldName;
if (component == parentObj) {
m_location = undefined;
} else if (parentField.m_location == undefined) {
m_location = fieldName;
} else {
m_location = (parentField.m_location + ".") + fieldName;
}
this.type = type;
this.index = index;
}
function getValue() {
var _local2 = getFieldData();
if ((_local2 == null) && (type.value != undefined)) {
var _local3 = new mx.data.binding.TypedValue(type.value, "String");
_local3.getDefault = true;
component.getField(fieldName).setAnyTypedValue(_local3);
_local2 = _local3.value;
}
if ((isXML(_local2) && (_local2.childNodes.length == 1)) && (_local2.firstChild.nodeType == 3)) {
return(_local2.firstChild.nodeValue);
}
return(_local2);
}
function setValue(newValue, newTypedValue) {
if (newTypedValue.getDefault) {
newTypedValue.value = newValue;
} else {
if (xpath != null) {
var _local4 = getFieldData();
if (_local4 != null) {
setXMLData(_local4, newValue);
} else {
_global.__dataLogger.logData(component, "Can't assign to '<property>:<xpath>' because there is no element at the given path", this);
}
} else if (isXML(parentObj)) {
if (type.category == "attribute") {
parentObj.attributes[fieldName] = newValue;
} else if (type.category == "array") {
} else {
var _local4 = getOrCreateFieldData();
setXMLData(_local4, newValue);
}
} else {
if (parentObj == null) {
_global.__dataLogger.logData(component, "Can't set field '<property>/<location>' because the field doesn't exist", this);
}
parentObj[fieldName] = newValue;
}
component.propertyModified(property, (xpath == null) && (parentObj == component), newTypedValue.type);
}
}
static function isActionScriptPath(str) {
var _local2 = str.toLowerCase();
var _local3 = "0123456789abcdefghijklmnopqrstuvwxyz_.";
var _local1 = 0;
while (_local1 < _local2.length) {
if (-1 == _local3.indexOf(_local2.charAt(_local1))) {
return(false);
}
_local1++;
}
return(true);
}
static function createFieldAccessor(component, property, location, type, mustExist) {
if (mustExist && (component[property] == null)) {
_global.__dataLogger.logData(component, "Warning: property '<property>' does not exist", {property:property});
return(null);
}
var _local5 = new mx.data.binding.FieldAccessor(component, property, component, property, type, null, null);
if (location == null) {
return(_local5);
}
var _local7 = null;
if (location.indices != null) {
_local7 = location.indices;
location = location.path;
}
if (typeof(location) == "string") {
if (_local7 != null) {
_global.__dataLogger.logData(component, "Warning: ignoring index values for property '<property>', path '<location>'", {property:property, location:location});
}
if (isActionScriptPath(String(location))) {
location = location.split(".");
} else {
_local5.xpath = location;
return(_local5);
}
}
if (location instanceof Array) {
var _local3;
var _local10 = 0;
_local3 = 0;
while (_local3 < location.length) {
var _local2 = null;
var _local4 = location[_local3];
if (_local4 == "[n]") {
if (_local7 == null) {
_global.__dataLogger.logData(component, "Error: indices for <property>:<location> are null, but [n] appears in the location.", {property:property, location:location});
return(null);
}
_local2 = _local7[_local10++];
if (_local2 == null) {
_global.__dataLogger.logData(component, "Error: not enough index values for <property>:<location>", {property:property, location:location});
return(null);
}
}
_local5 = _local5.getChild(_local4, _local2, mustExist);
_local3++;
}
if (mustExist && (_local5.getValue() == null)) {
_global.__dataLogger.logData(component, "Warning: field <property>:<m_location> does not exist, or is null", _local5);
}
return(_local5);
}
trace("unrecognized location: " + mx.data.binding.ObjectDumper.toString(location));
return(null);
}
function getFieldAccessor() {
return(this);
}
function getChild(childName, index, mustExist) {
if (childName == ".") {
return(this);
}
var _local2 = getOrCreateFieldData(mustExist);
if (_local2 == null) {
return(null);
}
var _local4 = findElementType(type, childName);
return(new mx.data.binding.FieldAccessor(component, property, _local2, childName, _local4, index, this));
}
function getOrCreateFieldData(mustExist) {
var _local3 = getFieldData();
if (_local3 == null) {
if (mustExist) {
_global.__dataLogger.logData(component, "Warning: field <property>:<m_location> does not exist", this);
} else {
setupComplexField();
_local3 = getFieldData();
}
}
return(_local3);
}
function evaluateSubPath(obj, type) {
var path = type.path;
if (isActionScriptPath(path)) {
var tokens = path.split(".");
var i = 0;
while (i < tokens.length) {
var token = tokens[i];
if (isXML(obj)) {
obj = obj.firstChild;
while (obj != null) {
if (toLocalName(obj.nodeName) == token) {
break;
}
obj = obj.nextSibling;
}
} else {
obj = obj[token];
}
if (obj == null) {
_global.__dataLogger.logData(component, "Warning: path '<path>' evaluates to null, at '<token>' in <t.property>:<t.m_location>", {path:path, token:token, t:this});
break;
}
i++;
}
} else if (isXML(obj)) {
if (path.charAt(0) != "/") {
path = "/" + path;
}
if (obj.nodeName == null) {
obj = obj.firstChild;
} else {
path = toLocalName(obj.nodeName) + path;
}
var category = ((type.category != null) ? (type.category) : (((type.elements.length > 0) ? "complex" : "simple")));
if ((category == "simple") || (category == "attribute")) {
obj = eval ("obj" + mx.xpath.XPathAPI.getEvalString(obj, path));
} else if (category == "complex") {
obj = mx.xpath.XPathAPI.selectSingleNode(obj, path);
} else if (category == "array") {
obj = mx.xpath.XPathAPI.selectNodeList(obj, path);
}
} else {
_global.__dataLogger.logData(component, "Error: path '<path>' is an XPath. It cannot be applied to non-XML data <t.property>:<t.m_location>", {path:path, t:this});
}
return(obj);
}
function getFieldData() {
if (xpath != null) {
var _local4 = parentObj[fieldName].firstChild;
while ((_local4 != null) && (_local4.nodeType != 1)) {
_local4 = _local4.nextSibling;
}
var _local10 = mx.xpath.XPathAPI.selectSingleNode(_local4, xpath);
return(_local10);
}
if (isXML(parentObj)) {
if (type.path != null) {
return(evaluateSubPath(parentObj, type));
}
if (type.category == "attribute") {
var _local5 = parentObj.attributes;
for (var _local8 in _local5) {
if (toLocalName(_local8) == fieldName) {
return(_local5[_local8]);
}
}
return(undefined);
}
var _local3 = parentObj.firstChild;
if (type.category == "array") {
var _local6 = new Array();
while (_local3 != null) {
if (toLocalName(_local3.nodeName) == fieldName) {
_local6.push(_local3);
}
_local3 = _local3.nextSibling;
}
return(_local6);
}
while (_local3 != null) {
if (toLocalName(_local3.nodeName) == fieldName) {
return(_local3);
}
_local3 = _local3.nextSibling;
}
return(null);
}
if (fieldName == "[n]") {
var _local7;
if (index.component != null) {
var _local9 = index.component.getField(index.property, index.location);
_local7 = _local9.getAnyTypedValue(["Number"]);
_local7 = _local7.value;
} else {
_local7 = index.constant;
}
var index = Number(_local7);
if (typeof(_local7) == "undefined") {
_global.__dataLogger.logData(component, "Error: index specification '<index>' was not supplied, or incorrect, for <t.property>:<t.m_location>", {index:index, t:this});
return(null);
}
if (index.toString() == "NaN") {
_global.__dataLogger.logData(component, "Error: index value '<index>' for <t.property>:<t.m_location> is not a number", {index:index, t:this});
return(null);
}
if (!(parentObj instanceof Array)) {
_global.__dataLogger.logData(component, "Error: indexed field <property>:<m_location> is not an array", this);
return(null);
}
if ((index < 0) || (index >= parentObj.length)) {
_global.__dataLogger.logData(component, "Error: index '<index>' for <t.property>:<t.m_location> is out of bounds", {index:index, t:this});
return(null);
}
_global.__dataLogger.logData(component, "Accessing item [<index>] of <t.property>:<t.m_location>", {index:index, t:this});
return(parentObj[index]);
}
if (type.path != null) {
return(evaluateSubPath(parentObj, type));
}
return(parentObj[fieldName]);
}
static function setXMLData(obj, newValue) {
while (obj.hasChildNodes()) {
obj.firstChild.removeNode();
}
var _local2 = xmlNodeFactory.createTextNode(newValue);
obj.appendChild(_local2);
}
function setupComplexField() {
var _local2;
if (isXML(parentObj)) {
_local2 = xmlNodeFactory.createElement(fieldName);
parentObj.appendChild(_local2);
} else if (dataIsXML()) {
parentObj[fieldName] = new XML();
} else {
parentObj[fieldName] = new Object();
}
}
static function findElementType(type, name) {
var _local1 = 0;
while (_local1 < type.elements.length) {
if (type.elements[_local1].name == name) {
return(type.elements[_local1].type);
}
_local1++;
}
return(null);
}
function isXML(obj) {
return(obj instanceof XMLNode);
}
function dataIsXML() {
return(type.name == "XML");
}
static function accessField(component, fieldName, desiredTypes) {
var _local1;
_local1 = desiredTypes[fieldName];
if (_local1 == null) {
_local1 = desiredTypes.dflt;
}
if (_local1 == null) {
_local1 = desiredTypes;
}
var _local4 = component.createField("data", [fieldName]);
var _local2 = _local4.getAnyTypedValue([_local1]);
return(_local2.value);
}
static function ExpandRecord(obj, objectType, desiredTypes) {
var _local4 = new Object();
mx.data.binding.ComponentMixins.initComponent(_local4);
_local4.data = obj;
_local4.__schema = {elements:[{name:"data", type:objectType}]};
var _local2 = new Object();
if (objectType.elements.length > 0) {
var _local3 = 0;
while (_local3 < objectType.elements.length) {
var _local10 = objectType.elements[_local3].name;
_local2[_local10] = accessField(_local4, _local10, desiredTypes);
_local3++;
}
} else if ((obj instanceof XML) || (obj instanceof XMLNode)) {
if ((obj.childNodes.length == 1) && (obj.firstChild.nodeType == 3)) {
return(obj.firstChild.nodeValue);
}
var _local5 = obj.lastChild;
while (_local5 != null) {
var _local10 = toLocalName(_local5.nodeName);
if ((_local10 != null) && (_local2[_local10] == null)) {
_local2[_local10] = accessField(_local4, _local10, desiredTypes);
}
_local5 = _local5.previousSibling;
}
for (var _local10 in obj.attributes) {
if (_local2[_local10] != null) {
_global.__dataLogger.logData(null, "Warning: attribute '<name>' has same name as an element, in XML object <obj>", {name:_local10, obj:obj});
}
_local2[_local10] = accessField(_local4, _local10, desiredTypes);
}
} else {
if (typeof(obj) != "object") {
return(obj);
}
for (var _local10 in obj) {
_local2[_local10] = accessField(_local4, _local10, desiredTypes);
}
}
return(_local2);
}
static function wrapArray(theArray, itemType, desiredTypes) {
var _local4 = {getItemAt:function (index) {
if ((index < 0) || (index >= this.data.length)) {
return(undefined);
}
var _local2 = this.data[index];
if (_local2 == undefined) {
return(undefined);
}
var _local3 = mx.data.binding.FieldAccessor.ExpandRecord(_local2, this.type, desiredTypes);
return(_local3);
}, getItemID:function (index) {
return(index);
}, data:theArray, type:itemType, length:theArray.length};
return(_local4);
}
static function toLocalName(nodeName) {
var _local1 = nodeName.split(":");
var _local2 = _local1[_local1.length - 1];
return(_local2);
}
static var xmlNodeFactory = new XML();
}
Symbol 301 MovieClip [__Packages.mx.data.binding.TypedValue] Frame 0
class mx.data.binding.TypedValue
{
var value, typeName, type;
function TypedValue (value, typeName, type) {
this.value = value;
this.typeName = typeName;
this.type = type;
}
}
Symbol 302 MovieClip [__Packages.mx.xpath.XPathAPI] Frame 0
class mx.xpath.XPathAPI
{
function XPathAPI () {
}
static function getEvalString(node, path) {
var _local7 = "";
var _local4 = null;
var _local9 = getPathSet(path);
var _local3 = _local9[0].nodeName;
var _local8;
var _local2 = node;
var _local5 = false;
if ((_local3 != undefined) && ((_local3 == "*") || (node.nodeName == _local3))) {
var _local6 = 1;
while (_local6 < _local9.length) {
_local3 = _local9[_local6].nodeName;
_local8 = _local3.indexOf("@");
if (_local8 >= 0) {
_local3 = _local3.substring(_local8 + 1);
_local5 = _local2.attributes[_local3] != undefined;
_local7 = _local7 + (".attributes." + _local3);
} else {
_local5 = false;
var _local1 = 0;
while (_local1 < _local2.childNodes.length) {
_local4 = _local2.childNodes[_local1];
if (_local4.nodeName == _local3) {
_local7 = _local7 + (".childNodes." + _local1);
_local1 = _local2.childNodes.length;
_local2 = _local4;
_local5 = true;
}
_local1++;
}
}
if (!_local5) {
return("");
}
_local6++;
}
if (!_local5) {
_local7 = "";
} else if (_local8 == -1) {
_local7 = _local7 + ".firstChild.nodeValue";
}
} else {
_local7 = "";
}
return(_local7);
}
static function selectNodeList(node, path) {
var _local2 = new Array(node);
var _local5 = getPathSet(path);
var _local4 = _local5[0];
var _local6 = _local4.__get__nodeName();
var _local1 = null;
if ((_local6 != undefined) && ((_local6 == "*") || (node.nodeName == _local6))) {
if (_local4.__get__filter().length > 0) {
_local1 = new mx.xpath.FilterStack(_local4.__get__filter());
_local2 = filterNodes(_local2, _local1);
}
if (_local2.length > 0) {
var _local3 = 1;
while (_local3 < _local5.length) {
_local4 = _local5[_local3];
_local2 = getAllChildNodesByName(_local2, _local4.__get__nodeName());
if (_local4.__get__filter().length > 0) {
_local1 = new mx.xpath.FilterStack(_local4.__get__filter());
} else {
_local1 = null;
}
if ((_local1 != null) && (_local1.__get__exprs().length > 0)) {
_local2 = filterNodes(_local2, _local1);
}
_local3++;
}
}
} else {
_local2 = new Array();
}
return(_local2);
}
static function selectSingleNode(node, path) {
var _local1 = selectNodeList(node, path);
if (_local1.length > 0) {
return(_local1[0]);
}
return(null);
}
static function setNodeValue(node, path, newValue) {
var _local1 = new Array(node);
var _local9 = getPathSet(path);
var _local7 = _local9[_local9.length - 1].nodeName;
if (_local7.charAt(0) == "@") {
_local7 = _local7.substring(1, _local7.length);
_local9.pop();
} else {
_local7 = null;
}
var _local5 = _local9[0];
var _local11 = _local5.__get__nodeName();
var _local3 = null;
if ((_local11 != undefined) && ((_local11 == "*") || (node.nodeName == _local11))) {
if (_local5.__get__filter().length > 0) {
_local3 = new mx.xpath.FilterStack(_local5.__get__filter());
_local1 = filterNodes(_local1, _local3);
}
if (_local1.length > 0) {
var _local2 = 1;
while (_local2 < _local9.length) {
_local5 = _local9[_local2];
_local1 = getAllChildNodesByName(_local1, _local5.__get__nodeName());
if (_local5.__get__filter().length > 0) {
_local3 = new mx.xpath.FilterStack(_local5.__get__filter());
} else {
_local3 = null;
}
if ((_local3 != null) && (_local3.__get__exprs().length > 0)) {
_local1 = filterNodes(_local1, _local3);
}
_local2++;
}
}
} else {
_local1 = new Array();
}
var _local4 = null;
var _local6 = null;
var _local10 = new XML();
var _local2 = 0;
while (_local2 < _local1.length) {
if (_local7 != null) {
_local1[_local2].attributes[_local7] = newValue;
} else {
_local4 = _local1[_local2];
if ((_local4.firstChild == null) || (_local4.firstChild.nodeType != 3)) {
_local6 = _local10.createTextNode(newValue);
_local4.appendChild(_local6);
} else {
_local6 = _local4.firstChild;
_local6.nodeValue = newValue;
}
}
_local2++;
}
return(_local1.length);
}
static function copyStack(toStk, fromStk) {
var _local1 = 0;
while (_local1 < fromStk.length) {
toStk.splice(_local1, 0, fromStk[_local1]);
_local1++;
}
}
static function evalExpr(expr, node) {
var _local2 = true;
if (expr.__get__attr()) {
_local2 = ((expr.__get__value() != null) ? (node.attributes[expr.__get__name()] == expr.__get__value()) : (node.attributes[expr.__get__name()] != null));
} else {
var _local3 = getChildNodeByName(node, expr.__get__name());
if (_local3 != null) {
_local2 = ((expr.__get__value() != null) ? (_local3.firstChild.nodeValue == expr.__get__value()) : true);
} else {
_local2 = false;
}
}
return(_local2);
}
static function filterNodes(nodeList, stack) {
var _local13 = new Array();
var _local2;
var _local3;
var _local9;
var _local6;
var _local10;
var _local1 = true;
var _local4;
var _local5;
var _local8 = 0;
while (_local8 < nodeList.length) {
_local5 = true;
_local2 = new Array();
_local3 = new Array();
copyStack(_local2, stack.__get__exprs());
copyStack(_local3, stack.__get__ops());
_local4 = nodeList[_local8];
while ((_local2.length > 0) && (_local5)) {
if (typeof(_local2[_local2.length - 1]) == "object") {
_local9 = mx.xpath.FilterExpr(_local2.pop());
_local1 = evalExpr(_local9, _local4);
} else {
_local10 = Boolean(_local2.pop());
_local1 = _local10;
}
if (_local3.length > 0) {
var _local7 = _local2.pop();
_local6 = _local7;
switch (_local3[_local3.length - 1]) {
case "and" :
_local1 = _local1 && (evalExpr(_local6, _local4));
_local5 = _local1;
break;
case "or" :
_local1 = _local1 || (evalExpr(_local6, _local4));
_local5 = !_local1;
}
_local3.pop();
_local2.push(_local1);
}
}
if (_local1) {
_local13.push(_local4);
}
_local8++;
}
return(_local13);
}
static function getAllChildNodesByName(nodeList, name) {
var _local5 = new Array();
var _local2;
var _local3 = 0;
while (_local3 < nodeList.length) {
_local2 = nodeList[_local3].childNodes;
if (_local2 != null) {
var _local1 = 0;
while (_local1 < _local2.length) {
if ((name == "*") || (_local2[_local1].nodeName == name)) {
_local5.push(_local2[_local1]);
}
_local1++;
}
}
_local3++;
}
return(_local5);
}
static function getChildNodeByName(node, nodeName) {
var _local2;
var _local3 = node.childNodes;
var _local1 = 0;
while (_local1 < _local3.length) {
_local2 = _local3[_local1];
if (_local2.nodeName == nodeName) {
return(_local2);
}
_local1++;
}
return(null);
}
static function getKeyValues(node, keySpec) {
var _local5 = "";
var _local3 = new mx.utils.StringTokenParser(keySpec);
var _local2 = _local3.nextToken();
var _local1;
var _local6;
while (_local2 != mx.utils.StringTokenParser.tkEOF) {
_local1 = _local3.token;
_local5 = _local5 + (" " + _local1);
if (_local2 == mx.utils.StringTokenParser.tkSymbol) {
if (_local1 == "@") {
_local2 = _local3.nextToken();
_local1 = _local3.token;
if (_local2 == mx.utils.StringTokenParser.tkSymbol) {
_local5 = _local5 + (((_local1 + "='") + node.attributes[_local1]) + "'");
}
} else if (_local1 == "/") {
_local2 = _local3.nextToken();
if (_local2 == mx.utils.StringTokenParser.tkSymbol) {
_local1 = _local3.token;
node = getChildNodeByName(node, _local1);
if (node != null) {
_local5 = _local5 + _local1;
}
}
} else if ((((_local1 != "and") && (_local1 != "or")) && (_local1 != "[")) && (_local1 != "]")) {
_local6 = getChildNodeByName(node, _local1);
if (_local6 != null) {
_local5 = _local5 + (("='" + _local6.firstChild.nodeValue) + "'");
}
}
}
if (node == null) {
trace(("Invalid keySpec specified. '" + keySpec) + "' Error.");
return("ERR");
}
_local2 = _local3.nextToken();
}
return(_local5.slice(1));
}
static function getPath(node, keySpecs) {
var _local2 = "";
var _local5 = keySpecs[node.nodeName];
if (_local5 == undefined) {
var _local8 = "";
var _local10;
for (_local10 in node.attributes) {
_local8 = _local8 + (((("@" + _local10) + "='") + node.attributes[_local10]) + "' and ");
}
var _local7 = "";
var _local1;
var _local6;
var _local4 = 0;
while (_local4 < node.childNodes.length) {
_local1 = node.childNodes[_local4];
_local6 = _local1.firstChild.nodeValue;
if (_local6 != undefined) {
_local7 = _local7 + (((_local1.nodeName + "='") + _local6) + "' and ");
}
_local4++;
}
if (_local8.length > 0) {
if (_local7.length > 0) {
_local2 = (((("/" + node.nodeName) + "[") + _local8) + _local7.substring(0, _local7.length - 4)) + "]";
} else {
_local2 = ((("/" + node.nodeName) + "[") + _local8.substring(0, _local8.length - 4)) + "]";
}
} else {
_local2 = ((("/" + node.nodeName) + "[") + _local7.substring(0, _local7.length - 4)) + "]";
}
} else {
_local2 = _local2 + (("/" + node.nodeName) + getKeyValues(node, _local5));
}
var _local1 = node.parentNode;
while (_local1.parentNode != null) {
_local5 = keySpecs[_local1.nodeName];
if (_local5 != undefined) {
_local2 = (("/" + _local1.nodeName) + getKeyValues(_local1, _local5)) + _local2;
} else {
_local2 = ("/" + _local1.nodeName) + _local2;
}
_local1 = _local1.parentNode;
}
return(_local2);
}
static function getPathSet(path) {
var _local6 = new Array();
var _local4;
var _local1;
var _local2;
var _local5;
while (path.length > 0) {
_local4 = path.lastIndexOf("/");
_local1 = path.substring(_local4 + 1);
_local2 = _local1.indexOf("[", 0);
_local5 = ((_local2 >= 0) ? (_local1.substring(_local2 + 1, _local1.length - 1)) : "");
_local1 = ((_local2 >= 0) ? (_local1.substring(0, _local2)) : (_local1));
_local6.splice(0, 0, new mx.xpath.NodePathInfo(_local1, _local5));
path = path.substring(0, _local4);
}
return(_local6);
}
}
Symbol 303 MovieClip [__Packages.mx.xpath.NodePathInfo] Frame 0
class mx.xpath.NodePathInfo
{
function NodePathInfo (nodeName, filter) {
__nodeName = nodeName;
__filter = filter;
}
function get nodeName() {
return(__nodeName);
}
function get filter() {
return(__filter);
}
var __nodeName = null;
var __filter = null;
}
Symbol 304 MovieClip [__Packages.mx.xpath.FilterStack] Frame 0
class mx.xpath.FilterStack
{
var __expr, __ops;
function FilterStack (filterVal) {
__expr = new Array();
__ops = new Array();
var _local2 = new mx.utils.StringTokenParser(filterVal);
var _local5 = _local2.nextToken();
var _local4;
var _local3 = _local2.__get__token();
while (_local5 != mx.utils.StringTokenParser.tkEOF) {
if (_local3 == "@") {
_local5 = _local2.nextToken();
_local3 = _local2.token;
_local4 = new mx.xpath.FilterExpr(true, _local3, null);
__expr.splice(0, 0, _local4);
if (_local2.nextToken() == mx.utils.StringTokenParser.tkSymbol) {
if (_local2.__get__token() == "=") {
_local5 = _local2.nextToken();
_local4.__set__value(_local2.token);
}
}
} else if ((_local3 == "and") || (_local3 == "or")) {
__ops.splice(0, 0, _local3);
} else if ((_local3 != ")") && (_local3 != "(")) {
_local4 = new mx.xpath.FilterExpr(false, _local3, null);
__expr.splice(0, 0, _local4);
if (_local2.nextToken() == mx.utils.StringTokenParser.tkSymbol) {
if (_local2.__get__token() == "=") {
_local5 = _local2.nextToken();
_local4.__set__value(_local2.token);
}
}
}
_local5 = _local2.nextToken();
_local3 = _local2.token;
}
}
function get exprs() {
return(__expr);
}
function get ops() {
return(__ops);
}
}
Symbol 305 MovieClip [__Packages.mx.utils.StringTokenParser] Frame 0
class mx.utils.StringTokenParser
{
var _source, _skipChars;
function StringTokenParser (source, skipChars) {
_source = source;
_skipChars = ((skipChars == undefined) ? null : (skipChars));
}
function get token() {
return(_token);
}
function getPos() {
return(_index);
}
function nextToken() {
var _local4;
var _local2;
var _local3 = _source.length;
skipBlanks();
if (_index >= _local3) {
return(tkEOF);
}
_local2 = _source.charCodeAt(_index);
if (((((_local2 >= 65) && (_local2 <= 90)) || ((_local2 >= 97) && (_local2 <= 122))) || ((_local2 >= 192) && (_local2 <= Number.POSITIVE_INFINITY))) || (_local2 == 95)) {
_local4 = _index;
_index++;
_local2 = _source.charCodeAt(_index);
while (((((((_local2 >= 65) && (_local2 <= 90)) || ((_local2 >= 97) && (_local2 <= 122))) || ((_local2 >= 48) && (_local2 <= 57))) || ((_local2 >= 192) && (_local2 <= Number.POSITIVE_INFINITY))) || (_local2 == 95)) && (_index < _local3)) {
_index++;
_local2 = _source.charCodeAt(_index);
}
_token = _source.substring(_local4, _index);
return(tkSymbol);
}
if ((_local2 == 34) || (_local2 == 39)) {
_index++;
_local4 = _index;
_local2 = _source.charCodeAt(_local4);
while (((_local2 != 34) && (_local2 != 39)) && (_index < _local3)) {
_index++;
_local2 = _source.charCodeAt(_index);
}
_token = _source.substring(_local4, _index);
_index++;
return(tkString);
}
if ((_local2 == 45) || ((_local2 >= 48) && (_local2 <= 57))) {
var _local5 = tkInteger;
_local4 = _index;
_index++;
_local2 = _source.charCodeAt(_index);
while (((_local2 >= 48) && (_local2 <= 57)) && (_index < _local3)) {
_index++;
_local2 = _source.charCodeAt(_index);
}
if (_index < _local3) {
if (((((((_local2 >= 48) && (_local2 <= 57)) || (_local2 == 46)) || (_local2 == 43)) || (_local2 == 45)) || (_local2 == 101)) || (_local2 == 69)) {
_local5 = tkFloat;
}
while ((((((((_local2 >= 48) && (_local2 <= 57)) || (_local2 == 46)) || (_local2 == 43)) || (_local2 == 45)) || (_local2 == 101)) || (_local2 == 69)) && (_index < _local3)) {
_index++;
_local2 = _source.charCodeAt(_index);
}
}
_token = _source.substring(_local4, _index);
return(_local5);
}
_token = _source.charAt(_index);
_index++;
return(tkSymbol);
}
function skipBlanks() {
if (_index < _source.length) {
var _local2 = _source.charAt(_index);
while ((_local2 == " ") || ((_skipChars != null) && (skipChar(_local2)))) {
_index++;
_local2 = _source.charAt(_index);
}
}
}
function skipChar(ch) {
var _local2 = 0;
while (_local2 < _skipChars.length) {
if (ch == _skipChars[_local2]) {
return(true);
}
_local2++;
}
return(false);
}
static var tkEOF = -1;
static var tkSymbol = 0;
static var tkString = 1;
static var tkInteger = 2;
static var tkFloat = 3;
var _index = 0;
var _token = "";
}
Symbol 306 MovieClip [__Packages.mx.xpath.FilterExpr] Frame 0
class mx.xpath.FilterExpr
{
function FilterExpr (attrInit, nameInit, valueInit) {
__attr = attrInit;
__name = nameInit;
__value = valueInit;
}
function get attr() {
return(__attr);
}
function set attr(newVal) {
__attr = newVal;
//return(attr);
}
function get name() {
return(__name);
}
function set name(newVal) {
__name = newVal;
//return(name);
}
function get value() {
return(__value);
}
function set value(newVal) {
__value = newVal;
//return(value);
}
var __attr = false;
var __value = null;
var __name = null;
}
Symbol 307 MovieClip [__Packages.mx.data.binding.DataAccessor] Frame 0
class mx.data.binding.DataAccessor
{
var dataAccessor, component, property, location, type;
function DataAccessor () {
}
function getAnyTypedValue(suggestedTypes) {
var _local3 = 0;
while (_local3 < suggestedTypes.length) {
var _local5 = getTypedValue(suggestedTypes[_local3]);
if (_local5 != null) {
return(_local5);
}
_local3++;
}
var _local5 = getTypedValue();
_local3 = 0;
while (_local3 < suggestedTypes.length) {
var _local2 = suggestedTypes[_local3];
if (_local2 == "String") {
return(new mx.data.binding.TypedValue(String(_local5.value), _local2));
}
if (_local2 == "Number") {
return(new mx.data.binding.TypedValue(Number(_local5.value), _local2));
}
if (_local2 == "Boolean") {
return(new mx.data.binding.TypedValue(Boolean(_local5.value), _local2));
}
_local3++;
}
return(_local5);
}
function setAnyTypedValue(newValue) {
var _local7 = getSettableTypes();
if ((_local7 == null) || (-1 != findString(newValue.typeName, _local7))) {
return(setTypedValue(newValue));
}
var _local3 = 0;
while (_local3 < _local7.length) {
var _local2 = _local7[_local3];
if (_local2 == "String") {
return(setTypedValue(new mx.data.binding.TypedValue(String(newValue.value), _local2)));
}
if (_local2 == "Number") {
var _local5 = Number(newValue.value);
var _local6 = setTypedValue(new mx.data.binding.TypedValue(_local5, _local2));
if (_local5.toString() == "NaN") {
return([("Failed to convert '" + newValue.value) + "' to a number"]);
}
return(_local6);
}
if (_local2 == "Boolean") {
return(setTypedValue(new mx.data.binding.TypedValue(Boolean(newValue.value), _local2)));
}
_local3++;
}
return(dataAccessor.setTypedValue(newValue));
}
function getTypedValue(requestedType) {
var _local2 = dataAccessor.getTypedValue(requestedType);
return(_local2);
}
function getGettableTypes() {
return(null);
}
function setTypedValue(newValue) {
return(dataAccessor.setTypedValue(newValue));
}
function getSettableTypes() {
return(null);
}
function findLastAccessor() {
return(((dataAccessor == null) ? this : (dataAccessor.findLastAccessor())));
}
function setupDataAccessor(component, property, location) {
this.component = component;
this.property = property;
this.location = location;
type = component.findSchema(property, location);
}
static function findString(str, arr) {
var _local3 = str.toLowerCase();
var _local1 = 0;
while (_local1 < arr.length) {
if (arr[_local1].toLowerCase() == _local3) {
return(_local1);
}
_local1++;
}
return(-1);
}
static function conversionFailed(newValue, target) {
return(((("Failed to convert to " + target) + ": '") + newValue.value) + "'");
}
}
Symbol 308 MovieClip [__Packages.mx.data.binding.ComponentMixins] Frame 0
class mx.data.binding.ComponentMixins
{
var __refreshing, __bindings, __schema, __fieldCache, _eventDispatcher;
function ComponentMixins () {
}
function refreshFromSources() {
if (__refreshing != null) {
return(undefined);
}
__refreshing = true;
_global.__dataLogger.logData(this, "Refreshing from sources");
_global.__dataLogger.nestLevel++;
mx.data.binding.Binding.refreshFromSources(this, null, __bindings);
_global.__dataLogger.nestLevel--;
__refreshing = null;
}
function refreshDestinations() {
_global.__dataLogger.logData(this, "Refreshing Destinations");
_global.__dataLogger.nestLevel++;
mx.data.binding.Binding.refreshDestinations(this, __bindings);
_global.__dataLogger.nestLevel--;
}
function validateProperty(property, initialMessages) {
var _local4 = null;
var _local3 = getField(property);
if (_local3 != null) {
_local4 = _local3.validateAndNotify(null, null, initialMessages);
} else {
_global.__dataLogger.logData(this, "Can't validate property '<property>' because it doesn't exist", {property:property});
}
return(_local4);
}
function addBinding(binding) {
if (__bindings == undefined) {
__bindings = new Array();
}
__bindings.push(binding);
var _local3 = false;
if (binding.source.component == this) {
getField(binding.source.property, binding.source.location);
_local3 = true;
}
if (binding.dest.component == this) {
getField(binding.dest.property, binding.dest.location);
_local3 = _local3 | Object(binding).is2way;
}
if (_local3) {
var _local4 = binding.dest.component.findSchema(binding.dest.property, binding.dest.location);
if (_local4.readonly) {
binding.source.component.__setReadOnly(true);
}
}
}
static function initComponent(component) {
var _local2 = mx.data.binding.ComponentMixins.prototype;
if (component.refreshFromSources == undefined) {
component.refreshFromSources = _local2.refreshFromSources;
}
if (component.refreshDestinations == undefined) {
component.refreshDestinations = _local2.refreshDestinations;
}
if (component.validateProperty == undefined) {
component.validateProperty = _local2.validateProperty;
}
if (component.createFieldAccessor == undefined) {
component.createFieldAccessor = _local2.createFieldAccessor;
}
if (component.createField == undefined) {
component.createField = _local2.createField;
}
if (component.addBinding == undefined) {
component.addBinding = _local2.addBinding;
}
if (component.findSchema == undefined) {
component.findSchema = _local2.findSchema;
}
if (component.getField == undefined) {
component.getField = _local2.getField;
}
if (component.refreshAndValidate == undefined) {
component.refreshAndValidate = _local2.refreshAndValidate;
}
if (component.getFieldFromCache == undefined) {
component.getFieldFromCache = _local2.getFieldFromCache;
}
if (component.getBindingMetaData == undefined) {
component.getBindingMetaData = _local2.getBindingMetaData;
}
if (component.__setReadOnly == undefined) {
component.__setReadOnly = _local2.__setReadOnly;
}
if (component.__addHighPrioEventListener == undefined) {
component.__addHighPrioEventListener = _local2.__addHighPrioEventListener;
}
}
function createFieldAccessor(property, location, mustExist) {
return(mx.data.binding.FieldAccessor.createFieldAccessor(this, property, location, mx.data.binding.FieldAccessor.findElementType(__schema, property), mustExist));
}
function findSchema(property, location) {
if (typeof(location) == "string") {
if (mx.data.binding.FieldAccessor.isActionScriptPath(String(location))) {
location = location.split(".");
} else {
return(null);
}
}
var _local5 = mx.data.binding.FieldAccessor.findElementType(__schema, property);
if (location != null) {
if (location.path != null) {
location = location.path;
}
if (!(location instanceof Array)) {
return(null);
}
var _local2 = 0;
while (_local2 < location.length) {
var _local4 = location[_local2];
_local5 = mx.data.binding.FieldAccessor.findElementType(_local5, _local4);
_local2++;
}
}
return(_local5);
}
function createField(property, location) {
var _local3 = findSchema(property, location);
var _local2;
if (_local3.validation != null) {
_local2 = mx.data.binding.Binding.getRuntimeObject(_local3.validation);
} else {
_local2 = new mx.data.binding.DataType();
}
_local2.setupDataAccessor(this, property, location);
return(_local2);
}
static function deepEqual(a, b) {
if (a == b) {
return(true);
}
if (typeof(a) != typeof(b)) {
return(false);
}
if (typeof(a) != "object") {
return(false);
}
var _local3 = new Object();
for (var _local4 in a) {
if (!deepEqual(a[_local4], b[_local4])) {
return(false);
}
_local3[_local4] = 1;
}
for (var _local4 in b) {
if (_local3[_local4] != 1) {
return(false);
}
}
return(true);
}
function getFieldFromCache(property, location) {
for (var _local5 in __fieldCache) {
var _local2 = __fieldCache[_local5];
if ((_local2.property == property) && (deepEqual(_local2.location, location))) {
return(_local2);
}
}
return(null);
}
function getField(property, location) {
var _local2 = getFieldFromCache(property, location);
if (_local2 != null) {
return(_local2);
}
_local2 = createField(property, location);
if (__fieldCache == null) {
__fieldCache = new Array();
}
__fieldCache.push(_local2);
return(_local2);
}
function refreshAndValidate(property) {
_global.__dataLogger.logData(this, "Refreshing and validating " + property);
_global.__dataLogger.nestLevel++;
var _local3 = mx.data.binding.Binding.refreshFromSources(this, property, __bindings);
_local3 = validateProperty(property, _local3);
_global.__dataLogger.nestLevel--;
return(_local3 == null);
}
function getBindingMetaData(name) {
return(this["__" + name]);
}
function __setReadOnly(setting) {
if (Object(this).editable != undefined) {
Object(this).editable = !setting;
}
}
function __addHighPrioEventListener(event, handler) {
var _local3 = ((_eventDispatcher != undefined) ? (_eventDispatcher) : this);
if (_local3.__highPrioEvents == undefined) {
_local3.__highPrioEvents = new Object();
}
var _local4 = "__q_" + event;
if (_local3.__highPrioEvents[_local4] == undefined) {
_local3.__highPrioEvents[_local4] = new Array();
}
_global.ASSetPropFlags(_local3.__highPrioEvents, _local4, 1);
mx.events.EventDispatcher._removeEventListener(_local3.__highPrioEvents[_local4], event, handler);
_local3.__highPrioEvents[_local4].push(handler);
if (_local3._databinding_original_dispatchEvent == undefined) {
_local3._databinding_original_dispatchEvent = _local3.dispatchEvent;
_local3.dispatchEvent = function (eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this.dispatchQueue(this.__highPrioEvents, eventObj);
this._databinding_original_dispatchEvent(eventObj);
};
}
}
}
Symbol 309 MovieClip [__Packages.mx.data.binding.Binding] Frame 0
class mx.data.binding.Binding
{
var is2way, dest, source, format;
function Binding (source, dest, format, is2way) {
mx.events.EventDispatcher.initialize(this);
var _local5 = this;
_local5.source = source;
_local5.dest = dest;
_local5.format = format;
_local5.is2way = is2way;
registerBinding(this);
calcShortLoc(source);
calcShortLoc(dest);
_global.__dataLogger.logData(null, ("Creating binding " + summaryString()) + (is2way ? ", 2-way" : ""), {binding:this});
_global.__dataLogger.nestLevel++;
mx.data.binding.ComponentMixins.initComponent(dest.component);
if (source.component != undefined) {
mx.data.binding.ComponentMixins.initComponent(source.component);
}
dest.component.addBinding(this);
if (source.component != undefined) {
source.component.addBinding(this);
setUpListener(source, false);
if (this.is2way) {
setUpListener(dest, true);
setUpIndexListeners(source, false);
setUpIndexListeners(dest, true);
} else {
setUpIndexListeners(source, false);
setUpIndexListeners(dest, false);
}
} else {
execute();
}
_global.__dataLogger.nestLevel--;
}
function execute(reverse) {
var _local3;
var _local4;
if (reverse) {
if (!is2way) {
_global.__dataLogger.logData(null, ("Warning: Can't execute binding " + summaryString(false)) + " in reverse, because it's not a 2 way binding", {binding:this}, mx.data.binding.Log.BRIEF);
return(["error"]);
}
_local3 = dest;
_local4 = source;
} else {
_local3 = source;
_local4 = dest;
}
_global.__dataLogger.logData(null, "Executing binding " + summaryString(reverse), {binding:this});
_global.__dataLogger.nestLevel++;
var _local10;
if (_local3.constant != undefined) {
_local10 = {value:new mx.data.binding.TypedValue(_local3.constant, "String"), getAnyTypedValue:function () {
return(this.value);
}, getTypedValue:function () {
return(this.value);
}, getGettableTypes:function () {
return(["String"]);
}};
} else {
_local10 = _local3.component.getField(_local3.property, _local3.location, true);
}
var _local18;
var _local20;
var _local12 = "";
var _local8 = _local4.component.getField(_local4.property, _local4.location);
if (format != null) {
var _local5 = getRuntimeObject(format);
if (_local5 != null) {
if (reverse) {
_local5.setupDataAccessor(_local4.component, _local4.property, _local4.location);
_local5.dataAccessor = _local8;
_local8 = _local5;
} else {
_local5.setupDataAccessor(_local3.component, _local3.property, _local3.location);
_local5.dataAccessor = _local10;
_local10 = _local5;
}
}
}
var _local14 = ((format == null) ? (_local8.getSettableTypes()) : null);
var value = _local10.getAnyTypedValue(_local14);
var _local9 = new Object();
if (_local8.type.readonly == true) {
_global.__dataLogger.logData(null, "Not executing binding because the destination is read-only", null, mx.data.binding.Log.BRIEF);
var _local6 = new Object();
_local6.type = "invalid";
_local6.property = _local4.property;
_local6.location = _local4.location;
_local6.messages = [{message:"Cannot assign to a read-only data field."}];
_local4.component.dispatchEvent(_local6);
_local9.event = _local6;
} else {
_global.__dataLogger.logData(null, "Assigning new value '<value>' (<typeName>) " + _local12, {value:value.value, typeName:value.typeName, unformattedValue:_local18, formatterFrom:_local20});
var _local13 = _local8.setAnyTypedValue(value);
_local8.validateAndNotify(_local9, false, _local13);
_local4.component.dispatchEvent({type:"bindingExecuted", binding:this});
}
if (_local9.event != null) {
if (_local3.component != null) {
var _local7 = new Object();
_local7.type = _local9.event.type;
_local7.property = _local3.property;
_local7.location = _local3.location;
_local7.messages = _local9.event.messages;
_local7.to = _local4.component;
_local3.component.dispatchEvent(_local7);
}
}
_global.__dataLogger.nestLevel--;
return(_local9.event.messages);
}
function queueForExecute(reverse) {
if (!queued) {
if (_global.__databind_executeQueue == null) {
_global.__databind_executeQueue = new Array();
}
if (_root.__databind_dispatch == undefined) {
_root.createEmptyMovieClip("__databind_dispatch", -8888);
}
_global.__databind_executeQueue.push(this);
queued = true;
this.reverse = reverse;
_root.__databind_dispatch.onEnterFrame = dispatchEnterFrame;
}
}
static function dispatchEnterFrame() {
_root.__databind_dispatch.onEnterFrame = null;
var _local4 = 0;
while (_local4 < _global.__databind_executeQueue.length) {
var _local3 = _global.__databind_executeQueue[_local4];
_local3.execute(_local3.reverse);
_local4++;
}
var _local5;
while (_local5 = _global.__databind_executeQueue.pop() , _local5 != null) {
_local5.queued = false;
_local5.reverse = false;
}
}
function calcShortLoc(endpoint) {
var _local1 = endpoint.location;
if (_local1.path != null) {
_local1 = _local1.path;
}
endpoint.loc = ((_local1 instanceof Array) ? (_local1.join(".")) : (_local1));
}
function summaryString(reverse) {
var _local2 = "<binding.dest.component>:<binding.dest.property>:<binding.dest.loc>";
var _local3 = "<binding.source.component>:<binding.source.property>:<binding.source.loc>";
if (source.constant == null) {
if (reverse == true) {
return((("from " + _local2) + " to ") + _local3);
}
return((("from " + _local3) + " to ") + _local2);
}
return("from constant '<binding.source.constant>' to " + _local2);
}
static function getRuntimeObject(info, constructorParameter) {
if (info.cls == undefined) {
info.cls = mx.utils.ClassFinder.findClass(info.className);
}
var _local3 = new info.cls(constructorParameter);
if (_local3 == null) {
_global.__dataLogger.logData(null, "Could not construct a formatter or validator - new <info.className>(<params>)", {info:info, params:constructorParameter}, mx.data.binding.Log.BRIEF);
}
for (var _local4 in info.settings) {
_local3[_local4] = info.settings[_local4];
}
return(_local3);
}
static function refreshFromSources(component, property, bindings) {
var _local5 = null;
var _local3;
_local3 = 0;
while (_local3 < bindings.length) {
var _local1 = bindings[_local3];
var _local2 = null;
if ((_local1.dest.component == component) && ((property == null) || (property == _local1.dest.property))) {
_local2 = _local1.execute();
} else if ((_local1.is2way && (_local1.source.component == component)) && ((property == null) || (property == _local1.source.property))) {
_local2 = _local1.execute(true);
}
if (_local2 != null) {
_local5 = ((_local5 == null) ? (_local2) : (_local5.concat(_local2)));
}
_local3++;
}
return(_local5);
}
static function refreshDestinations(component, bindings) {
var _local1;
_local1 = 0;
while (_local1 < bindings.length) {
var _local2 = bindings[_local1];
if (_local2.source.component == component) {
_local2.execute();
} else if (_local2.is2way && (_local2.dest.component == component)) {
_local2.execute(true);
}
_local1++;
}
_local1 = 0;
while (_local1 < component.__indexBindings.length) {
var _local3 = component.__indexBindings[_local1];
_local3.binding.execute(_local3.reverse);
_local1++;
}
}
static function okToCallGetterFromSetter() {
function setter(val) {
this.value2 = this.value;
}
function getter() {
return(5);
}
var _local2 = new Object();
_local2.addProperty("value", getter, setter);
_local2.value = 0;
var _local3 = _local2.value2 == _local2.value;
return(_local3);
}
function setUpListener(endpoint, reverse) {
var _local4 = new Object();
_local4.binding = this;
_local4.property = endpoint.property;
_local4.reverse = reverse;
_local4.immediate = okToCallGetterFromSetter();
_local4.handleEvent = function (event) {
_global.__dataLogger.logData(event.target, "Data of property '<property>' has changed. <immediate>.", this);
if (this.immediate) {
if (this.binding.executing != true) {
this.binding.executing = true;
this.binding.execute(this.reverse);
this.binding.executing = false;
}
} else {
this.binding.queueForExecute(this.reverse);
}
};
if (endpoint.event instanceof Array) {
for (var _local5 in endpoint.event) {
endpoint.component.__addHighPrioEventListener(endpoint.event[_local5], _local4);
}
} else {
endpoint.component.__addHighPrioEventListener(endpoint.event, _local4);
}
mx.data.binding.ComponentMixins.initComponent(endpoint.component);
}
function setUpIndexListeners(endpoint, reverse) {
if (endpoint.location.indices != undefined) {
var _local3 = 0;
while (_local3 < endpoint.location.indices.length) {
var _local2 = endpoint.location.indices[_local3];
if (_local2.component != undefined) {
setUpListener(_local2, reverse);
if (_local2.component.__indexBindings == undefined) {
_local2.component.__indexBindings = new Array();
}
_local2.component.__indexBindings.push({binding:this, reverse:reverse});
}
_local3++;
}
}
}
static function copyBinding(b) {
var _local1 = new Object();
_local1.source = copyEndPoint(b.source);
_local1.dest = copyEndPoint(b.dest);
_local1.format = b.format;
_local1.is2way = b.is2way;
return(_local1);
}
static function copyEndPoint(e) {
var _local1 = new Object();
_local1.constant = e.constant;
_local1.component = String(e.component);
_local1.event = e.event;
_local1.location = e.location;
_local1.property = e.property;
return(_local1);
}
static function registerScreen(screen, id) {
var symbol = screenRegistry[id];
if (symbol == null) {
screenRegistry[id] = {symbolPath:String(screen), bindings:[], id:id};
return(undefined);
}
if (symbol.symbolPath == String(screen)) {
return(undefined);
}
var instancePath = String(screen);
var i = 0;
while (i < bindingRegistry.length) {
var b = bindingRegistry[i];
var src = copyEndPoint(b.source);
var dst = copyEndPoint(b.dest);
var prefix = (symbol.symbolPath + ".");
var symbolContainsSource = (prefix == b.source.component.substr(0, prefix.length));
var symbolContainsDest = (prefix == b.dest.component.substr(0, prefix.length));
if (symbolContainsSource) {
if (symbolContainsDest) {
src.component = eval (instancePath + src.component.substr(symbol.symbolPath.length));
dst.component = eval (instancePath + dst.component.substr(symbol.symbolPath.length));
new mx.data.binding.Binding(src, dst, b.format, b.is2way);
} else {
src.component = eval (instancePath + src.component.substr(symbol.symbolPath.length));
dst.component = eval (dst.component);
new mx.data.binding.Binding(src, dst, b.format, b.is2way);
}
} else if (symbolContainsDest) {
src.component = eval (src.component);
dst.component = eval (instancePath + dst.component.substr(symbol.symbolPath.length));
new mx.data.binding.Binding(src, dst, b.format, b.is2way);
}
i++;
}
}
static function registerBinding(binding) {
var _local1 = copyBinding(binding);
bindingRegistry.push(_local1);
}
static function getLocalRoot(clip) {
var _local2;
var _local3 = clip._url;
while (clip != null) {
if (clip._url != _local3) {
break;
}
_local2 = clip;
clip = clip._parent;
}
return(_local2);
}
var queued = false;
var reverse = false;
static var counter = 0;
static var screenRegistry = new Object();
static var bindingRegistry = new Array();
}
Symbol 310 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
if (queue != undefined) {
var _local4 = queue.length;
var _local1;
_local1 = 0;
while (_local1 < _local4) {
var _local2 = queue[_local1];
if (_local2 == handler) {
queue.splice(_local1, 1);
return(undefined);
}
_local1++;
}
}
}
static function initialize(object) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
object.addEventListener = _fEventDispatcher.addEventListener;
object.removeEventListener = _fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var _local7 = "__q_" + eventObj.type;
var _local4 = queueObj[_local7];
if (_local4 != undefined) {
var _local5;
for (_local5 in _local4) {
var _local1 = _local4[_local5];
var _local3 = typeof(_local1);
if ((_local3 == "object") || (_local3 == "movieclip")) {
if (_local1.handleEvent != undefined) {
_local1.handleEvent(eventObj);
}
if (_local1[eventObj.type] != undefined) {
if (exceptions[eventObj.type] == undefined) {
_local1[eventObj.type](eventObj);
}
}
} else {
_local1.apply(queueObj, [eventObj]);
}
}
}
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(this, eventObj);
}
function addEventListener(event, handler) {
var _local3 = "__q_" + event;
if (this[_local3] == undefined) {
this[_local3] = new Array();
}
_global.ASSetPropFlags(this, _local3, 1);
_removeEventListener(this[_local3], event, handler);
this[_local3].push(handler);
}
function removeEventListener(event, handler) {
var _local2 = "__q_" + event;
_removeEventListener(this[_local2], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1, load:1};
}
Symbol 311 MovieClip [__Packages.mx.data.binding.EndPoint] Frame 0
class mx.data.binding.EndPoint
{
function EndPoint () {
}
}
Symbol 312 MovieClip [__Packages.mx.data.binding.DataType] Frame 0
class mx.data.binding.DataType extends mx.data.binding.DataAccessor
{
var errorArray, type, kind, dataAccessor, encoder, formatter, getAnyTypedValue, setAnyTypedValue, component, location, property;
function DataType () {
super();
errorArray = null;
}
function setupDataAccessor(component, property, location) {
super.setupDataAccessor(component, property, location);
type = component.findSchema(property, location);
if (type.kind != undefined) {
kind = mx.data.binding.Binding.getRuntimeObject(type.kind);
} else {
kind = new mx.data.kinds.Data();
}
kind.setupDataAccessor(component, property, location);
dataAccessor = kind;
if (type.encoder != undefined) {
encoder = mx.data.binding.Binding.getRuntimeObject(type.encoder);
encoder.setupDataAccessor(component, property, location);
encoder.dataAccessor = dataAccessor;
dataAccessor = encoder;
}
if (type.formatter != undefined) {
formatter = mx.data.binding.Binding.getRuntimeObject(type.formatter);
formatter.setupDataAccessor(component, property, location);
formatter.dataAccessor = dataAccessor;
}
}
function getAsBoolean() {
var _local2 = getAnyTypedValue(["Boolean"]);
return(_local2.value);
}
function getAsNumber() {
var _local2 = getAnyTypedValue(["Number"]);
return(_local2.value);
}
function getAsString() {
var _local2 = getAnyTypedValue(["String"]);
return(_local2.value);
}
function setAsBoolean(newValue) {
setAnyTypedValue(new mx.data.binding.TypedValue(newValue, "Boolean"));
}
function setAsNumber(newValue) {
setAnyTypedValue(new mx.data.binding.TypedValue(newValue, "Number"));
}
function setAsString(newValue) {
setAnyTypedValue(new mx.data.binding.TypedValue(newValue, "String"));
}
function validationError(errorMessage) {
if (errorArray == null) {
errorArray = new Array();
}
errorArray.push(errorMessage);
}
function validate(value) {
}
function getTypedValue(requestedType) {
var _local2;
if ((requestedType == "String") && (formatter != null)) {
_local2 = formatter.getTypedValue(requestedType);
} else {
_local2 = dataAccessor.getTypedValue(requestedType);
if (_local2.type == null) {
_local2.type = type;
}
if (_local2.typeName == null) {
_local2.typeName = type.name;
}
}
if ((_local2.typeName != requestedType) && (requestedType != null)) {
_local2 = null;
} else if (((!requestedType) && (_local2.typeName == "XML")) && (_local2.type.name == "String")) {
_local2 = null;
}
return(_local2);
}
function getGettableTypes() {
var _local2 = new Array();
var _local3 = gettableTypes();
if (_local3 != null) {
_local2 = _local2.concat(_local3);
}
if (type.name != null) {
_local2 = _local2.concat(type.name);
}
if (formatter != null) {
_local2 = _local2.concat(formatter.getGettableTypes());
}
if (_local2.length == 0) {
return(null);
}
return(_local2);
}
function setTypedValue(newValue) {
if ((newValue.typeName == "String") && (formatter != null)) {
return(formatter.setTypedValue(newValue));
}
var _local3 = dataAccessor.getSettableTypes();
if ((_local3 == null) || (-1 != mx.data.binding.DataAccessor.findString(newValue.typeName, _local3))) {
return(dataAccessor.setTypedValue(newValue));
}
return(["Can't set a value of type " + newValue.typeName]);
}
function getSettableTypes() {
var _local2 = new Array();
var _local3 = settableTypes();
if (_local3 != null) {
_local2 = _local2.concat(_local3);
}
if (type.name != null) {
_local2 = _local2.concat(type.name);
}
if (formatter != null) {
_local2 = _local2.concat(formatter.getSettableTypes());
}
if (_local2.length == 0) {
return(null);
}
return(_local2);
}
function gettableTypes() {
return(dataAccessor.getGettableTypes());
}
function settableTypes() {
return(dataAccessor.getSettableTypes());
}
function validateAndNotify(returnData, noEvent, initialMessages) {
var _local4 = false;
errorArray = null;
for (var _local6 in initialMessages) {
validationError(initialMessages[_local6]);
_local4 = true;
}
var _local7 = getTypedValue();
if ((_local7.value == null) || (_local7.value == "")) {
if (type.required == false) {
_global.__dataLogger.logData(component, "Validation of null value succeeded because field '<property>/<m_location>' is not required", this);
} else {
var _local8 = ((location == null) ? "" : (":" + String(location)));
validationError((("Required item '" + property) + _local8) + "' is missing");
_local4 = true;
}
} else {
validate(_local7.value);
_local4 = true;
}
if (_local4 && (noEvent != true)) {
var _local5 = new Object();
_local5.type = ((errorArray == null) ? "valid" : "invalid");
_local5.property = property;
_local5.location = location;
_local5.messages = errorArray;
component.dispatchEvent(_local5);
returnData.event = _local5;
}
return(errorArray);
}
}
Symbol 313 MovieClip [__Packages.mx.data.kinds.Data] Frame 0
class mx.data.kinds.Data extends mx.data.binding.DataAccessor
{
var component, property, location;
function Data () {
super();
}
function getTypedValue(requestedType) {
var _local5;
var _local2 = getFieldAccessor().getValue();
var _local3 = null;
if (_local2 != null) {
if (_local2 instanceof Array) {
_local3 = "Array";
} else if ((_local2 instanceof XMLNode) || (_local2 instanceof XMLNode)) {
_local3 = "XML";
} else {
var _local4 = typeof(_local2);
_local3 = _local4.charAt(0).toUpperCase() + _local4.slice(1);
}
} else {
_local2 = null;
}
_local5 = new mx.data.binding.TypedValue(_local2, _local3, null);
return(_local5);
}
function getGettableTypes() {
return(null);
}
function setTypedValue(newValue) {
getFieldAccessor().setValue(newValue.value, newValue);
return(null);
}
function getSettableTypes() {
return(null);
}
function getFieldAccessor() {
return(component.createFieldAccessor(property, location, false));
}
}
Symbol 314 MovieClip [__Packages.mx.data.binding.Formatter] Frame 0
class mx.data.binding.Formatter extends mx.data.binding.DataAccessor
{
function Formatter () {
super();
}
}
Symbol 315 MovieClip [__Packages.com.midasplayer.util.XPMath] Frame 0
class com.midasplayer.util.XPMath
{
function XPMath () {
}
static function atan2(y, x) {
var _local4 = Math.PI;
var _local5 = 1.5707963267949 /* Math.PI/2 */;
if (x == 0) {
if (y > 0) {
return(_local5);
}
if (y == 0) {
return(0);
}
return(-_local5);
}
var _local7 = y / x;
if (Math.abs(_local7) < 1) {
var _local6 = _local7 / (1 + ((0.28 * _local7) * _local7));
if (x < 0) {
if (y < 0) {
return(_local6 - _local4);
}
return(_local6 + _local4);
}
} else {
var _local6 = _local5 - (_local7 / ((_local7 * _local7) + 0.28));
if (y < 0) {
return(_local6 - _local4);
}
}
return(_local6);
}
static function atan(x) {
var _local3 = 0;
if (x < -2.41421356237309) {
var _local4 = 1 / x;
_local3 = -1.5707963267949 - (_local4 * (1 - ((_local4 * _local4) * ((1 / 3) - ((_local4 * _local4) / 5)))));
} else if (x < -1) {
var _local5 = (1 + (x * 0.414213562373095)) / (0.414213562373095 - x);
_local3 = (-1.5707963267949 + (_local5 * (1 - ((_local5 * _local5) * ((1 / 3) - ((_local5 * _local5) / 5)))))) + 0.392699081698724;
} else if (x < -0.414213562373095) {
var _local6 = (x + 0.414213562373095) / ((0.414213562373095 * x) - 1);
_local3 = (-(_local6 * (1 - ((_local6 * _local6) * ((1 / 3) - ((_local6 * _local6) / 5)))))) - 0.392699081698724;
} else if (x < 0.414213562373095) {
_local3 = x * (1 - ((x * x) * ((1 / 3) - ((x * x) / 5))));
} else if (x < 1) {
var _local7 = (x - 0.414213562373095) / (1 + (0.414213562373095 * x));
_local3 = (_local7 * (1 - ((_local7 * _local7) * ((1 / 3) - ((_local7 * _local7) / 5))))) + 0.392699081698724;
} else if (x < 2.41421356237309) {
var _local8 = (1 - (x * 0.414213562373095)) / (x + 0.414213562373095);
_local3 = (1.5707963267949 /* Math.PI/2 */ - (_local8 * (1 - ((_local8 * _local8) * ((1 / 3) - ((_local8 * _local8) / 5)))))) - 0.392699081698724;
} else {
var _local9 = 1 / x;
_local3 = 1.5707963267949 /* Math.PI/2 */ - (_local9 * (1 - ((_local9 * _local9) * ((1 / 3) - ((_local9 * _local9) / 5)))));
}
return(_local3);
}
static function cos(f) {
var _local3 = 0;
var _local4 = ((f > 0) ? (f) : (-f));
if (_local4 >= (12.5663706143592 + 1.5707963267949 /* Math.PI/2 */)) {
_local3 = int(_local4 * 0.636619772367581);
if ((_local3 & 1) != 0) {
_local3++;
}
_local4 = _local4 - (_local3 * 1.5707963267949 /* Math.PI/2 */);
} else if (_local4 < 1.5707963267949 /* Math.PI/2 */) {
} else if (_local4 < (1.5707963267949 /* Math.PI/2 */ + Math.PI)) {
_local4 = _local4 - Math.PI;
_local3 = 2;
} else if (_local4 < ((Math.PI*2) + 1.5707963267949 /* Math.PI/2 */)) {
_local4 = _local4 - (Math.PI*2);
} else if (_local4 < (9.42477796076938 + 1.5707963267949 /* Math.PI/2 */)) {
_local4 = _local4 - 9.42477796076938;
_local3 = 2;
} else {
_local4 = _local4 - 12.5663706143592;
}
var _local5 = _local4 * _local4;
var _local6 = 0.999999953027512 + (_local5 * (-0.499999047777921 + (_local5 * (0.041663573160188 + (_local5 * (-0.0013853629536173 + (_local5 * 2.31524166599385E-5)))))));
return((((_local3 & 2) != 0) ? (-_local6) : (_local6)));
}
static function sin(f) {
f = f - 1.5707963267949 /* Math.PI/2 */;
var _local3 = 0;
var _local4 = ((f > 0) ? (f) : (-f));
if (_local4 >= (12.5663706143592 + 1.5707963267949 /* Math.PI/2 */)) {
_local3 = int(_local4 * 0.636619772367581);
if ((_local3 & 1) != 0) {
_local3++;
}
_local4 = _local4 - (_local3 * 1.5707963267949 /* Math.PI/2 */);
} else if (_local4 < 1.5707963267949 /* Math.PI/2 */) {
} else if (_local4 < (1.5707963267949 /* Math.PI/2 */ + Math.PI)) {
_local4 = _local4 - Math.PI;
_local3 = 2;
} else if (_local4 < ((Math.PI*2) + 1.5707963267949 /* Math.PI/2 */)) {
_local4 = _local4 - (Math.PI*2);
} else if (_local4 < (9.42477796076938 + 1.5707963267949 /* Math.PI/2 */)) {
_local4 = _local4 - 9.42477796076938;
_local3 = 2;
} else {
_local4 = _local4 - 12.5663706143592;
}
var _local5 = _local4 * _local4;
var _local6 = 0.999999953027512 + (_local5 * (-0.499999047777921 + (_local5 * (0.041663573160188 + (_local5 * (-0.0013853629536173 + (_local5 * 2.31524166599385E-5)))))));
return((((_local3 & 2) != 0) ? (-_local6) : (_local6)));
}
}
Symbol 316 MovieClip [__Packages.com.king.bbbathtub.Tire] Frame 0
class com.king.bbbathtub.Tire extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function Tire (c, im) {
super(c, im);
m_itemId = 24;
m_shape = new com.king.bbbathtub.BoundOctagon(0, 0, 66, 66);
}
function getWeight() {
return(75);
}
function getScore() {
return(50);
}
}
Symbol 317 MovieClip [__Packages.com.king.bbbathtub.BoundOctagon] Frame 0
class com.king.bbbathtub.BoundOctagon extends com.king.bbbathtub.BoundShape
{
var m_diameter, m_area, m_r, m_x, m_y, m_w, m_h, m_cx, m_cy, m_py, m_px, m_sphereVal, m_changed, m_line;
function BoundOctagon (x, y, diam) {
super();
if (x == undefined) {
x = 0;
}
if (y == undefined) {
y = 0;
}
if (diam == undefined) {
diam = 1;
}
m_diameter = diam;
m_area = 0;
m_r = 0;
m_x = x;
m_y = y;
m_w = 0;
m_h = 0;
m_cx = x;
m_cy = y;
recompute();
var _local6 = [];
var _local7 = 0;
var _local8 = 0;
for ( ; _local8 < 8 ; _local8++ , _local7++) {
_local6[_local8] = {x:m_px[_local8], y:m_py[_local8]};
}
_local6[_local7] = _local6[0];
_local6[_local7 + 1] = _local6[1];
var _local9 = 1;
var _local10 = 2;
var _local11 = 0;
for ( ; _local9 <= _local7 ; _local9++ , _local10++ , _local11++) {
m_area = m_area + (_local6[_local9].x * (_local6[_local10].y - _local6[_local11].y));
}
m_area = m_area / 2;
var _local12 = m_diameter / 2;
m_sphereVal = (Math.PI * _local12) * _local12;
m_w = _local12;
m_h = _local12;
}
function recompute() {
if (!m_changed) {
return(undefined);
}
var _local4 = 0;
var _local5 = 0;
var _local6 = (2 * Math.PI) / 8;
var _local7 = m_diameter / 2;
var _local8 = m_x;
var _local9 = m_y;
m_px = new Array(8);
m_py = new Array(8);
m_line = new Array(8);
var _local10 = 0;
for ( ; _local10 < 8 ; _local10++) {
_local4 = (8 - _local10) - 1;
m_px[_local4] = (Math.sin(_local5) * _local7) + _local8;
m_py[_local4] = (Math.cos(_local5) * _local7) + _local9;
if (_local10 > 0) {
m_line.push(new com.midasplayer.geom.Line(_local2, _local3, m_px[_local4], m_py[_local4]));
}
var _local2 = m_px[_local4];
var _local3 = m_py[_local4];
_local5 = _local5 + _local6;
}
m_line.push(new com.midasplayer.geom.Line(m_px[7], m_py[7], m_px[0], m_py[0]));
m_changed = false;
}
function getArea() {
return(m_area);
}
function getSphereVal() {
return(m_sphereVal);
}
}
Symbol 318 MovieClip [__Packages.com.king.bbbathtub.DietCoke] Frame 0
class com.king.bbbathtub.DietCoke extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function DietCoke (c, im) {
super(c, im);
m_itemId = 23;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 22, 41);
}
function getWeight() {
return(10);
}
function getScore() {
return(300);
}
}
Symbol 319 MovieClip [__Packages.com.king.bbbathtub.BoundBox] Frame 0
class com.king.bbbathtub.BoundBox extends com.king.bbbathtub.BoundShape
{
var m_r, m_x, m_y, m_w, m_h, m_w2, m_h2, m_cx, m_cy, m_lrs, m_lrc, m_maxRadius, m_intersects, m_line, m_px, m_py, m_sphereVal, m_scale, m_changed;
function BoundBox (x, y, w, h, angle) {
super();
if (x == undefined) {
x = 0;
}
if (y == undefined) {
y = 0;
}
if (w == undefined) {
w = 0;
}
if (h == undefined) {
h = 0;
}
if (angle == undefined) {
angle = 0;
}
m_r = angle;
m_x = x;
m_y = y;
m_w = w;
m_h = h;
m_w2 = m_w / 2;
m_h2 = m_h / 2;
m_cx = x;
m_cy = y;
m_lrs = Math.sin(m_r);
m_lrc = Math.cos(m_r);
m_maxRadius = 0;
m_intersects = new Array();
var _local8 = 0;
for ( ; _local8 < 4 ; _local8++) {
m_line[_local8] = new com.midasplayer.geom.Line();
}
recompute();
var _local9 = 0;
for ( ; _local9 < 4 ; _local9++) {
var _local10 = m_px[_local9] - m_cx;
_local10 = _local10 * _local10;
var _local11 = m_py[_local9] - m_cy;
_local11 = _local11 * _local11;
m_maxRadius = Math.max(m_maxRadius, Math.sqrt(_local10 + _local11));
}
var _local12 = Math.abs(m_px[0] - m_px[2]);
var _local13 = Math.abs(m_py[0] - m_py[2]);
m_sphereVal = (_local12 * _local12) + (_local13 * _local13);
}
function toString() {
return(("[BoundBox:" + [m_x, m_y, m_w, m_h, m_r]) + "]");
}
function rescale(factor) {
m_scale = factor;
m_w2 = (m_w / 2) * m_scale;
m_h2 = (m_h / 2) * m_scale;
m_changed = true;
}
function recompute() {
if (!m_changed) {
return(undefined);
}
m_lrs = Math.sin(m_r);
m_lrc = Math.cos(m_r);
m_px[0] = (m_x - m_w2) - m_cx;
m_py[0] = (m_y - m_h2) - m_cy;
m_px[1] = (m_x + m_w2) - m_cx;
m_py[1] = (m_y - m_h2) - m_cy;
m_px[2] = (m_x + m_w2) - m_cx;
m_py[2] = (m_y + m_h2) - m_cy;
m_px[3] = (m_x - m_w2) - m_cx;
m_py[3] = (m_y + m_h2) - m_cy;
var _local2 = m_px[0];
var _local3 = m_py[0];
m_px[0] = ((m_lrc * _local2) + (m_lrs * _local3)) + m_cx;
m_py[0] = ((m_lrs * _local2) - (m_lrc * _local3)) + m_cy;
_local2 = m_px[1];
_local3 = m_py[1];
m_px[1] = ((m_lrc * _local2) + (m_lrs * _local3)) + m_cx;
m_py[1] = ((m_lrs * _local2) - (m_lrc * _local3)) + m_cy;
_local2 = m_px[2];
_local3 = m_py[2];
m_px[2] = ((m_lrc * _local2) + (m_lrs * _local3)) + m_cx;
m_py[2] = ((m_lrs * _local2) - (m_lrc * _local3)) + m_cy;
_local2 = m_px[3];
_local3 = m_py[3];
m_px[3] = ((m_lrc * _local2) + (m_lrs * _local3)) + m_cx;
m_py[3] = ((m_lrs * _local2) - (m_lrc * _local3)) + m_cy;
m_line[0].x1 = m_px[0];
m_line[0].y1 = m_py[0];
m_line[0].x2 = m_px[1];
m_line[0].y2 = m_py[1];
m_line[1].x1 = m_px[1];
m_line[1].y1 = m_py[1];
m_line[1].x2 = m_px[2];
m_line[1].y2 = m_py[2];
m_line[2].x1 = m_px[2];
m_line[2].y1 = m_py[2];
m_line[2].x2 = m_px[3];
m_line[2].y2 = m_py[3];
m_line[3].x1 = m_px[3];
m_line[3].y1 = m_py[3];
m_line[3].x2 = m_px[0];
m_line[3].y2 = m_py[0];
m_changed = false;
}
function getPositionKey() {
return(Math.round(Math.sqrt((m_cx * m_cx) + (m_cy * m_cy))) / 960);
}
function getArea() {
return((m_w * m_h) * m_scale);
}
function getSphereVal() {
return(m_sphereVal);
}
function getRadius() {
return(m_maxRadius);
}
}
Symbol 320 MovieClip [__Packages.com.king.bbbathtub.Aeroplane] Frame 0
class com.king.bbbathtub.Aeroplane extends com.king.bbbathtub.TankItem
{
var m_bounds, m_itemMgr, m_itemId, m_dist, m_distRad, m_leaveTime, m_entered, m_started, m_initialState, m_isMovingAround, m_shape, m_minDist, m_ua, m_avglevel, m_ub, m_xpos, m_ypos, m_clip, m_numUpd, m_startDelay, m_lastX, m_lastY, flip, m_rotation, setPosition2n;
function Aeroplane (c, im) {
super(c, im);
m_bounds = m_itemMgr.getBoundaries();
m_itemId = 1;
m_dist = 0;
m_distRad = 0;
m_leaveTime = -1;
m_entered = false;
m_started = false;
m_initialState = false;
m_isMovingAround = true;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 67.5, 48);
m_minDist = 10;
m_ua = m_avglevel - 32;
m_ub = m_avglevel + 32;
}
function updateShock() {
return(false);
}
function onHit() {
if (m_entered) {
var _local2 = m_itemMgr.getLevel().createItem(11, m_xpos, m_ypos, 0, 0, false, false);
m_itemMgr.onSpawnItem(new com.king.bbbathtub.BalloonWrap(_local2));
com.midasplayer.fx.SoundManager.play("hit_bonus");
m_itemMgr.onSpawnItem(_local2);
m_clip.swapDepths(m_itemMgr.getParentClip().getNextHighestDepth());
m_dist = 8;
m_distRad = 0;
}
return(false);
}
function getScore() {
return(0);
}
function isCollision() {
return(m_entered && (m_bounds.minEdgeDistance(m_xpos, m_ypos) < m_minDist));
}
function update(tick) {
com.king.bbbathtub.Collidable.m_cTick = tick;
var _local3 = m_bounds.minEdgeDistance(m_xpos, m_ypos);
var _local4 = (m_leaveTime != -1) && (m_numUpd >= m_leaveTime);
var _local5 = 0;
var _local6 = 0;
if (!m_started) {
if (m_numUpd == m_startDelay) {
m_initialState = m_bounds.isInside(m_xpos, m_ypos);
m_started = true;
m_entered = m_initialState;
m_leaveTime = m_startDelay + 500;
}
} else {
if (!_local4) {
if (m_entered && (_local3 <= m_minDist)) {
m_xpos = m_lastX;
m_ypos = m_lastY;
flip();
} else if ((_local3 > (m_minDist * 1.5)) && (m_bounds.isInside(m_xpos, m_ypos))) {
m_entered = true;
}
}
if (((m_ypos > m_ua) && (m_lastY < m_ub)) || ((m_ypos < m_ub) && (m_lastY > m_ua))) {
m_xpos = m_lastX;
m_ypos = m_lastY;
flip();
}
var _local7 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
_local5 = Math.cos(_local7) * 2;
_local6 = Math.sin(_local7) * 2;
}
if (m_dist > 0.001) {
_local6 = _local6 + (Math.cos(m_distRad) * m_dist);
m_distRad = m_distRad + 0.625;
m_dist = m_dist * 0.9;
}
m_lastX = m_xpos;
m_lastY = m_ypos;
setPosition2n(m_xpos + _local5, m_ypos + _local6);
if (_local4 && ((m_xpos < -100) || ((m_ypos < -100) || ((m_xpos > 786) || (m_ypos > 592))))) {
m_itemMgr.onKillItem(this);
}
m_numUpd++;
}
}
Symbol 321 MovieClip [__Packages.com.king.bbbathtub.BalloonWrap] Frame 0
class com.king.bbbathtub.BalloonWrap extends com.king.bbbathtub.TankItem
{
var m_itemId, m_wave, m_fs, m_fact, m_wave2, m_innerObject, m_shape, m_itemMgr, m_isMovingAround, m_clip, m_xpos, m_ypos, m_rotation, m_isReleased, m_fx, m_fy, m_collisionEnabled, setPosition;
function BalloonWrap (inner) {
super(inner.m_clip, inner.m_itemMgr);
m_itemId = 41;
m_wave = 0;
m_fs = 2;
m_fact = 1.08;
m_wave2 = 0;
m_innerObject = inner;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 20, 20);
m_shape = null;
m_itemMgr = inner.m_itemMgr;
m_isMovingAround = true;
m_innerObject.m_isMovingAround = true;
var _local4 = inner.m_clip._parent;
var _local5 = _local4.getNextHighestDepth();
m_clip = _local4.attachMovie("balloon", "bobble_" + _local5, _local5);
m_clip._alpha = 0;
m_clip._x = inner.m_xpos;
m_clip._y = inner.m_ypos;
inner.m_fadeIn = false;
m_xpos = inner.m_xpos;
m_ypos = inner.m_ypos;
m_rotation = 0;
m_isReleased = false;
}
function destroy() {
m_innerObject.destroy();
m_innerObject = null;
super.destroy();
}
function render() {
var _local2 = m_fx.value;
var _local3 = m_fy.value;
m_clip._x = _local2;
m_clip._y = _local3;
m_clip._rotation = m_rotation;
if (!m_isReleased) {
var _local4 = m_innerObject.m_clip;
var _local5 = m_innerObject.m_fx.value;
var _local6 = m_innerObject.m_fy.value;
_local4._x = _local5;
_local4._y = _local6;
_local4._rotation = m_innerObject.m_rotation;
var _local7 = {x:_local5, y:_local6};
_local4.globalToLocal(_local7);
var _local8 = {x:_local2, y:_local3};
_local4.globalToLocal(_local8);
_local4.clear();
_local4.lineStyle(1, 13421772);
_local4.moveTo(_local7.x, _local7.y);
_local4.lineTo(_local8.x, _local8.y);
} else {
m_clip.clear();
m_clip.lineStyle(1, 13421772);
m_clip.moveTo(0, 0);
m_clip.lineTo(0, 15);
}
}
function setDirectAlpha(amount) {
m_clip._alpha = amount;
m_innerObject.m_clip._alpha = amount;
}
function update(tick) {
com.king.bbbathtub.Collidable.m_cTick = tick;
var _local3 = m_xpos;
var _local4 = m_ypos;
if (!m_isReleased) {
if (m_innerObject.m_isCaught) {
m_innerObject.m_clip.clear();
m_innerObject = null;
m_collisionEnabled = false;
m_isReleased = true;
} else {
_local3 = _local3 + Math.sin(m_wave2);
_local4 = _local4 + Math.cos(m_wave2);
var _local5 = m_rotation;
m_wave = m_wave + 0.1;
m_wave2 = m_wave2 + 0.075;
var _local6 = (Math.sin(m_wave) * Math.PI) / 12;
var _local7 = (180 / Math.PI) * _local6;
var _local8 = Math.sin(_local6);
var _local9 = Math.cos(_local6);
var _local10 = 0;
var _local11 = -20;
var _local12 = ((_local9 * _local10) + (_local8 * _local11)) + m_xpos;
var _local13 = ((_local8 * _local10) - (_local9 * _local11)) + m_ypos;
setPosition(_local3, _local4, _local7);
var _local14 = 0.9;
var _local15 = 0.1;
var _local16 = (-m_innerObject.m_xpos) + _local12;
var _local17 = (-m_innerObject.m_ypos) + _local13;
m_sxp = (m_sxp * _local14) + (_local16 * _local15);
m_syp = (m_syp * _local14) + (_local17 * _local15);
_local12 = m_innerObject.m_xpos + m_sxp;
_local13 = m_innerObject.m_ypos + m_syp;
m_innerObject.setPosition(_local12, _local13, _local7);
}
} else {
var _local18 = m_rotation;
if (_local18 < 0) {
_local18++;
}
if (_local18 > 0) {
_local18--;
}
_local4 = _local4 - m_fs;
m_fs = m_fs * m_fact;
setPosition(_local3, _local4, _local18);
if (_local4 < -30) {
m_itemMgr.onKillItem(this);
}
}
}
var m_sxp = 0;
var m_syp = 0;
}
Symbol 322 MovieClip [__Packages.com.midasplayer.util.Map] Frame 0
class com.midasplayer.util.Map
{
var map, lastSize;
function Map (init) {
map = new Object();
for (var i in init) {
map["" + i] = init[i];
}
lastSize = -1;
}
function put(key, value) {
map["" + key] = value;
lastSize = -1;
}
function get(key) {
return(map["" + key]);
}
function remove(key) {
var _local3 = "" + key;
var _local4 = map[_local3];
delete map[_local3];
lastSize = -1;
return(_local4);
}
function contains(key) {
return(map["" + key] != undefined);
}
function count() {
if (lastSize < 0) {
lastSize = 0;
for (var i in map) {
lastSize++;
}
}
return(lastSize);
}
function size() {
return(count());
}
function clear() {
map = {};
lastSize = 0;
}
function dump() {
var _local2 = "";
for (var i in map) {
_local2 = _local2 + (((i + "=>") + map[i]) + newline);
}
}
function toArray() {
var _local2 = [];
for (var i in map) {
_local2[_local2.length] = map[i];
}
return(_local2);
}
function keySet() {
var _local2 = [];
for (var i in map) {
_local2[_local2.length] = i;
}
return(_local2);
}
function get iterator() {
return(new com.midasplayer.util.MapIterator(this));
}
function get valueIterator() {
return(new com.midasplayer.util.MapValueIterator(this));
}
function foreach(fn) {
var _local3 = arguments.slice(1);
if (_local3.length > 0) {
do {
if ((in map) == null) {
break;
}
var i = (in map);
} while (fn(i, map[i], _local3[0], _local3[1], _local3[2], _local3[3], _local3[4]) != false);
do {
} while ("foreach" != null);
} else {
do {
if ((in map) == null) {
break;
}
var i = (in map);
} while (fn(i, map[i]) != false);
do {
} while (_local1 != null);
}
lastSize = -1;
}
function get _content() {
return(map);
}
}
Symbol 323 MovieClip [__Packages.com.midasplayer.util.MapIterator] Frame 0
class com.midasplayer.util.MapIterator implements com.midasplayer.util.Iterator
{
var map, keys, ptr;
function MapIterator (map) {
this.map = map;
keys = map.keySet();
ptr = 0;
}
function next() {
if (ptr < keys.length) {
return(keys[ptr++]);
}
return(undefined);
}
function hasNext() {
return(ptr != keys.length);
}
function remove() {
if (ptr == 0) {
return(undefined);
}
map.remove(keys[ptr - 1]);
}
}
Symbol 324 MovieClip [__Packages.com.midasplayer.util.MapValueIterator] Frame 0
class com.midasplayer.util.MapValueIterator implements com.midasplayer.util.Iterator
{
var map, mapRef, keys, ptr;
function MapValueIterator (map) {
this.map = map;
mapRef = map._content;
keys = map.keySet();
ptr = 0;
}
function next() {
return(mapRef[keys[ptr++]]);
}
function hasNext() {
return(ptr != keys.length);
}
function remove() {
if (ptr == 0) {
return(undefined);
}
map.remove(keys[ptr - 1]);
}
}
Symbol 325 MovieClip [__Packages.com.midasplayer.fx.SoundManager] Frame 0
class com.midasplayer.fx.SoundManager
{
static var preloadLastId, progressCallback, preloadList, preloadNum, preloadLast, beginLoadCallback;
function SoundManager () {
}
static function setup(useClip) {
m_placeholder = useClip;
}
static function isSoundEnabled() {
return(soundEnabled);
}
static function enableSounds(enabled) {
soundEnabled = enabled;
if (!enabled) {
muteAll();
} else {
restoreMuteAll();
}
}
static function stopAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.stop();
soundEntry.playStatus = false;
});
}
static function muteAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.setVolume(0);
soundEntry.isMuted = true;
});
}
static function restoreMuteAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.setVolume(soundEntry.realVol);
soundEntry.isMuted = false;
});
}
static function stop(resource) {
var _local3 = sounds.get(resource);
if (_local3 != undefined) {
_local3.sound.stop();
_local3.playStatus = false;
}
}
static function getCalibratedVolume(flashVolume) {
flashVolume = Math.min(100, flashVolume);
flashVolume = Math.max(0, flashVolume);
return(Math.ceil(Math.pow(flashVolume / 100, 1.46) * 100));
}
static function setVolume(resource, percent) {
var _local4 = sounds.get(resource);
if ((_local4 != undefined) && (_local4.playStatus == true)) {
if (!_local4.isMuted) {
_local4.sound.setVolume(percent);
}
_local4.realVol = percent;
}
}
static function getPosition(resource) {
var _local3 = sounds.get(resource);
if ((_local3 != undefined) && (_local3.playStatus == true)) {
return(_local3.sound.position);
}
return(-1);
}
static function getLength(resource) {
var _local3 = sounds.get(resource);
if (_local3 != undefined) {
return(_local3.sound.duration);
}
return(-1);
}
static function isPlaying(resource) {
var _local3 = sounds.get(resource);
return((_local3 != undefined) && (_local3.playStatus == true));
}
static function initialize(list) {
for (var i in list) {
var resource = list[i];
var _local3 = m_placeholder.getNextHighestDepth();
var _local4 = new Sound(m_placeholder.createEmptyMovieClip("sm_sndhold_" + _local3, _local3));
_local4.attachSound(resource);
_local4.onSoundComplete = function () {
var _local2 = com.midasplayer.fx.SoundManager.sounds.get(resource);
_local2.playStatus = false;
};
sounds.put(resource, {realVol:100, sound:_local4, playStatus:false});
}
}
static function killPreload() {
unload(preloadLastId);
progressCallback = undefined;
preloadLastId = undefined;
preloadList = undefined;
preloadNum = 0;
preloadLast = undefined;
}
static function preload(urlList, fnProgressCallback, fnBeginLoadCallback) {
beginLoadCallback = fnBeginLoadCallback;
progressCallback = fnProgressCallback;
preloadList = new Array();
for (var i in urlList) {
preloadList.push(urlList[i]);
}
preloadLast = "";
preloadNum = urlList.length;
loadUrl_();
}
static function unload(name) {
var _local3 = sounds.get(name);
if ((_local3 != undefined) && (_local3.runtime == true)) {
var _local4 = m_placeholder[_local3.clipId];
_local4.removeMovieClip();
delete _local3.sound;
_local3.sound = undefined;
sounds.remove(name);
}
}
static function setPlaceholderParent(p) {
m_placeholder = p;
}
static function play(resource, volume, isLoop, fn) {
if (volume == undefined) {
volume = 100;
}
if (isLoop == undefined) {
isLoop = false;
}
volume = getCalibratedVolume(volume);
var _local5 = sounds.get(resource);
if (_local5 != undefined) {
_local5.sound.setVolume((soundEnabled ? (volume) : 0));
_local5.realVol = volume;
_local5.isMuted = !soundEnabled;
_local5.playStatus = true;
_local5.onPlayedFn = fn;
_local5.sound.start(0, (isLoop ? 65535 : 1));
} else {
var _local6 = m_placeholder.getNextHighestDepth();
var _local7 = new Sound(m_placeholder.createEmptyMovieClip("sm_sndhold_" + _local6, _local6));
_local7.attachSound(resource);
_local7.onSoundComplete = function () {
var _local2 = com.midasplayer.fx.SoundManager.sounds.get(resource);
_local2.playStatus = false;
com.midasplayer.fx.SoundManager.onPlayed_(resource);
};
_local7.setVolume((soundEnabled ? (volume) : 0));
_local7.start(0, (isLoop ? 65535 : 1));
sounds.put(resource, {isMuted:!soundEnabled, realVol:volume, onPlayedFn:fn, sound:_local7, playStatus:true});
}
}
static function onPlayed_(name) {
var _local3 = sounds.get(name);
if ((_local3 != undefined) && (_local3.onPlayedFn != undefined)) {
_local3.onPlayedFn();
}
}
static function loadUrl_(success) {
var _local3 = preloadNum - preloadList.length;
if (_local3 != 0) {
if (success == false) {
}
progressCallback(_local3, success);
}
if (preloadList.length == 0) {
progressCallback = undefined;
preloadList = undefined;
preloadNum = 0;
preloadLast = undefined;
return(undefined);
}
var _local4 = preloadList.pop();
preloadLast = _local4.url;
var nextId = _local4.id;
if (!_local4.id) {
var _local5 = preloadLast.lastIndexOf("/");
if (_local5 == -1) {
_local5 = 0;
} else {
_local5++;
}
var _local6 = preloadLast.lastIndexOf(".");
if (_local6 == -1) {
_local6 = preloadLast.length;
}
nextId = preloadLast.substring(_local5, _local6);
}
var _local7 = m_placeholder.getNextHighestDepth();
var _local8 = "dn_sndhold_" + _local7;
var _local9 = new Sound(m_placeholder.createEmptyMovieClip(_local8, _local7));
_local9.onLoad = function (a) {
var _local3 = com.midasplayer.fx.SoundManager.loadUrl_;
com.midasplayer.util.Delay.oneShot(this, _local3, 50, a);
};
_local9.onSoundComplete = function () {
var _local2 = com.midasplayer.fx.SoundManager.sounds.get(nextId);
_local2.playStatus = false;
com.midasplayer.fx.SoundManager.onPlayed_(nextId);
};
preloadLastId = nextId;
_local9.loadSound("" + preloadLast, false);
sounds.put(nextId, {realVol:100, clipId:_local8, sound:_local9, playStatus:false, runtime:true});
if (beginLoadCallback) {
beginLoadCallback(_local9, preloadLast, nextId, (preloadNum - preloadList.length) - 1);
}
}
static var m_placeholder = _root;
static var sounds = new com.midasplayer.util.Map();
static var soundEnabled = true;
}
Symbol 326 MovieClip [__Packages.com.midasplayer.util.Delay] Frame 0
class com.midasplayer.util.Delay
{
var m_fn, m_param, m_context, m_delay, m_started, m_timerId;
function Delay (context, fn, delay) {
m_fn = fn;
m_param = new Array();
var _local5 = 3;
for ( ; _local5 < arguments.length ; _local5++) {
m_param.push(arguments[_local5]);
}
m_context = context;
m_delay = delay;
m_started = getTimer();
m_timerId = _global.setInterval(mx.utils.Delegate.create(this, onEvent), delay);
}
function onEvent() {
if (getTimer() >= (m_delay + m_started)) {
_global.clearInterval(m_timerId);
m_fn.apply(m_context, m_param);
m_fn = undefined;
m_param = undefined;
}
}
static function oneShot(context, fn, delay) {
var _local5 = new com.midasplayer.util.Delay(context, fn, delay);
_local5.m_param = new Array();
var _local6 = 3;
for ( ; _local6 < arguments.length ; _local6++) {
_local5.m_param.push(arguments[_local6]);
}
}
}
Symbol 327 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 328 MovieClip [__Packages.com.king.bbbathtub.GoldbarAeroplane] Frame 0
class com.king.bbbathtub.GoldbarAeroplane extends com.king.bbbathtub.Aeroplane
{
var m_itemId, m_entered, m_itemMgr, m_xpos, m_ypos, m_clip, m_dist, m_distRad;
function GoldbarAeroplane (c, im) {
super(c, im);
m_itemId = 16;
}
function onHit() {
if (m_entered) {
var _local2 = m_itemMgr.getLevel().createItem(18, m_xpos, m_ypos, 0, 0, false, false);
m_itemMgr.onSpawnItem(_local2);
m_clip.swapDepths(m_itemMgr.getParentClip().getNextHighestDepth());
com.midasplayer.fx.SoundManager.play("hit_bonus");
m_dist = 8;
m_distRad = 0;
}
return(false);
}
}
Symbol 329 MovieClip [__Packages.com.king.bbbathtub.FloatingSoap] Frame 0
class com.king.bbbathtub.FloatingSoap extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function FloatingSoap (c, im) {
super(c, im);
m_itemId = 5;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 40, 17);
}
function getWeight() {
return(30);
}
function getScore() {
return(100);
}
}
Symbol 330 MovieClip [__Packages.com.king.bbbathtub.Submarine] Frame 0
class com.king.bbbathtub.Submarine extends com.king.bbbathtub.TankItem
{
var m_itemId, m_startedTick, m_bounds, m_itemMgr, m_opacity, m_shape, m_collisionEnabled, m_isMovingAround, m_clip, m_ua, m_avglevel, m_ub, m_xpos, m_ypos, m_rotation, m_spikesR, m_spikes, prepareSpikes, m_lastX, m_lastY, flip, setPosition2n, m_startDelay, m_numUpd, m_fx, m_fy;
function Submarine (c, im) {
super(c, im);
m_itemId = 15;
m_startedTick = -1;
m_bounds = m_itemMgr.getBoundaries();
m_opacity = new com.midasplayer.timing.IFloat(0);
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 90, 46);
m_collisionEnabled = false;
m_isMovingAround = true;
m_clip._alpha = 0;
m_ua = m_avglevel - 32;
m_ub = m_avglevel + 32;
}
function updateShock() {
return(false);
}
function onHit() {
if (m_collisionEnabled) {
var _local2 = m_itemMgr.getLevel().createItem(14, m_xpos, m_ypos, 0, 0, false, false);
m_itemMgr.onSpawnItem(_local2);
com.midasplayer.fx.SoundManager.play("hit_bonus");
m_clip.swapDepths(m_itemMgr.getParentClip().getNextHighestDepth());
}
return(false);
}
function isCollision() {
var _local2 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
if (m_spikesR != _local2) {
m_spikes = prepareSpikes(0.8, (m_spikesR = _local2));
}
return(m_bounds.mayCollide(m_xpos, m_ypos) && (m_bounds.testSpikes(m_spikes, m_xpos, m_ypos)));
}
function update(tick) {
com.king.bbbathtub.Collidable.m_cTick = tick;
if (m_startedTick != -1) {
if (com.king.bbbathtub.Collidable.m_cTick >= (m_startedTick + 640)) {
var _local3 = 1 - (Math.min(17, com.king.bbbathtub.Collidable.m_cTick - (m_startedTick + 640)) / 17);
if (_local3 == 0) {
m_itemMgr.onKillItem(this);
return(undefined);
}
} else {
var _local3 = Math.min(17, com.king.bbbathtub.Collidable.m_cTick - m_startedTick) / 17;
if (_local3 > 0.25) {
m_collisionEnabled = true;
}
}
m_opacity.set(_local3 * 100);
var _local4 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
if (m_spikesR != _local4) {
m_spikes = prepareSpikes(0.8, (m_spikesR = _local4));
}
if (m_bounds.testSpikesWater(m_spikes, m_xpos, m_ypos)) {
if (m_lastX != null) {
m_xpos = m_lastX;
m_ypos = m_lastY;
}
flip();
_local4 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
}
if (((m_ypos > m_ua) && (m_lastY < m_ub)) || ((m_ypos < m_ub) && (m_lastY > m_ua))) {
m_xpos = m_lastX;
m_ypos = m_lastY;
flip();
_local4 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
}
var _local5 = (Math.cos(_local4) * 5) * _local3;
var _local6 = (Math.sin(_local4) * 5) * _local3;
m_lastX = m_xpos;
m_lastY = m_ypos;
setPosition2n(m_xpos + _local5, m_ypos + _local6);
} else if (m_numUpd == m_startDelay) {
m_startedTick = com.king.bbbathtub.Collidable.m_cTick;
}
m_numUpd++;
}
function render() {
m_clip._x = m_fx.value;
m_clip._y = m_fy.value;
m_clip._alpha = m_opacity.value;
m_clip._rotation = m_rotation;
}
}
Symbol 331 MovieClip [__Packages.com.midasplayer.timing.Timeable] Frame 0
class com.midasplayer.timing.Timeable
{
function Timeable () {
}
}
Symbol 332 MovieClip [__Packages.com.king.bbbathtub.MidasGame] Frame 0
class com.king.bbbathtub.MidasGame implements com.midasplayer.timing.Timeable
{
var m_enableFrameRate, m_performance, m_parent, m_mainTimer, m_forcedLow, m_soundsEnabled, m_lastFps;
function MidasGame (gameParent) {
fscommand ("config", "contextmenu=false");
var _local3 = new ContextMenu();
_local3.hideBuiltInItems();
_local3.builtInItems.quality = true;
_root.menu = _local3;
_root._quality = "high";
Stage.scaleMode = "noScale";
m_enableFrameRate = false;
m_performance = new com.midasplayer.timing.Performance(MOVIE_FPS);
m_performance.setFpsThreshold(MIN_FPS, MEASURE_TIME);
m_performance.addQualityFeedbackListener(mx.utils.Delegate.create(this, onLowQualityWarning));
m_parent = gameParent;
m_parent.onEnterFrame = mx.utils.Delegate.create(this, drive);
m_mainTimer = new com.midasplayer.timing.Timer(this, 25);
m_forcedLow = false;
m_soundsEnabled = true;
}
function drive() {
m_mainTimer.advanceTime2();
m_performance.frameUpdated();
if (m_enableFrameRate) {
var _local2 = ((m_performance.fps > 0) ? ("fps: " + m_performance.fps) : "");
if (_local2 != m_lastFps) {
m_parent.fpsmeter_txt.text = _local2;
m_lastFps = _local2;
}
} else if (m_lastFps.length > 0) {
m_parent.fpsmeter_txt.text = "";
m_lastFps = "";
}
}
function tick(tick) {
}
function render(tick, alpha) {
}
function init(gda) {
}
function onLowQualityWarning() {
if (!m_forcedLow) {
m_forcedLow = true;
m_parent._quality = "low";
}
}
static var MOVIE_FPS = 60;
static var MEASURE_TIME = 5;
static var MIN_FPS = 15;
}
Symbol 333 MovieClip [__Packages.com.midasplayer.timing.Timer] Frame 0
class com.midasplayer.timing.Timer
{
var timeable;
function Timer (timeable, gameTicksPerSecond) {
millisPerGameTick = 1000 / gameTicksPerSecond;
this.gameTicksPerSecond = gameTicksPerSecond;
this.timeable = timeable;
maxTickTime = 500;
}
function getMillisPerTick() {
return(millisPerGameTick);
}
function getTicksPerSecond() {
return(gameTicksPerSecond);
}
function setMaxTickTime(millis) {
maxTickTime = millis;
}
function advanceTime2() {
var _local2 = getTimer();
if (startTime < 0) {
startTime = _local2;
unprocessedTime = millisPerGameTick;
}
time = _local2 - startTime;
var _local3 = time - lastTime;
lastTime = time;
unprocessedTime = unprocessedTime + _local3;
if (unprocessedTime >= millisPerGameTick) {
var _local4 = maxTickTime + _local2;
do {
timeable.tick(tick);
tick++;
unprocessedTime = unprocessedTime - millisPerGameTick;
} while ((unprocessedTime >= millisPerGameTick) && (getTimer() < _local4));
}
var _local5 = (unprocessedTime % millisPerGameTick) / millisPerGameTick;
com.midasplayer.timing.IFloat.setAlpha(_local5);
timeable.render(tick, _local5);
}
function advanceTime() {
time = getTimer();
var _local2 = time - lastTime;
lastTime = time;
unprocessedTime = unprocessedTime + _local2;
var _local3 = 0;
while (unprocessedTime > millisPerGameTick) {
unprocessedTime = unprocessedTime - millisPerGameTick;
timeable.tick(tick);
tick++;
_local3++;
if (_local3 >= 10) {
unprocessedTime = 0;
}
}
var _local4 = unprocessedTime / millisPerGameTick;
timeable.render(tick, _local4);
}
var time = 0;
var startTime = -1;
var lastTime = 0;
var unprocessedTime = 0;
var gameTicksPerSecond = 0;
var tick = 0;
var millisPerGameTick = 0;
var maxTickTime = -1;
}
Symbol 334 MovieClip [__Packages.com.midasplayer.timing.Performance] Frame 0
class com.midasplayer.timing.Performance
{
var idealFps, measurePeriod, minPeriodFps, listeners, startAt, period, nextFpsUpdate, totalFps, fpsCount, lastFpsCount, periodFps, updates;
function Performance (idealFps) {
this.idealFps = idealFps;
measurePeriod = 5;
minPeriodFps = (idealFps / 2) * measurePeriod;
listeners = [];
begin();
}
function begin() {
startAt = -1;
period = -1;
nextFpsUpdate = getTimer();
totalFps = 0;
fpsCount = 0;
lastFpsCount = -1;
periodFps = 0;
updates = 0;
}
function frameUpdated() {
fpsCount++;
var _local2 = getTimer();
if (startAt < 0) {
startAt = _local2;
}
if (_local2 > nextFpsUpdate) {
if (updates > 0) {
lastFpsCount = fpsCount;
totalFps = totalFps + fpsCount;
}
periodFps = periodFps + fpsCount;
if ((++period) == measurePeriod) {
if (periodFps < minPeriodFps) {
for (var i in listeners) {
listeners[i](periodFps / measurePeriod);
}
}
period = 0;
periodFps = 0;
}
nextFpsUpdate = _local2 + 1000;
fpsCount = 0;
updates++;
}
}
function addQualityFeedbackListener(fn) {
listeners.push(fn);
}
function setFpsThreshold(minPeriodFps, measurePeriod) {
this.minPeriodFps = minPeriodFps * measurePeriod;
this.measurePeriod = measurePeriod;
}
function get fps() {
return(lastFpsCount);
}
function get averageFps() {
return(totalFps / ((getTimer() - startAt) / 1000));
}
}
Symbol 335 MovieClip [__Packages.com.midasplayer.util.GameDataAcquirer] Frame 0
class com.midasplayer.util.GameDataAcquirer
{
var attrib, trees, targetVar, dataEvent, timerFn, timer, error;
function GameDataAcquirer (variable) {
attrib = new com.midasplayer.util.Map();
trees = new com.midasplayer.util.Map();
if (variable != undefined) {
targetVar = variable;
} else {
targetVar = "gameData";
}
}
function beginWait(fn) {
dataEvent = fn;
timerFn = function (caller) {
var _local3 = _level0[caller.targetVar];
if ((_local3 != undefined) && ((_local3 != null) && (_local3.length > 0))) {
caller.parse(_local3);
if (caller.dataEvent != undefined) {
caller.dataEvent();
}
caller.dataEvent = undefined;
_global.clearInterval(caller.timer);
}
};
timer = _global.setInterval(timerFn, 100, this);
}
function poll() {
if (!parsed) {
var _local2 = _level0[targetVar];
if ((_local2 != undefined) && ((_local2 != null) && (_local2.length > 0))) {
parse(_local2);
parsed = true;
return(true);
}
}
return(false);
}
function getAttributes() {
return(attrib);
}
function getSubTrees(name) {
return(trees.get(name));
}
function getGameData(name) {
return(attrib.get(name));
}
function parse(data) {
attrib.clear();
var _local3 = new com.midasplayer.util.Map();
var _local4 = new XML();
_local4.ignoreWhite = true;
_local4.parseXML(data);
var _local5 = _local4.firstChild;
if (_local5.nodeName != "gamedata") {
error = "Bad XML (expected <gamedata>)";
return(undefined);
}
for (var i in _local5.attributes) {
var _local7 = _local5.attributes[i];
if ((_local7.indexOf("[") == 0) && ((_local6 = _local7.indexOf("]")) != -1)) {
_local7 = _local7.substring(1, _local6).split(",");
}
attrib.put(i, _local7);
}
for (var i in _local5.childNodes) {
var _local8 = _local5.childNodes[i];
switch (_local8.nodeName) {
case "text" :
_local3.put(_local8.attributes.id, _local8.firstChild.nodeValue);
break;
default :
var _local9 = trees.get(_local8.nodeName);
if (_local9 == undefined) {
trees.put(_local8.nodeName, [_local8]);
} else {
_local9.push(_local8);
}
}
}
com.midasplayer.util.I18n.init(_local3);
}
var parsed = false;
}
Symbol 336 MovieClip [__Packages.com.midasplayer.util.I18n] Frame 0
class com.midasplayer.util.I18n
{
static var lang;
function I18n () {
}
static function init(newLang) {
lang = newLang;
}
static function getProperties() {
return(lang);
}
static function getString(name) {
var _local3 = lang.get(name);
if (_local3 == undefined) {
var _local4 = ("{" + name) + "}";
} else {
var _local4 = _local3.toString();
}
var _local5 = 1;
for ( ; _local5 < arguments.length ; _local5++) {
var _local4 = _local4.split(("{" + (_local5 - 1)) + "}").join(arguments[_local5]);
}
return(_local4);
}
}
Symbol 337 MovieClip [__Packages.com.king.bbbathtub.HarpoonListener] Frame 0
class com.king.bbbathtub.HarpoonListener
{
function HarpoonListener () {
}
}
Symbol 338 MovieClip [__Packages.com.king.bbbathtub.Harpoon] Frame 0
class com.king.bbbathtub.Harpoon extends com.king.bbbathtub.Collidable
{
var m_itemMgr, m_id, m_mirrorHarpoon, m_shape, m_listener, m_lineLength, m_dropSpeed, m_parent, m_canReelIn, m_inverted, m_rodx, m_rody, m_pendula, m_windingDirection, m_lastAngle, m_caught, m_reelSlowdown, m_windInDelay, m_fx, m_xpos, m_fy, m_ypos, m_fr, m_rotation, setPosition;
function Harpoon (id, aClip, listener, mirror, im) {
super(aClip);
m_itemMgr = im;
m_id = id;
m_mirrorHarpoon = mirror;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 11, 22, 0);
m_listener = listener;
m_lineLength = MIN_LENGTH;
m_dropSpeed = 10;
m_parent = aClip;
resetLevel();
}
function setCanReelIn(val) {
m_canReelIn = val;
}
function setInverted(val) {
m_inverted = val;
}
function setRodTip(x, y) {
m_rodx = x;
m_rody = y;
}
function pendulaStep(steps) {
var _local3 = 0;
for ( ; _local3 < steps ; _local3++) {
m_pendula.update(true);
}
}
function update(tick) {
if (!m_mirrorHarpoon) {
m_pendula.update(false);
}
if (m_windingDirection == 0) {
if (!m_mirrorHarpoon) {
m_lastAngle = m_pendula.angle;
} else {
m_lastAngle = m_mirrorHarpoon.m_pendula.angle;
}
}
var _local3 = DEGREE_TO_RADIAN * ((m_inverted ? 180 : 0) + m_lastAngle);
var _local4 = Math.sin(_local3);
var _local5 = (_local4 * m_lineLength) + m_rodx;
var _local6 = Math.cos(_local3);
var _local7 = (_local6 * m_lineLength) + m_rody;
var _local8 = (-m_lastAngle) + (m_inverted ? 180 : 0);
var _local9 = -12;
if (m_caught != undefined) {
m_caught.updateCaught(_local5, _local7, -m_lastAngle);
_local9 = m_caught.getYOffset();
_local5 = m_caught.getPosX() + (_local4 * _local9);
_local7 = m_caught.getPosY() + (_local6 * _local9);
}
if (m_canReelIn && (m_windingDirection < 0)) {
var _local10 = 1;
if (m_caught != undefined) {
_local10 = (100 - m_caught.getWeight()) / 100;
}
var _local11 = (10 * _local10) - ((m_reelSlowdown = m_reelSlowdown / 5));
_local11 = _local11 * 1;
if (m_windInDelay == -1) {
m_lineLength = m_lineLength - _local11;
}
if (m_lineLength < 22) {
m_lineLength = MIN_LENGTH;
m_windingDirection = 0;
m_listener.onRetracted(this, m_caught);
m_caught = undefined;
}
}
if (m_windingDirection > 0) {
m_lineLength = m_lineLength + m_dropSpeed;
if (!m_itemMgr.getBoundaries().isInside(_local5 + (_local4 * 10), _local7 + (_local6 * 10))) {
m_windInDelay = 3;
m_windInDelay = -1;
m_windingDirection = -1;
var _local12 = m_itemMgr.getParentClip();
var _local13 = _local12.attachMovie("ploink", "ploink_" + this, _local12.getNextHighestDepth());
_local13._x = _local5 + (_local4 * 16);
_local13._y = _local7 + (_local6 * 16);
_local13._xscale = 250;
_local13._yscale = 250;
m_listener.onBeginReelIn(this, null);
}
}
if ((m_windInDelay != -1) && ((--m_windInDelay) == -1)) {
m_listener.onBeginReelIn(this, null);
}
m_fx.set((m_xpos = _local5));
m_fy.set((m_ypos = _local7));
m_fr.set((m_rotation = _local8));
_local5 = _local5 + (_local4 * 4);
_local7 = _local7 + (_local6 * 4);
m_shape.setPosition(_local5, _local7, _local8 * DEGREE_TO_RADIAN);
}
function getRenderedPos() {
return([m_fx.value, m_fy.value]);
}
function resetLevel() {
m_pendula = new com.king.bbbathtub.Pendulum(0.0065, 90, MIN_LENGTH);
m_lastAngle = m_pendula.angle;
m_lineLength = MIN_LENGTH;
m_windingDirection = 0;
m_canReelIn = true;
m_caught = undefined;
var _local2 = DEGREE_TO_RADIAN * m_lastAngle;
var _local3 = Math.sin(_local2);
var _local4 = (_local3 * m_lineLength) + m_rodx;
var _local5 = Math.cos(_local2);
var _local6 = (_local5 * m_lineLength) + m_rody;
var _local7 = -m_lastAngle;
m_windInDelay = -1;
setPosition(_local4 + (_local3 * 7), _local6 + (_local5 * 7), -_local2);
}
function getDirection() {
return(m_windingDirection);
}
function canDropHarpoon() {
return(m_windingDirection == 0);
}
function releaseHarpoon() {
if (canDropHarpoon()) {
m_windingDirection = 1;
m_reelSlowdown = 50;
return(true);
}
return(false);
}
function getHarpoonId() {
return(m_id);
}
function retractHarpoon(caught, score) {
if (caught != undefined) {
var _local4 = DEGREE_TO_RADIAN * ((m_inverted ? 180 : 0) + m_lastAngle);
if (caught.onHit()) {
caught.movieClip.setDepth(m_parent.getNextHighestDepth());
m_caught = caught;
m_caught.setCaught(true);
m_listener.onBeginReelIn(this, m_caught);
m_listener.onAttached(this, m_caught, score);
m_windInDelay = 5;
m_windInDelay = -1;
} else {
var _local5 = m_itemMgr.getParentClip();
var _local6 = _local5.attachMovie("ploink", "ploink_" + this, _local5.getNextHighestDepth());
_local6._x = m_xpos + (Math.sin(_local4) * 16);
_local6._y = m_ypos + (Math.cos(_local4) * 16);
_local6._xscale = 250;
_local6._yscale = 250;
m_listener.onBeginReelIn(this, null);
}
}
m_windingDirection = -1;
}
static var RADIAN_TO_DEGREE = 57.2957795;
static var DEGREE_TO_RADIAN = 0.0174532925;
static var MIN_LENGTH = 1;
}
Symbol 339 MovieClip [__Packages.com.king.bbbathtub.Pendulum] Frame 0
class com.king.bbbathtub.Pendulum
{
var tickCount, ad, ad1, ad2, ad3, ad4, alfa, tf, grlan;
function Pendulum (timeFactor, a, b) {
if ((STAB == undefined) || (STAB.length == 0)) {
STAB = new Array(LUTLEN);
var _local5 = 0;
for ( ; _local5 < LUTLEN ; _local5++) {
STAB[_local5] = -Math.sin(_local5 * CO);
}
}
tickCount = 0;
ad = [0, 0];
ad1 = [0, 0];
ad2 = [0, 0];
ad3 = [0, 0];
ad4 = [0, 0];
alfa = [0, 0];
tf = timeFactor;
alfa[0] = (a * Math.PI) / 180;
grlan = (-grav) / b;
}
function derivs(fad, fad1) {
fad1[0] = fad[1];
var _local4 = int((fad[0] * ICO) + LUTLEN2);
fad1[1] = (grlan * STAB[_local4]) * tf;
return(fad1);
}
function rk4(ad, ad1) {
ad4[0] = ad[0] + (d1 * ad1[0]);
ad4[1] = ad[1] + (d1 * ad1[1]);
ad3[0] = ad4[1];
var _local4 = int((ad4[0] * ICO) + LUTLEN2);
ad3[1] = (grlan * STAB[_local4]) * tf;
ad4[0] = ad[0] + (d1 * ad3[0]);
ad4[1] = ad[1] + (d1 * ad3[1]);
ad2[0] = ad4[1];
_local4 = int((ad4[0] * ICO) + LUTLEN2);
ad2[1] = (grlan * STAB[_local4]) * tf;
ad4[0] = ad[0] + (dt * ad2[0]);
ad2[0] = ad2[0] + ad3[0];
ad4[1] = ad[1] + (dt * ad2[1]);
ad2[1] = ad2[1] + ad3[1];
ad3[0] = ad4[1];
_local4 = int((ad4[0] * ICO) + LUTLEN2);
ad3[1] = (grlan * STAB[_local4]) * tf;
ad[0] = ad[0] + (d2 * ((ad1[0] + ad3[0]) + (2 * ad2[0])));
ad[1] = ad[1] + (d2 * ((ad1[1] + ad3[1]) + (2 * ad2[1])));
return(ad);
}
function update(skipTick) {
alfa = rk4(alfa, derivs(alfa, ad));
if (!skipTick) {
tickCount++;
}
}
function get state() {
return([tickCount, alfa[0]]);
}
function get tick() {
return(tickCount);
}
function get angle() {
return(alfa[0] * 57.2957795);
}
function get radians() {
return(alfa[0]);
}
static var grav = 9.81;
static var bt = 2;
static var LUTLEN = 16384;
static var LUTLEN2 = LUTLEN / 2;
static var CO = (Math.PI * 2) / LUTLEN;
static var ICO = 1 / CO;
static var STAB = undefined;
static var dt = 0.2;
static var d1 = dt * 0.5;
static var d2 = dt / 6;
}
Symbol 340 MovieClip [__Packages.com.king.bbbathtub.BBBathtub] Frame 0
class com.king.bbbathtub.BBBathtub extends com.king.bbbathtub.MidasGame implements com.king.bbbathtub.ItemManager, com.king.bbbathtub.HarpoonListener
{
var m_levels, m_currentLevelPtr, m_currentLevel, m_isBBGame, m_isEnabledBBLogoDe, m_isEnabledBBLogoEn, m_loClips, m_loClipsCount, m_renderList, m_updateList, m_shockList, m_appearList, m_removeList, m_items, m_throwList, m_newItems, m_lastKeys, m_lastChangedSide, m_tryReleaseHarpoon, m_ctick, m_score, m_levelStartTick, m_startNewLevel, m_keys, m_exitGame, m_parent, m_enableFrameRate, m_soundsEnabled, m_timeLeft, m_mainTimer, m_playTimeLeft, m_plate, m_levelRunning, m_boat, m_mouseY, m_water, m_debugD, m_pointLabels, m_lastItemTime, m_lastItemId, m_lastItemCount, m_lastItemClip, m_boundaries, m_itemClip, m_random, m_waterBlock, m_isGameOver;
function BBBathtub (aParent) {
super(aParent);
m_levels = new com.midasplayer.util.ArrayList();
m_currentLevelPtr = 0;
m_currentLevel = null;
m_isBBGame = false;
m_isEnabledBBLogoDe = false;
m_isEnabledBBLogoEn = false;
m_loClips = [];
m_loClipsCount = 0;
m_renderList = new com.midasplayer.util.ArrayList();
m_updateList = new com.midasplayer.util.ArrayList();
m_shockList = new com.midasplayer.util.ArrayList();
m_appearList = new com.midasplayer.util.ArrayList();
m_removeList = new com.midasplayer.util.ArrayList();
m_items = new com.midasplayer.util.ArrayList();
m_throwList = new com.midasplayer.util.ArrayList();
m_newItems = new com.midasplayer.util.ArrayList();
m_lastKeys = new Array(10);
m_lastChangedSide = -1;
m_tryReleaseHarpoon = false;
m_ctick = 0;
m_score = 0;
m_levelStartTick = 0;
m_startNewLevel = false;
m_keys = new Array(256);
m_exitGame = 0;
m_parent.onBegin();
var _local4 = SharedObject.getLocal("king.bbbathtub");
if (_local4 != null) {
m_enableExtraSfx = _local4.data.enableExtraSfx;
m_enableFrameRate = _local4.data.enableFrameRate;
m_soundsEnabled = _local4.data.enableAllSound;
if (m_enableExtraSfx == undefined) {
m_enableExtraSfx = false;
}
if (m_enableFrameRate == undefined) {
m_enableFrameRate = false;
}
if (m_soundsEnabled == undefined) {
m_soundsEnabled = true;
}
}
Key.addListener(this);
}
function tick(tick) {
m_ctick = tick;
m_timeLeft = m_playTimeLeft - ((m_ctick - m_levelStartTick) * m_mainTimer.getMillisPerTick());
if (m_exitGame == 1) {
if (m_plate != null) {
m_plate.destroy();
}
m_exitGame++;
m_currentLevelPtr = m_levels.size();
writePD(16, m_ctick, undefined, m_score);
levelEnded();
return(undefined);
}
if (m_startNewLevel) {
writePD(1, m_ctick);
populateLevel();
m_levelStartTick = m_ctick;
m_startNewLevel = false;
m_levelRunning = true;
return(undefined);
}
if (m_levelRunning) {
if ((Math.max(0, m_timeLeft) == 0) || (m_items.size() == 0)) {
writePD(5, m_ctick, undefined, m_score);
m_levelRunning = false;
m_boat.setReelIn(false);
levelEnded();
return(undefined);
}
if (m_tryReleaseHarpoon) {
m_mouseY = m_parent._ymouse;
var _local3 = false;
if (m_mouseY < m_boatY) {
_local3 = m_boat.getHarpoonSky().releaseHarpoon();
} else {
_local3 = m_boat.getHarpoonWater().releaseHarpoon();
}
writePD(2, m_ctick, m_mouseY);
m_tryReleaseHarpoon = false;
if (_local3) {
com.midasplayer.fx.SoundManager.play("poff", 50);
}
}
}
updateObjects();
checkCollisions();
}
function updateObjects() {
m_water.update();
m_boat.update(m_ctick);
if (m_newItems.size() > 0) {
var _local2 = m_newItems.iterator;
while (_local2.hasNext()) {
var _local3 = com.king.bbbathtub.TankItem(_local2.next());
_local3.setDebugDraw(m_debugD);
m_items.insert(_local3);
m_renderList.insert(_local3);
if (_local3.isFadeInOnCreate()) {
m_appearList.insert(_local3);
}
if (_local3.isMovingAround()) {
m_updateList.insert(_local3);
}
if (_local3.isScaleOnCreate()) {
var _local4 = m_itemScaleList[_local3.getItemId() - 1];
if (_local4) {
_local3.setScale(_local4.scale);
}
}
}
if (m_beginAppear < getTimer()) {
m_beginAppear = getTimer();
}
m_newItems.clear();
}
if (m_shockList.size() > 0) {
var _local5 = [];
var _local6 = m_shockList.iterator;
while (_local6.hasNext()) {
var _local7 = com.king.bbbathtub.TankItem(_local6.next());
var _local8 = _local7.updateShock();
if (!_local8) {
_local5.push(_local7);
}
}
for (var f in _local5) {
m_shockList.remove(_local5[f]);
}
}
var _local9 = m_updateList.iterator;
for ( ; _local9.hasNext() ; _local9.next().update(m_ctick)) {
}
if (m_removeList.size() > 0) {
var _local10 = m_removeList.iterator;
while (_local10.hasNext()) {
var _local11 = com.king.bbbathtub.TankItem(_local10.next());
m_items.remove(_local11);
m_renderList.remove(_local11);
m_appearList.remove(_local11);
m_shockList.remove(_local11);
m_updateList.remove(_local11);
_local11.destroy();
}
m_removeList.clear();
}
}
function checkCollisions() {
var _local2 = m_boat.getHarpoonSky();
var _local3 = _local2.getDirection();
var _local4 = m_boat.getHarpoonWater();
var _local5 = _local4.getDirection();
if ((_local5 <= 0) && (_local3 <= 0)) {
return(undefined);
}
var _local6 = _local2.getCenterX();
var _local7 = _local2.getCenterY();
var _local8 = _local4.getCenterX();
var _local9 = _local4.getCenterY();
var _local10 = new Array();
var _local11 = new Array();
var _local12 = 0;
var _local13 = 0;
var _local14 = 0;
var _local15 = null;
if ((_local5 <= 0) && (_local3 > 0)) {
var _local16 = m_items.iterator;
while (_local16.hasNext()) {
_local15 = com.king.bbbathtub.TankItem(_local16.next());
_local13 = _local6 - _local15.getCenterX();
_local13 = _local13 * _local13;
_local14 = _local7 - _local15.getCenterY();
_local14 = _local14 * _local14;
if ((_local13 + _local14) <= _local15.getSphereVal()) {
_local12 = _local15.getCollisionScore(_local2);
if (_local12 > 0.2) {
_local10.push({s:_local12, object:_local15});
}
}
}
} else if ((_local5 > 0) && (_local3 <= 0)) {
var _local17 = m_items.iterator;
while (_local17.hasNext()) {
_local15 = com.king.bbbathtub.TankItem(_local17.next());
_local13 = _local8 - _local15.getCenterX();
_local13 = _local13 * _local13;
_local14 = _local9 - _local15.getCenterY();
_local14 = _local14 * _local14;
if ((_local13 + _local14) <= _local15.getSphereVal()) {
_local12 = _local15.getCollisionScore(_local4);
if (_local12 > 0.2) {
_local11.push({s:_local12, object:_local15});
}
}
}
} else {
var _local18 = 0;
var _local19 = 0;
var _local20 = 0;
var _local21 = m_items.iterator;
while (_local21.hasNext()) {
_local15 = com.king.bbbathtub.TankItem(_local21.next());
_local18 = _local15.getCenterX();
_local19 = _local15.getCenterY();
_local20 = _local15.getSphereVal();
_local13 = _local6 - _local18;
_local13 = _local13 * _local13;
_local14 = _local7 - _local19;
_local14 = _local14 * _local14;
if ((_local13 + _local14) <= _local20) {
_local12 = _local15.getCollisionScore(_local2);
if (_local12 > 0.2) {
_local10.push({s:_local12, object:_local15});
}
}
_local13 = _local8 - _local18;
_local13 = _local13 * _local13;
_local14 = _local9 - _local19;
_local14 = _local14 * _local14;
if ((_local13 + _local14) <= _local20) {
_local12 = _local15.getCollisionScore(_local4);
if (_local12 > 0.2) {
_local11.push({s:_local12, object:_local15});
}
}
}
}
if (_local10.length > 0) {
qsort(_local10);
var _local22 = _local10[_local10.length - 1];
_local2.retractHarpoon(_local22.object, _local22.s);
}
if (_local11.length > 0) {
qsort(_local11);
var _local23 = _local11[_local11.length - 1];
_local4.retractHarpoon(_local23.object, _local23.s);
}
}
function render(tick, alpha) {
for (var i in m_pointLabels) {
var _local4 = m_pointLabels[i];
if (_local4.animator.update()) {
_local4.clip.removeMovieClip();
delete m_pointLabels[i];
} else {
_local4.clip._alpha = Math.floor(_local4.animator.getElapsed() * 100);
}
}
if (m_appearList.size() > 0) {
var _local5 = getTimer();
var _local6 = 1 - (Math.max(0, 250 - (_local5 - m_beginAppear)) / 250);
_local6 = _local6 * 100;
var _local7 = m_appearList.iterator;
for ( ; _local7.hasNext() ; _local7.next().setDirectAlpha(_local6)) {
}
if (_local6 == 100) {
m_appearList.clear();
}
}
m_boat.render(tick, alpha);
m_water.render(tick);
if (m_throwList.size() != 0) {
var _local8 = [];
var _local9 = m_throwList.iterator;
while (_local9.hasNext()) {
var _local10 = com.king.bbbathtub.JumpingItem(_local9.next());
if (_local10.updateThrowOut()) {
_local8.push(_local10);
}
}
for (var i in _local8) {
m_throwList.remove(_local8[i]);
_local8[i].destroy();
}
}
var _local11 = m_renderList.iterator;
for ( ; _local11.hasNext() ; _local11.next().render()) {
}
if (m_levelRunning && (m_timeLeft > m_nextTime)) {
m_parent.time_value_txt.text = com.midasplayer.util.Numbers.asTime(m_timeLeft, false, true);
m_nextTime = m_timeLeft - 500;
}
}
function onKeyDown() {
m_keys[Key.getCode()] = true;
}
function onKeyUp() {
var _local2 = Key.getCode();
var _local3 = m_lastKeys.length - 1;
for ( ; _local3 > 0 ; _local3--) {
m_lastKeys[_local3] = m_lastKeys[_local3 - 1];
}
m_lastKeys[0] = _local2;
var _local4 = [83, 85, 84, 78, 79, 80, 71, 78, 73, 75];
var _local5 = [69, 84, 65, 82, 69, 77, 65, 82, 70, -1];
var _local6 = true;
var _local7 = true;
var _local8 = 0;
var _local9 = m_lastKeys.length;
for ( ; (_local7 || (_local6)) && (_local8 < _local9) ; _local8++) {
var _local10 = m_lastKeys[_local8];
var _local11 = _local4[_local8];
if ((_local10 != _local11) && (_local11 != -1)) {
_local6 = false;
}
_local11 = _local5[_local8];
if ((_local10 != _local11) && (_local11 != -1)) {
_local7 = false;
}
}
if (_local7) {
m_enableFrameRate = !m_enableFrameRate;
updateSettings();
}
if (_local6) {
m_enableExtraSfx = !m_enableExtraSfx;
updateSettings();
}
m_keys[_local2] = false;
}
function updateSettings() {
var _local2 = SharedObject.getLocal("king.bbbathtub");
if (_local2 != null) {
_local2.data.enableExtraSfx = m_enableExtraSfx;
_local2.data.enableFrameRate = m_enableFrameRate;
_local2.data.enableAllSound = m_soundsEnabled;
_local2.flush();
}
}
function onDropHarpoon() {
m_tryReleaseHarpoon = true;
}
function updateSound() {
com.midasplayer.fx.SoundManager.enableSounds(m_soundsEnabled);
m_parent.buttonrow.soundbutton.sound_button_txt.text = com.midasplayer.util.I18n.getString((m_soundsEnabled ? "sound_off" : "sound_on"));
}
function onToggleSoundButton() {
com.midasplayer.fx.SoundManager.enableSounds((m_soundsEnabled = !m_soundsEnabled));
m_parent.buttonrow.soundbutton.sound_button_txt.text = com.midasplayer.util.I18n.getString((m_soundsEnabled ? "sound_off" : "sound_on"));
updateSettings();
}
function onBeginReelIn(h, item) {
}
function onRetracted(harpoon, item) {
if (item) {
var _local4 = item.getScore();
var _local5 = item.getItemId();
var _local6 = _local4;
var _local7 = 1;
var _local8 = 0;
if (m_lastItemTime >= 0) {
var _local9 = m_ctick - m_lastItemTime;
var _local10 = 10000 / m_mainTimer.getMillisPerTick();
var _local11 = Math.min(_local9, _local10) / _local10;
_local8 = int(10 * (1 - _local11));
}
m_lastItemTime = m_ctick;
if (_local5 == m_lastItemId) {
m_lastItemCount++;
} else {
m_lastItemCount = 1;
}
m_lastItemId = _local5;
_local7 = 1 + (0.5 * (m_lastItemCount - 1));
com.midasplayer.fx.SoundManager.play("catch_" + Math.min(4, m_lastItemCount));
_local6 = _local6 * _local7;
_local6 = _local6 | 0;
_local6 = _local6 + _local8;
writePD(4, m_ctick, harpoon.getHarpoonId(), _local6);
m_score = m_score + _local6;
m_parent.score_value_txt.text = com.midasplayer.util.Numbers.itoa(m_score, 6);
m_parent.multiplier_txt.text = "x " + m_lastItemCount;
assureRemove(item);
var _local12 = m_parent.getNextHighestDepth();
m_lastItemClip.removeMovieClip();
m_lastItemClip = null;
m_lastItemClip = m_parent.attachMovie(item.movieClip.clipName, "th" + _local12, _local12);
var _local13 = m_lastItemClip._width;
var _local14 = m_lastItemClip._height;
var _local15 = 35;
var _local16 = 20;
var _local17 = _local13;
var _local18 = _local14;
if ((_local17 < _local15) && (_local18 < _local15)) {
_local18 = _local18 * (_local15 / _local17);
_local17 = _local15;
}
if (_local17 > _local15) {
_local18 = _local18 * (_local15 / _local17);
_local17 = _local15;
}
if (_local18 > _local16) {
_local17 = _local17 * (_local16 / _local18);
_local18 = _local16;
}
m_lastItemClip._xscale = 100 * (1 - ((_local13 - _local17) / _local13));
m_lastItemClip._yscale = 100 * (1 - ((_local14 - _local18) / _local14));
m_lastItemClip._x = 450;
m_lastItemClip._y = 12;
_local12 = m_parent.getNextHighestDepth();
var _local19 = m_parent.attachMovie(item.movieClip.clipName, "th" + _local12, _local12);
_local19._x = item.getPosX();
_local19._y = item.getPosY();
_local19._rotation = item.getRotation();
for (var i in m_itemScaleList) {
var _local20 = m_itemScaleList[i].name;
var _local21 = item.movieClip.clipName;
if (_local20.indexOf(_local21) != -1) {
var _local22 = m_itemScaleList[i].scale;
_local19._xscale = _local22;
_local19._yscale = _local22;
break;
}
}
var _local23 = m_loClips[m_loClipsCount % m_loClips.length];
m_loClipsCount++;
var _local24 = new com.king.bbbathtub.JumpingItem(_local19, _local23, m_boat, m_enableExtraSfx);
_local24.start(-20, -30, item.getRotation());
assureThrow(_local24);
var _local25 = m_parent.getNextHighestDepth();
var _local26 = m_parent.attachMovie("points", "pts" + _local25, _local25);
_local26._x = m_boatX;
_local26._y = m_boatY - 60;
_local26.pts.text = _local6;
var _local27 = new com.midasplayer.util.EaseOutCubicAnimator(_local26);
_local27.setPosition(m_boatX, m_boatY - 100);
_local27.setDuration(1500);
var _local28 = new Object();
_local28.clip = _local26;
_local28.animator = _local27;
m_pointLabels.push(_local28);
}
}
function onAttached(h, item, score) {
m_updateList.remove(item);
assureRendered(item);
writePD(3, m_ctick, [h.getHarpoonId(), com.midasplayer.util.FloatEncoder.encodeBits(score)]);
}
function onKillItem(t) {
assureRemove(t);
}
function onInitItem(t, requireUpdate) {
t.setDebugDraw(m_debugD);
m_items.insert(t);
m_renderList.insert(t);
if (t.isFadeInOnCreate()) {
m_appearList.insert(t);
}
if (requireUpdate) {
m_updateList.insert(t);
}
if (t.isScaleOnCreate()) {
t.setScale(m_itemScaleList[t.getItemId() - 1].scale);
}
if (m_beginAppear < getTimer()) {
m_beginAppear = getTimer();
}
}
function onSpawnItem(t) {
if (m_newItems.indexOf(t) < 0) {
m_newItems.insert(t);
}
}
function onParked(t) {
m_renderList.remove(t);
m_updateList.remove(t);
m_shockList.remove(t);
t.recomputeShape();
}
function getWaterLine() {
return(m_water);
}
function getBoundaries() {
return(m_boundaries);
}
function getParentClip() {
return(m_itemClip);
}
function getMillisPerTick() {
return(m_mainTimer.getMillisPerTick());
}
function onShockwave(originX, originY, force, cause) {
assureRemove(cause);
var _local6 = (force * 10) * (force * 10);
var _local7 = _local6 + 256;
var _local8 = m_items.iterator;
while (_local8.hasNext()) {
var _local9 = com.king.bbbathtub.TankItem(_local8.next());
var _local10 = originX - _local9.getCenterX();
var _local11 = originY - _local9.getCenterY();
var _local12 = _local10;
_local12 = _local12 * _local12;
var _local13 = _local11;
_local13 = _local13 * _local13;
var _local14 = _local12 + _local13;
if (_local14 < _local6) {
var _local15 = Math.sqrt(_local14);
if (_local15 == 0) {
continue;
}
var _local16 = _local9.getWeight();
var _local17 = (_local7 - _local14) / _local7;
var _local18 = (100 - _local16) / 100;
var _local19 = (force * _local17) * _local18;
_local10 = _local10 / _local15;
_local10 = _local10 * _local19;
_local11 = _local11 / _local15;
_local11 = _local11 * _local19;
_local9.applyShockwave(-_local10, -_local11);
assureShock(_local9);
assureRendered(_local9);
var _local20 = new com.midasplayer.geom.Line(originX, originY, _local9.getCenterX(), _local9.getCenterY());
var _local21 = _local20.getMiddle();
_local9.onHit(_local21.x, _local21.y);
}
}
}
function getLevel() {
return(m_currentLevel);
}
function init(gda) {
m_random = new com.midasplayer.util.Random(gda.getGameData("randomseed"));
var _local3 = gda.getSubTrees("head");
var _local4 = gda.getGameData("lang");
m_isBBGame = (_local3 != undefined) && (_local3.length > 0);
m_isEnabledBBLogoEn = m_isBBGame && (gda.getGameData("partner") == "channel4");
m_isEnabledBBLogoDe = m_isBBGame && (_local4 == "de");
m_isEnabledBBLogoDe = false;
m_parent.bb_logo_en._visible = m_isEnabledBBLogoEn;
m_parent.bb_logo_de._visible = m_isEnabledBBLogoDe;
m_parent.buttonrow.exitbutton._visible = false;
var _local5 = gda.getSubTrees("level");
var _local6 = [];
var _local7 = 0;
for ( ; _local7 < _local5.length ; _local7++) {
_local6.push(new com.king.bbbathtub.Level(_local5[_local7], this));
}
var _local8 = 0;
var _local9 = _local6.length;
for ( ; _local8 < _local9 ; _local8++) {
var _local10 = 0;
for ( ; _local10 < _local9 ; _local10++) {
if (_local6[_local8].getPlayingOrder() < _local6[_local10].getPlayingOrder()) {
var _local11 = _local6[_local10];
_local6[_local10] = _local6[_local8];
_local6[_local8] = _local11;
}
}
}
m_levels = new com.midasplayer.util.ArrayList();
var _local12 = 0;
var _local13 = _local6.length;
for ( ; _local12 < _local13 ; _local12++) {
_local6[_local12].init(m_random);
_local6[_local12].setScoreLimit(SCORE_LIMIT[Math.min(SCORE_LIMIT.length, _local12)]);
m_levels.insert(_local6[_local12]);
}
updateSound();
m_parent.buttonrow.exitbutton.button_txt.text = com.midasplayer.util.I18n.getString("exit_btn");
m_parent.score_txt.text = com.midasplayer.util.I18n.getString("score");
m_parent.time_txt.text = com.midasplayer.util.I18n.getString("time");
m_parent.wall.onPress = mx.utils.Delegate.create(this, onDropHarpoon);
m_parent.tub.onPress = mx.utils.Delegate.create(this, onDropHarpoon);
var _local14 = 0;
for ( ; _local14 < 15 ; _local14++) {
var _local15 = m_parent.createEmptyMovieClip("depthholder" + _local14, gnhdp());
m_loClips.push(_local15);
}
m_boat = com.king.bbbathtub.Boat(m_parent.attachMovie("boat", "boat_1", gnhdp()));
m_boat.setup(m_boatX + 80, m_boatY, m_parent, this, this);
m_boat.setVisible(false);
m_boat.setLevelOver(true);
m_itemClip = m_parent.createEmptyMovieClip("wateritems", gnhdp());
m_waterBlock = m_parent.attachMovie("water", "waterstatic", gnhdp());
m_waterBlock._x = 0;
m_waterBlock._y = 110;
m_waterBlock._alpha = 45;
m_boundaries = new com.king.bbbathtub.Boundaries(265);
m_water = new com.king.bbbathtub.Waterline(m_parent, 688, 500, 265);
m_water.update();
m_water.update();
m_water.render(1, 0);
m_boat.update();
m_boat.update();
m_boat.render(1, 0);
m_parent.score_value_txt.text = com.midasplayer.util.Numbers.itoa(0, 6);
m_parent.time_value_txt.text = com.midasplayer.util.Numbers.asTime(59 * 1000, false, true);
m_parent.multiplier_txt.text = "";
m_lastItemClip.removeMovieClip();
m_lastItemClip = null;
m_debugD = new com.midasplayer.fx.Draw();
m_debugD.createClip(m_parent);
m_debugD.mc._x = 0;
m_debugD.mc._y = 0;
var _local16 = m_parent.attachMovie("ctrls", "ctrlspanel", gnhdp());
_local16._x = 4;
_local16._y = 475;
_local16.swapDepths(_root.getNextHighestDepth());
com.midasplayer.fx.SoundManager.play("intro");
if (!m_isBBGame) {
var _local17 = _local3.length;
if ((_local3 != undefined) && (_local17 > 0)) {
var _local18 = _local3[int(Math.random() * _local17) % _local17].attributes;
m_boat.setHead(_local18.url, _local18.config, mx.utils.Delegate.create(this, onFailLoadHead), mx.utils.Delegate.create(this, onHeadLoaded));
} else {
m_boat.useFailSafeHead();
onHeadLoaded();
}
m_startNewLevel = false;
} else {
var _local19 = "BB BATHTUB";
var _local20 = "PICK YOUR FAVORITE CAPTAIN";
if (_local4 == "de") {
_local20 = "W\u00E4hle deinen Bewohner";
}
_local16 = m_parent.attachMovie("bb_select_plate", "bbplate", gnhdp());
_local16.setExitEvent(mx.utils.Delegate.create(this, levelIntro));
_local16._x = 115 - 700;
_local16._y = 126;
_local16.init(_local3, m_boat, _local19, _local20);
m_boat.setPosition(m_boatX + 80, m_boatY);
m_boat.setVisible(false);
m_levelRunning = false;
}
m_parent.buttonrow.swapDepths(gnhdp());
m_parent.cover._visible = false;
m_parent.cover._y = 800;
fscommand ("gameStart");
var _local21 = AUTO_VERSION.split("_")[1];
writePD(711, m_ctick, _global.parseInt(_local21.substring(1, _local21.length - 1)));
}
function onHeadLoaded() {
m_boat.setPosition(m_boatX + 80, m_boatY);
m_boat.setVisible(true);
levelIntro();
}
function onFailLoadHead() {
m_boat.useFailSafeHead();
m_boat.setPosition(m_boatX + 80, m_boatY);
m_boat.setVisible(true);
levelIntro();
}
function levelIntro() {
var _local2 = m_parent.attachMovie("intro_plate", "introplate", gnhdp());
_local2.setExitEvent(mx.utils.Delegate.create(this, levelStart));
_local2._x = 115 - 700;
_local2._y = 126;
_local2.init(m_boat);
m_parent.buttonrow.swapDepths(gnhdp());
}
function levelEnded() {
for (var i in m_pointLabels) {
var _local2 = m_pointLabels[i];
_local2.clip.removeMovieClip();
delete m_pointLabels[i];
}
m_boat.setLevelOver(true);
com.midasplayer.fx.SoundManager.stopAll();
com.midasplayer.fx.SoundManager.stop("reel_in");
if ((m_score < m_currentLevel.getScoreLimit()) || (m_currentLevelPtr == m_levels.size())) {
m_plate = com.midasplayer.fx.Plate(m_parent.attachMovie("gameoverslab", "plate", m_parent.getNextHighestDepth()));
m_plate.setExitEvent(mx.utils.Delegate.create(this, leaveGame));
m_isGameOver = true;
m_levelRunning = false;
com.midasplayer.fx.SoundManager.play("gameover");
fscommand ("gameEnd", "" + m_score);
} else {
m_plate = com.midasplayer.fx.Plate(m_parent.attachMovie("levelslab", "plate", m_parent.getNextHighestDepth()));
m_plate.setExitEvent(mx.utils.Delegate.create(this, levelStart));
com.midasplayer.fx.SoundManager.play("level_complete");
}
m_plate._x = 207;
m_plate._y = 95.5;
m_plate.init(m_score, m_currentLevel.getScoreLimit(), m_exitGame > 0);
}
function levelStart() {
m_plate = null;
m_startNewLevel = true;
m_parent.buttonrow.exitbutton._visible = true;
com.midasplayer.fx.SoundManager.stopAll();
com.midasplayer.fx.SoundManager.play("level_start", 75, false, mx.utils.Delegate.create(this, onBeginPlayLoop));
m_boat.setLevelOver(false);
}
function onBeginPlayLoop() {
com.midasplayer.fx.SoundManager.play("ingame_loop", 50, true);
}
function leaveGame() {
m_plate = null;
m_boat.setGameOver(true);
fscommand ("gameQuit");
m_parent.onEnd();
}
function populateLevel() {
m_pointLabels = [];
m_lastItemId = 0;
m_lastItemCount = 1;
m_lastItemTime = -1;
m_parent.multiplier_txt.text = "";
m_lastItemClip.removeMovieClip();
m_lastItemClip = null;
m_water.resetLevel();
m_water.update();
m_boat.setPosition(m_boatX, m_boatY);
m_boat.setVisible(false);
m_boat.resetLevel();
m_boat.update();
m_boat.update();
m_boat.render(1, 0);
m_boat.setVisible(true);
var _local2 = m_items.iterator;
for ( ; _local2.hasNext() ; _local2.next().destroy()) {
}
var _local3 = m_throwList.iterator;
for ( ; _local3.hasNext() ; _local3.next().destroy()) {
m_renderList.clear();
}
m_newItems.clear();
m_updateList.clear();
m_appearList.clear();
m_removeList.clear();
m_shockList.clear();
m_items.clear();
m_throwList.clear();
m_currentLevel = com.king.bbbathtub.Level(m_levels.get(m_currentLevelPtr));
m_currentLevel.activate();
m_currentLevelPtr++;
m_boat.prestep(m_currentLevel.getNumPreStep());
m_playTimeLeft = m_currentLevel.getTimeLimit();
m_beginAppear = getTimer();
m_tryReleaseHarpoon = false;
}
function gnhd(p) {
return(p.getNextHighestDepth());
}
function gnhdp() {
return(m_parent.getNextHighestDepth());
}
function onExitButton() {
if (m_levelRunning && ((!m_isGameOver) && (m_exitGame == 0))) {
m_exitGame = 1;
}
}
function qsort(a) {
qsort_r(a, 0, a.length - 1);
}
function qsort_r(a, l, r) {
var _local5 = l;
var _local6 = r;
var _local8 = a[(l + r) >> 1].s;
do {
while (a[_local5].s > _local8) {
_local5++;
}
while (_local8 > a[_local6].s) {
_local6--;
}
if (_local5 <= _local6) {
var _local7 = a[_local5];
a[_local5++] = a[_local6];
a[_local6--] = _local7;
}
} while (_local5 <= _local6);
if (l < _local6) {
qsort_r(a, l, _local6);
}
if (_local5 < r) {
qsort_r(a, _local5, r);
}
}
function writePD(event, tick, param, sc) {
var _local6 = (event + ",") + tick;
if (param != undefined) {
_local6 = _local6 + ("," + param);
}
if (sc == undefined) {
sc = 0;
}
_local6 = _local6 + (",0=" + sc);
fscommand ("playData", _local6);
}
function assureRendered(item) {
if (item && (m_renderList.indexOf(item) < 0)) {
m_renderList.insert(item);
}
}
function assureUpdated(item) {
if (item && (m_updateList.indexOf(item) < 0)) {
m_updateList.insert(item);
}
}
function assureShock(item) {
if (item && (m_shockList.indexOf(item) < 0)) {
m_shockList.insert(item);
}
}
function assureRemove(item) {
if (item && (m_removeList.indexOf(item) < 0)) {
m_removeList.insert(item);
}
}
function assureThrow(item) {
if (item && (m_throwList.indexOf(item) < 0)) {
m_throwList.insert(item);
}
}
static var AUTO_VERSION = "BUILD_[164]_11d43b9bc96";
var m_itemScaleList = [{name:"item_aeroplane", scale:75}, {name:"item_brush", scale:100}, {name:"item_champagne", scale:75}, {name:"item_duck", scale:100}, {name:"item_floatingsoap", scale:100}, {name:"item_hangingsoap", scale:100}, {name:"item_inflatableball", scale:100}, {name:"item_sandwich", scale:75}, {name:"item_shampoo", scale:75}, {name:"item_sponge", scale:100}, {name:"item_strawberry", scale:100}, {name:"item_diver", scale:100}, {name:"item_shark", scale:100}, {name:"item_goldenhits", scale:100}, {name:"item_submarine", scale:100}, {name:"item_goldaeroplane", scale:75}, {name:"item_treasure", scale:100}, {name:"item_goldbar", scale:100}, {name:"item_gull", scale:75}, {name:"item_camera", scale:100}, {name:"item_gull_ring", scale:75}, {name:"item_shark_ring", scale:100}, {name:"item_dietcoke", scale:100}, {name:"item_tire", scale:100}];
static var SCORE_LIMIT = [2000, 5000, 10000, 0];
var m_boatX = 378;
var m_boatY = 272;
var m_beginAppear = 0;
var m_nextTime = -1;
var m_enableExtraSfx = false;
}
Symbol 341 MovieClip [__Packages.com.midasplayer.fx.Plate] Frame 0
class com.midasplayer.fx.Plate extends MovieClip
{
var _visible, self, exitDelay, exitCallback, swapDepths, removeMovieClip, stopDisplayTime;
function Plate () {
super();
_visible = false;
self = this;
exitDelay = -1;
}
function setExitEvent(fn) {
exitCallback = fn;
}
function remove() {
exitDelay = getTimer() + Math.round((Math.random() * 500) + 10);
}
function destroy() {
onEnterFrame = undefined;
swapDepths(1048000);
removeMovieClip();
}
function init() {
}
function onEnterFrame() {
var _local2 = getTimer();
var _local3 = stopDisplayTime - _local2;
if (_local3 < 0) {
_local3 = 0;
}
_local3 = _local3 / 1000;
_local3 = Math.ceil(_local3);
var _local4 = this;
_local4.next_level_txt.text = com.midasplayer.util.I18n.getString("count_down_text", _local3);
if ((exitDelay != -1) && (_local2 > exitDelay)) {
if (exitCallback) {
exitCallback(this);
}
onEnterFrame = undefined;
swapDepths(1048000);
removeMovieClip();
} else if (_local2 > stopDisplayTime) {
remove();
}
}
function onPress() {
remove();
}
}
Symbol 342 MovieClip [__Packages.com.king.bbbathtub.Boat] Frame 0
class com.king.bbbathtub.Boat extends MovieClip implements com.king.bbbathtub.HarpoonListener
{
var m_loadwx, m_loadwy, m_loadsx, m_loadsy, m_r, m_fx, m_fy, m_fr, m_fharpoonWaterX, m_fharpoonWaterY, m_fharpoonSkyX, m_fharpoonSkyY, m_fisherHeadFrameF, m_headrad, m_fheaddeg, m_fisherHeadBeginAt, m_fisherHeadOpenAt, m_fisherHeadCloseAt, m_fisherHeadFrame, m_sxp, m_syp, m_wave, m_stateHiSky, m_stateHiWater, m_x, m_y, m_levelOver, m_gameOver, m_harpoonSky, m_harpoonWater, m_extraListener, m_ox, m_oy, _x, _y, _rotation, m_itemMgr, m_parent, m_fishingLineSky, m_fishingLineWater, swapDepths, _parent, m_head, suitclip, getNextHighestDepth, boatclip, m_cTick, _visible;
function Boat () {
super();
m_loadwx = 0;
m_loadwy = 0;
m_loadsx = 0;
m_loadsy = 0;
m_r = 0;
m_fx = new com.midasplayer.timing.IFloat();
m_fy = new com.midasplayer.timing.IFloat();
m_fr = new com.midasplayer.timing.IFloat();
m_fharpoonWaterX = new com.midasplayer.timing.IFloat();
m_fharpoonWaterY = new com.midasplayer.timing.IFloat();
m_fharpoonSkyX = new com.midasplayer.timing.IFloat();
m_fharpoonSkyY = new com.midasplayer.timing.IFloat();
m_fisherHeadFrameF = new com.midasplayer.timing.IFloat();
m_headrad = 0;
m_fheaddeg = new com.midasplayer.timing.IFloat(m_headrad);
m_fisherHeadBeginAt = -1;
m_fisherHeadOpenAt = -1;
m_fisherHeadCloseAt = -1;
m_fisherHeadFrame = 0;
m_sxp = 0;
m_syp = 0;
m_wave = 0;
m_stateHiSky = false;
m_stateHiWater = false;
}
function setHilightState(sky, water) {
m_stateHiSky = sky;
m_stateHiWater = water;
}
function getPosX() {
return(m_x);
}
function getPosY() {
return(m_y);
}
function setLevelOver(v) {
m_levelOver = v;
}
function setGameOver(v) {
m_gameOver = v;
}
function setReelIn(b) {
m_harpoonSky.setCanReelIn(b);
m_harpoonWater.setCanReelIn(b);
}
function prestep(n) {
m_harpoonWater.pendulaStep(n);
}
function resetLevel() {
m_sxp = 0;
m_syp = 0;
m_wave = 0;
m_loadwx = 0;
m_loadwy = 0;
m_loadsx = 0;
m_loadsy = 0;
m_harpoonSky.resetLevel();
m_harpoonWater.resetLevel();
}
function onRetracted(h, item) {
if ((m_harpoonSky.getDirection() >= 0) && (m_harpoonWater.getDirection() >= 0)) {
com.midasplayer.fx.SoundManager.stop("reel_in");
}
m_extraListener.onRetracted(h, item);
if (h == m_harpoonSky) {
m_loadsx = 0;
m_loadsy = 0;
} else {
m_loadwx = 0;
m_loadwy = 0;
}
if (item) {
if (m_fisherHeadBeginAt != -1) {
m_fisherHeadBeginAt = m_fisherHeadBeginAt + 500;
} else if (m_fisherHeadOpenAt != -1) {
m_fisherHeadOpenAt = getTimer() + 125;
} else if (m_fisherHeadCloseAt != -1) {
m_fisherHeadBeginAt = m_fisherHeadBeginAt + 500;
} else {
m_fisherHeadOpenAt = getTimer() + 125;
}
}
}
function onBeginReelIn(h, item) {
if ((!m_levelOver) && (!com.midasplayer.fx.SoundManager.isPlaying("reel_in"))) {
if (!item) {
com.midasplayer.fx.SoundManager.play("hit_ceramic", 100, false, function () {
com.midasplayer.fx.SoundManager.play("reel_in", 50, true);
});
} else {
com.midasplayer.fx.SoundManager.play("reel_in", 50, true);
}
}
m_extraListener.onBeginReelIn(h, item);
}
function onAttached(h, item, score) {
if (!m_levelOver) {
if (item.getWeight() > 75) {
com.midasplayer.fx.SoundManager.play("hit_hard");
} else {
com.midasplayer.fx.SoundManager.play("hit_soft");
}
}
m_extraListener.onAttached(h, item, score);
if (h == m_harpoonSky) {
var _local5 = item.getWeight();
var _local6 = com.midasplayer.util.XPMath.atan2(h.getPosX() - (m_x + SKY_HOOK_X), h.getPosY() - (SKY_HOOK_Y + m_y));
m_loadsx = (Math.sin(_local6) * _local5) * 0.1;
m_loadsy = (Math.cos(_local6) * _local5) * 0.1;
} else {
var _local7 = item.getWeight();
var _local8 = com.midasplayer.util.XPMath.atan2(h.getPosX() - (m_x + WATER_HOOK_X), h.getPosY() - (WATER_HOOK_Y + m_y));
m_loadwx = (Math.sin(_local8) * _local7) * 0.25;
m_loadwy = (Math.cos(_local8) * _local7) * 0.25;
}
}
function setPosition(x, y) {
m_x = x;
m_y = y;
m_ox = x;
m_oy = y;
}
function setup(x, y, parent, im, listener) {
m_x = x;
m_y = y;
m_ox = x;
m_oy = y;
m_fx.set(x);
m_fx.set(x);
m_fy.set(y);
m_fy.set(y);
m_fr.set(0);
m_fr.set(0);
_x = x;
_y = y;
_rotation = 0;
m_itemMgr = im;
m_parent = parent;
m_extraListener = listener;
m_harpoonWater = new com.king.bbbathtub.Harpoon(2, m_parent, this, null, m_itemMgr);
m_harpoonSky = new com.king.bbbathtub.Harpoon(1, m_parent, this, m_harpoonWater, m_itemMgr);
m_harpoonSky.setInverted(true);
m_fishingLineSky = new com.king.bbbathtub.FishingLine2(m_parent);
m_fishingLineWater = new com.king.bbbathtub.FishingLine2(m_parent);
swapDepths(_parent.getNextHighestDepth());
}
function useFailSafeHead() {
m_head = new com.king.bbbathtub.FishermanHead(null, this, null, null);
m_head.setHeadClip("default_head");
var _local2 = "ux=18.41,uy=30.71,mx=17.42,my=73.8,lx=19.41,ly=67.12,j=59.94,ul=1,um=1";
var _local3 = parseCfg(_local2);
m_head.setUpperPivot(_local3.ux, _local3.uy);
m_head.setHandleOffset(_local3.mx, _local3.my);
m_head.setLowerPivot(_local3.lx, _local3.ly);
m_head.setJawLine(_local3.j);
m_head.setUpperLiftFactor(_local3.ul);
m_head.setUpperMoveFactor(_local3.um);
m_head.setPosition(33, -50);
suitclip.swapDepths(getNextHighestDepth());
boatclip.swapDepths(getNextHighestDepth());
}
function setHead(url, config, fnError, fnSuccess) {
if (m_head) {
m_head.kill();
m_head = undefined;
}
m_head = new com.king.bbbathtub.FishermanHead(url, this, fnError, fnSuccess);
var _local6 = parseCfg(config);
m_head.setUpperPivot(_local6.ux, _local6.uy);
m_head.setHandleOffset(_local6.mx, _local6.my);
m_head.setLowerPivot(_local6.lx, _local6.ly);
m_head.setJawLine(_local6.j);
m_head.setUpperLiftFactor(_local6.ul);
m_head.setUpperMoveFactor(_local6.um);
m_head.setPosition(36, -47);
suitclip.swapDepths(getNextHighestDepth());
boatclip.swapDepths(getNextHighestDepth());
}
function parseCfg(c) {
var _local3 = new Object();
var _local4 = c.split(",");
var _local5 = 0;
for ( ; _local5 < _local4.length ; _local5++) {
var _local6 = _local4[_local5].split("=");
_local3[_local6[0]] = _global.parseFloat(_local6[1]);
}
return(_local3);
}
function paint(cx) {
m_harpoonSky.getBounds().drawShape(cx);
m_harpoonWater.getBounds().drawShape(cx);
}
function getX() {
return(m_x);
}
function getY() {
return(m_y);
}
function getHarpoonSky() {
return(m_harpoonSky);
}
function getHarpoonWater() {
return(m_harpoonWater);
}
function update(tick) {
m_cTick = tick;
if (m_gameOver) {
m_ox = m_ox - 7.5;
}
var _local3 = 0.7;
var _local4 = 0.125;
var _local5 = m_ox + (Math.sin(m_wave) * 1);
var _local6 = m_oy + (Math.cos(m_wave) * 2);
var _local7 = ((-_local5) + (m_loadwx + m_loadsx)) + m_x;
var _local8 = ((-_local6) + (m_loadwy + m_loadsy)) + m_y;
m_sxp = (m_sxp * _local3) + (_local7 * _local4);
m_syp = (m_syp * _local3) + (_local8 * _local4);
m_x = _local5 + m_sxp;
m_y = _local6 + m_syp;
var _local9 = BOAT_WIDTH / 2;
var _local10 = m_itemMgr.getWaterLine();
var _local11 = m_x - _local9;
var _local12 = _local10.getWaterLevel(_local11);
var _local13 = m_x + _local9;
var _local14 = _local10.getWaterLevel(_local13);
var _local15 = _local13 - _local11;
var _local16 = _local14 - _local12;
var _local17 = -com.midasplayer.util.XPMath.atan2(_local16, _local15);
if (m_gameOver) {
_local17 = _local17 + 0.31415926;
}
var _local18 = Math.sin(_local17);
var _local19 = Math.cos(_local17);
var _local20 = m_x - ((_local5 + m_sxp) + SKY_HOOK_X);
var _local21 = m_y - ((_local6 + m_syp) + SKY_HOOK_Y);
var _local22 = (((_local19 * _local20) + (_local18 * _local21)) + _local5) + m_sxp;
var _local23 = (((_local18 * _local20) - (_local19 * _local21)) + _local6) + m_syp;
m_fharpoonSkyX.set(_local22);
m_fharpoonSkyY.set(_local23);
m_harpoonSky.setRodTip(_local22, _local23);
_local20 = m_x - ((_local5 + m_sxp) + WATER_HOOK_X);
_local21 = m_y - ((_local6 + m_syp) + WATER_HOOK_Y);
_local22 = (((_local19 * _local20) + (_local18 * _local21)) + _local5) + m_sxp;
_local23 = (((_local18 * _local20) - (_local19 * _local21)) + _local6) + m_syp;
m_fharpoonWaterX.set(_local22);
m_fharpoonWaterY.set(_local23);
m_harpoonWater.setRodTip(_local22, _local23);
m_r = _local17 * RADIAN_TO_DEGREE;
m_fx.set(m_x);
m_fy.set(m_y);
m_fr.set(m_r);
m_fheaddeg.set((-m_r) * 2.25);
m_wave = m_wave + 0.02;
m_harpoonWater.update(tick);
m_harpoonSky.update(tick);
}
function isVisible() {
return(m_allVisible);
}
function setVisible(b) {
m_fishingLineSky.setVisible(b);
m_fishingLineWater.setVisible(b);
_visible = b;
m_allVisible = b;
}
function render(tick, alpha) {
var _local4 = getTimer();
if ((m_fisherHeadBeginAt != -1) && (_local4 >= m_fisherHeadBeginAt)) {
m_fisherHeadBeginAt = -1;
m_fisherHeadCloseAt = _local4 + 125;
}
if (m_fisherHeadCloseAt != -1) {
var _local5 = 0;
if (_local4 <= m_fisherHeadCloseAt) {
_local5 = (m_fisherHeadCloseAt - _local4) / 125;
}
if (_local5 == 0) {
m_fisherHeadCloseAt = -1;
}
m_fisherHeadFrame = int(20 * _local5);
}
if (m_fisherHeadOpenAt != -1) {
var _local6 = 1;
if (_local4 <= m_fisherHeadOpenAt) {
_local6 = 1 - ((m_fisherHeadOpenAt - _local4) / 125);
}
if (_local6 == 1) {
m_fisherHeadBeginAt = _local4 + 625;
m_fisherHeadOpenAt = -1;
}
m_fisherHeadFrame = int(20 * _local6);
}
var _local7 = m_harpoonWater.getRenderedPos();
var _local8 = m_harpoonWater.getDirection() > 0;
m_fishingLineWater.draw(tick, alpha, m_fharpoonWaterX.value, m_fharpoonWaterY.value, _local7[0], _local7[1], _local8);
var _local9 = m_harpoonSky.getRenderedPos();
_local8 = m_harpoonSky.getDirection() > 0;
m_fishingLineSky.draw(tick, alpha, m_fharpoonSkyX.value, m_fharpoonSkyY.value, _local9[0], _local9[1], _local8);
_x = m_fx.value;
_y = m_fy.value;
_rotation = m_fr.value;
if (!m_levelOver) {
if (m_parent._ymouse < 272) {
if (m_lastHilite != 1) {
m_fishingLineSky.setHighlighted(true);
m_fishingLineWater.setHighlighted(false);
m_lastHilite = 1;
}
} else if (m_lastHilite != 2) {
m_fishingLineSky.setHighlighted(false);
m_fishingLineWater.setHighlighted(true);
m_lastHilite = 2;
}
} else {
m_fishingLineSky.setHighlighted(m_stateHiSky);
m_fishingLineWater.setHighlighted(m_stateHiWater);
}
m_head.setFrame(m_fisherHeadFrame);
m_head.setRotation(m_fheaddeg.value);
m_head.update();
}
static var RADIAN_TO_DEGREE = 57.2957795;
static var SKY_HOOK_X = 19;
static var SKY_HOOK_Y = -51 - 4;
static var WATER_HOOK_X = 18;
static var WATER_HOOK_Y = 3;
static var BOAT_WIDTH = 126;
var m_allVisible = true;
var m_lastHilite = 0;
}
Symbol 343 MovieClip [__Packages.com.king.bbbathtub.FishermanHead] Frame 0
class com.king.bbbathtub.FishermanHead
{
var m_inited, m_url, m_parent, m_errorHandler, m_successHandler, m_loadState1, m_loadState2, m_loadStateAll, m_x, m_y, m_ox, m_oy, m_my, m_lx, m_ly, m_ux, m_uy, m_lf, m_rf, m_degree, m_head, m_headInner, m_headLowerContainer, m_headUpperContainer, m_headLower, m_headUpper, m_loader1, m_loader2, m_width, m_height, m_frame, m_delay, m_dir, m_headLowerMask, m_headUpperMask, m_headLowerDraw, m_headUpperDraw;
function FishermanHead (url, parent, errorCallback, successCallback) {
m_inited = false;
m_url = url;
m_parent = parent;
m_errorHandler = errorCallback;
m_successHandler = successCallback;
m_loadState1 = 0;
m_loadState2 = 0;
m_loadStateAll = 0;
m_x = 0;
m_y = 0;
m_ox = 0;
m_oy = 0;
m_my = 0;
m_lx = 0;
m_ly = 0;
m_ux = 0;
m_uy = 0;
m_my = 0;
m_lf = 1;
m_rf = 1;
m_degree = 0;
var _local6 = url.lastIndexOf("/");
var _local7 = url.lastIndexOf(".");
if (_local6 < 0) {
_local6 = 0;
}
if (_local7 < 0) {
_local7 = url.length;
}
var _local8 = "";
var _local9 = "head";
var _local10 = "_" + url.substring(_local6 + 1, _local7);
var _local11 = 2;
while (m_parent[_local9 + _local8] != undefined) {
_local8 = (_local10 + "_") + _local11;
_local11++;
}
m_head = m_parent.createEmptyMovieClip(_local9 + _local8, m_parent.getNextHighestDepth());
m_headInner = m_head.createEmptyMovieClip("head_inner", m_head.getNextHighestDepth());
m_headLowerContainer = m_headInner.createEmptyMovieClip("head_lower_base", m_headInner.getNextHighestDepth());
m_headUpperContainer = m_headInner.createEmptyMovieClip("head_upper_base", m_headInner.getNextHighestDepth());
if (url != null) {
m_headLower = m_headLowerContainer.createEmptyMovieClip("head_lower", m_headLowerContainer.getNextHighestDepth());
m_headUpper = m_headUpperContainer.createEmptyMovieClip("head_upper", m_headUpperContainer.getNextHighestDepth());
m_loader1 = new com.king.bbbathtub.ImageLoader(url, m_headUpper, mx.utils.Delegate.create(this, upperLoaded));
m_loader2 = new com.king.bbbathtub.ImageLoader(url, m_headLower, mx.utils.Delegate.create(this, lowerLoaded));
}
}
function setHeadClip(name) {
m_headLower = m_headLowerContainer.attachMovie(name, "head_lower", m_headLowerContainer.getNextHighestDepth());
m_headUpper = m_headUpperContainer.attachMovie(name, "head_upper", m_headUpperContainer.getNextHighestDepth());
m_loadState1 = 1;
m_loadState2 = 1;
m_loadStateAll = 1;
initStep1();
}
function setUpperPivot(x, y) {
m_ux = x;
m_uy = y;
}
function setLowerPivot(x, y) {
m_lx = x;
m_ly = y;
}
function setHandleOffset(x, y) {
m_ox = x;
m_oy = y;
}
function setJawLine(y) {
m_my = y;
}
function setUpperLiftFactor(l) {
m_lf = l;
}
function setUpperMoveFactor(r) {
m_rf = r;
}
function setRotation(dgr) {
m_degree = dgr;
}
function setPosition(x, y) {
m_x = x;
m_y = y;
}
function checkState() {
if ((m_loadState1 != 0) && (m_loadState2 != 0)) {
if ((m_loadState1 == 1) && (m_loadState2 == 1)) {
m_loadStateAll = 1;
} else {
m_loadStateAll = -1;
}
if ((m_errorHandler != null) && (m_loadStateAll < 0)) {
m_errorHandler();
return(undefined);
}
initStep1();
}
}
function upperLoaded(clip, error) {
m_loadState1 = ((error == null) ? 1 : -1);
checkState();
}
function lowerLoaded(clip, error) {
m_loadState2 = ((error == null) ? 1 : -1);
checkState();
}
function getSize() {
if (m_inited) {
return([m_width, m_height]);
}
return(null);
}
function isInited() {
return(m_inited);
}
function setScale(f) {
m_head._xscale = f;
m_head._yscale = f;
}
function setAlpha(f) {
m_head._alpha = f;
}
function setFrame(f) {
m_frame = f;
}
function update() {
m_head._x = m_x;
m_head._y = m_y;
m_head._rotation = m_degree;
var _local2 = m_upper[m_frame];
m_headUpperContainer._x = _local2[0] * m_rf;
m_headUpperContainer._y = _local2[1] * m_lf;
m_headUpperContainer._rotation = _local2[2];
_local2 = m_lower[m_frame];
m_headLowerContainer._x = _local2[0] - (m_ux - m_lx);
m_headLowerContainer._y = (_local2[1] + 5.9) - (m_uy - m_ly);
m_headLowerContainer._rotation = _local2[2];
}
function updateTest() {
update();
if (m_delay == 0) {
m_frame = m_frame + m_dir;
if (m_frame == 19) {
m_dir = -1;
m_delay = 5;
}
if (m_frame == 0) {
m_dir = 1;
m_delay = 5;
}
} else {
m_delay--;
}
}
function getTargetScale(maxWidth, maxHeight) {
var _local4 = m_width;
var _local5 = m_height;
var _local6 = _local4;
var _local7 = _local5;
if ((_local6 < maxWidth) && (_local7 < maxWidth)) {
_local7 = _local7 * (maxWidth / _local6);
_local6 = maxWidth;
}
if (_local6 > maxWidth) {
_local7 = _local7 * (maxWidth / _local6);
_local6 = maxWidth;
}
if (_local7 > maxHeight) {
_local6 = _local6 * (maxHeight / _local7);
_local7 = maxHeight;
}
var _local8 = 100 * (1 - ((_local4 - _local6) / _local4));
var _local9 = 100 * (1 - ((_local5 - _local7) / _local5));
return([_local8, _local9]);
}
function initStep1() {
m_frame = 0;
m_dir = 1;
m_delay = Math.floor(Math.random() * 40);
m_head.onEnterFrame = mx.utils.Delegate.create(this, reinit);
}
function kill() {
m_loader1.halt();
m_loader2.halt();
m_head.removeMovieClip();
}
function reinit() {
m_width = m_headLower._width;
m_height = m_headLower._height;
if ((m_width == undefined) || (m_width <= 0)) {
if (m_errorHandler != undefined) {
m_errorHandler();
}
return(undefined);
}
m_headInner._x = -(m_lx - m_ux);
m_headInner._y = -(m_ly - m_uy);
m_headInner._x = m_ux - m_ox;
m_headInner._y = m_uy - m_oy;
m_headUpper._x = -m_ux;
m_headUpper._y = -m_uy;
m_headLower._x = -m_lx;
m_headLower._y = -m_ly;
m_headUpperContainer._x = 0;
m_headUpperContainer._y = 0;
m_headLowerContainer._x = -(m_ux - m_lx);
m_headLowerContainer._y = -(m_uy - m_ly);
m_headLowerMask.removeMovieClip();
m_headUpperMask.removeMovieClip();
m_headLowerMask = m_headLower.createEmptyMovieClip("head_lower_mask", m_headLower.getNextHighestDepth());
m_headLowerDraw = new com.midasplayer.fx.Draw(m_headLowerMask);
m_headLowerDraw.fillRect(0, m_my, m_headLower._width, m_headLower._height - m_my);
m_headLower.setMask(m_headLowerMask);
m_headUpperMask = m_headUpper.createEmptyMovieClip("head_upper_mask", m_headUpper.getNextHighestDepth());
m_headUpperDraw = new com.midasplayer.fx.Draw(m_headUpperMask);
m_headUpperDraw.fillRect(0, 0, m_width, m_my);
m_headUpper.setMask(m_headUpperMask);
m_inited = true;
m_head.onEnterFrame = undefined;
if (m_successHandler != undefined) {
m_successHandler();
}
}
var m_lower = [[0, -5.9, 0], [0, -5.6, -0.3], [0, -5.3, -0.5], [0, -5, -0.8], [0, -4.7, -1], [0, -4.3, -1.3], [0, -4, -1.5], [0, -3.7, -1.8], [0, -3.4, -2], [0, -3, -2.3], [0, -2.8, -2.5], [0, -2.5, -2.8], [0, -2.1, -3], [0, -1.8, -3.3], [0, -1.5, -3.5], [0, -1.1, -3.8], [0, -0.8, -4.1], [0, -0.6, -4.3], [0, -0.2, -4.6], [0, 0.1, -5]];
var m_upper = [[0, 0, 0], [0.25, -0.1, 1.3], [1, -0.1, 2.8], [2, -0.2, 4.5], [3.2, -0.2, 6.5], [4.5, -0.3, 8.8], [6, -0.3, 11.3], [7.5, -0.4, 14], [9.3, -0.4, 17], [11.2, -0.5, 20.3], [13.2, -0.5, 23.6], [15.4, -0.6, 27.3], [17.6, -0.6, 31.3], [20.1, -0.7, 35.4], [22.6, -0.7, 39.9], [25.3, -0.8, 44.6], [28.2, -0.8, 49.4], [31.2, -0.9, 54.6], [34.4, -0.9, 59.9], [37.6, -1, 65.5]];
}
Symbol 344 MovieClip [__Packages.com.king.bbbathtub.ImageLoader] Frame 0
class com.king.bbbathtub.ImageLoader
{
var m_loadedCallback, m_url, m_target, m_timeOut, m_beginLoad, m_loader;
function ImageLoader (url, dest, loaded) {
m_loadedCallback = loaded;
m_url = url;
m_target = dest;
m_timeOut = _global.setInterval(mx.utils.Delegate.create(this, checkTimeOut), 100);
m_beginLoad = getTimer();
m_loader = new MovieClipLoader();
m_loader.addListener(this);
m_loader.loadClip(m_url, m_target);
}
function halt() {
_global.clearInterval(m_timeOut);
m_timeOut = null;
m_loadedCallback = null;
m_loader = null;
}
function onLoadProgress(tg, loadedBytes, totalBytes) {
}
function onLoadStart(tg) {
}
function onLoadInit(tg) {
}
function onLoadError(tg, msg) {
_global.clearInterval(m_timeOut);
m_timeOut = null;
m_loadedCallback(null, msg);
m_loadedCallback = null;
}
function checkTimeOut() {
if ((m_loadedCallback != null) && ((getTimer() - m_beginLoad) > LOAD_TIMEOUT)) {
onLoadError(null, "head request timed out");
}
}
function onLoadComplete(tg) {
m_loadedCallback(tg, null);
m_loadedCallback = null;
_global.clearInterval(m_timeOut);
m_timeOut = null;
}
static var LOAD_TIMEOUT = 5000;
}
Symbol 345 MovieClip [__Packages.com.king.bbbathtub.FishingLine2] Frame 0
class com.king.bbbathtub.FishingLine2
{
var m_parent, m_movieClips, m_visible, m_hx, m_hy, m_ha;
function FishingLine2 (parent) {
m_parent = parent;
m_movieClips = new Array();
var _local3 = m_parent.attachMovie("harpoon", "a-1", m_parent.getNextHighestDepth());
m_movieClips.push(_local3);
var _local4 = 0;
for ( ; _local4 < 32 ; _local4++) {
_local3 = m_parent.attachMovie("link", "a" + _local4, m_parent.getNextHighestDepth());
_local3._visible = false;
m_movieClips.push(_local3);
}
}
function setVisible(visible) {
m_visible = visible;
}
function setHighlighted(enable) {
m_movieClips[0].gotoAndStop((enable ? 2 : 1));
}
function drawWiggly(tick, alpha, x1, y1, x2, y2) {
var _local8 = 15;
var _local9 = 0.6;
var _local10 = (_local9 / 4) - ((tick * 40) / 75);
var _local11 = x2 - x1;
var _local12 = y2 - y1;
var _local13 = Math.max(_local8, Math.sqrt((_local11 * _local11) + (_local12 * _local12)));
var _local14 = 4;
_local14 = _local14 * (Math.min(_local8, _local13 - _local8) / _local8);
var _local15 = com.midasplayer.util.XPMath.atan2(_local12, _local11);
var _local16 = Math.cos(_local15);
var _local17 = Math.sin(_local15);
var _local18 = _local16 * _local8;
var _local19 = _local17 * _local8;
var _local20 = 0;
var _local21 = 0;
var _local22 = 0;
var _local23 = 0;
var _local24 = 0;
var _local25 = 0;
var _local26 = 180 / Math.PI;
var _local27 = int(_local13 / _local8) - 1;
var _local28 = _local13 - ((_local27 + 1) * _local8);
x1 = x1 + (_local28 * _local16);
y1 = y1 + (_local28 * _local17);
var _local29 = -1;
for ( ; _local29 < _local27 ; _local29++ , _local10 = _local10 + _local9 , _local24 = _local20 , _local25 = _local21) {
var _local30 = Math.sin(_local10);
var _local31 = (Math.cos(_local30) * Math.sin((1 + _local10) * 0.25)) * _local14;
var _local32 = (Math.sin(_local30) * Math.cos((2.1 + _local10) * 0.25)) * _local14;
_local22 = ((_local16 * _local31) + (_local17 * _local32)) + x1;
_local20 = (_local18 * _local29) + _local22;
_local23 = ((_local17 * _local31) - (_local16 * _local32)) + y1;
_local21 = (_local19 * _local29) + _local23;
for ( ; _local29 < 0 ; _local29++ , _local10 = _local10 + _local9 , _local24 = _local20 , _local25 = _local21) {
}
var _local33 = com.midasplayer.util.XPMath.atan2(_local21 - _local25, _local20 - _local24) * _local26;
m_movieClips[_local29 + 1]._x = _local20;
m_movieClips[_local29 + 1]._y = _local21;
m_movieClips[_local29 + 1]._rotation = _local33;
m_movieClips[_local29 + 1]._visible = true;
}
var _local34 = 0;
if (_local13 > _local8) {
_local34 = 4;
}
m_hx = (_local16 * ((_local27 * _local8) - _local34)) + _local22;
m_hy = (_local17 * ((_local27 * _local8) - _local34)) + _local23;
m_ha = _local15 * _local26;
m_movieClips[0]._x = m_hx;
m_movieClips[0]._y = m_hy;
m_movieClips[0]._rotation = m_ha;
var _local35 = _local27 + 1;
for ( ; _local35 < m_movieClips.length ; _local35++) {
m_movieClips[_local35]._visible = false;
}
m_movieClips[0]._visible = true;
}
function drawStraight(x1, y1, x2, y2) {
var _local6 = 15;
var _local7 = 0.6;
var _local8 = 0;
var _local9 = x2 - x1;
var _local10 = y2 - y1;
var _local11 = Math.max(_local6, Math.sqrt((_local9 * _local9) + (_local10 * _local10)));
var _local12 = com.midasplayer.util.XPMath.atan2(_local10, _local9);
var _local13 = Math.cos(_local12);
var _local14 = Math.sin(_local12);
var _local15 = _local13 * _local6;
var _local16 = _local14 * _local6;
var _local17 = 180 / Math.PI;
var _local18 = int(_local11 / _local6) - 1;
var _local19 = _local11 - ((_local18 + 1) * _local6);
x1 = x1 + (_local19 * _local13);
y1 = y1 + (_local19 * _local14);
var _local20 = 0;
for ( ; _local20 < _local18 ; _local20++) {
m_movieClips[_local20 + 1]._x = (_local15 * _local20) + x1;
m_movieClips[_local20 + 1]._y = (_local16 * _local20) + y1;
m_movieClips[_local20 + 1]._rotation = _local12 * _local17;
m_movieClips[_local20 + 1]._visible = true;
_local8 = _local8 + _local7;
}
var _local21 = 0;
if (_local11 > _local6) {
_local21 = 4;
}
m_hx = (_local13 * ((_local18 * _local6) - _local21)) + x1;
m_hy = (_local14 * ((_local18 * _local6) - _local21)) + y1;
m_ha = _local12 * _local17;
var _local22 = _local18 + 1;
for ( ; _local22 < m_movieClips.length ; _local22++) {
m_movieClips[_local22]._visible = false;
}
m_movieClips[0]._x = m_hx;
m_movieClips[0]._y = m_hy;
m_movieClips[0]._rotation = m_ha;
m_movieClips[0]._visible = true;
}
function draw(tick, alpha, x1, y1, x2, y2, wiggly) {
if (!m_visible) {
var _local9 = 0;
for ( ; _local9 < m_movieClips.length ; _local9++) {
m_movieClips[_local9]._visible = false;
}
} else if (wiggly) {
drawWiggly(tick, alpha, x1, y1, x2, y2);
} else {
drawStraight(x1, y1, x2, y2);
}
}
function getHarpoonX() {
return(m_hx);
}
function getHarpoonY() {
return(m_hy);
}
function getHarpoonAngle() {
return(m_ha);
}
}
Symbol 346 MovieClip [__Packages.com.king.bbbathtub.JumpingItem] Frame 0
class com.king.bbbathtub.JumpingItem
{
var m_begin, m_sfxEnable, m_clip, m_other, m_target, m_ox, m_oy, m_swapped, m_scale;
function JumpingItem (clip, other, tgt, sfxEnable) {
m_begin = -1;
m_sfxEnable = sfxEnable;
m_clip = clip;
m_other = other;
m_target = tgt;
m_clip._visible = false;
}
function start(x, y, r) {
m_ox = x;
m_oy = y;
m_begin = getTimer();
m_clip._rotation = r;
m_clip._visible = true;
var _local5 = m_clip._xscale / 100;
m_swapped = false;
m_scale = getTargetScale(32, 32);
m_scale[0] = m_scale[0] * _local5;
m_scale[1] = m_scale[1] * _local5;
}
function getTargetScale(maxWidth, maxHeight) {
var _local4 = m_clip._width;
var _local5 = m_clip._height;
var _local6 = _local4;
var _local7 = _local5;
if ((_local6 < maxWidth) && (_local7 < maxWidth)) {
_local7 = _local7 * (maxWidth / _local6);
_local6 = maxWidth;
}
if (_local6 > maxWidth) {
_local7 = _local7 * (maxWidth / _local6);
_local6 = maxWidth;
}
if (_local7 > maxHeight) {
_local6 = _local6 * (maxHeight / _local7);
_local7 = maxHeight;
}
var _local8 = 100 * (1 - ((_local4 - _local6) / _local4));
var _local9 = 100 * (1 - ((_local5 - _local7) / _local5));
return([_local8, _local9]);
}
function updateThrowOut() {
var _local2 = Math.min(AIR_TIME, getTimer() - m_begin);
var _local3 = _local2 / AIR_TIME;
var _local4 = 1 - _local3;
m_clip._xscale = (_local4 * 100) + (_local3 * m_scale[0]);
m_clip._yscale = (_local4 * 100) + (_local3 * m_scale[1]);
m_clip._x = (m_ox + m_target._x) + (_local3 * 52);
m_clip._y = (m_oy + m_target._y) - (Math.sin(_local3 * (Math.PI - (Math.PI / 7))) * 100);
if ((!m_swapped) && (_local3 > 0.5)) {
m_swapped = true;
m_clip.swapDepths(m_other.getDepth());
}
return(_local2 == AIR_TIME);
}
function destroy() {
if (m_sfxEnable) {
com.midasplayer.fx.SoundManager.play("eat");
}
m_clip.removeMovieClip();
}
static var AIR_TIME = 750;
}
Symbol 347 MovieClip [__Packages.com.midasplayer.util.Numbers] Frame 0
class com.midasplayer.util.Numbers
{
function Numbers () {
}
static function dec2hex(iValue, padding) {
var _local4 = "";
while (iValue != 0) {
_local4 = "0123456789abcdef".charAt(iValue & 15) + _local4;
iValue = iValue >>> 4;
}
if (padding) {
if (_local4.length == 0) {
_local4 = "00";
}
if (_local4.length < 2) {
_local4 = "0" + _local4;
}
} else if (_local4.length == 0) {
_local4 = "0";
}
return(_local4);
}
static function itoa(value, numZeroPadding) {
var _local4 = "" + value;
if (numZeroPadding) {
var _local5 = numZeroPadding - 1;
for ( ; _local5 > 0 ; _local5--) {
if (value < Math.pow(10, _local5)) {
_local4 = "0" + _local4;
}
}
}
return(_local4);
}
static function asTime(millis, alwaysHours, alwaysMinutes) {
if (alwaysHours) {
alwaysMinutes = true;
}
if (millis < 0) {
millis = 0;
}
millis = millis / 1000;
millis = Math.floor(millis);
var _local5 = Math.floor(millis / 3600);
var _local6 = Math.floor(millis / 60) % 60;
var _local7 = millis % 60;
var _local8 = "";
if (alwaysHours || (_local5 > 0)) {
_local8 = _local8 + itoa(_local5, 2);
}
if (alwaysHours || (_local8.length > 0)) {
_local8 = _local8 + ":";
}
var _local9 = _local8.length;
if (alwaysMinutes || ((_local6 > 0) || (_local5 > 0))) {
_local8 = _local8 + itoa(_local6, 2);
}
if (alwaysMinutes || (_local8.length != _local9)) {
_local8 = _local8 + ":";
}
return(_local8 + itoa(_local7, 2));
}
}
Symbol 348 MovieClip [__Packages.com.midasplayer.util.Animator] Frame 0
class com.midasplayer.util.Animator
{
var finished, targetObject, x, startX, y, startY, startTime, tick, duration, timeTicks, targetY, targetX, dx, dy, dt, callback, callbackFire;
function Animator (t) {
finished = true;
targetObject = t;
x = (startX = t._x);
y = (startY = t._y);
startTime = null;
tick = 0;
duration = 800;
timeTicks = false;
}
function fillBaseCopy(t, o) {
o.targetObject = t;
o.duration = duration;
o.x = x;
o.y = y;
o.startTime = startTime;
o.finished = finished;
o.timeTicks = timeTicks;
o.tick = tick;
o.targetY = targetY;
o.targetX = targetX;
o.startX = startX;
o.startY = startY;
o.dx = dx;
o.dy = dy;
o.dt = dt;
}
function setSource(t) {
targetObject = t;
x = (startX = t._x);
y = (startY = t._y);
}
function complete() {
startTime = null;
x = targetX;
y = targetY;
finished = true;
targetObject._x = x;
targetObject._y = y;
}
function setPosition(x, y) {
startX = targetObject._x;
startY = targetObject._y;
targetX = Math.round(x);
targetY = Math.round(y);
finished = false;
startTime = null;
}
function setDuration(ms) {
duration = ms;
finished = false;
startTime = null;
}
function setDurationTicks(ticks) {
duration = ticks;
finished = false;
startTime = null;
timeTicks = true;
}
function getElapsedPercent() {
return(getElapsed());
}
function getElapsed() {
if ((!dt) || (duration == 0)) {
return(1);
}
return(Math.max(0, duration - dt) / duration);
}
function update() {
if (finished) {
if (callback && ((1 - getElapsed()) >= callbackFire)) {
callback();
callbackFire = undefined;
callback = undefined;
}
return(true);
}
if (!timeTicks) {
var _local2 = getTimer();
if (startTime == null) {
startTime = _local2;
}
dt = _local2 - startTime;
} else {
dt = tick;
tick++;
}
dx = targetX - startX;
dy = targetY - startY;
nextPosition();
var _local3 = false;
x = Math.floor(x);
if (((x >= targetX) && (targetX >= startX)) || ((x <= targetX) && (targetX <= startX))) {
_local3 = true;
x = targetX;
}
var _local4 = false;
y = Math.floor(y);
if (((y >= targetY) && (targetY >= startY)) || ((y <= targetY) && (targetY <= startY))) {
_local4 = true;
y = targetY;
}
if (_local3 && (_local4)) {
startTime = null;
x = targetX;
y = targetY;
finished = true;
}
targetObject._x = x;
targetObject._y = y;
if (callback && ((1 - getElapsed()) >= callbackFire)) {
callback();
callbackFire = undefined;
callback = undefined;
}
return(finished);
}
function setCallback(at, fn) {
callbackFire = ((at == undefined) ? 1 : (at));
callback = fn;
}
function toString() {
return((((((((("Animator[start=" + [startX, startY]) + ", target=") + [targetX, targetY]) + ", t=") + getElapsedPercent()) + ", ticks=") + tick) + ", targetObject=") + [targetObject._x, targetObject._y]);
}
function isFinished() {
return(finished);
}
function nextPosition() {
}
}
Symbol 349 MovieClip [__Packages.com.midasplayer.util.EaseOutCubicAnimator] Frame 0
class com.midasplayer.util.EaseOutCubicAnimator extends com.midasplayer.util.Animator
{
var dt, duration, x, startX, dx, y, startY, dy;
function EaseOutCubicAnimator (o) {
super(o);
}
function nextPosition() {
var _local2 = dt;
if (_local2 > duration) {
_local2 = duration;
}
var _local3 = _local2;
_local3 = (_local3 / duration) - 1;
x = (dx * (((_local3 * _local3) * _local3) + 1)) + startX;
_local3 = _local2;
_local3 = (_local3 / duration) - 1;
y = (dy * (((_local3 * _local3) * _local3) + 1)) + startY;
}
}
Symbol 350 MovieClip [__Packages.com.midasplayer.util.FloatEncoder] Frame 0
class com.midasplayer.util.FloatEncoder
{
function FloatEncoder () {
}
static function encodeBits(val) {
var _local3 = val < 0;
if (_local3) {
val = -val;
}
var _local4 = 0;
while (val > 1) {
val = val / 2;
_local4++;
}
if (_local3) {
_local4 = (-_local4) - 1;
}
var _local5 = _local4 + ".";
do {
var _local6 = 0;
var _local7 = 0;
for ( ; _local7 < 6 ; _local7++) {
if (val >= 1) {
val = val - 1;
_local6 = _local6 | (1 << _local7);
}
val = val * 2;
}
_local5 = _local5 + BASE_64_CHARS.charAt(_local6);
} while (val > 0);
return(_local5);
}
static function decodeBits(encodedData) {
var _local3 = encodedData.split(".");
var _local4 = _global.parseInt(_local3[0]);
var _local5 = _local4 < 0;
var _local6 = _local3[1];
var _local7 = 0;
if (_local5) {
_local4 = (-_local4) - 1;
}
var _local8 = 0;
for ( ; _local8 < _local6.length ; _local8++) {
_local3 = _local6.charAt((_local6.length - _local8) - 1);
var _local9 = BASE_64_CHARS.indexOf(_local3);
var _local10 = 0;
for ( ; _local10 < 6 ; _local10++) {
_local7 = _local7 / 2;
if (((_local9 >> (5 - _local10)) & 1) > 0) {
_local7 = _local7 + 1;
}
}
}
var _local11 = 0;
for ( ; _local11 < _local4 ; _local11++) {
_local7 = _local7 * 2;
}
if (_local5) {
_local7 = -_local7;
}
return(_local7);
}
static var BASE_64_CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ()";
}
Symbol 351 MovieClip [__Packages.com.king.bbbathtub.TubCamera] Frame 0
class com.king.bbbathtub.TubCamera extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function TubCamera (c, im) {
super(c, im);
m_itemId = 20;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 95, 58);
}
function getWeight() {
return(84);
}
function getScore() {
return(100);
}
}
Symbol 352 MovieClip [__Packages.com.king.bbbathtub.Treasure] Frame 0
class com.king.bbbathtub.Treasure extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function Treasure (c, im) {
super(c, im);
m_itemId = 17;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 32, 26);
}
function getWeight() {
return(30);
}
function getScore() {
return(500);
}
}
Symbol 353 MovieClip [__Packages.com.king.bbbathtub.Diver] Frame 0
class com.king.bbbathtub.Diver extends com.king.bbbathtub.TankItem
{
var m_itemId, m_exploded, m_startedTick, m_speed, m_shape, m_bounds, m_itemMgr, m_isMovingAround, m_lastX, m_lastY, m_spikesR, m_dirMod, m_legRad, m_leg1, m_leg2, m_leg1rf, m_leg2rf, m_opacity, m_collisionEnabled, m_clip, m_xpos, m_ypos, m_rotation, m_spikes, prepareSpikes, flip, setPosition2n, m_startDelay, m_numUpd, m_fx, m_fy, m_fr;
function Diver (c, im) {
super(c, im);
m_itemId = 12;
m_exploded = false;
m_startedTick = -1;
m_speed = 3;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 83, 33.5);
m_bounds = m_itemMgr.getBoundaries();
m_isMovingAround = true;
m_lastX = null;
m_lastY = null;
m_spikesR = _global.NaN;
m_dirMod = new com.midasplayer.timing.IFloat();
m_legRad = 0;
m_leg1 = c.leg1;
m_leg2 = c.leg2;
m_leg1rf = new com.midasplayer.timing.IFloat(0);
m_leg2rf = new com.midasplayer.timing.IFloat(0);
m_opacity = new com.midasplayer.timing.IFloat(0);
m_collisionEnabled = false;
m_clip._alpha = 0;
}
function updateShock() {
return(false);
}
function onHit() {
if (m_collisionEnabled) {
var _local2 = m_itemMgr.getLevel().createItem(17, m_xpos, m_ypos, 0, 0, false, false);
m_itemMgr.onSpawnItem(new com.king.bbbathtub.BubbleWrap(_local2));
m_itemMgr.onSpawnItem(_local2);
com.midasplayer.fx.SoundManager.play("hit_bonus");
m_clip.swapDepths(m_itemMgr.getParentClip().getNextHighestDepth());
m_speed = Math.min(5, ++m_speed);
}
return(false);
}
function isCollision() {
var _local2 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
if (m_spikesR != _local2) {
m_spikes = prepareSpikes(0.8, (m_spikesR = _local2));
}
return(m_bounds.mayCollide(m_xpos, m_ypos) && (m_bounds.testSpikes(m_spikes, m_xpos, m_ypos)));
}
function update(tick) {
com.king.bbbathtub.Collidable.m_cTick = tick;
if (m_startedTick != -1) {
if (com.king.bbbathtub.Collidable.m_cTick >= (m_startedTick + 500)) {
var _local3 = 1 - (Math.min(17, com.king.bbbathtub.Collidable.m_cTick - (m_startedTick + 500)) / 17);
if (_local3 == 0) {
m_itemMgr.onKillItem(this);
return(undefined);
}
} else {
var _local3 = Math.min(17, com.king.bbbathtub.Collidable.m_cTick - m_startedTick) / 17;
if (_local3 > 0.25) {
m_collisionEnabled = true;
}
}
m_opacity.set(_local3 * 100);
var _local4 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
if (m_spikesR != _local4) {
m_spikes = prepareSpikes(0.8, (m_spikesR = _local4));
}
if (m_bounds.testSpikesWater(m_spikes, m_xpos, m_ypos)) {
if (m_lastX != null) {
m_xpos = m_lastX;
m_ypos = m_lastY;
}
flip();
_local4 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
}
var _local5 = (Math.cos(_local4) * m_speed) * _local3;
var _local6 = (Math.sin(_local4) * m_speed) * _local3;
var _local7 = Math.sin(m_legRad) * 20;
m_leg1rf.set(8 + _local7);
m_leg2rf.set(8 - _local7);
m_dirMod.set(Math.sin(m_legRad / 2) * 5);
m_legRad = m_legRad + (((m_speed / 3) * 0.8) * _local3);
m_lastX = m_xpos;
m_lastY = m_ypos;
setPosition2n(m_xpos + _local5, m_ypos + _local6);
} else if (m_numUpd == m_startDelay) {
m_startedTick = com.king.bbbathtub.Collidable.m_cTick;
}
m_numUpd++;
}
function render() {
m_clip._x = m_fx.value;
m_clip._y = m_fy.value;
m_clip._alpha = m_opacity.value;
m_clip._rotation = m_fr.value + m_dirMod.value;
m_leg1._rotation = m_leg1rf.value;
m_leg2._rotation = m_leg2rf.value;
}
}
Symbol 354 MovieClip [__Packages.com.king.bbbathtub.BubbleWrap] Frame 0
class com.king.bbbathtub.BubbleWrap extends com.king.bbbathtub.TankItem
{
var m_collisionEnabled, m_numUpd, m_scaleWave, m_scale, m_wave, m_itemId, m_exploded, m_innerObject, m_shape, m_itemMgr, m_isMovingAround, m_clip, m_bubbles, m_xpos, m_ypos, m_rotation, m_fx, m_fy, m_avglevel, setPosition;
function BubbleWrap (inner) {
super(inner.m_clip, inner.m_itemMgr);
m_collisionEnabled = false;
m_numUpd = 0;
m_scaleWave = 0;
m_scale = new com.midasplayer.timing.IFloat();
m_wave = 0;
m_itemId = 40;
m_exploded = false;
m_innerObject = inner;
m_shape = null;
m_itemMgr = inner.m_itemMgr;
m_isMovingAround = true;
m_innerObject.m_isMovingAround = true;
m_innerObject.m_scaleOnCreate = false;
var _local4 = inner.m_clip._parent;
var _local5 = _local4.getNextHighestDepth();
m_clip = _local4.attachMovie("bubble", "bobble_" + _local5, _local5);
m_clip._x = inner.m_xpos;
m_clip._y = inner.m_ypos;
m_clip._alpha = 66;
m_bubbles = new Array();
var _local6 = 0;
for ( ; _local6 < 5 ; _local6++) {
_local5 = _local4.getNextHighestDepth();
var _local7 = _local4.attachMovie("bubble", "bobble_" + _local5, _local5);
_local7._x = (inner.m_xpos + (Math.random() * 10)) - 5;
_local7._y = (inner.m_ypos + (Math.random() * 10)) + 15;
_local7._xscale = (6 - _local6) * 7;
_local7._yscale = (6 - _local6) * 7;
_local7._visible = false;
var _local8 = new Object();
_local8.mc = _local7;
_local8.delay = 1 + (_local6 * 4);
_local8.x = _local7._x;
_local8.y = _local7._y;
_local8.fx = new com.midasplayer.timing.IFloat(_local8.x);
_local8.fy = new com.midasplayer.timing.IFloat(_local8.y);
m_bubbles[_local6] = _local8;
}
var _local9 = getTargetScale(42, 40);
inner.m_clip._xscale = _local9[0];
inner.m_clip._yscale = _local9[1];
inner.m_clip._alpha = 100;
inner.m_shape.rescale(_local9[0] / 100);
m_xpos = inner.m_xpos;
m_ypos = inner.m_ypos;
m_rotation = 0;
}
function destroy() {
m_innerObject.destroy();
m_innerObject = null;
super.destroy();
}
function setDirectAlpha(amount) {
m_clip._alpha = amount;
m_innerObject.m_clip._alpha = amount;
}
function getTargetScale(maxWidth, maxHeight) {
var _local4 = m_innerObject.m_shape.getWidth();
var _local5 = m_innerObject.m_shape.getHeight();
var _local6 = _local4;
var _local7 = _local5;
if ((_local6 < maxWidth) && (_local7 < maxWidth)) {
_local7 = _local7 * (maxWidth / _local6);
_local6 = maxWidth;
}
if (_local6 > maxWidth) {
_local7 = _local7 * (maxWidth / _local6);
_local6 = maxWidth;
}
if (_local7 > maxHeight) {
_local6 = _local6 * (maxHeight / _local7);
_local7 = maxHeight;
}
var _local8 = 100 * (1 - ((_local4 - _local6) / _local4));
var _local9 = 100 * (1 - ((_local5 - _local7) / _local5));
return([_local8, _local9]);
}
function render() {
m_clip._x = m_fx.value;
m_clip._y = m_fy.value;
m_clip._rotation = m_rotation;
var _local2 = m_scale.value;
m_clip._xscale = _local2;
m_clip._yscale = _local2;
for (var i in m_bubbles) {
var _local3 = m_bubbles[i];
_local3.mc._x = _local3.fx.value;
_local3.mc._y = _local3.fy.value;
}
}
function update(tick) {
com.king.bbbathtub.Collidable.m_cTick = tick;
if (m_innerObject.m_isCaught) {
for (var i in m_bubbles) {
m_bubbles[i].mc.removeMovieClip();
}
m_bubbles = null;
m_innerObject.m_shape.rescale(1);
m_innerObject.setScale(100);
m_innerObject = null;
m_itemMgr.onKillItem(this);
return(undefined);
}
m_scale.set(((Math.sin((m_scaleWave = m_scaleWave + 0.05)) * 0.1) + 1) * 100);
var _local3 = m_xpos;
var _local4 = m_ypos;
var _local5 = m_rotation;
for (var i in m_bubbles) {
var _local6 = m_bubbles[i];
if (_local6.delay != -1) {
if (m_numUpd >= _local6.delay) {
_local6.delay = -1;
_local6.mc._visible = true;
} else {
continue;
}
}
var _local7 = _local6.x + (Math.sin(m_wave + (int(i) / 5)) * 0.5);
_local6.x = _local7;
var _local8 = _local6.y - 1.495;
_local6.y = _local8;
if (_local8 < m_avglevel) {
m_bubbles[i].mc.removeMovieClip();
delete m_bubbles[i];
} else {
m_bubbles[i].fx.set(_local7);
m_bubbles[i].fy.set(_local8);
}
}
if (_local4 > 45) {
_local3 = _local3 + (Math.sin(m_wave) * 0.5);
_local4 = _local4 - 1.5;
m_wave = m_wave + 0.122;
}
setPosition(_local3, _local4, _local5);
m_innerObject.setPosition(_local3, _local4, _local5);
m_numUpd++;
}
}
Symbol 355 MovieClip [__Packages.com.king.bbbathtub.Strawberry] Frame 0
class com.king.bbbathtub.Strawberry extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function Strawberry (c, im) {
super(c, im);
m_itemId = 11;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 21, 25.5);
}
function getWeight() {
return(30);
}
function getScore() {
return(300);
}
}
Symbol 356 MovieClip [__Packages.com.king.bbbathtub.Shark] Frame 0
class com.king.bbbathtub.Shark extends com.king.bbbathtub.TankItem
{
var m_itemId, m_bounds, m_itemMgr, m_shape, m_isMovingAround, m_tail, m_mouth, m_tailframe, m_mouthframe, m_tailNextFr, m_updCount, m_moveEnergy, m_lastX, m_lastY, m_spikesR, m_dirRad, m_dirMod, m_moffset, m_rotation, m_spikes, prepareSpikes, m_xpos, m_ypos, flip, setPosition2n, m_fx, m_clip, m_fy;
function Shark (c, im) {
super(c, im);
m_itemId = 13;
m_bounds = m_itemMgr.getBoundaries();
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 82.8, 38);
m_isMovingAround = true;
m_tail = c.tail;
m_mouth = c.mouth;
m_tailframe = 1;
m_mouthframe = 2;
m_tailNextFr = 0;
m_updCount = 0;
m_moveEnergy = 0;
m_lastX = null;
m_lastY = null;
m_spikesR = _global.NaN;
m_dirRad = 0;
m_dirMod = new com.midasplayer.timing.IFloat(0);
}
function updateShock() {
return(false);
}
function setMagicOffset(n) {
m_moffset = n;
m_tailNextFr = n / 5;
m_moveEnergy = n / 10;
}
function getWeight() {
return(90);
}
function getScore() {
return(50);
}
function onHit() {
return(true);
}
function isCollision() {
var _local2 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
if (m_spikesR != _local2) {
m_spikes = prepareSpikes(0.8, (m_spikesR = _local2));
}
return(m_bounds.mayCollide(m_xpos, m_ypos) && (m_bounds.testSpikes(m_spikes, m_xpos, m_ypos)));
}
function update(tick) {
com.king.bbbathtub.Collidable.m_cTick = tick;
var _local3 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
if (m_spikesR != _local3) {
m_spikes = prepareSpikes(0.8, (m_spikesR = _local3));
}
if (m_bounds.testSpikesWater(m_spikes, m_xpos, m_ypos)) {
if (m_lastX != null) {
m_xpos = m_lastX;
m_ypos = m_lastY;
}
flip();
_local3 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
}
if (m_tailNextFr <= m_updCount) {
if (m_tailframe == 1) {
m_tailframe = 2;
m_tailNextFr = m_updCount + 5;
m_moveEnergy = 8;
} else {
m_tailframe = 1;
m_tailNextFr = m_updCount + 10;
}
}
var _local4 = ((m_moveEnergy = m_moveEnergy * 0.9)) / 2;
var _local5 = Math.cos(_local3) * _local4;
var _local6 = Math.sin(_local3) * _local4;
m_lastX = m_xpos;
m_lastY = m_ypos;
setPosition2n(m_xpos + _local5, m_ypos + _local6);
m_updCount++;
}
function updateCaught(hookX, hookY, hookAngle) {
m_dirMod.set(270 + (Math.sin(m_dirRad * 2) * 15));
m_dirRad = m_dirRad + 0.9;
m_mouthframe = 1;
m_tailframe = int(((m_moffset + com.king.bbbathtub.Collidable.m_cTick) % 4) / 2) + 1;
super.updateCaught(hookX, hookY, hookAngle);
}
function render() {
m_clip._x = m_fx.value;
m_clip._y = m_fy.value;
m_clip._rotation = m_rotation + m_dirMod.value;
m_tail.gotoAndStop(m_tailframe);
m_mouth.gotoAndStop(m_mouthframe);
}
}
Symbol 357 MovieClip [__Packages.com.king.bbbathtub.Gull] Frame 0
class com.king.bbbathtub.Gull extends com.king.bbbathtub.TankItem
{
var m_itemId, m_collisionEnabled, m_shape, m_bounds, m_itemMgr, m_entered, m_started, m_initialState, m_dirRad, m_dirMod, m_isMovingAround, m_frame, m_bird, m_clip, m_minDist, m_moffset, m_xpos, m_ypos, m_fx, m_fy, m_rotation, m_startDelay, m_numUpd, m_lastX, m_lastY, flip, setPosition2n;
function Gull (c, im) {
super(c, im);
m_itemId = 19;
m_collisionEnabled = false;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 65, 25);
m_bounds = m_itemMgr.getBoundaries();
m_entered = false;
m_started = false;
m_initialState = false;
m_dirRad = 0;
m_dirMod = new com.midasplayer.timing.IFloat(0);
m_isMovingAround = true;
m_frame = 1;
m_bird = m_clip.bird;
m_minDist = 10;
}
function setMagicOffset(n) {
m_moffset = n;
m_frame = n % 36;
}
function updateShock() {
return(false);
}
function getWeight() {
return(70);
}
function getScore() {
return(50);
}
function setStartDelay(valueMs) {
super.setStartDelay(valueMs);
if (valueMs != 0) {
m_clip._visible = false;
}
}
function isCollision() {
return(m_entered && (m_bounds.minEdgeDistance(m_xpos, m_ypos) < m_minDist));
}
function render() {
m_clip._x = m_fx.value;
m_clip._y = m_fy.value;
m_clip._rotation = m_rotation + m_dirMod.value;
m_bird.gotoAndStop(m_frame + 1);
}
function updateCaught(hookX, hookY, hookAngle) {
m_frame = int((com.king.bbbathtub.Collidable.m_cTick * 6) % 36) + 1;
m_dirMod.set(270 + (Math.sin(m_dirRad * 2) * 20));
m_dirRad = m_dirRad + 0.9;
super.updateCaught(hookX, hookY, hookAngle);
}
function update(tick) {
com.king.bbbathtub.Collidable.m_cTick = tick;
var _local3 = m_bounds.minEdgeDistance(m_xpos, m_ypos);
var _local4 = 0;
var _local5 = 0;
if (!m_started) {
if (m_numUpd == m_startDelay) {
m_initialState = m_bounds.isInside(m_xpos, m_ypos);
m_started = true;
m_clip._visible = true;
m_collisionEnabled = true;
m_entered = m_initialState;
}
} else {
if (m_entered && (_local3 <= m_minDist)) {
m_xpos = m_lastX;
m_ypos = m_lastY;
flip();
} else if ((_local3 > (m_minDist * 1.5)) && (m_bounds.isInside(m_xpos, m_ypos))) {
m_entered = true;
}
var _local6 = m_rotation * com.king.bbbathtub.Collidable.DEGREE_TO_RADIAN;
_local4 = Math.cos(_local6) * 2.5;
_local5 = (Math.sin(_local6) * 2.5) + (0.5 * Math.cos((((35 - m_frame) / 35) * Math.PI) * 2));
if ((++m_frame) >= 36) {
m_frame = 0;
}
}
m_lastX = m_xpos;
m_lastY = m_ypos;
setPosition2n(m_xpos + _local4, m_ypos + _local5);
m_numUpd++;
}
}
Symbol 358 MovieClip [__Packages.com.king.bbbathtub.RingGull] Frame 0
class com.king.bbbathtub.RingGull extends com.king.bbbathtub.Gull
{
var m_itemId, m_shape;
function RingGull (c, im) {
super(c, im);
m_itemId = 21;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 65, 40);
}
function getWeight() {
return(60);
}
function getScore() {
return(300);
}
}
Symbol 359 MovieClip [__Packages.com.king.bbbathtub.RingShark] Frame 0
class com.king.bbbathtub.RingShark extends com.king.bbbathtub.Shark
{
var m_itemId;
function RingShark (c, im) {
super(c, im);
m_itemId = 22;
}
function getWeight() {
return(93);
}
function getScore() {
return(300);
}
}
Symbol 360 MovieClip [__Packages.com.king.bbbathtub.Shampoo] Frame 0
class com.king.bbbathtub.Shampoo extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function Shampoo (c, im) {
super(c, im);
m_itemId = 9;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 28.5, 72.8);
}
function getWeight() {
return(30);
}
function getScore() {
return(200);
}
}
Symbol 361 MovieClip [__Packages.com.king.bbbathtub.Sandwich] Frame 0
class com.king.bbbathtub.Sandwich extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function Sandwich (c, im) {
super(c, im);
m_itemId = 8;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 57, 35.2);
}
function getWeight() {
return(20);
}
function getScore() {
return(200);
}
}
Symbol 362 MovieClip [__Packages.com.king.bbbathtub.Champagne] Frame 0
class com.king.bbbathtub.Champagne extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function Champagne (c, im) {
super(c, im);
m_itemId = 3;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 26.3, 59.2);
}
function getWeight() {
return(30);
}
function getScore() {
return(300);
}
}
Symbol 363 MovieClip [__Packages.com.king.bbbathtub.GoldenHits] Frame 0
class com.king.bbbathtub.GoldenHits extends com.king.bbbathtub.TankItem
{
var m_frame, m_delay, m_itemId, m_shape, m_isMovingAround, m_fx, m_clip, m_fy, setPosition2n, m_xpos, m_ypos;
function GoldenHits (c, im) {
super(c, im);
m_frame = 1;
m_delay = 0;
m_itemId = 14;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 24, 24);
m_isMovingAround = true;
}
function getWeight() {
return(10);
}
function getScore() {
return(500);
}
function render() {
m_clip._x = m_fx.value;
m_clip._y = m_fy.value;
m_clip.innerobject.gotoAndStop(m_frame);
}
function update(tick) {
if ((--m_delay) < 0) {
m_delay = 1;
if ((++m_frame) == 26) {
m_frame = 1;
}
}
setPosition2n(m_xpos, m_ypos);
}
}
Symbol 364 MovieClip [__Packages.com.king.bbbathtub.InflatableBall] Frame 0
class com.king.bbbathtub.InflatableBall extends com.king.bbbathtub.TankItem
{
var m_itemId, m_exploded, m_shape, m_itemMgr, m_xpos, m_ypos;
function InflatableBall (c, im) {
super(c, im);
m_itemId = 7;
m_exploded = false;
m_shape = new com.king.bbbathtub.BoundOctagon(0, 0, 52, 52);
}
function getWeight() {
return(1);
}
function getScore() {
return(0);
}
function onHit() {
if (!m_exploded) {
var _local2 = m_itemMgr.getParentClip();
var _local3 = _local2.attachMovie("pow", "pow_" + this, _local2.getNextHighestDepth());
_local3._x = m_xpos;
_local3._y = m_ypos;
_local3._rotation = (Math.random() * 60) - 30;
com.midasplayer.fx.SoundManager.play("pop");
m_exploded = true;
m_itemMgr.onShockwave(m_xpos, m_ypos, 12, this);
}
return(false);
}
}
Symbol 365 MovieClip [__Packages.com.king.bbbathtub.Duck] Frame 0
class com.king.bbbathtub.Duck extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function Duck (c, im) {
super(c, im);
m_itemId = 4;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 39, 40);
}
function getWeight() {
return(40);
}
function getScore() {
return(200);
}
}
Symbol 366 MovieClip [__Packages.com.king.bbbathtub.Goldbar] Frame 0
class com.king.bbbathtub.Goldbar extends com.king.bbbathtub.TankItem
{
var m_fallFact, m_itemId, m_yoffset, m_isMovingAround, m_falling, m_shape, m_bounds, m_itemMgr, flipImage, m_xpos, m_lastX, m_ypos, m_lastY, m_avglevel, setPosition2n;
function Goldbar (c, im) {
super(c, im);
m_fallFact = 1;
m_itemId = 18;
m_yoffset = -14;
m_isMovingAround = true;
m_falling = true;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 40, 28);
m_bounds = m_itemMgr.getBoundaries();
if (Math.random() > 0.5) {
flipImage();
}
}
function getWeight() {
return(80);
}
function getScore() {
return(500);
}
function update(tick) {
com.king.bbbathtub.Collidable.m_cTick = tick;
var _local3 = m_xpos;
m_lastX = m_xpos;
var _local4 = m_ypos;
m_lastY = m_ypos;
if (m_falling) {
var _local5 = ((_local4 < m_avglevel) ? 1.2 : 0.875);
_local4 = _local4 + ((m_fallFact = m_fallFact * _local5));
m_fallFact = Math.max(0.67, m_fallFact);
if (!m_bounds.isInside(_local3, _local4)) {
var _local6 = 50;
while (_local6-- , (_local6 > 0) && (!m_bounds.isInside(_local3, _local4))) {
_local4 = _local4 - 0.5;
}
m_falling = false;
m_isMovingAround = false;
}
}
setPosition2n(_local3, _local4);
}
}
Symbol 367 MovieClip [__Packages.com.king.bbbathtub.Sponge] Frame 0
class com.king.bbbathtub.Sponge extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function Sponge (c, im) {
super(c, im);
m_itemId = 10;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 41, 29);
}
function getWeight() {
return(30);
}
function getScore() {
return(200);
}
}
Symbol 368 MovieClip [__Packages.com.king.bbbathtub.Brush] Frame 0
class com.king.bbbathtub.Brush extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function Brush (c, im) {
super(c, im);
m_itemId = 2;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 18, 93);
}
function getWeight() {
return(10);
}
function getScore() {
return(100);
}
}
Symbol 369 MovieClip [__Packages.com.king.bbbathtub.HangingSoap] Frame 0
class com.king.bbbathtub.HangingSoap extends com.king.bbbathtub.TankItem
{
var m_itemId, m_shape;
function HangingSoap (c, im) {
super(c, im);
m_itemId = 6;
m_shape = new com.king.bbbathtub.BoundBox(0, 0, 18, 74);
}
function getWeight() {
return(30);
}
function getScore() {
return(100);
}
}
Symbol 370 MovieClip [__Packages.com.king.bbbathtub.LevelOverPlate] Frame 0
class com.king.bbbathtub.LevelOverPlate extends com.midasplayer.fx.Plate
{
var title_txt, qualify_txt, qualify_count_txt, score_txt, score_count_txt, stopDisplayTime, _visible;
function LevelOverPlate () {
super();
}
function init(score, qualify, quit) {
title_txt.text = com.midasplayer.util.I18n.getString("level_over");
qualify_txt.text = com.midasplayer.util.I18n.getString("qualify");
qualify_count_txt.text = qualify;
score_txt.text = com.midasplayer.util.I18n.getString("current_score");
score_count_txt.text = score;
stopDisplayTime = getTimer() + 10000;
_visible = true;
}
}
Symbol 371 MovieClip [__Packages.com.king.bbbathtub.BBPlate] Frame 0
class com.king.bbbathtub.BBPlate extends MovieClip
{
var m_thisClip, m_bubbles, m_head, m_loader, m_headList, _visible, self, exitDelay, exitCallback, m_exitAnim, swapDepths, removeMovieClip, m_enterAnim, stopDisplayTime, boatX, m_boat, createEmptyMovieClip, getNextHighestDepth;
function BBPlate () {
super();
m_thisClip = this;
m_bubbles = {};
m_head = {};
m_loader = [];
m_headList = [];
_visible = false;
self = this;
exitDelay = -1;
}
function setExitEvent(fn) {
exitCallback = fn;
}
function remove() {
_root._quality = "medium";
for (var i in m_headList) {
m_headList[i].clip.onPressFunction = undefined;
m_headList[i].clip.onRollOverFunction = undefined;
m_headList[i].clip.onRollOutFunction = undefined;
}
m_exitAnim = new com.midasplayer.util.EaseInQuadAnimator(this);
m_exitAnim.setPosition(115 + 686, 126);
m_exitAnim.setDuration(750);
exitDelay = getTimer() + 800;
}
function destroy() {
onEnterFrame = undefined;
swapDepths(1048000);
removeMovieClip();
}
function onEnterFrame() {
if (m_enterAnim != undefined) {
if (m_enterAnim.update()) {
m_enterAnim = undefined;
}
}
if (m_exitAnim != undefined) {
if (m_exitAnim.update()) {
m_exitAnim = undefined;
}
}
var _local2 = getTimer();
var _local3 = stopDisplayTime - _local2;
if (_local3 < 0) {
_local3 = 0;
}
_local3 = _local3 / 1000;
_local3 = Math.ceil(_local3);
self.next_level_txt.text = com.midasplayer.util.I18n.getString("count_down_text", _local3);
if (exitDelay != -1) {
if (_local2 > (exitDelay - 550)) {
if (exitCallback) {
exitCallback(this);
exitCallback = undefined;
}
}
if (_local2 > exitDelay) {
if (exitCallback) {
exitCallback(this);
exitCallback = undefined;
}
onEnterFrame = undefined;
swapDepths(1048000);
removeMovieClip();
}
} else if (_local2 > stopDisplayTime) {
remove();
}
}
function init(xmlHeadNodes, boat, titleTxt1, titleTxt2) {
boatX = boat.getPosX();
m_enterAnim = new com.midasplayer.util.EaseOutQuadAnimator(this);
m_enterAnim.setPosition(115, 126);
m_enterAnim.setDuration(750);
m_boat = boat;
var _local6 = 40;
var _local7 = 78;
var _local8 = 217;
var _local9 = 204;
var _local10 = _local8 - _local6;
var _local11 = _local9 - _local7;
var _local12 = 0;
var _local13 = 0;
var _local14 = 0;
var _local15 = xmlHeadNodes.length;
for ( ; _local14 < _local15 ; _local14++) {
var _local16 = new Object();
var _local17 = xmlHeadNodes[_local14].attributes;
_local16.id = _local17.id;
_local16.url = _local17.url;
_local16.config = _local17.config;
var _local18 = "headcontainer-" + _local16.id;
_local16.clip = createEmptyMovieClip(_local18, getNextHighestDepth());
_local16.clip._visible = false;
var _local19 = _local16.clip.createEmptyMovieClip("head", _local16.clip.getNextHighestDepth());
_local16.clip.attachMovie("headbubble", "bubble", _local16.clip.getNextHighestDepth());
var _local20 = _local16.clip.attachMovie("headbubble_mask", "_mask", _local16.clip.getNextHighestDepth());
_local16.clip.setMask(_local20);
_local16.clip.onPressFunction = mx.utils.Delegate.create(this, onSelectHead);
_local16.clip.onRollOverFunction = mx.utils.Delegate.create(this, onPreviewHead);
_local16.clip.onRollOutFunction = mx.utils.Delegate.create(this, onHidePreview);
_local16.clip.headname = _local17.name;
m_loader[_local14] = new com.king.bbbathtub.ImageLoader(_local16.url, _local19, onLoaded);
var _local21 = parseHeadConfig(_local16.config);
_local19._x = (-_local21.mx) * 0.5;
_local19._y = ((-_local21.my) * 0.5) + 20;
var _local22 = (_local6 + (_local12 * 50)) + (((_local13 % 2) == 1) ? 10 : 0);
var _local23 = _local7 + (_local13 * 62);
_local12++;
if (_local12 > 3) {
_local12 = 0;
_local13++;
}
m_bubbles[_local18] = {x:_local22, y:_local23};
_local16.clip._x = _local22;
_local16.clip._y = _local23;
m_headList.push(_local16);
m_head[_local18] = _local16;
}
self.game_name_txt.text = titleTxt1;
self.title_txt.text = titleTxt2;
onPreviewHead(m_headList[int(Math.random() * m_headList.length)].clip._name);
stopDisplayTime = getTimer() + 10000;
_visible = true;
}
function onSelectHead(name) {
if (!m_lastHeadLoaded) {
m_exitOnNextLoad = true;
} else {
remove();
}
}
function onPreviewHead(name) {
var _local3 = this[name];
var _local4 = m_head[name];
_local3.bubble.gotoAndStop(3);
m_boat.setHead(_local4.url, _local4.config, null, mx.utils.Delegate.create(this, onHeadLoaded));
m_lastHeadLoaded = false;
}
function onHeadLoaded() {
m_lastHeadLoaded = true;
m_boat.setVisible(true);
if (m_exitOnNextLoad) {
remove();
}
}
function onHidePreview(name) {
var _local3 = this[name];
_local3.bubble.gotoAndStop(2);
m_boat.setVisible(false);
}
function onLoaded(clip, error) {
if (clip != null) {
clip._xscale = 50;
clip._yscale = 50;
clip._parent.bubble.gotoAndStop(2);
var _local4 = clip._parent._parent.getNextHighestDepth();
var _local5 = clip._parent._parent.attachMovie("headbubble_text", clip._parent._name + "_nametag", _local4);
_local5._x = clip._parent._x;
_local5._y = clip._parent._y + 20;
_local5.name_txt.text = clip._parent.headname;
clip._parent.onRollOver = function () {
this.onRollOverFunction(this._name);
};
clip._parent.onRollOut = function () {
this.onRollOutFunction(this._name);
};
clip._parent.onPress = function () {
this.onPressFunction(this._name);
};
clip._parent._visible = true;
} else {
clip._parent.removeMovieClip();
}
}
function parseHeadConfig(c) {
var _local3 = new Object();
var _local4 = c.split(",");
var _local5 = 0;
for ( ; _local5 < _local4.length ; _local5++) {
var _local6 = _local4[_local5].split("=");
_local3[_local6[0]] = _global.parseFloat(_local6[1]);
}
return(_local3);
}
var m_lastHeadLoaded = false;
var m_exitOnNextLoad = false;
}
Symbol 372 MovieClip [__Packages.com.midasplayer.util.EaseInQuadAnimator] Frame 0
class com.midasplayer.util.EaseInQuadAnimator extends com.midasplayer.util.Animator
{
var dt, duration, x, startX, dx, y, startY, dy, fillBaseCopy;
function EaseInQuadAnimator (o) {
super(o);
}
function nextPosition() {
var _local2 = dt * dt;
var _local3 = duration * duration;
x = ((dx * _local2) / _local3) + startX;
y = ((dy * _local2) / _local3) + startY;
}
function makeCopy(t) {
var _local3 = new com.midasplayer.util.EaseInQuadAnimator();
fillBaseCopy(t, _local3);
return(_local3);
}
}
Symbol 373 MovieClip [__Packages.com.midasplayer.util.EaseOutQuadAnimator] Frame 0
class com.midasplayer.util.EaseOutQuadAnimator extends com.midasplayer.util.Animator
{
var dt, duration, x, startX, dx, y, startY, dy;
function EaseOutQuadAnimator (o) {
super(o);
}
function nextPosition() {
var _local2 = dt;
var _local3 = duration * duration;
if (_local2 > duration) {
_local2 = duration;
}
var _local4 = _local2 * _local2;
x = ((((-dx) * _local4) / _local3) + (((2 * dx) * _local2) / duration)) + startX;
y = ((((-dy) * _local4) / _local3) + (((2 * dy) * _local2) / duration)) + startY;
}
}
Symbol 374 MovieClip [__Packages.com.king.bbbathtub.IntroPlate] Frame 0
class com.king.bbbathtub.IntroPlate extends com.midasplayer.fx.Plate
{
var m_slave, _visible, self, exitDelay, m_exitAnim, m_boatAnim, m_beginAt, m_mouseAnim, m_boat, m_enterAnim, stopDisplayTime, exitCallback, swapDepths, removeMovieClip, m_boatX, m_boatY;
function IntroPlate () {
super();
m_slave = {_x:0, _y:0};
_visible = false;
self = this;
exitDelay = -1;
}
function remove() {
_root._quality = "medium";
m_exitAnim = new com.midasplayer.util.EaseInQuadAnimator(this);
m_exitAnim.setPosition(115 + 686, 126);
m_exitAnim.setDuration(750);
m_boatAnim = new com.midasplayer.util.EaseInBackAnimator(m_slave);
m_boatAnim.setPosition(378.017498833357, 273.793400011666);
m_boatAnim.setDuration(750);
exitDelay = getTimer() + 800;
}
function onEnterFrame() {
var _local2 = getTimer();
if (m_beginAt < 0) {
m_beginAt = _local2;
}
var _local3 = _local2 - m_beginAt;
var _local4 = 0;
for ( ; (_local3 > m_timeline[_local4][1]) && (_local4 < m_timeline.length) ; _local4++) {
}
if (_local4 < m_timeline.length) {
_local4--;
if ((m_lastIdx != _local4) && (_local3 > m_timeline[_local4][1])) {
var _local5 = m_timeline[_local4][0];
var _local6 = (((_local4 + 1) < m_timeline.length) ? (m_timeline[_local4 + 1][1] - m_timeline[_local4][1]) : 1000);
switch (_local5) {
case 0 :
m_mouseAnim = new com.midasplayer.util.EaseInQuadAnimator(self.mouse);
m_mouseAnim.setPosition(self.mouse._x, self.mouse._y - 100);
m_mouseAnim.setDuration(_local6);
break;
case 1 :
m_mouseAnim = new com.midasplayer.util.EaseInQuadAnimator(self.mouse);
m_mouseAnim.setPosition(self.mouse._x, self.mouse._y + 100);
m_mouseAnim.setDuration(_local6);
break;
case 2 :
self.mouse.gotoAndStop(2);
if (self.mouse._y < 140) {
m_boat.getHarpoonSky().releaseHarpoon();
} else {
m_boat.getHarpoonWater().releaseHarpoon();
}
break;
case 3 :
self.mouse.gotoAndStop(1);
break;
}
m_lastIdx = _local4;
}
}
if (self.mouse._y < 140) {
m_boat.setHilightState(true, false);
} else {
m_boat.setHilightState(false, true);
}
if (m_mouseAnim != undefined) {
if (m_mouseAnim.update()) {
m_mouseAnim = undefined;
}
}
if (m_enterAnim != undefined) {
if (m_enterAnim.update()) {
m_enterAnim = undefined;
}
}
if (m_boatAnim != undefined) {
if (m_boatAnim.update()) {
m_boatAnim = undefined;
}
m_boat.setPosition(m_slave._x, m_slave._y);
}
if (m_exitAnim != undefined) {
if (m_exitAnim.update()) {
m_exitAnim = undefined;
} else {
var _local7 = m_exitAnim.getElapsed();
_local7 = _local7 * 2;
_local7 = Math.min(1, _local7);
}
}
var _local8 = stopDisplayTime - _local2;
if (_local8 < 0) {
_local8 = 0;
}
_local8 = _local8 / 1000;
_local8 = Math.ceil(_local8);
self.next_level_txt.text = com.midasplayer.util.I18n.getString("count_down_text", _local8);
if (exitDelay != -1) {
if (_local2 > exitDelay) {
if (exitCallback) {
exitCallback(this);
exitCallback = undefined;
}
onEnterFrame = undefined;
swapDepths(1048000);
removeMovieClip();
}
} else if (_local2 > stopDisplayTime) {
remove();
}
}
function init(boat) {
m_enterAnim = new com.midasplayer.util.EaseOutQuadAnimator(this);
m_enterAnim.setPosition(115, 126);
m_enterAnim.setDuration(750);
self.title_txt.text = com.midasplayer.util.I18n.getString("intro_title");
self.message_txt.text = com.midasplayer.util.I18n.getString("intro_msg");
m_boat = boat;
m_boatX = m_boat.getPosX();
m_slave._x = m_boatX;
m_slave._y = m_boatY;
m_boatY = m_boat.getPosY();
stopDisplayTime = getTimer() + 15000;
_visible = true;
_root._quality = "high";
self.mouse.gotoAndStop(1);
m_beginAt = -1;
}
var m_timeline = [[0, 1500], [5, 2000], [1, 3500], [5, 4000], [2, 5000], [3, 6000], [0, 7500], [5, 8000], [2, 9000], [3, 10000], [5, 11000]];
var m_lastIdx = -1;
}
Symbol 375 MovieClip [__Packages.com.midasplayer.util.EaseInBackAnimator] Frame 0
class com.midasplayer.util.EaseInBackAnimator extends com.midasplayer.util.Animator
{
var back, dt, duration, x, startX, dx, y, startY, dy;
function EaseInBackAnimator (o, backStep) {
super(o);
back = (backStep ? (backStep) : 1.516);
}
function nextPosition() {
var _local2 = dt;
_local2 = _local2 / duration;
x = (((dx * _local2) * _local2) * (((back + 1) * _local2) - back)) + startX;
_local2 = dt;
_local2 = _local2 / duration;
y = (((dy * _local2) * _local2) * (((back + 1) * _local2) - back)) + startY;
}
}
Symbol 376 MovieClip [__Packages.com.king.bbbathtub.GameOverPlate] Frame 0
class com.king.bbbathtub.GameOverPlate extends com.midasplayer.fx.Plate
{
var title_txt, score_txt, score_count_txt, qualify_txt, qualify_count_txt, qualify_msg_txt, stopDisplayTime, _visible;
function GameOverPlate () {
super();
}
function init(score, qualify, quit) {
title_txt.text = com.midasplayer.util.I18n.getString("game_over");
score_txt.text = com.midasplayer.util.I18n.getString("current_score");
score_count_txt.text = score;
if (quit || (qualify != 0)) {
qualify_txt.text = com.midasplayer.util.I18n.getString("qualify");
qualify_count_txt.text = qualify;
if (score < qualify) {
qualify_msg_txt.text = com.midasplayer.util.I18n.getString("not_enough");
}
}
stopDisplayTime = getTimer() + 10000;
_visible = true;
}
}