Frame 1
function onGameDataLoaded() {
var _local2 = new bw.Game(_root);
_local2.init(gd);
}
var gd = null;
gd = new com.midasplayer.util.GameDataAcquirer();
gd.beginWait(mx.utils.Delegate.create(this, onGameDataLoaded));
Symbol 78 MovieClip [scoreboard] Frame 1
#initclip 64
Object.registerClass("scoreboard", bw.ScoreBoard);
#endinitclip
Symbol 104 MovieClip [arrow_down] Frame 1
#initclip 55
Object.registerClass("arrow_down", bw.AnimDriver50Fps);
#endinitclip
Symbol 107 MovieClip [arrow_left] Frame 1
#initclip 56
Object.registerClass("arrow_left", bw.AnimDriver50Fps);
#endinitclip
Symbol 130 MovieClip [arrow_spin_left] Frame 1
#initclip 57
Object.registerClass("arrow_spin_left", bw.AnimDriver50Fps);
#endinitclip
Symbol 153 MovieClip [arrow_spin_right] Frame 1
#initclip 58
Object.registerClass("arrow_spin_right", bw.AnimDriver50Fps);
#endinitclip
Symbol 158 MovieClip [illu_mouse_anim] Frame 1
#initclip 59
Object.registerClass("illu_mouse_anim", bw.AnimDriver50Fps);
#endinitclip
Symbol 160 MovieClip [illu_mouse] Frame 2
stop();
Symbol 161 MovieClip [illustration] Frame 1
stop();
Symbol 171 MovieClip [gamectrl_buttons] Frame 1
Symbol 182 MovieClip [bowlingball] Frame 1
#initclip 60
Object.registerClass("bowlingball", bw.BowlingBall);
#endinitclip
Symbol 1024 MovieClip [pintable_marker] Frame 1
stop();
Symbol 1024 MovieClip [pintable_marker] Frame 12
stop();
Symbol 1029 MovieClip [turn_light] Frame 1
stop();
Symbol 1050 MovieClip [digits] Frame 1
stop();
Symbol 1106 MovieClip [signs] Frame 1
#initclip 61
Object.registerClass("signs", bw.BigSign);
#endinitclip
stop();
Symbol 1144 MovieClip [spin-o-meter] Frame 1
stop();
Symbol 1150 MovieClip [power-meter] Frame 1
#initclip 62
Object.registerClass("power-meter", bw.PowerMeter);
#endinitclip
stop();
Symbol 1180 MovieClip [disco] Frame 1
#initclip 63
Object.registerClass("disco", bw.AnimDriver50Fps);
#endinitclip
Symbol 1181 MovieClip [__Packages.com.midasplayer.timing.Timeable] Frame 0
class com.midasplayer.timing.Timeable
{
function Timeable () {
}
}
Symbol 1182 MovieClip [__Packages.bw.KingGame] Frame 0
class bw.KingGame implements com.midasplayer.timing.Timeable
{
var m_parent, m_performance, m_lastFps, m_forcedLow, m_enableFrameRate, m_soundsEnabled, m_mainTimer;
function KingGame (gameParent) {
m_parent = gameParent;
var _local3 = new ContextMenu();
_local3.hideBuiltInItems();
_local3.builtInItems.quality = true;
_root.menu = _local3;
_root._quality = "low";
Stage.scaleMode = "noScale";
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_lastFps = "";
m_forcedLow = false;
m_enableFrameRate = true;
m_soundsEnabled = true;
}
function start() {
m_mainTimer = new com.midasplayer.timing.Timer(this, 25);
m_parent.onEnterFrame = mx.utils.Delegate.create(this, drive);
}
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.btnpanel.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 = 120;
static var MEASURE_TIME = 6;
static var MIN_FPS = 8;
}
Symbol 1183 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 1184 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 1185 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 1186 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 1187 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 1188 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 1189 MovieClip [__Packages.com.midasplayer.util.Iterator] Frame 0
class com.midasplayer.util.Iterator
{
function Iterator () {
}
}
Symbol 1190 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 1191 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 1192 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 1193 MovieClip [__Packages.bw.Game] Frame 0
class bw.Game extends bw.KingGame
{
var m_eeEnabled, m_quitJumped, m_quitAddr, m_soundEnabled, m_gameQuit, m_state, m_halt, m_resultFlag, m_execListPc, m_returnCode, m_buttons, m_soundBtn, m_quitBtn, m_lastKeys, m_buildVisible, m_data, m_parent, m_gda, start, m_mainTimer, m_prevStateFinalFrame, m_runState;
function Game (m_parent) {
super(m_parent);
m_eeEnabled = false;
m_quitJumped = false;
m_quitAddr = 0;
m_soundEnabled = true;
m_gameQuit = false;
m_state = null;
m_halt = false;
m_resultFlag = false;
m_execListPc = 0;
m_returnCode = 0;
m_buttons = m_parent.attachMovie("gamectrl_buttons", "btnpanel", m_parent.getNextHighestDepth());
m_buttons._x = 2;
m_buttons._y = 555;
m_buttons.version_txt._visible = false;
m_buttons.fpsmeter_txt._visible = false;
m_soundBtn = m_buttons.btn_sound;
m_quitBtn = m_buttons.btn_quit;
m_soundBtn.onPress = mx.utils.Delegate.create(this, onSoundToggle);
m_quitBtn.onPress = mx.utils.Delegate.create(this, onQuit);
m_quitBtn.swapDepths(m_parent.getNextHighestDepth());
m_quitBtn.txt.text = com.midasplayer.util.I18n.getString("btn_quit_game");
m_soundBtn.swapDepths(m_parent.getNextHighestDepth());
m_soundBtn.txt.text = com.midasplayer.util.I18n.getString("btn_sound_off");
updateSoundState();
m_lastKeys = new Array(10);
m_buildVisible = false;
Key.addListener(this);
}
function updateSoundState() {
com.midasplayer.fx.SoundManager.enableSounds(m_soundEnabled);
m_soundBtn.txt.text = (m_soundEnabled ? (com.midasplayer.util.I18n.getString("btn_sound_off")) : (com.midasplayer.util.I18n.getString("btn_sound_on")));
}
function onSoundToggle() {
m_soundEnabled = !m_soundEnabled;
updateSoundState();
}
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 = true;
var _local6 = [68, 76, 73, 85, 66, -1, -1, -1, -1, -1];
var _local7 = true;
var _local8 = 0;
var _local9 = m_lastKeys.length;
for ( ; (_local7 || (_local5)) && (_local8 < _local9) ; _local8++) {
var _local10 = m_lastKeys[_local8];
var _local11 = _local4[_local8];
if ((_local10 != _local11) && (_local11 != -1)) {
_local5 = false;
}
_local11 = _local6[_local8];
if ((_local10 != _local11) && (_local11 != -1)) {
_local7 = false;
}
}
if (_local5) {
m_eeEnabled = !m_eeEnabled;
m_data.ee = m_eeEnabled;
}
if (_local7) {
m_buildVisible = !m_buildVisible;
m_parent.btnpanel.version_txt._visible = m_buildVisible;
m_parent.btnpanel.fpsmeter_txt._visible = m_buildVisible;
}
}
function onQuit() {
if ((!m_gameQuit) && (m_state)) {
m_gameQuit = true;
m_state.quitGame();
}
}
function init(gda) {
m_gda = gda;
start();
}
function gameInit() {
m_gameQuit = false;
m_quitJumped = false;
var _local2 = AUTO_VERSION.split("_")[1];
var _local3 = AUTO_VERSION.split("_")[2];
m_data = new Object();
m_data.version = _global.parseInt(_local2.substring(1, _local2.length - 1));
m_data.buildDate = new Date();
var _local4 = _global.parseInt(_local3, 16);
m_data.buildDate.setTime(_local4);
m_data.fancyBonus = 0;
m_data.isRelaxMode = m_gda.getGameData("relaxMode") == "true";
m_data.currentSquare = 0;
m_data.millisPerTick = m_mainTimer.getMillisPerTick();
m_data.ticksPerSec = m_mainTimer.getTicksPerSecond();
m_data.lang = m_gda.getGameData("lang");
m_data.username = m_gda.getGameData("username");
m_data.totalScore = 0;
m_data.timeBonus = 0;
m_data.ballResult = new Array();
m_data.seed = m_gda.getGameData("randomseed");
m_data.dataPath = m_gda.getGameData("path");
m_data.tick = -1;
m_data.alpha = -1;
var _local5 = m_gda.getGameData("frames");
if (_local5 == undefined) {
_local5 = 10;
} else {
_local5 = _global.parseInt(_local5);
}
m_data.numFrames = _local5;
m_data.rng = new com.midasplayer.util.Random(m_data.seed);
m_data.ee = false;
var _local6 = m_data.buildDate;
var _local7 = _local6.getHours();
if (_local7 < 10) {
_local7 = "0" + _local7;
}
var _local8 = _local6.getMinutes();
if (_local8 < 10) {
_local8 = "0" + _local8;
}
var _local9 = _local6.getSeconds();
if (_local9 < 10) {
_local9 = "0" + _local9;
}
var _local10 = [_local7, _local8, _local9].join(":");
var _local11 = _local6.getFullYear();
var _local12 = _local6.getMonth() + 1;
if (_local12 < 10) {
_local12 = "0" + _local12;
}
var _local13 = _local6.getDate();
if (_local13 < 10) {
_local13 = "0" + _local13;
}
var _local14 = [_local11, _local12, _local13].join("-");
m_parent.btnpanel.version_txt.text = ((((("BUILD: " + m_data.version) + " @ ") + _local14) + " ") + _local10) + " dr-m";
_root.onBeginProfile();
}
function tick(tick) {
m_data.tick = tick;
if (m_halt) {
return(undefined);
}
if ((m_state == null) || (m_state.isDisengage())) {
var _local3 = false;
if ((m_execListPc < 0) || (m_execListPc >= m_execList.length)) {
m_halt = true;
return(undefined);
}
if (m_state && (m_state.isDisengage())) {
m_state.disengage();
m_prevStateFinalFrame = m_state.getFramebuffer();
m_returnCode = m_state.returnCode();
m_state.destroy();
m_state = null;
}
if ((!m_quitJumped) && (m_gameQuit)) {
m_execListPc = m_quitAddr;
m_quitJumped = true;
}
while (!_local3) {
var _local4 = m_execList[m_execListPc++];
var _local5 = _local4.split(" ");
switch (_local5[0]) {
case "qu" :
m_quitAddr = _global.parseInt(_local5[1]);
break;
case "init" :
gameInit();
break;
case "nop" :
break;
case "st" :
var _local6 = _local5[1];
m_runState = _local6;
switch (_local6) {
case "gameover" :
m_state = new bw.StateGameOver(m_parent, tick, m_data, _local5[2]);
m_gameQuit = true;
m_quitJumped = true;
break;
case "game" :
m_state = new bw.StateGame(m_parent, tick, m_data, _local5[2]);
break;
case "intro" :
m_state = new bw.StateIntro(m_parent, tick, m_data, _local5[2]);
break;
default :
m_halt = true;
return(undefined);
}
m_state.copyFramebuffer(m_prevStateFinalFrame);
m_state.engage();
m_state.initCurtain();
m_buttons.swapDepths(m_parent.getNextHighestDepth());
_local3 = true;
break;
case "stop" :
_root.onEndProfile();
m_halt = true;
_local3 = true;
break;
case "cmp" :
m_resultFlag = _global.parseInt(_local5[1]) == m_returnCode;
break;
case "beq" :
if (m_resultFlag) {
m_execListPc--;
m_execListPc = m_execListPc + _global.parseInt(_local5[1]);
}
break;
case "bne" :
if (!m_resultFlag) {
m_execListPc--;
m_execListPc = m_execListPc + _global.parseInt(_local5[1]);
}
break;
case "bra" :
m_execListPc--;
m_execListPc = m_execListPc + _global.parseInt(_local5[1]);
break;
default :
m_halt = true;
_local3 = true;
return(undefined);
}
}
}
m_state.tick();
}
function render(tick, alpha) {
m_data.alpha = alpha;
m_state.render();
}
static var AUTO_VERSION = "BUILD_[205]_121cf1f95c2";
static var m_execList = ["qu 6", "init", "st intro", "st game", "cmp -1", "beq -2", "st gameover", "stop"];
}
Symbol 1194 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 1195 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 1196 MovieClip [__Packages.bw.State] Frame 0
class bw.State
{
var m_superParent, m_disengage, m_startTick, m_data, m_width, m_height, m_ctorParam, m_curtainRemoved, m_parent, m_frameBuf, m_curtain;
function State (aParent, tick, dao, param) {
m_superParent = aParent;
m_disengage = false;
m_startTick = tick;
m_data = dao;
m_width = 755;
m_height = 600;
m_ctorParam = param;
m_curtainRemoved = true;
m_parent = m_superParent.createEmptyMovieClip("state_parent", m_superParent.getNextHighestDepth());
m_frameBuf = new flash.display.BitmapData(m_width, m_height, false, 0);
m_curtain = m_superParent.createEmptyMovieClip("state_curtain", m_superParent.getNextHighestDepth());
m_curtain.attachBitmap(m_frameBuf, 1);
}
function removeCurtain() {
m_curtain._visible = false;
m_curtainRemoved = true;
}
function destroy() {
m_parent.removeMovieClip();
m_parent = null;
m_curtain.removeMovieClip();
m_curtain = null;
m_frameBuf = null;
}
function initCurtain() {
m_curtainRemoved = false;
m_curtain.swapDepths(m_superParent.getNextHighestDepth());
}
function snapshot(src) {
m_frameBuf.draw(src);
}
function getFramebuffer() {
return(m_frameBuf);
}
function copyFramebuffer(buf) {
if (buf != undefined) {
m_frameBuf.copyPixels(buf, new flash.geom.Rectangle(0, 0, m_width, m_height), new flash.geom.Point(0, 0));
}
}
function quitGame() {
}
function engage(tick, dao, prevStateReturnCode) {
}
function isDisengage() {
return(false);
}
function disengage() {
}
function returnCode() {
return(0);
}
function tick() {
}
function render() {
}
}
Symbol 1197 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 1198 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 1199 MovieClip [__Packages.bw.StateGameOver] Frame 0
class bw.StateGameOver extends bw.State
{
var m_bkg, m_parent, m_plate, m_data, m_initTick, m_startTick, m_hasLeft, m_autoLeaveTick, m_removePlateTick, removeCurtain, m_tick, m_disengageNow, snapshot, m_scoreBoard, m_anim;
function StateGameOver (a1, a2, a3, a4, a5) {
super(a1, a2, a3, a4, a5);
}
function engage() {
m_bkg = m_parent.attachMovie("gameover_bkg", "bkg", m_parent.getNextHighestDepth());
m_plate = m_bkg.attachMovie("gameover_plate", "score", m_bkg.getNextHighestDepth());
m_plate._x = 8;
m_plate._y = -250;
m_plate._alpha = 0;
m_plate.title.text = com.midasplayer.util.I18n.getString("gameover_title");
m_plate.score.text = com.midasplayer.util.I18n.getString("gameover_score");
m_plate.score_value.text = m_data.totalScore;
if (m_data.isRelaxMode) {
m_plate.time_bonus._visible = false;
m_plate.time_bonus_value._visible = false;
}
m_plate.time_bonus.text = com.midasplayer.util.I18n.getString("gameover_time_bonus");
m_plate.time_bonus_value.text = m_data.timeBonus;
m_plate.total_score.text = com.midasplayer.util.I18n.getString("gameover_total_score");
m_plate.total_score_value.text = "" + (m_data.timeBonus + m_data.totalScore);
m_initTick = m_startTick + 10;
fscommand ("gameEnd", "" + (m_data.totalScore + m_data.timeBonus));
m_hasLeft = false;
m_autoLeaveTick = m_startTick + (m_data.ticksPerSec * 21);
m_removePlateTick = m_autoLeaveTick - m_data.ticksPerSec;
com.midasplayer.fx.SoundManager.play("snd_outro");
removeCurtain();
}
function onLeave() {
if (!m_hasLeft) {
m_hasLeft = true;
m_autoLeaveTick = m_tick + 26;
m_removePlateTick = m_tick + 1;
}
}
function quitGame() {
m_disengageNow = true;
}
function isDisengage() {
return(m_disengageNow);
}
function disengage() {
snapshot(m_parent);
fscommand ("gameQuit");
}
function returnCode() {
return(0);
}
function tick() {
var _local2 = m_data.tick;
m_tick = _local2;
if (!m_hasLeft) {
var _local3 = 1 + int((Math.max(0, (m_autoLeaveTick - _local2) - m_data.ticksPerSec) * m_data.millisPerTick) / 1000);
m_plate.count_down.text = com.midasplayer.util.I18n.getString("gameover_count_down", _local3);
}
if (_local2 == m_initTick) {
m_scoreBoard = bw.ScoreBoard(m_plate.scoreboard);
m_scoreBoard.setUsername(m_data.username);
var _local4 = m_data.ballResult;
var _local5 = 0;
for ( ; (_local5 < _local4.length) && (_local5 < 21) ; _local5++) {
var _local6 = _local4[_local5];
m_scoreBoard.addScore(_local6[0], _local6[1]);
}
m_scoreBoard.finalize();
m_bkg.onPress = mx.utils.Delegate.create(this, onLeave);
m_anim = new com.midasplayer.util.EaseOutQuadAnimator(m_plate);
m_anim.setPosition(8, 28);
m_anim.setDuration(750);
}
if (m_hasLeft && (m_anim != undefined)) {
com.midasplayer.fx.SoundManager.setVolume("snd_outro", int(m_anim.getElapsed() * 100));
}
if (_local2 == m_removePlateTick) {
m_hasLeft = true;
m_anim = new com.midasplayer.util.EaseInQuadAnimator(m_plate);
m_anim.setPosition(8, -250);
m_anim.setDuration(750);
}
if (_local2 == m_autoLeaveTick) {
m_disengageNow = true;
}
}
function render() {
var _local2 = m_data.alpha;
if (m_anim && (m_anim.update())) {
m_anim = undefined;
}
if (m_anim != undefined) {
if (m_tick >= m_removePlateTick) {
m_plate._alpha = m_anim.getElapsed() * 100;
} else {
m_plate._alpha = (1 - m_anim.getElapsed()) * 100;
}
}
}
}
Symbol 1200 MovieClip [__Packages.bw.ScoreBoard] Frame 0
class bw.ScoreBoard extends MovieClip
{
var m_sketchCam, m_boardClip, board, m_linesClip, createEmptyMovieClip, sq_10_3, sq_10_1_split, sq_10_2_split, total, m_currentFrame, m_currentScore, m_currentBall, m_numConsecutiveStrike, m_frames, m_bonusFrames, playername, m_lastSplit, m_lastSpare, m_lastStrike, m_appearAnim;
function ScoreBoard () {
super();
m_sketchCam = new bw.Camera();
m_sketchCam.blackboardView();
reset();
}
function reset() {
m_boardClip = board;
m_linesClip = createEmptyMovieClip("lns", 1000);
m_linesClip._x = m_boardClip._x;
m_linesClip._y = m_boardClip._y;
m_boardClip._visible = false;
var _local2 = 0;
for ( ; _local2 < 10 ; _local2++) {
this[("sq_" + (_local2 + 1)) + "_1"].text = "";
this[("sq_" + (_local2 + 1)) + "_2"].text = "";
this[("sq_" + (_local2 + 1)) + "_t"].text = "";
this[("sq_" + (_local2 + 1)) + "_split"]._visible = false;
}
sq_10_3.text = "";
sq_10_1_split._visible = false;
sq_10_2_split._visible = false;
total.text = "0";
m_currentFrame = 1;
m_currentScore = 0;
m_currentBall = 0;
m_numConsecutiveStrike = 0;
m_frames = [];
m_bonusFrames = {};
var _local3 = 0;
for ( ; _local3 < 10 ; _local3++) {
m_frames.push(new bw.BowlingFrame(_local3 + 1));
}
}
function setUsername(name) {
playername.text = name;
}
function getScore() {
var _local2 = 0;
var _local3 = 0;
for ( ; _local3 < m_frames.length ; _local3++) {
_local2 = _local2 + m_frames[_local3].getFrameScore();
}
return(_local2 * 100);
}
function getBowlingScore() {
var _local2 = 0;
var _local3 = 0;
for ( ; _local3 < m_frames.length ; _local3++) {
if (m_frames[_local3].isClosed() && (m_frames[_local3].isScoreFinal())) {
_local2 = _local2 + m_frames[_local3].getFrameScore();
}
}
return(_local2);
}
function finalize() {
var _local2 = 0;
for (var i in m_bonusFrames) {
_local2++;
}
var _local3 = getCurrentFrame();
if ((_local3 > 0) && (!m_frames[_local3 - 1].isClosed())) {
_local2++;
}
var _local4 = 0;
for ( ; _local4 < _local2 ; _local4++) {
addScore(0, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);
}
}
function getCurrentFrame() {
return(Math.min(10, m_currentFrame));
}
function getCurrentThrow() {
if (m_currentFrame == 11) {
return(3);
}
return(m_currentBall + 1);
}
function getSignIdx() {
if (m_lastSplit) {
return(1);
}
if (m_lastSpare) {
return(2);
}
if (m_lastStrike) {
return(m_numConsecutiveStrike + 2);
}
return(0);
}
function getSoundEffect() {
if (m_lastSplit) {
return("snd_split_melody");
}
if (m_lastSpare) {
return("snd_spare_melody");
}
if (m_lastStrike) {
return("snd_strike_melody");
}
return("");
}
function addScore(knockedPins, pinMatrix) {
var _local4 = getCurrentFrame();
var _local5 = ("sq_" + _local4) + "_";
var _local6 = m_frames[_local4 - 1];
var _local7 = false;
if (_local4 == 10) {
var _local8 = getCurrentThrow();
if (_local8 == 1) {
_local7 = checkSplit(pinMatrix);
this[("sq_10_" + _local8) + "_split"]._visible = _local7;
}
} else if (getCurrentThrow() == 1) {
_local7 = checkSplit(pinMatrix);
this[_local5 + "split"]._visible = _local7;
}
m_currentBall++;
if (m_currentFrame == 11) {
m_currentBall = 3;
}
_local6.setKnockedPinsByBall(m_currentBall, knockedPins, _local7);
if (_local6.isStrike()) {
m_numConsecutiveStrike++;
} else {
m_numConsecutiveStrike = 0;
}
m_lastStrike = _local6.isStrike();
m_lastSplit = _local7;
m_lastSpare = _local6.isSpare();
if (m_currentFrame == 11) {
this[_local5 + "3"].text = _local6.getBallScore(m_currentBall);
} else {
this[_local5 + m_currentBall].text = _local6.getBallScore(m_currentBall);
}
for (var i in m_bonusFrames) {
var _local9 = m_bonusFrames[i];
_local9.addBonus(knockedPins);
if (_local9.isScoreFinal()) {
var _local10 = ("sq_" + _local9.getFrameNo()) + "_t";
m_currentScore = m_currentScore + _local9.getFrameScore();
this[_local10].text = "" + m_currentScore;
delete m_bonusFrames[i];
}
}
if (_local6.isClosed()) {
if (_local6.isScoreFinal()) {
m_currentScore = m_currentScore + _local6.getFrameScore();
this[_local5 + "t"].text = "" + m_currentScore;
} else {
m_bonusFrames["a" + _local5] = _local6;
}
m_currentFrame++;
m_currentBall = 0;
}
total.text = "" + m_currentScore;
}
function checkSplit(pinMatrix) {
if (pinMatrix[0] == 1) {
return(false);
}
var _local3 = {};
var _local4 = {};
var _local5 = {a10:[9, 6], a9:[8, 5, 6, 10], a8:[7, 4, 5, 9], a7:[4, 8], a6:[10, 9, 5, 3], a5:[3, 2, 4, 8, 9, 6], a4:[7, 8, 5, 2], a3:[1, 2, 5, 6, 9], a2:[4, 5, 3, 8, 1], a1:[2, 3]};
var _local6 = 0;
for ( ; _local6 < 10 ; _local6++) {
if (pinMatrix[_local6] == 1) {
_local3["q" + (_local6 + 1)] = _local6 + 1;
break;
}
}
for(;;){
var _local7 = 0;
for (var i in _local3) {
_local7++;
}
if (_local7 == 0) {
break;
}
var _local8 = -1;
for (var i in _local3) {
_local8 = _local3[i];
_local4["a" + _local8] = _local8;
delete _local3[i];
break;
}
var _local9 = _local5["a" + _local8];
var _local10 = 0;
for ( ; _local10 < _local9.length ; _local10++) {
var _local11 = _local9[_local10];
if ((pinMatrix[_local11 - 1] == 1) && (!_local4["a" + _local11])) {
_local3["a" + _local11] = _local11;
}
}
};
var _local12 = 0;
for (var i in _local4) {
_local12++;
}
var _local13 = 0;
for (var i in pinMatrix) {
if (pinMatrix[i] == 1) {
_local13++;
}
}
return(_local12 < _local13);
}
function renderSketch(pinMtx, pinBuf, ballBuf) {
for (var a in m_boardClip) {
m_boardClip[a].removeMovieClip();
}
m_linesClip.clear();
var _local5 = 0;
for ( ; _local5 < pinBuf.length ; _local5++) {
var _local6 = pinBuf[_local5];
var _local7 = 0;
for ( ; _local7 < _local6.length ; _local7++) {
var _local8 = _local6[_local7];
m_sketchCam.transformNoI(_local8);
m_sketchCam.project(_local8);
var _local9 = m_boardClip.attachMovie("whiteboard_symbols", "pin" + _local5, _local5);
var _local10 = (int(Math.random() * 10) % 10) + 2;
_local9.gotoAndStop(_local10 + 1);
var _local11 = {ra:100, ga:100, ba:100, aa:100, rb:0, gb:0, bb:255, ab:0};
if (pinMtx[_local5] == 0) {
_local11 = {ra:100, ga:100, ba:100, aa:100, rb:255, gb:0, bb:0, ab:0};
}
var _local12 = new Color(_local9);
_local12.setTransform(_local11);
_local9._xscale = 66;
_local9._yscale = 66;
_local9._x = _local8.sx;
_local9._y = _local8.sy;
}
}
m_linesClip.lineStyle(1.5, 0);
var _local15 = -1;
var _local16 = 0;
for ( ; _local16 < ballBuf.length ; _local16++) {
var _local17 = ballBuf[_local16];
for ( ; _local17.z < -130 ; _local16++) {
}
_local15 = _local16;
}
var _local18 = 0;
for ( ; _local18 < _local15 ; _local18++) {
var _local19 = ballBuf[_local18];
m_sketchCam.transformNoI(_local19);
m_sketchCam.project(_local19);
if ((_local18 == 0) || (_local18 == (_local15 - 1))) {
var _local20 = m_boardClip.attachMovie("whiteboard_symbols", "ball" + _local18, 11 + _local18);
_local20.gotoAndStop(Math.min(1, _local18) + 1);
_local20._xscale = 75;
_local20._yscale = 75;
_local20._x = _local19.sx;
_local20._y = _local19.sy;
var _local21 = Math.atan2(_local19.sy - _local14, _local19.sx - _local13) * (180 / Math.PI);
_local20._rotation = _local21;
}
if (_local18 > 1) {
m_linesClip.moveTo(_local13, _local14);
m_linesClip.lineTo(_local19.sx, _local19.sy);
}
var _local13 = _local19.sx;
var _local14 = _local19.sy;
}
}
function isVisible() {
return(m_appearAnim != undefined);
}
function setBlackBoardVisible(b) {
m_boardClip._visible = b;
m_linesClip._visible = b;
}
function render() {
if ((m_appearAnim != undefined) && (m_appearAnim.update())) {
m_appearAnim = undefined;
}
}
function appear() {
m_appearAnim = new com.midasplayer.util.EaseOutQuadAnimator(this);
m_appearAnim.setPosition(10, 395);
m_appearAnim.setDuration(300);
}
function remove() {
m_appearAnim = new com.midasplayer.util.EaseInQuadAnimator(this);
m_appearAnim.setPosition(10, 720);
m_appearAnim.setDuration(300);
}
}
Symbol 1201 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 1202 MovieClip [__Packages.bw.Matrix] Frame 0
class bw.Matrix
{
var m;
function Matrix (m) {
if (m == undefined) {
this.m = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]];
} else {
this.m = m;
}
}
function identity() {
m[0][0] = 1;
m[0][1] = 0;
m[0][2] = 0;
m[0][3] = 0;
m[1][0] = 0;
m[1][1] = 1;
m[1][2] = 0;
m[1][3] = 0;
m[2][0] = 0;
m[2][1] = 0;
m[2][2] = 1;
m[2][3] = 0;
m[3][0] = 0;
m[3][1] = 0;
m[3][2] = 0;
m[3][3] = 1;
}
function tx(x, y, z) {
return((((x * m[0][0]) + (y * m[0][1])) + (z * m[0][2])) + m[0][3]);
}
function ty(x, y, z) {
return((((x * m[1][0]) + (y * m[1][1])) + (z * m[1][2])) + m[1][3]);
}
function tz(x, y, z) {
return((((x * m[2][0]) + (y * m[2][1])) + (z * m[2][2])) + m[2][3]);
}
function scale(s) {
transformf(scaleMatrix(s));
}
function translate(x, y, z) {
transformf(translateMatrix(x, y, z));
}
function rotate(x, y, z) {
transformf(rotateMatrix(x, y, z));
}
function transformf(om) {
var _local3 = om.m;
var _local4 = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
var _local17 = 3;
for ( ; _local17 >= 0 ; _local17--) {
var _local5 = m[_local17][0];
var _local6 = m[_local17][1];
var _local7 = m[_local17][2];
var _local8 = m[_local17][3];
var _local9 = _local3[0];
var _local10 = _local3[1];
var _local11 = _local3[2];
var _local12 = _local3[3];
var _local13 = _local5 * _local9[0];
var _local14 = _local5 * _local9[1];
var _local15 = _local5 * _local9[2];
var _local16 = _local5 * _local9[3];
_local13 = _local13 + (_local6 * _local10[0]);
_local14 = _local14 + (_local6 * _local10[1]);
_local15 = _local15 + (_local6 * _local10[2]);
_local16 = _local16 + (_local6 * _local10[3]);
_local13 = _local13 + (_local7 * _local11[0]);
_local14 = _local14 + (_local7 * _local11[1]);
_local15 = _local15 + (_local7 * _local11[2]);
_local16 = _local16 + (_local7 * _local11[3]);
_local4[_local17][0] = _local13 + (_local8 * _local12[0]);
_local4[_local17][1] = _local14 + (_local8 * _local12[1]);
_local4[_local17][2] = _local15 + (_local8 * _local12[2]);
_local4[_local17][3] = _local16 + (_local8 * _local12[3]);
}
m = _local4;
}
function inverse() {
var _local2 = new bw.Matrix();
var _local3 = _local2.m[1][2];
var _local4 = _local2.m[1][0] * _local2.m[0][1];
var _local5 = _local2.m[1][0] * _local2.m[2][1];
var _local6 = _local2.m[0][2];
var _local7 = _local2.m[2][0] * _local2.m[0][1];
var _local8 = _local2.m[2][0] * _local2.m[1][1];
var _local9 = _local2.m[0][2] * _local2.m[2][1];
var _local10 = _local2.m[0][3] * _local2.m[2][1];
var _local11 = _local2.m[0][1] * _local2.m[1][2];
var _local12 = _local2.m[0][1] * _local2.m[1][3];
var _local13 = _local2.m[0][2] * _local2.m[1][1];
var _local14 = _local2.m[0][3] * _local2.m[1][1];
var _local15 = _local2.m[1][0] * _local2.m[2][2];
var _local16 = _local2.m[1][0] * _local2.m[2][3];
var _local17 = _local2.m[2][0] * _local2.m[1][2];
var _local18 = _local2.m[2][0] * _local2.m[1][3];
var _local19 = _local2.m[0][0] * _local2.m[2][2];
var _local20 = _local2.m[0][0] * _local2.m[2][3];
var _local21 = _local2.m[2][0] * _local2.m[0][2];
var _local22 = _local2.m[2][0] * _local2.m[0][3];
var _local23 = _local2.m[0][0] * _local2.m[1][2];
var _local24 = _local2.m[0][0] * _local2.m[1][3];
var _local25 = _local2.m[1][0] * _local2.m[0][2];
var _local26 = _local2.m[1][0] * _local2.m[0][3];
var _local27 = _local2.m[0][0] * _local2.m[1][1];
var _local28 = _local2.m[0][0] * _local2.m[2][1];
var _local29 = (((_local27 * _local2.m[2][2]) - (_local28 * _local3)) - (_local4 * _local2.m[2][2])) + (_local5 * _local6);
var _local30 = (_local7 * _local3) - (_local8 * _local6);
var _local31 = 1 / (_local29 + _local30);
_local2.m[0][0] = (((((((_local2.m[1][1] * _local2.m[2][2]) * _local2.m[3][3]) - ((_local2.m[1][1] * _local2.m[2][3]) * _local2.m[3][2])) - ((_local2.m[2][1] * _local2.m[1][2]) * _local2.m[3][3])) + ((_local2.m[2][1] * _local2.m[1][3]) * _local2.m[3][2])) + ((_local2.m[3][1] * _local2.m[1][2]) * _local2.m[2][3])) - ((_local2.m[3][1] * _local2.m[1][3]) * _local2.m[2][2])) * _local31;
_local2.m[0][1] = (-(((((_local2.m[0][1] * _local2.m[2][2]) * _local2.m[3][3]) - ((_local2.m[0][1] * _local2.m[2][3]) * _local2.m[3][2])) - (_local9 * _local2.m[3][3])) + (_local10 * _local2.m[3][2]))) * _local31;
_local2.m[0][2] = ((((_local11 * _local2.m[3][3]) - (_local12 * _local2.m[3][2])) - (_local13 * _local2.m[3][3])) + (_local14 * _local2.m[3][2])) * _local31;
_local2.m[0][3] = (-((((((_local11 * _local2.m[2][3]) - (_local12 * _local2.m[2][2])) - (_local13 * _local2.m[2][3])) + (_local14 * _local2.m[2][2])) + (_local9 * _local2.m[1][3])) - (_local10 * _local2.m[1][2]))) * _local31;
_local2.m[1][0] = (-((((_local15 * _local2.m[3][3]) - (_local16 * _local2.m[3][2])) - (_local17 * _local2.m[3][3])) + (_local18 * _local2.m[3][2]))) * _local31;
_local2.m[1][1] = ((((_local19 * _local2.m[3][3]) - (_local20 * _local2.m[3][2])) - (_local21 * _local2.m[3][3])) + (_local22 * _local2.m[3][2])) * _local31;
_local2.m[1][2] = (-((((_local23 * _local2.m[3][3]) - (_local24 * _local2.m[3][2])) - (_local25 * _local2.m[3][3])) + (_local26 * _local2.m[3][2]))) * _local31;
_local2.m[1][3] = ((((((_local23 * _local2.m[2][3]) - (_local24 * _local2.m[2][2])) - (_local25 * _local2.m[2][3])) + (_local26 * _local2.m[2][2])) + (_local21 * _local2.m[1][3])) - (_local22 * _local2.m[1][2])) * _local31;
_local2.m[2][0] = ((((_local5 * _local2.m[3][3]) - (_local16 * _local2.m[3][1])) - (_local8 * _local2.m[3][3])) + (_local18 * _local2.m[3][1])) * _local31;
_local2.m[2][1] = (-((((_local28 * _local2.m[3][3]) - (_local20 * _local2.m[3][1])) - (_local7 * _local2.m[3][3])) + (_local22 * _local2.m[3][1]))) * _local31;
_local2.m[2][2] = ((((_local27 * _local2.m[3][3]) - (_local24 * _local2.m[3][1])) - (_local4 * _local2.m[3][3])) + (_local26 * _local2.m[3][1])) * _local31;
_local2.m[2][3] = (-((((((_local27 * _local2.m[2][3]) - (_local24 * _local2.m[2][1])) - (_local4 * _local2.m[2][3])) + (_local26 * _local2.m[2][1])) + (_local7 * _local2.m[1][3])) - (_local22 * _local2.m[1][1]))) * _local31;
return(_local2);
}
function get values() {
return(m);
}
function copy() {
var _local2 = new bw.Matrix();
var _local3 = 0;
for ( ; _local3 < 4 ; _local3++) {
var _local4 = 0;
for ( ; _local4 < 4 ; _local4++) {
_local2.m[_local3][_local4] = m[_local3][_local4];
}
}
return(_local2);
}
function toString() {
var _local2 = "";
var _local3 = 0;
for ( ; _local3 < 4 ; _local3++) {
_local2 = _local2 + "[";
var _local4 = 0;
for ( ; _local4 < 4 ; _local4++) {
if (_local4 != 0) {
_local2 = _local2 + ", ";
}
_local2 = _local2 + m[_local3][_local4];
}
_local2 = _local2 + "]\n";
}
return(_local2);
}
function translateMatrix(x, y, z) {
var _local5 = new bw.Matrix();
_local5.m[0][3] = x;
_local5.m[1][3] = y;
_local5.m[2][3] = z;
return(_local5);
}
function scaleMatrix(s) {
var _local3 = new bw.Matrix();
_local3.m[0][0] = s;
_local3.m[1][1] = s;
_local3.m[2][2] = s;
return(_local3);
}
function rotateMatrix(x, y, z) {
var _local5 = new bw.Matrix();
if (x != 0) {
var _local6 = new bw.Matrix();
var _local7 = com.midasplayer.util.XPMath.sin(x);
var _local8 = com.midasplayer.util.XPMath.cos(x);
_local6.m[1][1] = _local8;
_local6.m[1][2] = _local7;
_local6.m[2][1] = -_local7;
_local6.m[2][2] = _local8;
_local5.transformf(_local6);
}
if (y != 0) {
var _local9 = new bw.Matrix();
var _local10 = com.midasplayer.util.XPMath.sin(y);
var _local11 = com.midasplayer.util.XPMath.cos(y);
_local9.m[0][0] = _local11;
_local9.m[0][2] = _local10;
_local9.m[2][0] = -_local10;
_local9.m[2][2] = _local11;
_local5.transformf(_local9);
}
if (z != 0) {
var _local12 = new bw.Matrix();
var _local13 = com.midasplayer.util.XPMath.sin(z);
var _local14 = com.midasplayer.util.XPMath.cos(z);
_local12.m[0][0] = _local14;
_local12.m[0][1] = _local13;
_local12.m[1][0] = -_local13;
_local12.m[1][1] = _local14;
_local5.transformf(_local12);
}
return(_local5);
}
}
Symbol 1203 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 1204 MovieClip [__Packages.bw.Camera] Frame 0
class bw.Camera extends bw.Matrix
{
var screenCX, screenCY, identity, scale, rotate, translate, m, tx, ty, tz;
function Camera () {
super();
laneView();
}
function debugView() {
screenCX = WIDTH2;
screenCY = HEIGHT2;
identity();
scale(9);
rotate(0, 0, 0);
translate(0, 0, 440);
rotate(Math.PI / 2, Math.PI * 2, 0);
m[2][3] = m[2][3] + DIST;
}
function blackboardView() {
screenCX = 70;
screenCY = 96;
identity();
scale(1);
rotate(0, 0, 0);
translate(0, 0, 440);
rotate(Math.PI / 2, Math.PI * 2, 0);
m[2][3] = m[2][3] + DIST;
}
function laneView() {
screenCX = WIDTH2;
screenCY = HEIGHT2;
identity();
scale(zoom);
rotate(0, 0, 0);
translate(positionX, positionY, positionZ);
rotate(rotationX, rotationY, rotationZ);
translate(0, 0, 90);
m[2][3] = m[2][3] + DIST;
}
function discoFloorView(val) {
val = val % (Math.PI * 2);
screenCX = WIDTH2;
screenCY = HEIGHT2;
identity();
scale(zoom);
rotate(0, 0, 0);
translate(positionX, positionY, positionZ);
rotate(rotationX, rotationY, rotationZ);
translate(5, 0, 390);
rotate(0, val, 0);
m[2][3] = m[2][3] + DIST;
}
function setPosition(x, z) {
positionX = x;
positionZ = z;
}
function setRotation(x, y, z) {
rotationX = x;
rotationY = y;
}
function project(p) {
var _local3 = p.ftz.value;
p.sz = _local3 / zoom;
var _local4 = K * (1 / _local3);
p.sx = (p.ftx.value * _local4) + screenCX;
p.sy = (p.fty.value * _local4) + screenCY;
}
function transformNoI(p) {
var _local3 = tx(p.x, p.y, p.z);
p.ftx.setTo(_local3);
var _local4 = ty(p.x, p.y, p.z);
p.fty.setTo(_local4);
var _local5 = tz(p.x, p.y, p.z);
p.ftz.setTo(_local5);
}
function transform(p) {
var _local3 = p.x;
var _local4 = p.y;
var _local5 = p.z;
var _local6 = m[0];
p.ftx.set((((_local3 * _local6[0]) + (_local4 * _local6[1])) + (_local5 * _local6[2])) + _local6[3]);
var _local7 = m[1];
p.fty.set((((_local3 * _local7[0]) + (_local4 * _local7[1])) + (_local5 * _local7[2])) + _local7[3]);
var _local8 = m[2];
p.ftz.set((((_local3 * _local8[0]) + (_local4 * _local8[1])) + (_local5 * _local8[2])) + _local8[3]);
}
static var DIST = 1000;
static var K = 825;
static var WIDTH = 755;
static var HEIGHT = 560;
static var WIDTH2 = WIDTH / 2;
static var HEIGHT2 = HEIGHT / 2;
var zoom = 8.5;
var rotationX = 2.948;
var rotationY = (-Math.PI) * 2;
var rotationZ = 0;
var positionX = 1.5;
var positionY = -100;
var positionZ = 980;
}
Symbol 1205 MovieClip [__Packages.bw.Vec3] Frame 0
class bw.Vec3
{
var x, y, z, c, clen;
function Vec3 (px, py, pz) {
x = px;
y = py;
z = pz;
c = 0;
}
function normalize() {
var _local2 = clen;
if (c == 0) {
_local2 = Math.sqrt(((x * x) + (y * y)) + (z * z));
}
_local2 = ((_local2 < 0) ? (-_local2) : (_local2));
if (_local2 > 0) {
var _local3 = 1 / _local2;
x = x * _local3;
y = y * _local3;
z = z * _local3;
}
c = 0;
}
function angleBetween(v) {
return(Math.acos(dot(v) / (Math.sqrt(dot(this)) * Math.sqrt(v.dot(v)))));
}
function copyInto(other) {
other.x = x;
other.y = y;
other.z = z;
other.c = c;
other.clen = clen;
}
function zero() {
clen = 0;
x = 0;
y = 0;
z = 0;
c = 1;
}
function isZero() {
return((z == 0) && ((x == 0) && (y == 0)));
}
function flush() {
c = 0;
}
function multiplyScalar(scalar) {
x = x * scalar;
y = y * scalar;
z = z * scalar;
c = 0;
}
function multiplyVec3(vo) {
x = x * vo.x;
y = y * vo.y;
z = z * vo.z;
c = 0;
}
function addScalar(scalar) {
x = x + scalar;
y = y + scalar;
z = z + scalar;
c = 0;
}
function addVec3(vo) {
x = x + vo.x;
y = y + vo.y;
z = z + vo.z;
c = 0;
}
function subtractScalar(scalar) {
x = x - scalar;
y = y - scalar;
z = z - scalar;
c = 0;
}
function subtractVec3(vo) {
x = x - vo.x;
y = y - vo.y;
z = z - vo.z;
c = 0;
}
function length() {
if (c == 0) {
c = 1;
clen = Math.sqrt(((x * x) + (y * y)) + (z * z));
}
return(clen);
}
function dot(vo) {
return(((vo.x * x) + (vo.y * y)) + (vo.z * z));
}
function copy() {
return(new bw.Vec3(x, y, z));
}
function toString() {
return(((((((("Vec3[x=" + x) + ", y=") + y) + ", z=") + z) + ", l=") + length()) + "]");
}
}
Symbol 1206 MovieClip [__Packages.bw.Point3] Frame 0
class bw.Point3 extends bw.Vec3
{
var ftx, fty, ftz, sx, sy, sz, x, y, z, c, clen;
function Point3 (px, py, pz) {
super(px, py, pz);
ftx = new com.midasplayer.timing.IFloat(0);
fty = new com.midasplayer.timing.IFloat(0);
ftz = new com.midasplayer.timing.IFloat(0);
sx = 0;
sy = 0;
sz = 0;
}
function copyInto(other) {
other.x = x;
other.y = y;
other.z = z;
other.c = c;
other.clen = clen;
other.sx = sx;
other.sy = sy;
other.sz = sz;
other.ftx.ivalue = ftx.ivalue;
other.fty.ivalue = fty.ivalue;
other.ftz.ivalue = ftz.ivalue;
other.ftx.lastValue = ftx.lastValue;
other.fty.lastValue = fty.lastValue;
other.ftz.lastValue = ftz.lastValue;
}
function toString() {
var _local2 = ftx.get(0);
var _local3 = fty.get(0);
var _local4 = ftz.get(0);
return(((((((((((((((((("Point3[" + x) + ", ") + y) + ", ") + z) + "] => [") + _local2) + ", ") + _local3) + ", ") + _local4) + "] => ") + sx) + ", ") + sy) + " (") + sz) + ")");
}
}
Symbol 1207 MovieClip [__Packages.bw.BowlingFrame] Frame 0
class bw.BowlingFrame
{
var m_numPinsByBall, m_score, m_bonus, m_numBall, m_tenthStrike1st, m_tenthClosed, m_tenthBonus, m_frameNo, m_isStrike, m_isSplit, m_isSpare, m_pinsLeft, m_bonusBallLeft;
function BowlingFrame (frameNo) {
if (frameNo == 10) {
m_numPinsByBall = [0, 0, 0];
} else {
m_numPinsByBall = [0, 0];
}
m_score = 0;
m_bonus = 0;
m_numBall = 0;
m_tenthStrike1st = false;
m_tenthClosed = false;
m_tenthBonus = 0;
m_frameNo = frameNo;
m_isStrike = false;
m_isSplit = false;
m_isSpare = false;
m_pinsLeft = 10;
}
function getFrameNo() {
return(Math.min(10, m_frameNo));
}
function addBonus(numPins) {
if (m_bonusBallLeft == 0) {
return(undefined);
}
m_bonus = m_bonus + numPins;
m_bonusBallLeft--;
}
function setKnockedPinsByBall(ballNo, numPins, isSplit) {
m_isSplit = isSplit;
var _local5 = "-123456789";
if (m_frameNo < 10) {
if (m_isStrike) {
return(undefined);
}
m_isStrike = (ballNo == 1) && (numPins == 10);
if (numPins > m_pinsLeft) {
return(undefined);
}
m_pinsLeft = m_pinsLeft - numPins;
if ((ballNo == 2) && (isSpare())) {
m_numPinsByBall[ballNo - 1] = "/";
m_isSpare = true;
} else if ((ballNo == 1) && (isStrike())) {
m_numPinsByBall[ballNo - 1] = "X";
} else {
m_numPinsByBall[ballNo - 1] = _local5.charAt(numPins);
}
m_numBall++;
if (isStrike()) {
m_score = 10;
m_bonusBallLeft = 2;
} else if (isSpare()) {
m_score = 10;
m_bonusBallLeft = 1;
} else {
m_score = m_score + numPins;
m_bonusBallLeft = 0;
}
} else {
m_pinsLeft = m_pinsLeft - numPins;
if (numPins == 10) {
m_score = m_score + 10;
m_tenthBonus = 0;
m_isStrike = true;
m_isSpare = false;
if (ballNo == 1) {
m_tenthStrike1st = true;
}
m_numPinsByBall[ballNo - 1] = "X";
} else if ((ballNo == 2) && (m_pinsLeft == 0)) {
m_numPinsByBall[ballNo - 1] = "/";
m_isSpare = true;
m_isStrike = false;
m_score = m_score + 10;
m_tenthBonus = 0;
} else if ((ballNo == 3) && (m_pinsLeft == 0)) {
m_numPinsByBall[ballNo - 1] = "/";
m_isSpare = true;
m_isStrike = false;
m_score = m_score + 10;
m_tenthBonus = 0;
} else {
m_numPinsByBall[ballNo - 1] = _local5.charAt(numPins);
m_tenthBonus = m_tenthBonus + numPins;
m_isSpare = false;
m_isStrike = false;
}
if ((ballNo == 3) || ((ballNo == 2) && ((!m_tenthStrike1st) && ((!m_isSpare) && (!m_isStrike))))) {
m_score = m_score + m_tenthBonus;
m_tenthClosed = true;
}
if ((ballNo < 3) && (m_pinsLeft == 0)) {
m_pinsLeft = 10;
}
}
}
function getBallScore(ballNo) {
return(m_numPinsByBall[ballNo - 1]);
}
function getFrameScore() {
return(m_score + m_bonus);
}
function isScoreFinal() {
if (m_frameNo == 10) {
return(m_tenthClosed);
}
return(m_bonusBallLeft == 0);
}
function isClosed() {
if (m_frameNo == 10) {
return(m_tenthClosed);
}
return(isStrike() || (isSpare() || (m_numBall == 2)));
}
function isSpare() {
if (m_frameNo == 10) {
return(m_isSpare);
}
return((!m_isStrike) && (m_pinsLeft == 0));
}
function isStrike() {
return(m_isStrike);
}
}
Symbol 1208 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 1209 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 1210 MovieClip [__Packages.bw.CurtainTransition] Frame 0
class bw.CurtainTransition
{
function CurtainTransition () {
}
}
Symbol 1211 MovieClip [__Packages.bw.ThrowListener] Frame 0
class bw.ThrowListener
{
function ThrowListener () {
}
}
Symbol 1212 MovieClip [__Packages.bw.PinSetterListener] Frame 0
class bw.PinSetterListener
{
function PinSetterListener () {
}
}
Symbol 1213 MovieClip [__Packages.bw.SweeperListener] Frame 0
class bw.SweeperListener
{
function SweeperListener () {
}
}
Symbol 1214 MovieClip [__Packages.bw.StateGame] Frame 0
class bw.StateGame extends bw.State implements bw.SweeperListener, bw.PinSetterListener, bw.ThrowListener
{
var m_indeed, m_colorMtx, m_parent, m_discoParent, m_discoBall, m_discoBowler, m_discoObj, m_renderList, m_fuzzR, m_data, m_failThrow, m_seriesOver, m_restartExit, m_bkg, m_scoreOver, m_powerMeter, m_pieTimer, m_throwDebug, m_scoreBoard, m_ballMask, m_camera, m_physicsDebug, m_signAnimParent, m_signParent, m_mirrorParent, m_scoreMirror, m_sweeper, m_sweeperClip, m_setter, m_pinsetterClip, m_throw, m_mousePos, m_mouseUp, m_mouseDown, m_mouseMoved, m_pit, m_pitObj, m_sndSeq, m_lastX, m_lastY, m_m3X, m_m3Y, m_eeState, m_isStrikeInFirstTenth, removeCurtain, m_timeShift, m_timeShiftDirection, m_currentNumPins, m_floor, m_roof, m_throwTick, m_startNextFrameTick, m_ballInMoatTick, m_hideScoreTick, m_autoLeaveTick, m_readScoreTick, m_nextSquareTick, m_disengageNow, m_view, m_pins, m_ball, m_lines, m_backWall, m_throwBonusEnd, m_throwBegun, m_frameOver, m_launched, m_wasDebugDraw, m_spin, m_throwNo, m_lastPinsStanding, m_pinsStanding, snapshot, m_spinForceV, m_spinX, m_spinZ, m_throwBeginData, m_throwPts, m_spinPts, m_ballApproachSlave, m_ballApproachAnim, m_beginCleanupTick, m_newThrowTick, m_waitForSettleTick, m_gutterPlayed, m_ballStopped, m_throwEnded, m_throwReadyTick, m_drawDebug, m_lowTimePlayed, m_soundQueue, m_firstCxTick, m_lastCxTick, m_cxScore;
function StateGame (a1, a2, a3, a4, a5) {
super(a1, a2, a3, a4, a5);
m_indeed = ((("burns: wait a minute, i don't remember writing a cheque for bowling!\n" + "smithers: uh, sir, that's for your boweling.\n") + "burns: ah yes, that's very important.\n") + "smithers: remember that month you didn't do it?\n") + "burns: yes...that was unpleasant for all concerned.\n";
}
function disco() {
var _local2 = [-0.453687802030142, 1.63142462633978, -0.177736824309635, 0, 0, 0.364245647731828, 0.399304783010422, 0.23644956925775, 0, 0, 0.6823243810247, 1.14233582138407, -0.824660202408771, 0, 0, 0, 0, 0, 1, 0];
m_colorMtx = new flash.filters.ColorMatrixFilter(_local2);
m_parent.filters = [m_colorMtx];
m_discoParent = m_parent.createEmptyMovieClip("discostu", m_parent.getNextHighestDepth());
m_discoParent.filters = [new flash.filters.GlowFilter(16777215, 100, 8, 8, 2, 1, false, false, false)];
m_discoBall = m_parent.attachMovie("disco", "db", m_parent.getNextHighestDepth());
m_discoBall._x = 117;
m_discoBall._y = -95;
m_discoBall.playStart();
m_discoBowler = new bw.DiscoBowling(m_discoParent);
m_discoObj = new bw.ZSorted(m_discoParent, 900000);
m_renderList.push(m_discoObj);
}
function undisco() {
m_parent.filters = [];
m_discoBall.removeMovieClip();
m_discoParent.removeMovieClip();
}
function engage() {
m_fuzzR = (m_data.rng.nextDouble() * Math.PI) * 2;
com.midasplayer.fx.SoundManager.play("snd_ambience_loop", 50, true);
m_failThrow = false;
m_seriesOver = false;
m_restartExit = false;
m_bkg = m_parent.attachMovie("bowling_bkg", "bkg", m_parent.getNextHighestDepth());
m_bkg.onReleaseOutside = mx.utils.Delegate.create(this, onMouseRelease);
m_bkg.useHandCursor = false;
m_scoreOver = m_parent.attachMovie("bowling_bkg_score_over", "score_over_2", m_parent.getNextHighestDepth());
m_scoreOver._x = 303;
m_scoreOver._y = 65;
m_powerMeter = m_parent.attachMovie("power-meter", "powmet", m_parent.getNextHighestDepth());
m_powerMeter.setPosition(755 + 81, 387);
m_pieTimer = new bw.PieTimer(m_bkg, m_data.isRelaxMode);
m_pieTimer.init("timer_empty", "timer_full");
m_pieTimer.setMaxTime(m_timeBonusSec * 1000);
m_pieTimer.setSize(40, 40);
m_pieTimer.setPosition(0, 350);
m_throwDebug = m_parent.attachMovie("test_throwdraw", "threowdebug", m_parent.getNextHighestDepth());
m_throwDebug._x = 0;
m_throwDebug._y = 150;
m_throwDebug._visible = false;
m_scoreBoard = bw.ScoreBoard(m_parent.attachMovie("scoreboard", "score", m_parent.getNextHighestDepth()));
m_scoreBoard.setUsername(m_data.username);
m_scoreBoard._x = 10;
m_scoreBoard._y = 720;
m_ballMask = m_parent.attachMovie("ballmask", "bm", m_parent.getNextHighestDepth());
m_ballMask._x = 319;
m_ballMask._y = 174;
m_ballMask._visible = false;
m_camera = new bw.Camera();
m_camera.laneView();
m_physicsDebug = m_parent.createEmptyMovieClip("dbug", m_parent.getNextHighestDepth());
m_signAnimParent = m_parent.createEmptyMovieClip("signpa", m_parent.getNextHighestDepth());
m_signAnimParent._visible = false;
m_signParent = m_parent.createEmptyMovieClip("signp", m_parent.getNextHighestDepth());
m_signParent._visible = false;
m_mirrorParent = m_parent.createEmptyMovieClip("mirr", m_parent.getNextHighestDepth());
m_mirrorParent.blendMode = "layer";
m_mirrorParent._alpha = 42;
m_scoreMirror = m_parent.createEmptyMovieClip("score_mirr", m_parent.getNextHighestDepth());
m_scoreMirror.blendMode = "layer";
m_scoreMirror._alpha = 42;
m_scoreMirror._y = 580;
m_scoreMirror._yscale = -100;
var _local2 = 0;
for ( ; _local2 < 2 ; _local2++) {
var _local3 = "round_digit_" + (_local2 + 1);
var _local4 = m_scoreOver[_local3];
var _local5 = m_scoreMirror.attachMovie("digits", _local3, m_scoreMirror.getNextHighestDepth());
_local5._x = m_scoreOver._x + _local4._x;
_local5._y = (m_scoreOver._y + _local4._y) + 164;
}
var _local6 = 0;
for ( ; _local6 < 3 ; _local6++) {
var _local7 = "score_digit_" + (_local6 + 1);
var _local8 = m_scoreOver[_local7];
var _local9 = m_scoreMirror.attachMovie("digits", _local7, m_scoreMirror.getNextHighestDepth());
_local9._x = m_scoreOver._x + _local8._x;
_local9._y = (m_scoreOver._y + _local8._y) + 164;
}
var _local10 = 0;
for ( ; _local10 < 10 ; _local10++) {
var _local11 = "pinm" + (_local10 + 1);
var _local12 = m_scoreOver[_local11];
var _local13 = m_scoreMirror.attachMovie("pintable_marker", _local11, m_scoreMirror.getNextHighestDepth());
_local13._x = m_scoreOver._x + _local12._x;
_local13._y = (m_scoreOver._y + _local12._y) + 164;
}
m_sweeper = new bw.Sweeper(m_parent, 0, 0, 40);
m_sweeperClip = m_sweeper.clip;
m_setter = new bw.Setter(m_parent, 0, 0, 40);
m_pinsetterClip = m_setter.clip;
m_sweeper.setMirror(m_mirrorParent);
m_sweeper.addListener(this);
m_setter.setMirror(m_mirrorParent);
m_setter.addListener(this);
m_throw = new bw.Throw(m_throwDebug);
m_throw.addThrowListener(this);
m_mousePos = [0, 0];
m_mouseUp = false;
m_mouseDown = false;
m_mouseMoved = false;
Mouse.addListener(this);
m_pit = m_parent.createEmptyMovieClip("pit", m_parent.getNextHighestDepth());
var _local14 = m_pit.attachMovie("left_pit", "pitl", m_pit.getNextHighestDepth());
_local14._x = 50;
_local14._y = 206;
_local14 = m_pit.attachMovie("right_pit", "pit2", m_pit.getNextHighestDepth());
_local14._x = 424;
_local14._y = 206;
m_pitObj = new bw.ZSorted(m_pit, 1000000);
m_sndSeq = 0;
m_lastX = 0;
m_lastY = 0;
m_m3X = 0;
m_m3Y = 0;
m_eeState = false;
m_isStrikeInFirstTenth = false;
newFrame();
removeCurtain();
}
function onMouseWheel() {
}
function onMouseUp() {
if (!m_failThrow) {
m_mouseUp = true;
}
}
function onMouseDown() {
if (!m_failThrow) {
m_mouseDown = true;
}
}
function onMouseMove() {
if (!m_failThrow) {
m_throw.onMouseMove(int(_root._xmouse), int(_root._ymouse));
}
}
function onMouseRelease() {
if ((!m_failThrow) && (m_throw.isThrowing())) {
m_mouseDown = false;
m_mouseUp = true;
}
}
function updateRoundAndScore() {
var _local2 = m_scoreBoard.getBowlingScore();
var _local3 = _local2;
var _local4 = _local2;
var _local5 = _local2;
_local3 = _local3 / 100;
_local3 = int(_local3);
_local3 = _local3 % 10;
_local4 = _local4 / 10;
_local4 = int(_local4);
_local4 = _local4 % 10;
_local5 = int(_local5);
_local5 = _local5 % 10;
var _local6 = "score_digit_";
_local5++;
m_scoreOver[_local6 + "1"].gotoAndStop(_local5);
m_scoreMirror[_local6 + "1"].gotoAndStop(_local5);
_local4++;
m_scoreOver[_local6 + "2"].gotoAndStop(_local4);
m_scoreMirror[_local6 + "2"].gotoAndStop(_local4);
_local3++;
m_scoreOver[_local6 + "3"].gotoAndStop(_local3);
m_scoreMirror[_local6 + "3"].gotoAndStop(_local3);
_local2 = m_scoreBoard.getCurrentFrame();
_local3 = _local2;
_local4 = _local2;
_local5 = _local2;
_local4 = _local4 / 10;
_local4 = int(_local4);
_local4 = _local4 % 10;
_local5 = int(_local5);
_local5 = _local5 % 10;
_local6 = "round_digit_";
_local5++;
m_scoreOver[_local6 + "1"].gotoAndStop(_local5);
m_scoreMirror[_local6 + "1"].gotoAndStop(_local5);
_local4++;
m_scoreOver[_local6 + "2"].gotoAndStop(_local4);
m_scoreMirror[_local6 + "2"].gotoAndStop(_local4);
}
function newFrame() {
m_timeShift = 0;
m_timeShiftDirection = 0;
m_currentNumPins = 10;
m_floor = 0;
m_roof = 50;
m_throwTick = -1;
m_startNextFrameTick = -1;
m_ballInMoatTick = -1;
m_hideScoreTick = -1;
m_autoLeaveTick = -1;
m_readScoreTick = -1;
m_nextSquareTick = -1;
m_disengageNow = false;
m_view = 0;
var _local2 = bw.Pin.BASE_RADIUS;
var _local3 = -5 + 80;
var _local4 = 0;
var _local5 = 34;
var _local6 = _local5 / 2;
var _local7 = _local6 + _local5;
m_renderList = [];
m_renderList.push(m_pitObj);
m_pit._visible = true;
if (m_pins != undefined) {
for (var i in m_pins) {
m_pins[i].destory();
}
}
m_pins = new Array();
m_pins.push(new bw.Pin(m_parent, m_mirrorParent, 10, (_local5 * 3) - _local7, _local2 + _local3, (_local5 * -3) - _local4));
m_pins.push(new bw.Pin(m_parent, m_mirrorParent, 9, (_local5 * 2) - _local7, _local2 + _local3, (_local5 * -3) - _local4));
m_pins.push(new bw.Pin(m_parent, m_mirrorParent, 8, (_local5 * 1) - _local7, _local2 + _local3, (_local5 * -3) - _local4));
m_pins.push(new bw.Pin(m_parent, m_mirrorParent, 7, (_local5 * 0) - _local7, _local2 + _local3, (_local5 * -3) - _local4));
m_pins.push(new bw.Pin(m_parent, m_mirrorParent, 6, ((_local5 * 3) - _local6) - _local7, _local2 + _local3, (_local5 * -2) - _local4));
m_pins.push(new bw.Pin(m_parent, m_mirrorParent, 5, ((_local5 * 2) - _local6) - _local7, _local2 + _local3, (_local5 * -2) - _local4));
m_pins.push(new bw.Pin(m_parent, m_mirrorParent, 4, ((_local5 * 1) - _local6) - _local7, _local2 + _local3, (_local5 * -2) - _local4));
m_pins.push(new bw.Pin(m_parent, m_mirrorParent, 3, (_local5 * 2) - _local7, _local2 + _local3, (_local5 * -1) - _local4));
m_pins.push(new bw.Pin(m_parent, m_mirrorParent, 2, (_local5 * 1) - _local7, _local2 + _local3, (_local5 * -1) - _local4));
m_pins.push(new bw.Pin(m_parent, m_mirrorParent, 1, ((_local5 * 2) - _local6) - _local7, _local2 + _local3, (_local5 * 0) - _local4));
if (m_ball != undefined) {
m_ball.destroy();
}
m_ball = new bw.Ball(m_parent, m_mirrorParent, 0, bw.Ball.RADIUS, m_ballBackLeastZ);
m_ball.init(m_camera, m_ballMask);
m_ball.setVisible(false);
var _local8 = 0;
for ( ; _local8 < 10 ; _local8++) {
var _local9 = m_scoreOver["pinm" + (_local8 + 1)];
_local9.gotoAndStop(1);
_local9 = m_scoreMirror["pinm" + (_local8 + 1)];
_local9.gotoAndStop(1);
}
var _local10 = 160;
var _local11 = 55;
var _local12 = (29.5 + (_local5 * 3)) - _local7;
var _local13 = _local2;
var _local14 = (((-_local5) * 3) - _local11) - 10;
var _local15 = _local12;
var _local16 = _local13;
var _local17 = 900;
m_lines = new Array();
m_lines[0] = new bw.Line3(m_physicsDebug, _local15, _local16, _local17, _local12, _local13, _local14);
m_lines[1] = new bw.Line3(m_physicsDebug, _local15 - 25, _local16, _local17, _local12 - 25, _local13, _local14 + _local11);
m_lines[2] = new bw.Line3(m_physicsDebug, _local15 - _local10, _local16, _local17, _local12 - _local10, _local13, _local14);
m_lines[3] = new bw.Line3(m_physicsDebug, (_local15 - _local10) + 25, _local16, _local17, (_local12 - _local10) + 25, _local13, _local14 + _local11);
m_lines[4] = new bw.Line3(m_physicsDebug, _local12 - _local10, _local13, _local14, _local12, _local13, _local14);
m_lines[5] = new bw.Line3(m_physicsDebug, (_local12 - _local10) + 25, _local13, _local14 + _local11, _local12 - 25, _local13, _local14 + _local11);
m_lines[6] = new bw.Line3(m_physicsDebug, _local15 - _local10, _local16, _local17, _local15, _local16, _local17);
m_backWall = m_lines[4].p1.z;
var _local18 = [m_lines[0].p1.x + 10, m_lines[6].p1.z];
var _local19 = [m_lines[2].p1.x - 10, m_lines[4].p1.z];
var _local20 = [m_lines[2].p1.x, m_floor, m_lines[4].p1.z];
var _local21 = [m_lines[0].p1.x, m_roof, m_lines[6].p1.z];
m_ball.setMoat((m_lines[2].p1.x + 10) + 1, (m_lines[0].p1.x - 10) - 1, m_lines[5].p1.z - m_ball.getRadius());
m_ball.setMax(_local18[0], _local18[1]);
m_ball.setMin(_local19[0], _local19[1]);
var _local22 = m_pins.length;
var _local23 = 0;
for ( ; _local23 < _local22 ; _local23++) {
var _local24 = _local22;
while (_local24--) {
if (_local24 == _local23) {
continue;
}
m_pins[_local23].addCollide(m_pins[_local24]);
}
m_pins[_local23].init(m_camera);
m_pins[_local23].initDebugDraw(m_physicsDebug);
m_pins[_local23].setReflection(true);
m_pins[_local23].setDebugDraw(false);
m_renderList.push(m_pins[_local23]);
}
m_renderList.push(m_ball);
m_renderList.push(m_setter);
m_renderList.push(m_sweeper);
m_renderList.push(m_discoObj);
m_ball.initDebugDraw(m_physicsDebug);
m_ball.setDebugDraw(false);
m_physicsDebug.swapDepths(m_parent.getNextHighestDepth());
m_throwBonusEnd = -1;
m_throwBegun = false;
m_frameOver = false;
m_launched = false;
m_wasDebugDraw = true;
m_spin = 0;
setRoofAndFloor(130, 80);
m_setter.drop();
m_throwNo = 0;
if (m_scoreBoard.getCurrentFrame() == 10) {
switch (m_scoreBoard.getCurrentThrow()) {
case 1 :
m_scoreOver.light_a.gotoAndStop(2);
m_scoreOver.light_b.gotoAndStop(1);
break;
case 2 :
m_scoreOver.light_a.gotoAndStop(1);
m_scoreOver.light_b.gotoAndStop(2);
break;
case 3 :
m_scoreOver.light_a.gotoAndStop(2);
m_scoreOver.light_b.gotoAndStop(2);
break;
}
} else {
m_scoreOver.light_a.gotoAndStop(2);
m_scoreOver.light_b.gotoAndStop(1);
}
m_lastPinsStanding = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
m_pinsStanding = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
updateRoundAndScore();
var _local25 = ("20," + m_data.tick) + ",0=0";
fscommand ("playData", _local25);
}
function setBackWall(bw) {
m_backWall = bw;
updateLimits();
}
function setRoofAndFloor(newRoof, newFloor) {
m_roof = newRoof;
m_floor = newFloor;
updateLimits();
}
function updateLimits() {
var _local2 = [m_lines[2].p1.x, m_floor, m_backWall];
var _local3 = [m_lines[0].p1.x, m_roof, m_lines[6].p1.z];
var _local4 = m_pins.length;
while (_local4--) {
m_pins[_local4].setMin(_local2[0], _local2[1], _local2[2]);
m_pins[_local4].setMax(_local3[0], _local3[1], _local3[2]);
}
}
function isDisengage() {
return(m_disengageNow);
}
function disengage() {
var _local2 = ("76," + m_data.tick) + ",0=0";
fscommand ("playData", _local2);
com.midasplayer.fx.SoundManager.stop("snd_ambience_loop");
m_data.totalScore = m_scoreBoard.getScore();
Mouse.removeListener(m_throw);
snapshot(m_parent);
}
function returnCode() {
if (m_restartExit) {
return(-1);
}
return(0);
}
function onBallThrown(force, dir, spinForce, spinDir) {
var _local6 = com.midasplayer.util.XPMath.cos(dir) * force;
var _local7 = com.midasplayer.util.XPMath.sin(dir) * force;
var _local8 = com.midasplayer.util.XPMath.cos(spinDir);
var _local9 = com.midasplayer.util.XPMath.sin(spinDir);
m_ball.applyForce(_local6, 0, _local7);
m_ball.setSpinAmount(_local8 * 15, _local9 * 15);
m_ball.setHandsVisible(false);
var _local10 = m_ball.getMaxSpeed();
var _local11 = m_ball.getSpeed();
m_spinForceV = new bw.Vec3(0, 0, 0);
m_powerMeter.setPower((_local10 - _local11) / _local10);
m_spinX = _local8 * spinForce;
m_spinZ = _local9 * spinForce;
m_throw.setReady(false);
m_launched = true;
m_throwNo++;
m_timeShift = 0;
m_timeShiftDirection = 1;
m_throwTick = m_data.tick;
var _local12 = m_throwBonusEnd - m_data.tick;
m_throwBonusEnd = -1;
if (_local12 < 0) {
_local12 = 0;
}
if (m_data.isRelaxMode) {
_local12 = 0;
}
m_throwBegun = false;
var _local13 = int(100 * (_local12 / (m_data.ticksPerSec * m_timeBonusSec)));
m_data.timeBonus = m_data.timeBonus + _local13;
playQueued([{name:"snd_throw", vol:100, loop:false}, {name:"snd_roll_loop", vol:100, loop:true}]);
var _local14 = ((("3," + m_throwBeginData.tick) + ",") + m_throwBeginData.pos) + ",0=0";
fscommand ("playData", _local14);
m_throwPts = m_throw.getThrowData();
_local14 = (((("52," + m_data.tick) + ",") + bakeAList(m_throwPts)) + ",0=") + _local13;
fscommand ("playData", _local14);
m_spinPts = [];
}
function onStartThrow() {
m_throwBeginData = new Object();
m_throwBeginData.tick = m_data.tick;
m_throwBeginData.pos = [com.midasplayer.util.FloatEncoder.encodeBits(m_m3X), com.midasplayer.util.FloatEncoder.encodeBits(m_m3Y)];
m_throwTick = -1;
m_throwBegun = true;
m_ballApproachSlave = {_x:m_m3X, _y:m_m3Y};
m_ballApproachAnim = new com.midasplayer.util.EaseOutQuadAnimator(m_ballApproachSlave);
m_ballApproachAnim.setPosition(m_ballApproachSlave._x, m_ballBackMostZ);
m_ballApproachAnim.setDurationTicks(10);
}
function bakeAList(list) {
var _local3 = [];
var _local4;
var _local5;
var _local6 = 0;
for ( ; _local6 < list.length ; _local6++) {
var _local9 = list[_local6];
if (_local4 == undefined) {
var _local7 = _local9[0];
} else {
var _local7 = _local9[0] - _local4;
}
if (_local5 == undefined) {
var _local8 = _local9[1];
} else {
var _local8 = _local9[1] - _local5;
}
_local4 = _local9[0];
_local5 = _local9[1];
_local3.push(_local7);
_local3.push(_local8);
}
var _local10 = "";
var _local11 = "abcde";
var _local12 = 0;
for ( ; _local12 < _local3.length ; _local12++) {
if (_local10.length > 0) {
var _local13 = int(Math.random() * _local11.length) % _local11.length;
_local10 = _local10 + _local11.charAt(_local13);
}
if (_local3[_local12] < 0) {
_local10 = _local10 + ("f" + Math.abs(_local3[_local12]));
} else {
_local10 = _local10 + _local3[_local12];
}
}
return(_local10);
}
function onSetterOperationCompleted(op) {
if (op == "new_drop") {
m_pinsStanding = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
m_lastPinsStanding = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
setRoofAndFloor(50, 0);
m_beginCleanupTick = -1;
m_newThrowTick = -1;
m_waitForSettleTick = -1;
m_gutterPlayed = false;
m_ballStopped = false;
m_throwEnded = false;
m_pieTimer.setTimeLeft(m_timeBonusSec * 1000);
m_pieTimer.repaint(true);
m_pieTimer.appear();
m_powerMeter.appear();
m_throwReadyTick = m_data.tick + 10;
m_failThrow = false;
var _local3 = m_pins.length;
while (_local3--) {
m_pins[_local3].updatePaused = true;
}
}
if (op == "replace") {
m_newThrowTick = m_data.tick + (m_data.ticksPerSec * 1);
}
if (op == "pickup") {
sweepKnocked();
}
}
function onSetterOperationStarted(op) {
com.midasplayer.fx.SoundManager.play("snd_setter");
}
function onSweepBegin() {
var _local2 = m_pins.length;
while (_local2--) {
m_pins[_local2].updatePaused = false;
}
var _local3 = 0;
var _local4 = 0;
var _local5 = 0;
for ( ; _local5 < m_pins.length ; _local5++) {
if (m_pinsStanding[_local5] != m_lastPinsStanding[_local5]) {
_local3++;
} else if (m_pinsStanding[_local5] == 1) {
_local4++;
}
}
if (((_local4 - m_setter.getNumPinsHeld()) + _local3) >= 2) {
com.midasplayer.fx.SoundManager.play("snd_sweep_pins");
}
}
function onSweepComplete() {
if (!m_seriesOver) {
if (m_frameOver) {
m_startNextFrameTick = m_data.tick + (m_data.ticksPerSec * 1);
} else if (m_throwEnded) {
if (m_scoreBoard.getCurrentFrame() == 10) {
m_startNextFrameTick = m_data.tick + (m_data.ticksPerSec * 1);
} else {
m_newThrowTick = m_data.tick + (m_data.ticksPerSec * 1);
}
}
}
if (m_setter.getNumPinsHeld() > 0) {
m_setter.placeBack();
}
}
function tick() {
var _local2 = m_data.tick;
var _local3 = m_pins.length;
if (((_local2 & 3) == 0) && (m_data.ee != m_eeState)) {
m_eeState = !m_eeState;
m_data.ee = m_eeState;
if (m_eeState) {
disco();
} else {
undisco();
}
}
if (m_throw.isFailing()) {
m_throw.failFinalize();
}
if ((_local2 == m_throwBonusEnd) && (m_data.isRelaxMode == false)) {
if (m_pieTimer.isVisible) {
m_powerMeter.remove();
m_pieTimer.remove();
}
if (!m_launched) {
if (m_throw.isThrowing()) {
m_throw.failFinalize();
} else {
m_throw.failBegin();
}
m_failThrow = true;
m_mouseUp = false;
m_mouseDown = false;
}
}
if (m_mouseUp && (m_mouseDown)) {
m_mouseDown = false;
m_throw.onMouseDown();
} else {
if (m_mouseDown) {
m_mouseDown = false;
m_throw.onMouseDown();
}
if (m_mouseUp) {
m_mouseUp = false;
m_throw.onMouseUp();
}
}
if (m_autoLeaveTick == _local2) {
m_disengageNow = true;
return(undefined);
}
if (m_seriesOver && (m_autoLeaveTick == -1)) {
m_autoLeaveTick = _local2 + (m_data.ticksPerSec * 7);
m_powerMeter.remove();
m_scoreBoard.appear();
}
if (_local2 == m_startNextFrameTick) {
newFrame();
return(undefined);
}
if (m_launched) {
if ((m_throwTick != -1) && (_local2 < (m_throwTick + 13))) {
var _local4 = m_bkg._xmouse - (755 / 2);
var _local5 = int(_local4 - m_lastX);
m_lastX = _local4;
var _local6 = m_bkg._ymouse - (580 / 2);
var _local7 = int(_local6 - m_lastY);
m_lastY = _local6;
m_spinX = m_spinX + (_local5 * 50);
m_spinZ = m_spinZ + (_local7 * 10);
m_spinPts.push([_local5, _local7]);
} else if (_local2 == (m_throwTick + 13)) {
var _local8 = ((("77," + m_throwTick) + ",") + bakeAList(m_spinPts)) + ",0=0";
fscommand ("playData", _local8);
}
if (!m_ballStopped) {
m_spinForceV.x = m_spinX;
m_spinForceV.z = m_spinZ;
var _local9 = Math.min(12500, m_spinForceV.x);
var _local10 = (Math.PI / 2) - m_spinForceV.x;
m_powerMeter.setSpinForce(_local10, _local9 / 12500);
m_ball.applyForce(m_spinX, 0, m_spinZ);
}
} else if (!m_throw.isThrowing()) {
var _local11 = m_bkg._xmouse - (755 / 2);
var _local12 = _local11 - m_lastX;
m_lastX = _local11;
m_m3X = _local11 / 3;
if (m_m3X < -50) {
m_m3X = -50;
}
if (m_m3X > 50) {
m_m3X = 50;
}
var _local13 = m_bkg._ymouse - (580 / 2);
var _local14 = _local13 - m_lastY;
m_lastY = _local13;
m_m3Y = 700 + (_local13 / 2);
if (m_m3Y < m_ballBackLeastZ) {
m_m3Y = m_ballBackLeastZ;
}
if (m_m3Y > m_ballBackMostZ) {
m_m3Y = m_ballBackMostZ;
}
var _local15 = com.midasplayer.util.XPMath.sin(m_fuzzR) * 5;
var _local16 = com.midasplayer.util.XPMath.cos(m_fuzzR / 2) * 5;
m_fuzzR = m_fuzzR + 0.05;
if (m_fuzzR > (Math.PI * 2)) {
m_fuzzR = m_fuzzR - (Math.PI * 2);
}
m_ball.setX(m_m3X + _local15);
m_ball.setZ(m_m3Y + _local16);
} else {
if (m_ballApproachAnim && (m_ballApproachAnim.update())) {
m_ballApproachAnim = undefined;
}
m_ball.setX(m_ballApproachSlave._x + (com.midasplayer.util.XPMath.sin(m_fuzzR) * 5));
m_ball.setZ(m_ballApproachSlave._y + (com.midasplayer.util.XPMath.cos(m_fuzzR / 2) * 5));
}
if (m_drawDebug) {
var _local17 = m_lines.length;
while (_local17--) {
m_lines[_local17].update(_local2, m_camera);
}
}
if (m_discoBowler) {
m_discoBowler.update(_local2, m_camera);
}
m_sweeper.update(_local2, m_camera);
m_setter.update(_local2, m_camera);
if (m_setter.isDropNew()) {
setRoofAndFloor(m_setter.getRoof(), m_setter.getFloor());
}
if (_local2 == m_throwReadyTick) {
m_ball.setVisible(true);
m_lowTimePlayed = false;
m_throwBonusEnd = _local2 + (m_data.ticksPerSec * m_timeBonusSec);
m_failThrow = false;
m_pieTimer.appear();
m_powerMeter.appear();
m_throw.setReady(true);
m_soundQueue = {};
m_firstCxTick = -1;
m_lastCxTick = -1;
m_cxScore = 0;
}
if (_local2 == m_newThrowTick) {
m_ball.resetPosition(m_camera, 0, bw.Ball.RADIUS, m_ballBackLeastZ);
m_ball.setReflection(false);
m_ball.setMasked(false);
m_ball.setHandsVisible(true);
var _local18 = m_pins.length;
while (_local18--) {
m_pins[_local18].updatePaused = true;
}
m_throwReadyTick = _local2 + 10;
m_failThrow = true;
m_throwTick = -1;
m_gutterPlayed = false;
m_launched = false;
m_ballStopped = false;
setBackWall(m_lines[4].p1.z);
setRoofAndFloor(50, 0);
m_pit._visible = true;
m_scoreOver.light_a.gotoAndStop(1);
m_scoreOver.light_b.gotoAndStop(2);
}
if (_local2 == m_beginCleanupTick) {
m_beginCleanupTick = -1;
readScore();
var _local19 = 0;
var _local20 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var _local21 = 0;
for ( ; _local21 < _local3 ; _local21++) {
var _local22 = m_pins[_local21].isKnockedOver();
var _local23 = 9 - _local21;
_local20[_local23] = (_local22 ? 0 : 1);
if (_local22) {
_local19++;
}
}
var _local24 = ((((("10," + _local2) + ",") + _local20.join("-")) + ",") + m_firstCxTick) + ",0=0";
fscommand ("playData", _local24);
var _local25 = _local19 - (10 - m_currentNumPins);
if (m_firstCxTick != -1) {
var _local26 = [];
var _local27 = [];
var _local28 = 0;
for ( ; _local28 < _local3 ; _local28++) {
var _local29 = m_pins[_local28].getSketchBuffer();
if (_local29.length != 0) {
_local26.push((m_pins[_local28].isKnockedOver() ? 0 : 1));
_local27.push(_local29);
}
}
m_scoreBoard.renderSketch(_local26, _local27, m_ball.getSketchBuffer());
m_scoreBoard.setBlackBoardVisible(true);
} else {
m_scoreBoard.setBlackBoardVisible(false);
}
m_scoreBoard.addScore(_local25, _local20);
m_scoreBoard.appear();
m_powerMeter.remove();
var _local30 = _local3;
while (_local30--) {
m_pins[_local30].clearSketchBuffer();
}
m_ball.clearSketchBuffer();
m_data.ballResult.push([_local25, _local20]);
m_currentNumPins = 10 - _local19;
updateRoundAndScore();
var _local31 = m_scoreBoard.getSoundEffect();
if (_local31 != "") {
com.midasplayer.fx.SoundManager.play(_local31);
}
var _local32 = m_scoreBoard.getSignIdx();
if (_local32 != 0) {
var _local33 = m_signParent.attachMovie("signs", "ss", m_signParent.getNextHighestDepth());
_local33.setup(_local32, m_signAnimParent);
m_signParent._x = 0;
m_signParent._y = 0;
m_signParent._visible = true;
}
}
if (_local2 == m_hideScoreTick) {
m_hideScoreTick = -1;
if (!m_seriesOver) {
m_scoreBoard.remove();
if (m_pieTimer.isVisible) {
m_pieTimer.remove();
}
if (m_powerMeter.isVisible) {
m_powerMeter.remove();
}
}
}
if (_local2 == m_waitForSettleTick) {
m_waitForSettleTick = -1;
m_timeShiftDirection = -1;
var _local34 = 0;
for ( ; _local34 < _local3 ; _local34++) {
m_lastPinsStanding[_local34] = m_pinsStanding[_local34];
}
var _local35 = 0;
for ( ; _local35 < _local3 ; _local35++) {
var _local36 = m_pins[_local35];
if (_local36.isKnockedOver()) {
m_pinsStanding[_local35] = 0;
}
if (m_lastPinsStanding[_local35] != m_pinsStanding[_local35]) {
var _local37 = m_scoreOver["pinm" + _local36.getNumber()];
_local37.gotoAndPlay(2);
_local37 = m_scoreMirror["pinm" + _local36.getNumber()];
_local37.gotoAndPlay(2);
}
}
m_pit._visible = false;
m_beginCleanupTick = _local2 + (m_data.ticksPerSec * 1);
m_hideScoreTick = _local2 + (m_data.ticksPerSec * 5);
}
if (m_timeShiftDirection == 0) {
updateCore(_local2 + m_timeShift);
}
if (m_timeShiftDirection > 0) {
var _local38 = 2;
updateCore(_local2 + m_timeShift);
while (_local38-- , (_local38 != 0) && (m_timeShift < 32)) {
updateCore(_local2 + (++m_timeShift));
}
if (m_timeShift == 32) {
m_timeShiftDirection = 0;
}
}
if (m_timeShiftDirection < 0) {
if (m_timeShift > 0) {
m_timeShift--;
} else {
m_timeShiftDirection = 0;
}
}
for (var i in m_soundQueue) {
var _local39 = m_soundQueue[i];
if (_local39.tick == _local2) {
if (_local39.cmd == "play") {
com.midasplayer.fx.SoundManager.play(_local39.snd);
} else if (_local39.cmd == "volume") {
com.midasplayer.fx.SoundManager.setVolume(_local39.snd, _local39.vol);
} else if (_local39.cmd == "stop") {
com.midasplayer.fx.SoundManager.stop(_local39.snd);
}
delete m_soundQueue[i];
}
}
}
function updateCore(tick) {
m_ball.update(tick, m_camera);
m_ball.prepare(m_camera);
var _local3 = m_ball.inRail;
var _local4 = m_ball.point.z;
var _local5 = m_ball.point.y;
var _local6 = m_pins.length;
var _local7 = _local6;
while (_local7--) {
m_pins[_local7].update(tick, m_camera);
}
if ((_local3 != 0) && (!m_gutterPlayed)) {
m_soundQueue["@" + (++m_sndSeq)] = {cmd:"play", snd:"snd_gutter", tick:tick};
m_gutterPlayed = true;
}
if ((_local4 < -100) && ((!m_ballStopped) && ((_local3 == 0) || ((_local3 != 0) && (_local4 < -170))))) {
m_ballStopped = true;
m_ball.setReflection(false);
m_ball.setMasked(true);
var _local8 = (int(Math.random() * 2) % 2) + 1;
m_soundQueue["@" + (++m_sndSeq)] = {cmd:"play", snd:"snd_moat_" + _local8, tick:tick};
m_waitForSettleTick = int(tick + (m_data.ticksPerSec * 3));
}
if ((tick & 1) == 0) {
var _local9 = m_ballBackLeastZ + 155;
var _local10 = int(100 * (1 - ((_local9 - (_local4 + 155)) / _local9)));
m_soundQueue["@" + (++m_sndSeq)] = {cmd:"volume", snd:"snd_roll_loop", vol:_local10, tick:tick};
}
if (_local5 == -40) {
m_ball.setVisible(false);
m_soundQueue["@" + (++m_sndSeq)] = {cmd:"stop", snd:"snd_roll_loop", tick:tick};
}
if (_local4 < 50) {
var _local11 = 0;
var _local12 = 0;
for ( ; _local12 < _local6 ; _local12++) {
var _local13 = m_pins[_local12];
var _local14 = _local13.entities;
var _local15 = m_ball.testCollision(_local14[0]);
var _local16 = m_ball.testCollision(_local14[1]);
if (_local15 || (_local16)) {
_local13.updateV();
_local11++;
}
_local11 = _local11 + _local13.testCollisions();
}
if (_local11 != 0) {
if (m_firstCxTick == -1) {
m_firstCxTick = tick;
m_lastCxTick = tick + 16;
var _local17 = _local6;
while (_local17--) {
m_pins[_local17].storeRecording();
m_pins[_local17].updatePaused = false;
}
}
if (tick < m_lastCxTick) {
m_cxScore = m_cxScore + _local11;
}
}
if ((m_firstCxTick != -1) && ((m_lastCxTick - tick) > 8)) {
m_ball.storeRecording();
}
if (tick == m_lastCxTick) {
if (m_cxScore < 5) {
var _local19 = (int(Math.random() * 2) % 2) + 1;
var _local18 = "snd_hit_low_" + _local19;
} else if (m_cxScore < 25) {
var _local20 = (int(Math.random() * 3) % 3) + 1;
var _local18 = "snd_hit_medium_" + _local20;
} else {
var _local21 = (int(Math.random() * 2) % 2) + 1;
var _local18 = "snd_hit_high_" + _local21;
}
m_soundQueue["@" + (++m_sndSeq)] = {cmd:"play", snd:_local18, tick:m_firstCxTick};
}
}
var _local22 = _local6;
while (_local22--) {
m_pins[_local22].record(tick);
}
m_ball.record(tick);
}
function readScore() {
var _local2 = [];
var _local3 = m_pins.length;
var _local4 = 0;
var _local5 = 0;
for ( ; _local5 < _local3 ; _local5++) {
if (!m_pins[_local5].isKnockedOver()) {
m_pins[_local5].updatePaused = false;
m_pins[_local5].stabilize();
_local2.push(m_pins[_local5]);
_local4++;
}
}
var _local6 = m_scoreBoard.getCurrentFrame();
if (m_data.numFrames < 10) {
var _local7 = m_scoreBoard.getCurrentThrow();
if ((_local6 == m_data.numFrames) && ((_local7 == 2) || ((_local7 == 1) && (_local4 == 0)))) {
updateRoundAndScore();
m_seriesOver = true;
sweepAll();
} else if ((_local4 > 0) && (m_throwNo < 2)) {
setRoofAndFloor(m_setter.getRoof(), m_setter.getFloor());
m_setter.pickup(_local2);
} else {
updateRoundAndScore();
m_frameOver = true;
sweepAll();
}
} else if (_local6 == 10) {
var _local8 = m_scoreBoard.getCurrentThrow();
if (_local8 == 1) {
if (_local4 == 0) {
m_isStrikeInFirstTenth = true;
sweepAll();
} else {
setRoofAndFloor(m_setter.getRoof(), m_setter.getFloor());
m_setter.pickup(_local2);
}
} else if (_local8 == 2) {
if (m_isStrikeInFirstTenth) {
if (_local4 > 0) {
setRoofAndFloor(m_setter.getRoof(), m_setter.getFloor());
m_setter.pickup(_local2);
} else {
sweepAll();
}
} else if (_local4 > 0) {
sweepAll();
m_seriesOver = true;
updateRoundAndScore();
} else {
sweepAll();
}
} else if (_local8 == 3) {
updateRoundAndScore();
m_seriesOver = true;
sweepAll();
}
} else if ((_local4 > 0) && (m_throwNo < 2)) {
setRoofAndFloor(m_setter.getRoof(), m_setter.getFloor());
m_setter.pickup(_local2);
} else {
updateRoundAndScore();
m_frameOver = true;
sweepAll();
}
}
function sweepKnocked() {
var _local2 = [];
var _local3 = m_pins.length;
var _local4 = 0;
for ( ; _local4 < _local3 ; _local4++) {
if (m_pins[_local4].isKnockedOver()) {
_local2.push(m_pins[_local4]);
}
}
setBackWall(-250);
m_sweeper.sweep(_local2);
com.midasplayer.fx.SoundManager.play("snd_sweeper");
}
function sweepAll() {
var _local2 = [];
var _local3 = m_pins.length;
var _local4 = 0;
for ( ; _local4 < _local3 ; _local4++) {
_local2.push(m_pins[_local4]);
}
setBackWall(-250);
m_sweeper.sweep(_local2);
m_throwEnded = true;
com.midasplayer.fx.SoundManager.play("snd_sweeper");
}
function quitGame() {
var _local2 = ("71," + m_data.tick) + ",0=0";
fscommand ("playData", _local2);
m_scoreBoard.finalize();
m_autoLeaveTick = m_data.tick + 1;
}
function depthSort(a) {
var _local3 = a.length;
var _local7 = 1;
for ( ; _local7 < _local3 ; _local7++) {
if (a[_local7].avgZ > a[_local7 - 1].avgZ) {
var _local5 = a[_local7];
var _local6 = a[_local7].avgZ;
var _local4 = _local7;
do {
a[_local4] = a[_local4 - 1];
_local4--;
} while ((_local4 > 0) && (a[_local4 - 1].avgZ < _local6));
a[_local4] = _local5;
}
}
}
function playQueued(samples) {
var _local3 = new Object();
_local3.list = samples;
_local3.listPtr = 0;
m_playQueues["a" + m_playQueueSequence] = _local3;
var thisCl = this;
var ptr = m_playQueueSequence;
var fn = null;
fn = function () {
var _local2 = thisCl.m_playQueues["a" + ptr];
if (_local2.list.length >= (_local2.listPtr - 1)) {
var _local3 = _local2.list[_local2.listPtr++];
com.midasplayer.fx.SoundManager.play(_local3.name, _local3.vol, _local3.loop, fn);
} else {
delete thisCl.m_playQueues["a" + ptr];
}
};
fn();
m_playQueueSequence++;
}
function render() {
var _local2 = m_data.tick;
var _local3 = m_data.alpha;
if (m_drawDebug) {
m_physicsDebug.clear();
var _local4 = 0;
for ( ; _local4 < m_lines.length ; _local4++) {
m_lines[_local4].render(m_camera, _local3);
}
var _local5 = 0;
for ( ; _local5 < m_renderList.length ; _local5++) {
m_renderList[_local5].renderDebug(m_camera, _local3);
}
m_physicsDebug.swapDepths(m_parent.getNextHighestDepth());
} else {
m_pitObj.vis = (m_ball.point.x < -45) || (m_ball.point.x > 45);
depthSort(m_renderList);
var _local6 = 0;
for ( ; _local6 < m_renderList.length ; _local6++) {
m_renderList[_local6].render(m_camera, _local2, _local3);
}
m_scoreOver.swapDepths(m_parent.getNextHighestDepth());
if (m_scoreBoard.isVisible()) {
m_scoreBoard.render();
m_scoreBoard.swapDepths(m_parent.getNextHighestDepth());
}
}
if (m_signAnimParent._visible) {
m_signAnimParent.swapDepths(m_parent.getNextHighestDepth());
}
if (m_signParent._visible) {
m_signParent.swapDepths(m_parent.getNextHighestDepth());
}
if (!m_launched) {
var _local7 = m_throwBonusEnd - _local2;
if ((m_throwBonusEnd != -1) && ((!m_lowTimePlayed) && (_local7 <= 38))) {
com.midasplayer.fx.SoundManager.play("snd_time_running_out");
m_lowTimePlayed = true;
}
if (_local7 < 0) {
_local7 = 0;
}
var _local8 = (_local7 - _local3) * m_data.millisPerTick;
m_pieTimer.setTimeLeft(_local8);
}
m_pieTimer.repaint(!m_launched);
if (m_discoBowler) {
m_discoBowler.render(_local2, m_camera);
m_discoBall.swapDepths(m_parent.getNextHighestDepth());
}
}
var m_timeBonusSec = 10;
var m_ballBackMostZ = 850;
var m_ballBackLeastZ = 810;
var m_playQueues = {};
var m_playQueueSequence = 1;
}
Symbol 1215 MovieClip [__Packages.bw.Sweeper] Frame 0
class bw.Sweeper
{
var m_listener, m_renderBuf, m_numRender, m_clip, m_isDone, m_point, m_mirrorClip, m_mirror, m_mirrorMask, m_pins, m_slave, m_dropAnimator, m_liftAnimator, m_sweepAnimator, avgZ;
function Sweeper (p, x, y, z) {
m_listener = [];
m_renderBuf = new Array(64);
var _local6 = 0;
for ( ; _local6 < 64 ; _local6++) {
m_renderBuf[_local6] = {x:0, y:0, z:0};
}
m_numRender = 2;
m_clip = p.attachMovie("sweeper", "sweep", p.getNextHighestDepth());
m_clip._x = 307 + (144 / 2);
m_clip._y = 67 + (83 / 2);
m_isDone = false;
m_point = new bw.Point3(x, y, z);
}
function addListener(l) {
m_listener.push(l);
}
function getZ() {
return(m_point.z);
}
function isDone() {
return(m_isDone);
}
function get clip() {
return(m_clip);
}
function get mirrorClip() {
return(m_mirrorClip);
}
function setMirror(mirror) {
m_mirror = mirror;
m_mirrorClip = m_mirror.attachMovie("sweeper_mirror", "sweep_mr", m_mirror.getNextHighestDepth());
m_mirrorClip._x = 307 + (144 / 2);
m_mirrorClip._y = 67 + (83 / 2);
m_mirrorMask = m_mirror.createEmptyMovieClip("sweeper_mask", m_mirror.getNextHighestDepth());
m_mirrorMask._x = 0;
m_mirrorMask._y = 0;
m_mirrorClip.setMask(m_mirrorMask);
}
function sweep(pins) {
m_pins = pins;
m_slave = {_x:50, _y:78};
m_dropAnimator = new com.midasplayer.util.EaseOutQuadAnimator(m_slave);
m_dropAnimator.setPosition(50, -15);
m_dropAnimator.setDurationTicks(25);
m_isDone = false;
}
function record(tick) {
var _local3 = m_renderBuf[tick & 63];
_local3.x = m_point.x;
_local3.y = m_point.y;
_local3.z = m_point.z;
}
function update(tick, camera) {
if (m_liftAnimator && (m_liftAnimator.update())) {
m_liftAnimator = undefined;
var _local4 = 0;
for ( ; _local4 < m_pins.length ; _local4++) {
m_pins[_local4].setVisible(false);
}
var _local5 = 0;
for ( ; _local5 < m_listener.length ; _local5++) {
m_listener[_local5].onSweepComplete();
}
m_isDone = true;
}
if (m_sweepAnimator && (m_sweepAnimator.update())) {
m_sweepAnimator = undefined;
m_liftAnimator = new com.midasplayer.util.EaseOutQuadAnimator(m_slave);
m_liftAnimator.setPosition(-200, 78);
m_liftAnimator.setDurationTicks(25);
}
if (m_dropAnimator && (m_dropAnimator.update())) {
m_dropAnimator = undefined;
var _local6 = 0;
for ( ; _local6 < m_listener.length ; _local6++) {
m_listener[_local6].onSweepBegin();
}
m_sweepAnimator = new com.midasplayer.util.EaseOutQuadAnimator(m_slave);
m_sweepAnimator.setPosition(-200, -15);
m_sweepAnimator.setDurationTicks(30);
}
if (m_point.y == -15) {
var _local7 = 0;
for ( ; _local7 < m_pins.length ; _local7++) {
var _local8 = m_pins[_local7].getZ();
if (_local8 < -180) {
var _local9 = -(-240 - _local8);
var _local10 = _local9 / 60;
if (_local10 > 0.8) {
m_pins[_local7].setVisible(false);
} else {
m_pins[_local7].setBlackTint(_local10 * 100);
}
m_pins[_local7].setReflection(false);
}
if (m_slave._x < (_local8 + 30)) {
m_pins[_local7].applyForce(0, 0, -10000);
}
}
}
if (m_sweepAnimator || (m_dropAnimator || (m_liftAnimator))) {
m_numRender = 10;
}
m_point.x = 0;
m_point.y = m_slave._y;
m_point.z = m_slave._x;
camera.transform(m_point);
avgZ = m_point.ftz.get(0.5);
}
function render(camera, tick) {
if ((--m_numRender) < 0) {
return(undefined);
}
camera.project(m_point);
var _local4 = bw.Camera.DIST / m_point.sz;
var _local5 = 90 * _local4;
m_clip._x = m_point.sx;
m_clip._y = m_point.sy - 40;
m_clip._xscale = _local5;
m_clip._yscale = _local5;
m_clip.swapDepths(m_clip._parent.getNextHighestDepth());
m_mirrorClip._x = m_point.sx;
m_mirrorClip._y = ((m_clip._y + 10) + (m_clip._height / 2)) + (m_point.y * 1.25);
m_mirrorClip._xscale = _local5;
m_mirrorClip._yscale = _local5;
m_mirrorClip.swapDepths(m_mirror.getNextHighestDepth());
var _local6 = m_mirrorClip._x - (144 / 2);
var _local7 = m_mirrorClip._y - (83 / 2);
var _local8 = 144;
var _local9 = 314 - (_local7 + 83);
if (_local7 < 202) {
_local7 = 202;
}
m_mirrorMask.clear();
m_mirrorMask.beginFill(16711935);
m_mirrorMask.moveTo(_local6, _local7);
m_mirrorMask.lineTo(_local6 + _local8, _local7);
m_mirrorMask.lineTo(_local6 + _local8, _local7 + _local9);
m_mirrorMask.lineTo(_local6, _local7 + _local9);
m_mirrorMask.lineTo(_local6, _local7);
m_mirrorMask.endFill();
}
}
Symbol 1216 MovieClip [__Packages.bw.Setter] Frame 0
class bw.Setter
{
var m_renderBuf, m_listener, m_parent, m_clip, m_slave, m_floor, m_inOp, m_roof, m_point, m_mode, m_pins, m_mirror, m_mirrorClip, m_mirrorMask, m_dropAnimator, m_liftAnimator, m_numRender, avgZ;
function Setter (p, x, y, z) {
m_renderBuf = new Array(64);
m_listener = [];
var _local6 = 0;
for ( ; _local6 < 64 ; _local6++) {
m_renderBuf[_local6] = {x:0, y:0, z:0};
}
m_parent = p;
m_clip = m_parent.attachMovie("pinsetter", "pinset", m_parent.getNextHighestDepth());
m_clip._x = 331 + (96 / 2);
m_clip._y = 65 + (85 / 2);
m_slave = {_x:0, _y:0};
m_floor = 80;
m_inOp = false;
m_roof = m_floor + 50;
m_point = new bw.Point3(x, y, z);
m_mode = "";
m_pins = [];
}
function addListener(l) {
m_listener.push(l);
}
function setMirror(mirror) {
m_mirror = mirror;
m_mirrorClip = m_mirror.attachMovie("pinsetter", "pinset", m_mirror.getNextHighestDepth());
m_mirrorClip._x = 331 + (96 / 2);
m_mirrorClip._y = 65 + (85 / 2);
m_mirrorMask = m_mirror.createEmptyMovieClip("pinsetter_mask", m_mirror.getNextHighestDepth());
m_mirrorMask._x = 0;
m_mirrorMask._y = 0;
m_mirrorClip.setMask(m_mirrorMask);
}
function get clip() {
return(m_clip);
}
function get mirrorClip() {
return(m_mirrorClip);
}
function placeBack() {
m_slave = {_x:0, _y:70};
m_dropAnimator = new com.midasplayer.util.EaseOutQuadAnimator(m_slave);
m_dropAnimator.setPosition(0, 30);
m_dropAnimator.setDurationTicks(25);
m_mode = "replace";
var _local2 = 0;
for ( ; _local2 < m_listener.length ; _local2++) {
m_listener[_local2].onSetterOperationStarted(m_mode);
}
m_inOp = true;
m_roof = 130;
}
function pickup(pinList) {
m_pins = pinList;
m_slave = {_x:0, _y:78};
m_dropAnimator = new com.midasplayer.util.EaseOutQuadAnimator(m_slave);
m_dropAnimator.setPosition(0, 30);
m_dropAnimator.setDurationTicks(25);
m_mode = "pickup";
var _local3 = 0;
for ( ; _local3 < m_listener.length ; _local3++) {
m_listener[_local3].onSetterOperationStarted(m_mode);
}
m_inOp = true;
m_roof = 130;
}
function drop() {
m_slave = {_x:0, _y:78};
m_dropAnimator = new com.midasplayer.util.EaseOutQuadAnimator(m_slave);
m_dropAnimator.setPosition(0, 30);
m_dropAnimator.setDurationTicks(25);
m_mode = "new_drop";
var _local2 = 0;
for ( ; _local2 < m_listener.length ; _local2++) {
m_listener[_local2].onSetterOperationStarted(m_mode);
}
m_inOp = true;
}
function getNumPinsHeld() {
return(m_pins.length);
}
function getFloor() {
if (m_inOp && (m_dropAnimator != undefined)) {
return(m_point.y - 30);
}
return(m_floor);
}
function getRoof() {
return(m_roof);
}
function isDone() {
return(!m_inOp);
}
function isLifting() {
return(m_inOp && (m_mode == "lift"));
}
function isDropNew() {
return(m_inOp && (m_mode == "new_drop"));
}
function isRepositining() {
return(m_inOp && ((m_mode == "pickup") || (m_mode == "replace")));
}
function update(tick, camera) {
if (m_liftAnimator && (m_liftAnimator.update())) {
m_liftAnimator = undefined;
m_inOp = false;
var _local4 = 0;
for ( ; _local4 < m_listener.length ; _local4++) {
m_listener[_local4].onSetterOperationCompleted(m_mode);
}
}
if (m_dropAnimator && (m_dropAnimator.update())) {
m_dropAnimator = undefined;
if (m_mode == "new_drop") {
m_floor = 0;
m_slave = {_x:0, _y:30};
m_liftAnimator = new com.midasplayer.util.EaseInQuadAnimator(m_slave);
m_liftAnimator.setPosition(0, 78);
m_liftAnimator.setDurationTicks(20);
}
if (m_mode == "replace") {
m_pins = [];
m_liftAnimator = new com.midasplayer.util.EaseInQuadAnimator(m_slave);
m_liftAnimator.setPosition(0, 78);
m_liftAnimator.setDurationTicks(20);
var _local5 = 0;
for ( ; _local5 < m_listener.length ; _local5++) {
m_listener[_local5].onSetterOperationCompleted(m_mode);
}
m_mode = "lift";
var _local6 = 0;
for ( ; _local6 < m_listener.length ; _local6++) {
m_listener[_local6].onSetterOperationStarted(m_mode);
}
}
if (m_mode == "pickup") {
m_liftAnimator = new com.midasplayer.util.EaseInQuadAnimator(m_slave);
m_liftAnimator.setPosition(0, 70);
m_liftAnimator.setDurationTicks(20);
var _local7 = 0;
for ( ; _local7 < m_listener.length ; _local7++) {
m_listener[_local7].onSetterOperationCompleted(m_mode);
}
m_mode = "lift";
var _local8 = 0;
for ( ; _local8 < m_listener.length ; _local8++) {
m_listener[_local8].onSetterOperationStarted(m_mode);
}
}
}
if ((m_mode == "lift") || (m_mode == "replace")) {
var _local9 = 0;
for ( ; _local9 < m_pins.length ; _local9++) {
m_pins[_local9].setYAndStabilize(m_slave._y - 10);
}
}
if ((m_mode == "lift") || (m_dropAnimator || (m_liftAnimator))) {
m_numRender = 10;
}
m_point.x = m_slave._x;
m_point.y = m_slave._y;
m_point.z = 0;
camera.transform(m_point);
avgZ = m_point.ftz.get(0);
}
function record(tick) {
var _local3 = m_renderBuf[tick & 63];
_local3.x = m_point.x;
_local3.y = m_point.y;
_local3.z = m_point.z;
}
function render(camera, tick) {
if ((--m_numRender) < 0) {
return(undefined);
}
camera.project(m_point);
var _local4 = bw.Camera.DIST / m_point.sz;
m_clip._x = m_point.sx;
m_clip._y = m_point.sy - 40;
m_clip.swapDepths(m_clip._parent.getNextHighestDepth());
m_mirrorClip._x = m_point.sx;
m_mirrorClip._y = (m_point.sy + 40) + (m_point.y * 1.33);
m_mirrorClip._xscale = 100;
m_mirrorClip._yscale = -100;
m_mirrorClip.swapDepths(m_mirror.getNextHighestDepth());
var _local5 = m_mirrorClip._x - (96 / 2);
var _local6 = m_mirrorClip._y - (85 / 2);
var _local7 = 96;
var _local8 = 332 - (_local6 + 85);
m_mirrorMask.clear();
m_mirrorMask.beginFill(16711935);
m_mirrorMask.moveTo(_local5, _local6);
m_mirrorMask.lineTo(_local5 + _local7, _local6);
m_mirrorMask.lineTo(_local5 + _local7, _local6 + _local8);
m_mirrorMask.lineTo(_local5, _local6 + _local8);
m_mirrorMask.lineTo(_local5, _local6);
m_mirrorMask.endFill();
}
}
Symbol 1217 MovieClip [__Packages.bw.PieTimer] Frame 0
class bw.PieTimer
{
var isDisabled, isVisible, m_parent, m_timeLeft, m_totalSeconds, m_container, m_circleBkg1, m_circleBkg2, m_lines, m_mask, m_lastDrawValue, m_posX, m_posY, m_w, m_h, m_anim;
function PieTimer (parent, isDisabled) {
this.isDisabled = isDisabled;
isVisible = false;
m_parent = parent;
m_timeLeft = 0;
m_totalSeconds = 0;
}
function init(clipName1, clipName2) {
var _local4 = m_parent.getNextHighestDepth();
m_container = m_parent.createEmptyMovieClip("container" + _local4, _local4);
m_circleBkg1 = m_container.attachMovie(clipName1, "b2", m_container.getNextHighestDepth());
m_circleBkg2 = m_container.attachMovie(clipName2, "b1", m_container.getNextHighestDepth());
m_lines = m_container.createEmptyMovieClip("line", m_container.getNextHighestDepth());
m_mask = m_container.createEmptyMovieClip("mk", m_container.getNextHighestDepth());
m_circleBkg2.setMask(m_mask);
m_container._visible = false;
m_lastDrawValue = -1;
if (isDisabled) {
m_container._visible = false;
}
}
function destroy() {
m_circleBkg1.removeMovieClip();
m_circleBkg2.removeMovieClip();
m_mask.removeMovieClip();
m_lines.removeMovieClip();
m_container.removeMovieClip();
m_timeLeft = 0;
m_totalSeconds = 0;
}
function setPosition(x, y) {
m_posX = x;
m_posY = y;
m_container._x = x - 150;
m_container._y = y;
}
function setSize(w, h) {
m_w = w;
m_h = h;
}
function setAlpha(v) {
if (v != 0) {
m_container._visible = true;
m_container._alpha = v;
} else {
m_container._visible = false;
}
}
function setMaxTime(millis) {
m_totalSeconds = millis;
}
function setTimeLeft(millis) {
m_timeLeft = millis;
}
function appear() {
isVisible = true;
m_anim = new com.midasplayer.util.EaseInQuadAnimator(m_container);
m_anim.setPosition(m_posX, m_posY);
m_anim.setDuration(400);
}
function remove() {
isVisible = false;
m_anim = new com.midasplayer.util.EaseInQuadAnimator(m_container);
m_anim.setPosition(m_posX - 150, m_posY);
m_anim.setDuration(400);
}
function repaint(redrawAll) {
if (isDisabled) {
return(undefined);
}
if (m_anim && (m_anim.update())) {
m_anim = undefined;
}
if (!redrawAll) {
return(undefined);
}
var _local3 = 64;
var _local4 = Math.floor(_local3 * (1 - ((m_totalSeconds - m_timeLeft) / m_totalSeconds)));
if (m_lastDrawValue == _local4) {
return(undefined);
}
m_lastDrawValue = _local4;
m_mask.clear();
m_mask.beginFill(16711680);
var _local9 = [-1, -1];
var _local10 = (Math.PI * 2) / (_local3 - 1);
var _local11 = Math.PI / 2;
var _local12 = 0;
for ( ; _local12 < _local3 ; _local12++) {
var _local13 = _local11 + (_local10 * ((_local3 - 1) - _local12));
var _local14 = Math.cos(_local13);
var _local15 = -Math.sin(_local13);
var _local16 = (_local14 * 40) + m_w;
var _local17 = (_local15 * 40) + m_h;
var _local18 = _local14 * 3.5;
var _local19 = _local15 * 3.5;
if (_local12 < (_local3 - _local4)) {
_local16 = m_w;
_local17 = m_h;
} else if (_local12 == (_local3 - _local4)) {
var _local7 = _local16 - _local18;
var _local8 = _local17 - _local19;
}
if (_local12 == 0) {
if ((_local16 != _local9[0]) || (_local17 != _local9[1])) {
}
_local9[0] = _local16;
_local9[1] = _local17;
m_mask.moveTo(_local16, _local17);
} else {
var _local5 = _local16 - _local18;
var _local6 = _local17 - _local19;
if ((_local16 != _local9[0]) || (_local17 != _local9[1])) {
}
_local9[0] = _local16;
_local9[1] = _local17;
m_mask.lineTo(_local16, _local17);
}
}
m_mask.endFill();
m_container._visible = true;
}
}
Symbol 1218 MovieClip [__Packages.bw.Entity] Frame 0
class bw.Entity
{
var eid, m_isActive, mass, radius, point, velocity, velocityS, maxX, maxY, maxZ, minX, minY, minZ;
function Entity (x_, y_, z_, radius_) {
if (x_ == undefined) {
x_ = 0;
}
if (y_ == undefined) {
y_ = 0;
}
if (z_ == undefined) {
z_ = 0;
}
if (radius_ == undefined) {
radius_ = 0;
}
eid = ++entityId;
m_isActive = true;
mass = radius_ * radius_;
radius = radius_;
point = new bw.Point3(x_, y_, z_);
velocity = new bw.Vec3(0, 0, 0);
velocityS = new bw.Vec3(0, 0, 0);
maxX = 1000;
maxY = 1000;
maxZ = 1000;
minX = -1000;
minY = radius_;
minZ = -1000;
}
function copyInto(other) {
point.copyInto(bw.Point3(other.point));
velocity.copyInto(bw.Vec3(other.velocity));
velocityS.copyInto(bw.Vec3(other.velocityS));
other.maxX = maxX;
other.maxY = maxY;
other.maxZ = maxZ;
other.minX = minX;
other.minY = minY;
other.minZ = minZ;
other.mass = mass;
other.eid = eid;
other.radius = radius;
other.friction = friction;
}
function init(cam) {
cam.transform(point);
}
function isActive() {
return(m_isActive);
}
function onCollision(other) {
}
function applyForce(x, y, z) {
velocity.x = velocity.x + ((x * 0.1) / mass);
velocity.y = velocity.y + ((y * 0.1) / mass);
velocity.z = velocity.z + ((z * 0.1) / mass);
velocityS.x = velocity.x * SFACTOR_D;
velocityS.y = velocity.y * SFACTOR_D;
velocityS.z = velocity.z * SFACTOR_D;
velocity.flush();
velocityS.flush();
}
function setMass(m) {
mass = m;
}
function collision(co) {
if (velocity.isZero()) {
return(false);
}
var _local3 = co.point.x - point.x;
_local3 = _local3 * _local3;
var _local4 = co.point.y - point.y;
_local4 = _local4 * _local4;
var _local5 = co.point.z - point.z;
_local5 = _local5 * _local5;
var _local6 = Math.sqrt((_local3 + _local4) + _local5);
var _local7 = co.radius + radius;
_local6 = _local6 - _local7;
var _local8 = velocityS.length();
if (_local8 < _local6) {
return(false);
}
var _local9 = new bw.Vec3(velocityS.x, velocityS.y, velocityS.z);
if (_local8 > 0) {
_local9.x = _local9.x / _local8;
_local9.y = _local9.y / _local8;
_local9.z = _local9.z / _local8;
}
var _local10 = new bw.Vec3(co.point.x - point.x, co.point.y - point.y, co.point.z - point.z);
var _local11 = _local9.dot(_local10);
if (_local11 <= 0) {
return(false);
}
var _local12 = _local10.length();
var _local13 = (_local12 * _local12) - (_local11 * _local11);
var _local14 = _local7 * _local7;
if (_local13 >= _local14) {
return(false);
}
var _local15 = _local14 - _local13;
if (_local15 < 0) {
return(false);
}
return(_local8 >= (_local11 - Math.sqrt(_local15)));
}
function minus(co) {
return(new bw.Vec3(co.point.x - point.x, co.point.y - point.y, co.point.z - point.z));
}
function setMax(x, y, z) {
maxX = x;
maxY = y;
maxZ = z;
}
function setMin(x, y, z) {
minX = x;
minY = y;
minZ = z;
}
function getRadius() {
return(radius);
}
function update(tick) {
velocity.y = velocity.y + (-9.81 * SFACTOR_D);
var _local3 = ((velocity.x * velocity.x) + (velocity.y * velocity.y)) + (velocity.z * velocity.z);
if (_local3 > SLIMIT) {
var _local4 = Math.sqrt(_local3 / SLIMIT);
velocity.x = velocity.x / _local4;
velocity.y = velocity.y / _local4;
velocity.z = velocity.z / _local4;
}
var _local5 = velocity.x;
var _local6 = velocity.y;
var _local7 = velocity.z;
point.x = point.x + (_local5 * SFACTOR_D);
point.y = point.y + (_local6 * SFACTOR_D);
point.z = point.z + (_local7 * SFACTOR_D);
if (point.x < minX) {
point.x = minX;
velocity.x = (-_local5) * 0.3;
} else if (point.x > maxX) {
point.x = maxX;
velocity.x = (-_local5) * 0.3;
}
if (point.z < minZ) {
point.z = minZ;
velocity.z = (-_local7) * 0.4;
} else if (point.z > maxZ) {
point.z = maxZ;
velocity.z = -_local7;
}
if (point.y < minY) {
point.y = minY;
velocity.y = 0;
} else if (point.y > maxY) {
point.y = maxY;
velocity.y = 0;
}
if (point.y == minY) {
velocity.x = velocity.x * friction;
velocity.z = velocity.z * friction;
}
}
static var SLIMIT = 12000;
static var SLIMIT_D = 1 / SLIMIT;
static var SFACTOR_M = 3;
static var SFACTOR_D = 1 / SFACTOR_M;
var friction = 0.85;
static var entityId = 0;
}
Symbol 1219 MovieClip [__Packages.bw.Ball] Frame 0
class bw.Ball extends bw.Entity
{
var m_sketchBuf, m_renderBuf, m_isHandsVisible, m_lastTickMasked, m_lastMask, m_isMasked, m_parent, m_bowlingBallClip, m_mirror, m_storeNext, m_bowlingBallClipMirror, friction, setMass, m_isVisible, m_isReflection, isInit, inMoat, inRail, m_myoffs, m_debugDraw, m_maxSpeed, m_bowlingBall, m_clip, m_maskClip, point, velocity, m_debugParent, velocityS, moatX1, moatX2, moatZ, minX, maxX, minZ, maxZ, minY, radius, maxY, collision, avgZ;
function Ball (p, mirror, px, py, pz) {
super(px, py, pz, RADIUS);
m_sketchBuf = new Array();
m_renderBuf = new Array(64);
var _local8 = 0;
for ( ; _local8 < 64 ; _local8++) {
m_renderBuf[_local8] = {point:new bw.Point3(), vis:false, refl:false, mask:false, myoffs:0};
}
m_isHandsVisible = true;
m_lastTickMasked = -1;
m_lastMask = false;
m_isMasked = false;
m_parent = p;
m_bowlingBallClip = p.attachMovie("bowlingball_container", "bball", p.getNextHighestDepth());
m_mirror = mirror;
m_storeNext = false;
m_bowlingBallClipMirror = m_mirror.createEmptyMovieClip("bowlingball_mirror", m_mirror.getNextHighestDepth());
friction = 0.99;
setMass(800);
m_isVisible = true;
m_isReflection = false;
isInit = false;
inMoat = false;
inRail = 0;
m_myoffs = 0;
m_debugDraw = false;
m_maxSpeed = 10000000 /* 0x989680 */;
var _local9 = new bw.Vec3(1, 0, bw.Entity.SLIMIT * 2);
var _local10 = ((_local9.x * _local9.x) + (_local9.y * _local9.y)) + (_local9.z * _local9.z);
if (_local10 > bw.Entity.SLIMIT) {
var _local11 = Math.sqrt(_local10 / bw.Entity.SLIMIT);
_local9.x = _local9.x / _local11;
_local9.y = _local9.y / _local11;
_local9.z = _local9.z / _local11;
m_maxSpeed = _local9.length();
}
setHandsVisible(true);
}
function destroy() {
if (m_bowlingBall) {
m_bowlingBallClipMirror.removeMovieClip();
m_bowlingBallClip.removeMovieClip();
m_clip.removeMovieClip();
m_bowlingBall.destory();
}
}
function init(cam, ballMask) {
m_maskClip = ballMask;
cam.transformNoI(point);
}
function resetPosition(cam, px, py, pz) {
point = new bw.Point3(px, py, pz);
haltHammerZeit();
setHandsVisible(true);
inRail = 0;
inMoat = false;
cam.transformNoI(point);
}
function getSpeed() {
var _local2 = new bw.Vec3();
velocity.copyInto(_local2);
var _local3 = ((_local2.x * _local2.x) + (_local2.y * _local2.y)) + (_local2.z * _local2.z);
if (_local3 > bw.Entity.SLIMIT) {
var _local4 = Math.sqrt(_local3 / bw.Entity.SLIMIT);
_local2.x = _local2.x / _local4;
_local2.y = _local2.y / _local4;
_local2.z = _local2.z / _local4;
}
return(_local2.length());
}
function getMaxSpeed() {
return(m_maxSpeed);
}
function initDebugDraw(mc) {
m_debugParent = mc;
m_clip = m_debugParent.attachMovie("test_ball", "bball2", m_debugParent.getNextHighestDepth());
}
function setSpinAmount(x, z) {
m_bowlingBall.setSpin(x, z);
}
function haltHammerZeit() {
velocity.zero();
velocityS.zero();
m_bowlingBall.setSpin(0, 0);
}
function setMoat(x1, x2, z) {
moatX1 = x1;
moatX2 = x2;
moatZ = z;
}
function setX(x) {
point.x = x;
}
function setZ(z) {
point.z = z;
}
function getZ() {
return(point.z);
}
function setDebugDraw(b) {
m_debugDraw = b;
m_clip._visible = b;
m_bowlingBallClipMirror._visible = (!b) && (m_isReflection);
m_bowlingBall._visible = (!b) && (m_isVisible);
}
function setMasked(enable) {
m_isMasked = enable;
}
function update(tick, camera) {
if (!isInit) {
m_bowlingBall = bw.BowlingBall(m_bowlingBallClip.innerBall);
if (m_bowlingBall != null) {
m_bowlingBall.init();
m_bowlingBallClipMirror.attachBitmap(m_bowlingBall.outputClip, 1);
isInit = true;
}
}
var _local4 = ((velocity.x * velocity.x) + (velocity.y * velocity.y)) + (velocity.z * velocity.z);
if (_local4 > bw.Entity.SLIMIT) {
var _local5 = Math.sqrt(_local4 / bw.Entity.SLIMIT);
velocity.x = velocity.x / _local5;
velocity.y = velocity.y / _local5;
velocity.z = velocity.z / _local5;
}
var _local6 = velocity.x;
var _local7 = velocity.y;
var _local8 = velocity.z;
point.x = point.x + (_local6 * bw.Entity.SFACTOR_D);
point.y = point.y + (_local7 * bw.Entity.SFACTOR_D);
point.z = point.z + (_local8 * bw.Entity.SFACTOR_D);
if (point.x < minX) {
point.x = minX;
velocity.x = (-_local6) * 0.4;
} else if (point.x > maxX) {
point.x = maxX;
velocity.x = (-_local6) * 0.4;
}
if (inRail == 0) {
if (point.z < minZ) {
point.z = minZ;
velocity.z = (-_local8) * 0.1;
} else if (point.z > maxZ) {
point.z = maxZ;
velocity.z = -_local8;
}
if ((!inMoat) && (point.z < moatZ)) {
inMoat = true;
inRail = 0;
}
} else {
if (point.z < (minZ - 50)) {
point.z = minZ - 50;
velocity.z = (-_local8) * 0.1;
} else if (point.z > maxZ) {
point.z = maxZ;
velocity.z = -_local8;
}
if ((!inMoat) && (point.z < (moatZ - 50))) {
inMoat = true;
}
}
if (point.y <= minY) {
velocity.x = velocity.x * friction;
velocity.z = velocity.z * friction;
}
if (inMoat && (point.z > moatZ)) {
point.z = moatZ;
velocity.z = (-velocity.z) * 0.2;
}
if (!inMoat) {
if ((inRail == 0) && (point.x < moatX1)) {
inRail = 1;
}
if ((inRail == 0) && (point.x > moatX2)) {
inRail = 2;
}
if (inRail == 1) {
if (point.x > (moatX1 - 7)) {
point.x = moatX1 - 7;
velocity.x = (-velocity.x) * 0.4;
}
velocity.z = velocity.z - 1;
m_myoffs = -16;
}
if (inRail == 2) {
if (point.x < (moatX2 + 7)) {
point.x = moatX2 + 7;
velocity.x = (-velocity.x) * 0.4;
}
velocity.z = velocity.z - 1;
m_myoffs = -16;
}
point.y = point.y + -9.81;
if (point.y < -1.5) {
point.y = -1.5;
}
} else {
point.y = point.y + -9.81;
if (point.y < -40) {
point.y = -40;
}
}
if ((!inMoat) && (inRail == 0)) {
point.y = radius;
velocity.y = 0;
}
camera.transform(point);
m_bowlingBall.update(tick);
}
function setMax(x, z) {
maxX = x - radius;
maxY = radius;
maxZ = z - radius;
}
function setMin(x, z) {
minX = x + radius;
minY = radius;
minZ = z + radius;
}
function storeRecording() {
m_storeNext = true;
}
function prepare(cam) {
velocityS.x = velocity.x * bw.Entity.SFACTOR_D;
velocityS.y = velocity.y * bw.Entity.SFACTOR_D;
velocityS.z = velocity.z * bw.Entity.SFACTOR_D;
velocityS.flush();
}
function collided(A, B) {
var _local4 = A.minus(B);
_local4.normalize();
var _local5 = A.velocityS.dot(_local4);
var _local6 = B.velocityS.dot(_local4);
var _local7 = (2 * (_local5 - _local6)) / (A.mass + B.mass);
var _local8 = A.velocityS.copy();
var _local9 = _local4.copy();
_local9.multiplyScalar(_local7 * B.mass);
_local8.subtractVec3(_local9);
var _local10 = B.velocityS.copy();
var _local11 = _local4.copy();
_local11.multiplyScalar(_local7 * A.mass);
_local10.addVec3(_local11);
A.velocity = _local8;
A.velocity.multiplyScalar(bw.Entity.SFACTOR_M);
A.onCollision(B);
B.velocity = _local10;
B.velocity.multiplyScalar(bw.Entity.SFACTOR_M);
B.onCollision(A);
}
function testCollision(po) {
if (po.isActive()) {
if (collision(po) || (po.collision(this))) {
collided(this, po);
return(true);
}
}
return(false);
}
function setHandsVisible(b) {
m_bowlingBallClip.hand1._visible = b;
m_bowlingBallClip.hand2._visible = b;
m_bowlingBallClip.hand_shadow._visible = b;
m_isHandsVisible = b;
m_isReflection = !b;
}
function setReflection(b) {
m_isReflection = b;
}
function setVisible(b) {
m_isVisible = b;
}
function get clipMirror() {
return(m_bowlingBallClipMirror);
}
function render(camera, tick, alpha) {
var _local5 = m_renderBuf[tick & 63];
camera.project(_local5.point);
m_bowlingBall.render();
var _local6 = (1.33 * radius) * (bw.Camera.DIST / _local5.point.sz);
m_bowlingBallClip.setMask((_local5.mask ? (m_maskClip) : null));
m_bowlingBallClip._x = int(_local5.point.sx);
m_bowlingBallClip._y = int(_local5.point.sy);
m_bowlingBallClip._xscale = _local6;
m_bowlingBallClip._yscale = _local6;
m_bowlingBallClip._visible = _local5.vis;
m_bowlingBallClip.swapDepths(m_parent.getNextHighestDepth());
if (_local5.refl) {
var _local7 = _local6 / 128;
m_bowlingBallClipMirror._x = (_local7 * -80) + _local5.point.sx;
m_bowlingBallClipMirror._y = (_local7 * (236 + _local5.myoffs)) + _local5.point.sy;
m_bowlingBallClipMirror._xscale = _local6;
m_bowlingBallClipMirror._yscale = -_local6;
m_bowlingBallClipMirror.swapDepths(m_parent.getNextHighestDepth());
m_bowlingBallClipMirror._visible = true;
} else {
m_bowlingBallClipMirror._visible = false;
}
avgZ = _local5.point.ftz.value;
}
function record(tick) {
var _local3 = m_renderBuf[tick & 63];
point.copyInto(_local3.point);
_local3.vis = m_isVisible;
_local3.refl = m_isReflection;
_local3.myoffs = m_myoffs;
_local3.mask = m_isMasked;
if (m_storeNext) {
var _local4 = new bw.Point3();
point.copyInto(_local4);
m_sketchBuf.push(_local4);
m_storeNext = false;
}
}
function clearSketchBuffer() {
m_sketchBuf = [];
}
function getSketchBuffer() {
return(m_sketchBuf);
}
function renderDebug(camera, alpha) {
camera.project(point);
var _local4 = (1.6 * radius) * (bw.Camera.DIST / point.sz);
m_clip._x = point.sx;
m_clip._y = point.sy;
m_clip._xscale = _local4;
m_clip._yscale = _local4;
}
static var RADIUS = 16;
}
Symbol 1220 MovieClip [__Packages.bw.BowlingBall] Frame 0
class bw.BowlingBall extends MovieClip
{
var m_spinX, m_spinZ, m_dx, m_dy, m_idx, m_idy, m_origin, m_matrix, m_image, m_aaMask, m_sphereAlpha, m_scrolled, m_output, m_aaOutput, m_displacementImage, m_clip, createEmptyMovieClip, m_mask, m_bounds, m_displacement, attachBitmap, m_lastSX, m_lastSY;
function BowlingBall () {
super();
m_spinX = 0;
m_spinZ = 0;
m_dx = 0;
m_dy = 0;
m_idx = new com.midasplayer.timing.IFloat();
m_idy = new com.midasplayer.timing.IFloat();
m_origin = new flash.geom.Point();
m_matrix = new flash.geom.Matrix();
m_image = flash.display.BitmapData.loadBitmap("ball_texture");
m_aaMask = flash.display.BitmapData.loadBitmap("ball_aaalpha");
m_sphereAlpha = flash.display.BitmapData.loadBitmap("ball_shadealpha");
m_scrolled = new flash.display.BitmapData(128, 128, true, 0);
m_output = new flash.display.BitmapData(128, 128, true, 0);
m_aaOutput = new flash.display.BitmapData(128, 128, true, 0);
m_displacementImage = new flash.display.BitmapData(128, 128, false, 0);
}
function destroy() {
m_aaMask.dispose();
m_output.dispose();
m_scrolled.dispose();
m_aaOutput.dispose();
m_displacementImage.dispose();
m_image.dispose();
m_sphereAlpha.dispose();
m_clip.removeMovieClip();
}
function init() {
m_clip = createEmptyMovieClip("temp", 0);
var _local2 = new flash.geom.Matrix();
_local2.createGradientBox(128, 128, Math.PI / 2, 0, 0);
m_clip.beginGradientFill("linear", [0, 255], [100, 100], [0, 255], _local2);
m_clip.moveTo(0, 0);
m_clip.lineTo(128, 0);
m_clip.lineTo(128, 128);
m_clip.lineTo(0, 128);
m_clip.lineTo(0, 0);
m_clip.endFill();
_local2.identity();
m_displacementImage.draw(m_clip, _local2);
_local2.createGradientBox(128, 128, 0, 0, 0);
m_clip.beginGradientFill("linear", [0, 65280], [100, 100], [0, 255], _local2);
m_clip.moveTo(0, 0);
m_clip.lineTo(128, 0);
m_clip.lineTo(128, 128);
m_clip.lineTo(0, 128);
m_clip.lineTo(0, 0);
m_clip.endFill();
_local2.identity();
m_displacementImage.draw(m_clip, _local2, null, "add");
m_clip.clear();
var _local3 = flash.display.BitmapData.loadBitmap("ball_dispmap");
m_mask = _local3.clone();
var _local4 = new flash.geom.ColorTransform();
_local4.greenMultiplier = 0.5;
_local4.blueMultiplier = 0.5;
m_displacementImage.draw(m_displacementImage, new flash.geom.Matrix(), _local4);
_local4.greenOffset = 128;
_local4.blueOffset = 128;
var _local5 = new flash.geom.Matrix();
m_displacementImage.draw(_local3, _local5, _local4, "difference");
m_mask.threshold(m_mask, m_displacementImage.rectangle, m_origin, ">", -16777216, 16777215);
m_bounds = m_output.rectangle;
m_displacement = new flash.filters.DisplacementMapFilter(m_displacementImage, m_origin, 2, 4, 128, 128, "wrap");
attachBitmap(m_aaOutput, 1);
}
function get outputClip() {
return(m_aaOutput);
}
function setSpin(x, z) {
m_spinX = x;
m_spinZ = z;
}
function update(tick) {
m_dx = m_dx + m_spinX;
m_idx.set(m_dx);
m_dy = m_dy + m_spinZ;
m_idy.set(m_dy);
}
function render() {
var _local2 = m_idx.value;
var _local3 = m_idy.value;
if ((_local2 != m_lastSX) || (_local3 != m_lastSY)) {
m_matrix.tx = _local2;
m_matrix.ty = _local3;
m_clip.beginBitmapFill(m_image, m_matrix, true);
m_clip.moveTo(0, 0);
m_clip.lineTo(128, 0);
m_clip.lineTo(128, 128);
m_clip.lineTo(0, 128);
m_clip.lineTo(0, 0);
m_clip.endFill();
m_matrix.tx = 0;
m_matrix.ty = 0;
m_scrolled.draw(m_clip, m_matrix);
m_output.applyFilter(m_scrolled, m_bounds, m_origin, m_displacement);
m_output.threshold(m_mask, m_bounds, m_origin, "==", -16777216);
m_output.draw(m_sphereAlpha);
m_aaOutput.copyPixels(m_output, m_bounds, m_origin, m_aaMask, m_origin, false);
m_clip.clear();
m_lastSX = _local2;
m_lastSY = _local3;
}
}
}
Symbol 1221 MovieClip [__Packages.bw.Throw] Frame 0
class bw.Throw
{
var m_debugParent, m_debugDraw, m_running, m_readyState, m_validThrow, m_listener, m_ready, m_throwDirBegun, m_failing, m_data;
function Throw (debugParent) {
m_debugParent = debugParent;
m_debugDraw = new com.midasplayer.fx.Draw(m_debugParent);
m_debugDraw.color = 0;
m_running = false;
m_readyState = false;
m_validThrow = false;
m_listener = [];
m_ready = false;
}
function addThrowListener(l) {
m_listener.push(l);
}
function setReady(b) {
m_readyState = b;
m_throwDirBegun = false;
m_ready = m_readyState;
m_running = false;
m_validThrow = false;
m_failing = false;
}
function isThrowing() {
return(m_running);
}
function isFailing() {
return(m_failing && (m_running));
}
function failBegin(isLeft) {
m_failing = true;
m_data = new Array();
m_running = true;
m_validThrow = false;
m_ready = false;
var _local3 = 0;
for ( ; _local3 < m_listener.length ; _local3++) {
m_listener[_local3].onStartThrow();
}
}
function failFinalize() {
if (!m_throwDirBegun) {
m_data = [];
onMouseMove(1, 0);
onMouseMove(6, -1);
onMouseMove(12, -2);
onMouseMove(14, -2);
onMouseMove(26, -2);
onMouseMove(38, -2);
onMouseMove(88, -3);
}
onMouseUp();
m_failing = false;
}
function onMouseMove(x, y) {
if (m_running) {
if (m_data.length < 100) {
if ((!m_throwDirBegun) && (m_data.length < 2)) {
if (m_data.length != 0) {
var _local4 = x - m_data[0][0];
var _local5 = y - m_data[0][1];
var _local6 = com.midasplayer.util.XPMath.atan2(_local5, _local4);
if (_local6 < 0) {
m_throwDirBegun = true;
}
}
m_data[0] = [x, y];
} else {
m_data.push([x, y]);
}
}
if (m_throwDirBegun && (m_data.length >= 4)) {
m_validThrow = true;
}
}
}
function getThrowData() {
return(m_data);
}
function onMouseUp() {
if (!m_running) {
return(undefined);
}
if (!m_validThrow) {
m_data = [];
m_throwDirBegun = false;
onMouseMove(1, 0);
onMouseMove(6, -1);
onMouseMove(12, -2);
onMouseMove(14, -2);
onMouseMove(26, -2);
onMouseMove(38, -2);
onMouseMove(88, -3);
}
m_running = false;
m_ready = m_readyState;
var _local2 = 0;
var _local3 = Math.PI;
var _local4 = Math.PI / 2;
var _local5 = _local4;
var _local6 = m_data.length - 1;
var _local7 = int(m_data.length / 2);
var _local8 = 0;
for ( ; _local8 < _local6 ; _local8++) {
var _local9 = _local8;
_local9++;
var _local10 = m_data[_local9][0] - m_data[_local8][0];
var _local11 = m_data[_local9][1] - m_data[_local8][1];
var _local12 = Math.sqrt((_local10 * _local10) + (_local11 * _local11));
_local2 = _local2 + _local12;
}
var _local13 = 2 * (_local2 / 3);
var _local14 = 0;
var _local15 = _local2 / 3;
var _local16 = -1;
var _local17 = 0;
for ( ; _local17 < _local6 ; _local17++) {
var _local18 = _local17;
_local18++;
var _local19 = m_data[_local18][0] - m_data[_local17][0];
var _local20 = m_data[_local18][1] - m_data[_local17][1];
var _local21 = Math.sqrt((_local19 * _local19) + (_local20 * _local20));
var _local22 = _local14 < _local13;
_local14 = _local14 + _local21;
var _local23 = _local14 < _local13;
if (_local23 != _local22) {
_local16 = _local18;
break;
}
}
_local15 = _local2 - _local14;
var _local24 = m_data[_local16][0] - m_data[0][0];
var _local25 = m_data[_local16][1] - m_data[0][1];
var _local26 = com.midasplayer.util.XPMath.atan2(_local25, _local24);
_local24 = m_data[_local6][0] - m_data[_local16][0];
_local25 = m_data[_local6][1] - m_data[_local16][1];
var _local27 = com.midasplayer.util.XPMath.atan2(_local25, _local24);
if (_local14 < 150) {
if (_local26 < (-_local4)) {
_local26 = _local26 - ((1 - (_local14 / 150)) * 0.3);
} else {
_local26 = _local26 + ((1 - (_local14 / 150)) * 0.3);
}
_local14 = Math.max(100, _local14);
}
if (_local15 > 100) {
_local15 = 100;
}
_local26 = ((_local26 + _local4) * 0.1667) - _local4;
_local27 = ((_local27 + _local4) * 0.1667) - _local4;
var _local28 = (-_local4) - (Math.PI / 180);
var _local29 = (-_local4) + (Math.PI / 180);
if ((_local26 > _local28) && (_local26 < _local29)) {
var _local30 = Math.abs(_local26 - _local28);
var _local31 = Math.abs(_local26 - _local29);
if (_local30 > _local31) {
_local26 = _local29;
} else if (_local31 > _local30) {
_local26 = _local28;
} else {
_local26 = _local29;
}
}
var _local32 = (-_local4) - (Math.PI / 12);
var _local33 = (-_local4) + (Math.PI / 12);
if (_local27 < _local32) {
_local27 = _local32;
}
if (_local27 > _local33) {
_local27 = _local33;
}
if (_local26 < _local32) {
_local26 = _local32;
}
if (_local26 > _local33) {
_local26 = _local33;
}
_local14 = _local14 * 5000;
_local14 = int(_local14);
_local15 = _local15 * 100;
_local15 = int(_local15);
var _local34 = 0;
for ( ; _local34 < m_listener.length ; _local34++) {
m_listener[_local34].onBallThrown(_local14, _local26, _local15, _local27);
}
}
function onMouseDown() {
if (m_ready) {
m_data = new Array();
m_running = true;
m_ready = false;
m_validThrow = false;
var _local2 = 0;
for ( ; _local2 < m_listener.length ; _local2++) {
m_listener[_local2].onStartThrow();
}
}
}
function onMouseWheel() {
}
}
Symbol 1222 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 1223 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 1224 MovieClip [__Packages.bw.ZSorted] Frame 0
class bw.ZSorted
{
var avgZ, m_clip, m_parent, vis;
function ZSorted (clip, zValue) {
avgZ = zValue;
m_clip = clip;
m_parent = clip._parent;
vis = true;
}
function render() {
if (vis) {
m_clip.swapDepths(m_parent.getNextHighestDepth());
}
}
}
Symbol 1225 MovieClip [__Packages.bw.DiscoBowling] Frame 0
class bw.DiscoBowling
{
var m_camWall, m_camFloor, m_parent, m_stars, m_discoBallX, m_discoBallY, m_discoBallZ;
function DiscoBowling (parent) {
m_camWall = new bw.Camera();
m_camFloor = new bw.Camera();
m_parent = parent;
m_stars = [];
m_discoBallX = 0;
m_discoBallY = 100;
m_discoBallZ = 900;
var _local3 = 8;
var _local4 = 6;
var _local5 = (Math.PI * 2) / _local3;
var _local6 = 700 / _local4;
var _local7 = 0;
for ( ; _local7 < _local3 ; _local7++) {
var _local8 = 0;
for ( ; _local8 < _local4 ; _local8++) {
var _local9 = new Object();
var _local10 = (Math.cos(_local5 * _local7) * _local6) * (_local8 + 1);
var _local11 = (Math.sin(_local5 * _local7) * _local6) * (_local8 + 1);
var _local12 = 10;
_local9.offs = [{x:_local10 + 0, y:0, z:_local11 - _local12}, {x:_local10 + _local12, y:0, z:_local11 + 0}, {x:_local10 + 0, y:0, z:_local11 + _local12}, {x:_local10 - _local12, y:0, z:_local11 + 0}];
_local9.vert = [new bw.Point3(_local9.offs[0].x, _local9.offs[0].y, _local9.offs[0].z), new bw.Point3(_local9.offs[1].x, _local9.offs[1].y, _local9.offs[1].z), new bw.Point3(_local9.offs[2].x, _local9.offs[2].y, _local9.offs[2].z), new bw.Point3(_local9.offs[3].x, _local9.offs[3].y, _local9.offs[3].z)];
m_stars.push(_local9);
}
}
}
function update(tick, cam) {
m_camWall.discoFloorView(tick / 70);
for (var i in m_stars) {
var _local4 = m_stars[i].vert;
var _local5 = m_stars[i].offs;
for (var j in _local4) {
m_camWall.transform(_local4[j]);
}
}
}
function render(tick, cam) {
m_parent.clear();
for (var i in m_stars) {
var _local6 = false;
var _local7 = m_stars[i].vert;
var _local8 = 0;
for ( ; (!_local6) && (_local8 < _local7.length) ; _local8++) {
var _local9 = _local7[_local8];
m_camWall.project(_local9);
if ((_local9.sz > 1100) || ((_local9.sz < 10) || ((_local9.sx < -100) || ((_local9.sy < -100) || ((_local9.sx > 800) || (_local9.sy > 600)))))) {
_local6 = true;
}
}
if (_local6) {
continue;
}
m_parent.beginFill(16777215);
var _local10 = 0;
for ( ; _local10 < _local7.length ; _local10++) {
var _local11 = _local7[_local10];
if (_local10 == 0) {
var _local4 = _local11.sx;
var _local5 = _local11.sy;
m_parent.moveTo(_local4, _local5);
} else {
m_parent.lineTo(_local11.sx, _local11.sy);
}
}
m_parent.lineTo(_local4, _local5);
m_parent.endFill();
}
}
}
Symbol 1226 MovieClip [__Packages.bw.Pin] Frame 0
class bw.Pin
{
var m_sketchBuf, m_renderBuf, m_storeNext, m_isPaused, ballRadius, m_parent, m_mirror, baseScale, xScale, yScale, avgZ, clipPin, clipPinMirror, m_color, m_colorTr, pinId, m_tint, tension, length, m_collideList, top, topCx, bottom, m_debugDraw, m_isVisible, entities, youngsModulus, dampRate, clipTop, clipBottom, m_yr, m_debugParent, m_hasReflection, m_frame, m_xr, __get__updatePaused;
function Pin (p, mirror, pinNo, px, py, pz) {
m_sketchBuf = new Array();
m_renderBuf = new Array(64);
var _local8 = 0;
for ( ; _local8 < 64 ; _local8++) {
m_renderBuf[_local8] = {bottom:new bw.Entity(), frame:0, vis:true, refl:true, tint:100, xscl:100, yscl:100, paus:false};
}
m_storeNext = false;
m_isPaused = false;
ballRadius = bw.Ball.RADIUS;
m_parent = p;
m_mirror = mirror;
baseScale = 100;
xScale = baseScale;
yScale = baseScale;
avgZ = 1;
clipPin = m_parent.attachMovie("pin_centered", "pin" + pinNo, m_parent.getNextHighestDepth());
clipPin.inner.gotoAndStop(1);
clipPinMirror = m_mirror.attachMovie("pin_centered", "pin" + pinNo, m_mirror.getNextHighestDepth());
clipPinMirror.inner.gotoAndStop(1);
m_color = new Color(clipPin);
m_colorTr = {ra:100, ga:100, ba:100, aa:100, rb:0, gb:0, bb:0, ab:0};
pinId = pinNo;
m_tint = 100;
tension = 0;
length = 20;
m_collideList = [];
top = new bw.Entity(px, py + length, pz, TIP_RADIUS);
top.setMass(20);
topCx = new bw.Entity(px, py + length, pz);
topCx.radius = top.radius;
topCx.mass = top.mass;
bottom = new bw.Entity(px, py, pz, BASE_RADIUS);
bottom.setMass(60);
topCx.onCollision = mx.utils.Delegate.create(this, onCollision);
bottom.onCollision = mx.utils.Delegate.create(this, onCollision);
m_debugDraw = false;
m_isVisible = true;
entities = [bottom, topCx];
youngsModulus = 100000 /* 0x0186A0 */;
dampRate = 1000;
}
function destory() {
clipPin.removeMovieClip();
clipPinMirror.removeMovieClip();
clipTop.removeMovieClip();
clipBottom.removeMovieClip();
}
function onCollision(other) {
var _local3 = topCx.velocity.length();
var _local4 = bottom.velocity.length();
if (_local4 < 5) {
bottom.velocity.zero();
}
if (_local3 < 5) {
topCx.velocity.zero();
}
}
function getNumber() {
return(pinId);
}
function storeRecording() {
m_storeNext = true;
}
function isKnockedOver() {
return(m_yr != 0);
}
function initDebugDraw(mc) {
m_debugParent = mc;
clipBottom = mc.attachMovie("test_circle", "cb" + pinId, mc.getNextHighestDepth());
clipTop = mc.attachMovie("test_circle", "ct" + pinId, mc.getNextHighestDepth());
var _local3 = new Color(clipTop);
var _local4 = new Color(clipBottom);
_local4.setTransform({ra:100, ga:100, ba:100, aa:100, rb:0, gb:0, bb:0, ab:0});
_local3.setTransform({ra:100, ga:100, ba:100, aa:100, rb:-240, gb:0, bb:-200, ab:0});
}
function stabilize() {
bottom.velocity.zero();
topCx.velocity.zero();
top.velocity.zero();
top.point.x = bottom.point.x;
top.point.z = bottom.point.z;
topCx.point.x = bottom.point.x;
topCx.point.z = bottom.point.z;
tension = 0;
length = 20;
youngsModulus = 100000 /* 0x0186A0 */;
dampRate = 1000;
}
function setYAndStabilize(y) {
bottom.point.y = y;
bottom.velocity.zero();
top.velocity.zero();
top.point.x = bottom.point.x;
top.point.y = bottom.point.y + length;
top.point.z = bottom.point.z;
}
function applyForce(x, y, z) {
top.applyForce(x, y, z);
bottom.applyForce(x, y, z);
}
function setZ(z) {
bottom.point.z = z;
top.point.z = z;
}
function getZ(z) {
return((top.point.z + bottom.point.z) / 2);
}
function setMin(x, y, z) {
top.setMin(x + TIP_RADIUS, y + bw.Ball.RADIUS, z + TIP_RADIUS);
bottom.setMin(x + BASE_RADIUS, y + bw.Ball.RADIUS, z + BASE_RADIUS);
}
function setMax(x, y, z) {
top.setMax(x - TIP_RADIUS, y - TIP_RADIUS, z - TIP_RADIUS);
bottom.setMax(x - BASE_RADIUS, y - BASE_RADIUS, z - BASE_RADIUS);
}
function collided(A, B) {
var _local4 = A.minus(B);
_local4.normalize();
var _local5 = A.velocityS.dot(_local4);
var _local6 = B.velocityS.dot(_local4);
var _local7 = (2 * (_local5 - _local6)) / (A.mass + B.mass);
var _local8 = A.velocityS.copy();
var _local9 = _local4.copy();
_local9.multiplyScalar(_local7 * B.mass);
_local8.subtractVec3(_local9);
var _local10 = B.velocityS.copy();
var _local11 = _local4.copy();
_local11.multiplyScalar(_local7 * A.mass);
_local10.addVec3(_local11);
A.velocity = _local8;
A.velocity.multiplyScalar(bw.Entity.SFACTOR_M);
A.onCollision(B);
B.velocity = _local10;
B.velocity.multiplyScalar(bw.Entity.SFACTOR_M);
B.onCollision(A);
}
function prepare(cam) {
var _local3 = top.point;
var _local4 = top.point.x;
var _local5 = top.point.y;
var _local6 = top.point.z;
var _local7 = bottom.point;
var _local8 = bottom.point.x;
var _local9 = bottom.point.y;
var _local10 = bottom.point.z;
var _local11 = _local4 - _local8;
var _local12 = _local5 - _local9;
var _local13 = _local6 - _local10;
var _local14 = (1 / Math.sqrt(((_local11 * _local11) + (_local12 * _local12)) + (_local13 * _local13))) * length;
_local11 = _local11 * _local14;
_local12 = _local12 * _local14;
_local13 = _local13 * _local14;
var _local15 = topCx.point;
_local15.x = _local8 + _local11;
_local15.y = _local9 + _local12;
_local15.z = _local10 + _local13;
if (_local15.y < top.minY) {
_local15.y = top.minY;
} else if (_local15.y > top.maxY) {
_local15.y = top.maxY;
}
var _local16 = top.velocity;
var _local17 = topCx.velocityS;
var _local18 = bw.Entity.SFACTOR_D;
_local17.x = _local16.x * _local18;
_local17.y = _local16.y * _local18;
_local17.z = _local16.z * _local18;
var _local19 = bottom.velocity;
var _local20 = bottom.velocityS;
_local20.x = _local19.x * _local18;
_local20.y = _local19.y * _local18;
_local20.z = _local19.z * _local18;
_local17.flush();
_local20.flush();
_local16.flush();
}
function updateV() {
top.velocity.x = topCx.velocity.x;
top.velocity.y = topCx.velocity.y;
top.velocity.z = topCx.velocity.z;
top.velocity.flush();
topCx.velocity.flush();
}
function setVisible(b) {
top.m_isActive = b;
topCx.m_isActive = b;
bottom.m_isActive = b;
m_isVisible = b;
clipPin._visible = b;
clipPinMirror._visible = b;
}
function setReflection(b) {
clipPinMirror._visible = b;
m_hasReflection = b;
}
function setPinByAngle(x, y) {
var _local4 = Math.PI;
var _local5 = Math.PI * 2;
while (x < 0) {
x = x + _local5;
}
x = x % _local5;
while (y < 0) {
y = y + _local5;
}
y = y % _local5;
var _local6 = 0;
var _local7 = 0;
var _local8 = 0;
var _local9 = 0;
var _local10 = false;
var _local11 = false;
var _local12 = 24;
var _local13 = 17;
var _local14 = _local12 * _local13;
_local13--;
if ((x <= _local4) && (y <= _local4)) {
_local8 = 0;
_local6 = Math.floor(_local12 * (x / _local4)) - 1;
_local7 = (_local12 * Math.floor(_local13 * (y / _local4))) + 1;
_local9 = _local6 + _local7;
_local10 = false;
} else if ((x > _local4) && (y <= _local4)) {
_local8 = 1;
_local6 = (_local14 - Math.floor(_local12 * (x / _local4))) - 1;
_local7 = _local12 * (Math.floor(_local13 * (y / _local4)) - 1);
_local9 = _local6 - _local7;
_local10 = true;
} else if ((x <= _local4) && (y > _local4)) {
_local8 = 2;
_local6 = Math.floor(_local12 * (x / _local4)) - 1;
_local7 = (_local12 * (_local13 - Math.floor(_local13 * ((y - _local4) / _local4)))) + 1;
_local9 = _local6 + _local7;
_local10 = true;
} else {
_local8 = 3;
_local6 = (_local12 - Math.floor(_local12 * ((x - _local4) / _local4))) - 1;
_local7 = _local14 - (_local12 * ((_local13 - Math.floor(_local13 * ((y - _local4) / _local4))) + 1));
_local9 = _local6 + _local7;
_local10 = false;
}
_local9++;
m_frame = _local9;
if (_local10) {
xScale = -baseScale;
} else {
xScale = baseScale;
}
if (_local11) {
yScale = -baseScale;
} else {
yScale = baseScale;
}
}
function testCollisions() {
if (m_isPaused) {
return(0);
}
if (!m_isVisible) {
return(0);
}
var _local2 = 0;
var _local7 = 0;
var _local8 = m_collideList.length;
for ( ; _local7 < _local8 ; _local7++) {
var _local9 = m_collideList[_local7];
for ( ; !_local9.m_isVisible ; _local7++) {
}
var _local3 = topCx.collision(_local9.topCx);
var _local4 = topCx.collision(_local9.bottom);
var _local5 = bottom.collision(_local9.topCx);
var _local6 = bottom.collision(_local9.bottom);
if (_local3) {
collided(_local9.topCx, topCx);
top.velocity = topCx.velocity;
top.velocity.flush();
_local9.top.velocity = _local9.topCx.velocity;
_local9.top.velocity.flush();
_local2++;
}
if (_local4) {
collided(_local9.topCx, bottom);
_local9.top.velocity = _local9.topCx.velocity;
_local9.top.velocity.flush();
_local2++;
}
if (_local5) {
collided(_local9.bottom, topCx);
top.velocity = topCx.velocity;
top.velocity.flush();
_local2++;
}
if (_local6) {
collided(_local9.bottom, bottom);
_local2++;
}
}
return(_local2);
}
function init(cam) {
cam.transformNoI(top.point);
cam.transformNoI(topCx.point);
cam.transformNoI(bottom.point);
}
function update(tick, cam) {
if (m_isPaused) {
return(undefined);
}
var _local4 = top.point;
var _local5 = bottom.point;
var _local6 = top.velocity;
var _local7 = bottom.velocity;
var _local8 = _local5.x - _local4.x;
var _local9 = _local8 + ((_local7.x - _local6.x) / 10000);
var _local10 = _local5.y - _local4.y;
var _local11 = _local10 + ((_local7.y - _local6.y) / 10000);
var _local12 = _local5.z - _local4.z;
var _local13 = _local12 + ((_local7.z - _local6.z) / 10000);
var _local14 = Math.sqrt(((_local8 * _local8) + (_local10 * _local10)) + (_local12 * _local12));
var _local15 = ((dampRate * 10000) * (Math.sqrt(((_local9 * _local9) + (_local11 * _local11)) + (_local13 * _local13)) - _local14)) / _local14;
var _local16 = (_local8 * _local15) / _local14;
var _local17 = (_local10 * _local15) / _local14;
var _local18 = (_local12 * _local15) / _local14;
top.applyForce(_local16, _local17, _local18);
bottom.applyForce(-_local16, -_local17, -_local18);
var _local19 = length;
if (_local14 < (_local19 * 0.8)) {
_local14 = _local19 * 0.8;
} else if (_local14 > (_local19 * 1.2)) {
_local14 = _local19 * 1.2;
}
tension = (youngsModulus * (_local19 - _local14)) / _local19;
tension = tension * 0.1;
_local16 = (_local8 * tension) / _local14;
_local17 = (_local10 * tension) / _local14;
_local18 = (_local12 * tension) / _local14;
top.applyForce(-_local16, -_local17, -_local18);
top.update(tick);
bottom.applyForce(_local16, _local17, _local18);
bottom.update(tick);
_local4 = topCx.point;
_local5.y = _local5.y - ballRadius;
cam.transform(_local5);
_local5.y = _local5.y + ballRadius;
_local4.y = _local4.y - ballRadius;
cam.transform(_local4);
_local4.y = _local4.y + ballRadius;
var _local20 = _local4.x - _local5.x;
var _local21 = _local4.y - _local5.y;
var _local22 = _local4.z - _local5.z;
m_yr = Math.atan2(_local21, _local22) - (Math.PI / 2);
m_xr = Math.atan2(_local20, _local22);
if (_local22 < 0) {
m_xr = m_xr + Math.PI;
}
setPinByAngle(m_yr, m_xr);
prepare(cam);
}
function set updatePaused(b) {
m_isPaused = b;
//return(__get__updatePaused());
}
function record(tick) {
var _local3 = m_renderBuf[tick & 63];
bottom.copyInto(_local3.bottom);
_local3.refl = m_hasReflection;
_local3.vis = m_isVisible;
_local3.frame = m_frame;
_local3.tint = m_tint;
_local3.xscl = xScale;
_local3.yscl = yScale;
_local3.paus = m_isPaused;
if (m_isVisible && (m_storeNext)) {
var _local4 = new bw.Point3();
bottom.point.copyInto(_local4);
m_sketchBuf.push(_local4);
m_storeNext = false;
}
}
function clearSketchBuffer() {
m_sketchBuf = [];
}
function getSketchBuffer() {
return(m_sketchBuf);
}
function setBlackTint(n) {
m_tint = n;
}
function addCollide(p) {
m_collideList.push(p);
}
function render(camera, tick, alpha) {
var _local5 = m_renderBuf[tick & 63];
if ((!_local5.vis) || (_local5.paus)) {
return(undefined);
}
var _local6 = _local5.bottom.point;
camera.project(_local6);
var _local7 = (0.95 * bw.Camera.DIST) / _local6.sz;
var _local8 = _local5.xscl * _local7;
var _local9 = _local5.yscl * _local7;
clipPin.inner.gotoAndStop(_local5.frame);
clipPin._x = _local6.sx;
clipPin._y = _local6.sy;
clipPin._xscale = _local8;
clipPin._yscale = _local9;
clipPin.swapDepths(m_parent.getNextHighestDepth());
if (_local5.tint != 100) {
m_colorTr.ra = _local5.tint;
m_colorTr.ga = _local5.tint;
m_colorTr.ba = _local5.tint;
m_color.setTransform(m_colorTr);
}
if (_local5.refl) {
clipPinMirror.inner.gotoAndStop(_local5.frame);
clipPinMirror._x = _local6.sx;
clipPinMirror._y = _local6.sy + (_local6.y - 12);
clipPinMirror._xscale = _local8;
clipPinMirror._yscale = -_local9;
clipPinMirror.swapDepths(m_mirror.getNextHighestDepth());
}
avgZ = _local6.ftz.value;
}
function setDebugDraw(b) {
m_debugDraw = b;
clipTop._visible = b && (m_isVisible);
clipBottom._visible = b && (m_isVisible);
m_debugParent._visible = b;
clipPin._visible = (!b) && (m_isVisible);
clipPinMirror._visible = (!b) && (m_hasReflection);
}
function renderDebug(camera, alpha) {
var _local4 = bw.Camera.DIST;
var _local5 = topCx.point;
camera.project(_local5);
var _local6 = (1.6 * topCx.radius) * (_local4 / _local5.sz);
clipTop._x = _local5.sx;
clipTop._y = _local5.sy;
clipTop._xscale = _local6;
clipTop._yscale = _local6;
var _local7 = bottom.point;
camera.project(_local7, alpha);
_local6 = (1.6 * bottom.radius) * (_local4 / _local7.sz);
clipBottom._x = _local7.sx;
clipBottom._y = _local7.sy;
clipBottom._xscale = _local6;
clipBottom._yscale = _local6;
if (m_isVisible) {
m_debugParent.lineStyle(1, 10066329);
m_debugParent.moveTo(_local7.sx, _local7.sy);
m_debugParent.lineTo(_local5.sx, _local5.sy);
}
}
static var TIP_RADIUS = 3.5;
static var BASE_RADIUS = 5;
}
Symbol 1227 MovieClip [__Packages.bw.Line3] Frame 0
class bw.Line3
{
var m_parent, p1, p2, isVisible, sx1, sy1, sx2, sy2;
function Line3 (parent, x1, y1, z1, x2, y2, z2) {
m_parent = parent;
p1 = new bw.Point3(x1, y1, z1);
p2 = new bw.Point3(x2, y2, z2);
}
function update(tick, camera) {
camera.transform(p1);
camera.transform(p2);
}
function render(camera, alpha) {
camera.project(p1, alpha);
camera.project(p2, alpha);
clipSegment(alpha);
if (isVisible) {
m_parent.lineStyle(1, 11184810);
m_parent.moveTo(sx1, sy1);
m_parent.lineTo(sx2, sy2);
}
}
function clipSegment(alpha) {
var _local3 = 10;
var _local4 = 755 - 10;
var _local5 = 10;
var _local6 = 560 - 10;
isVisible = true;
var _local7 = false;
var _local8 = true;
var _local9 = 0;
var _local10 = new bw.P(p1.sx, p1.sy);
var _local11 = new bw.P(p2.sx, p2.sy);
while (!_local7) {
var _local12 = outcode(_local10.x, _local10.y, _local5, _local6, _local3, _local4);
var _local13 = outcode(_local11.x, _local11.y, _local5, _local6, _local3, _local4);
if ((_local12 | _local13) == 0) {
sx1 = _local10.x;
sy1 = _local10.y;
sx2 = _local11.x;
sy2 = _local11.y;
_local7 = true;
} else if ((_local12 & _local13) != 0) {
_local7 = true;
isVisible = false;
} else {
_local8 = false;
if (_local12 == 0) {
swap(_local10, _local11);
var _local14 = _local12;
_local12 = _local13;
_local13 = _local14;
}
if (_local11.x != _local10.x) {
_local9 = (_local11.y - _local10.y) / (_local11.x - _local10.x);
}
if ((_local12 & 1) != 0) {
_local10.y = _local10.y + ((_local3 - _local10.x) * _local9);
_local10.x = _local3;
} else if ((_local12 & 2) != 0) {
_local10.y = _local10.y + ((_local4 - _local10.x) * _local9);
_local10.x = _local4;
} else if ((_local12 & 8) != 0) {
if (_local11.x != _local10.x) {
_local10.x = _local10.x + ((_local6 - _local10.y) / _local9);
}
_local10.y = _local6;
} else if ((_local12 & 4) != 0) {
if (_local11.x != _local10.x) {
_local10.x = _local10.x + ((_local5 - _local10.y) / _local9);
}
_local10.y = _local5;
}
}
}
}
function outcode(d, d1, d2, d3, d4, d5) {
var _local8 = 0;
if (d < d4) {
_local8 = _local8 | 1;
}
if (d > d5) {
_local8 = _local8 | 2;
}
if (d1 < d2) {
_local8 = _local8 | 4;
}
if (d1 > d3) {
_local8 = _local8 | 8;
}
return(_local8);
}
function swap(pb, pa) {
var _local4 = new bw.P(0, 0);
_local4.x = pb.x;
_local4.y = pb.y;
pb.x = pa.x;
pb.y = pa.y;
pa.x = _local4.x;
pa.y = _local4.y;
}
}
Symbol 1228 MovieClip [__Packages.bw.P] Frame 0
class bw.P
{
var x, y;
function P (x, y) {
this.x = x;
this.y = y;
}
function toString() {
return((x + ", ") + y);
}
}
Symbol 1229 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 1230 MovieClip [__Packages.bw.StateIntro] Frame 0
class bw.StateIntro extends bw.State
{
var m_data, m_bkg, m_parent, m_instructions, m_logo, m_logoAnim, m_plateAnim, m_autoLeaveTick, m_startTick, m_autoExitTick, m_initTick, m_startNextArrowTick, m_nextArrowNum, m_startClickAnim, m_hasLeft, removeCurtain, m_tick, m_disengageNow, snapshot;
function StateIntro (a1, a2, a3, a4, a5) {
super(a1, a2, a3, a4, a5);
}
function engage() {
fscommand ("gameStart");
var _local2 = ("33,0," + m_data.version) + ",0=0";
fscommand ("playData", _local2);
m_bkg = m_parent.attachMovie("intro_bkg", "bkg", m_parent.getNextHighestDepth());
m_instructions = m_bkg.attachMovie("instructions", "instructions", m_bkg.getNextHighestDepth());
m_instructions._x = 762;
m_instructions._y = 15;
m_instructions.count_down.text = com.midasplayer.util.I18n.getString("intro_count_down", 10);
m_instructions.title.text = com.midasplayer.util.I18n.getString("intro_title");
m_instructions.body.text = com.midasplayer.util.I18n.getString("intro_body");
m_instructions.cacheAsBitmap = true;
m_logo = m_bkg.attachMovie("main_logo", "logo", m_bkg.getNextHighestDepth());
m_logo._x = -500;
m_logo._y = -50;
m_logoAnim = new com.midasplayer.util.EaseOutQuadAnimator(m_logo);
m_logoAnim.setPosition(-120, -150);
m_logoAnim.setDuration(500);
m_plateAnim = new com.midasplayer.util.EaseOutQuadAnimator(m_instructions);
m_plateAnim.setPosition(295, 15);
m_plateAnim.setDuration(700);
m_bkg.onPress = mx.utils.Delegate.create(this, onLeave);
m_autoLeaveTick = m_startTick + (m_data.ticksPerSec * 20);
m_autoExitTick = (m_startTick + (m_data.ticksPerSec * 20)) - int(m_startTick + (m_data.ticksPerSec * 0.75));
m_initTick = m_startTick + 1;
m_startNextArrowTick = m_startTick + int(m_data.ticksPerSec);
m_nextArrowNum = 1;
m_startClickAnim = -1;
m_instructions.illustration.arrow1._visible = false;
m_instructions.illustration.arrow2._visible = false;
m_instructions.illustration.arrow3._visible = false;
m_instructions.illustration.arrow4._visible = false;
com.midasplayer.fx.SoundManager.play("snd_intro_music");
m_hasLeft = false;
removeCurtain();
}
function onLeave() {
if (!m_hasLeft) {
m_hasLeft = true;
m_autoLeaveTick = int(m_tick + (m_data.ticksPerSec * 0.75));
m_logoAnim = new com.midasplayer.util.EaseInQuadAnimator(m_logo);
m_logoAnim.setPosition(-500, -50);
m_logoAnim.setDuration(500);
m_plateAnim = new com.midasplayer.util.EaseInQuadAnimator(m_instructions);
m_plateAnim.setPosition(762, 15);
m_plateAnim.setDuration(700);
}
}
function quitGame() {
m_disengageNow = true;
}
function isDisengage() {
return(m_disengageNow);
}
function disengage() {
com.midasplayer.fx.SoundManager.stopAll();
snapshot(m_parent);
}
function returnCode() {
return(0);
}
function tick() {
var _local2 = m_data.tick;
m_tick = _local2;
if (m_hasLeft && (m_plateAnim)) {
com.midasplayer.fx.SoundManager.setVolume("snd_intro_music", int(m_plateAnim.getElapsed() * 100));
}
if (_local2 == m_startClickAnim) {
m_instructions.illustration.anim_mouse.playStart();
}
if ((m_nextArrowNum < 4) && (_local2 == m_startNextArrowTick)) {
var _local3 = m_instructions.illustration;
_local3.gotoAndStop(m_nextArrowNum + 1);
if (m_nextArrowNum == 1) {
m_startClickAnim = _local2 + 1;
}
if ((m_nextArrowNum == 2) || (m_nextArrowNum == 3)) {
_local3.anim_mouse.playStop();
_local3["arrow" + (m_nextArrowNum - 1)].playStop();
}
if (m_nextArrowNum == 3) {
_local3.arrow3._visible = true;
_local3.arrow3.playStart();
_local3.arrow4._visible = true;
_local3.arrow4.playStart();
_local3.anim_mouse_2.gotoAndStop(1);
} else {
_local3["arrow" + m_nextArrowNum]._visible = true;
_local3["arrow" + m_nextArrowNum].playStart();
}
m_startNextArrowTick = int(_local2 + (m_data.ticksPerSec * 4.25));
m_nextArrowNum++;
}
if (_local2 == m_autoExitTick) {
onLeave();
}
if (_local2 == m_autoLeaveTick) {
m_disengageNow = true;
}
if (!m_hasLeft) {
var _local4 = 1 + int((Math.max(0, m_autoLeaveTick - _local2) * m_data.millisPerTick) / 1000);
m_instructions.count_down.text = com.midasplayer.util.I18n.getString("intro_count_down", _local4);
}
}
function render() {
var _local2 = m_data.alpha;
if (m_logoAnim && (m_logoAnim.update())) {
m_logoAnim = undefined;
}
if (m_plateAnim && (m_plateAnim.update())) {
m_plateAnim = undefined;
}
}
}
Symbol 1231 MovieClip [__Packages.bw.AnimDriver] Frame 0
class bw.AnimDriver extends MovieClip
{
var m_isFrozen, m_ticks, m_direction, m_frameRate, m_frameTime, m_frameCounts, m_clips, cacheAsBitmap, m_stopped, m_once, m_lastTime, onEnterFrame;
function AnimDriver (frameRate) {
super();
m_isFrozen = false;
m_ticks = 0;
m_direction = 1;
m_frameRate = frameRate;
m_frameTime = (1 / m_frameRate) * 1000;
m_frameCounts = {};
m_clips = find(this);
for (var i in m_clips) {
m_frameCounts[m_clips[i]._name] = 0;
}
cacheAsBitmap = true;
m_stopped = true;
m_once = false;
m_lastTime = getTimer();
}
function drive() {
if (m_stopped) {
cacheAsBitmap = true;
onEnterFrame = undefined;
return(undefined);
}
var _local2 = getTimer();
var _local3 = _local2 - m_lastTime;
m_lastTime = _local2;
m_ticks = m_ticks + (_local3 / m_frameTime);
var _local4 = int(m_ticks);
if (_local4 > 0) {
if (m_direction > 0) {
m_ticks = m_ticks - (m_direction * _local4);
} else if (m_direction < 0) {
m_ticks = m_ticks + (m_direction * _local4);
}
var _local5 = 0;
var _local6 = 0;
for (var i in m_clips) {
var _local7 = m_clips[i];
if (bw.AnimDriver(_local7) != null) {
var _local8 = bw.AnimDriver(_local7);
if (_local8.frozen == true) {
continue;
}
}
m_frameCounts[_local7._name] = m_frameCounts[_local7._name] + (m_direction * _local4);
if (m_once) {
if ((m_direction > 0) && (m_frameCounts[_local7._name] >= _local7._totalframes)) {
m_frameCounts[_local7._name] = _local7._totalframes - 1;
_local7.frozen = true;
_local5++;
}
if ((m_direction < 0) && (m_frameCounts[_local7._name] <= 0)) {
m_frameCounts[_local7._name] = 0;
_local7.frozen = true;
_local5++;
}
}
var _local9 = (m_frameCounts[_local7._name] % _local7._totalframes) + 1;
_local7.gotoAndStop(_local9);
_local6++;
}
if (_local5 == _local6) {
m_stopped = true;
}
}
}
function get frozen() {
return(m_isFrozen);
}
function set frozen(b) {
m_isFrozen = b;
//return(frozen);
}
function forceCompleted() {
cacheAsBitmap = true;
onEnterFrame = undefined;
var _local2 = 0;
var _local3 = 0;
for (var i in m_clips) {
var _local4 = m_clips[i];
if (bw.AnimDriver(_local4) != null) {
var _local5 = bw.AnimDriver(_local4);
if (_local5.frozen == true) {
continue;
}
}
m_frameCounts[_local4._name] = m_frameCounts[_local4._name] + (m_direction * 10000);
if (m_once) {
if ((m_direction > 0) && (m_frameCounts[_local4._name] >= _local4._totalframes)) {
m_frameCounts[_local4._name] = _local4._totalframes - 1;
_local4.frozen = true;
}
if ((m_direction < 0) && (m_frameCounts[_local4._name] <= 0)) {
m_frameCounts[_local4._name] = 0;
_local4.frozen = true;
}
var _local6 = (m_frameCounts[_local4._name] % _local4._totalframes) + 1;
_local4.gotoAndStop(_local6);
}
}
}
function isRunning() {
return(onEnterFrame != undefined);
}
function playOnce(dir, fromFrame) {
if (fromFrame == undefined) {
fromFrame = 1;
}
if (dir == undefined) {
m_direction = 1;
} else {
m_direction = dir;
}
m_isFrozen = false;
m_ticks = 0;
m_stopped = false;
m_once = true;
m_lastTime = getTimer();
for (var i in m_clips) {
var _local4 = m_clips[i];
if (bw.AnimDriver(_local4) != null) {
var _local5 = bw.AnimDriver(_local4);
if (_local5.frozen == true) {
continue;
}
}
m_frameCounts[_local4._name] = fromFrame - 1;
_local4.gotoAndStop(fromFrame);
}
cacheAsBitmap = false;
onEnterFrame = mx.utils.Delegate.create(this, drive);
}
function playStart(startFrom) {
if (startFrom == undefined) {
startFrom = 0;
}
m_ticks = 0;
m_stopped = false;
m_lastTime = getTimer();
for (var i in m_clips) {
var _local3 = m_clips[i];
if (bw.AnimDriver(_local3) != null) {
var _local4 = bw.AnimDriver(_local3);
if (_local4.frozen == true) {
continue;
}
}
m_frameCounts[_local3._name] = startFrom;
_local3.gotoAndStop(1);
}
cacheAsBitmap = false;
onEnterFrame = mx.utils.Delegate.create(this, drive);
}
function playStop() {
m_stopped = true;
onEnterFrame = undefined;
}
function find(clip) {
var _local3 = new Array();
if (clip._totalframes > 1) {
clip.stop();
_local3.push(clip);
}
for (var i in clip) {
var _local4 = clip[i];
var _local5 = find(_local4);
for (var j in _local5) {
_local3.push(_local5[j]);
}
}
return(_local3);
}
}
Symbol 1232 MovieClip [__Packages.bw.AnimDriver50Fps] Frame 0
class bw.AnimDriver50Fps extends bw.AnimDriver
{
function AnimDriver50Fps () {
super(25);
}
}
Symbol 1233 MovieClip [__Packages.bw.BigSign] Frame 0
class bw.BigSign extends MovieClip
{
var m_targetFrame, m_pinO, dead_pins, m_animationParent, _x, _y, m_animIn, gotoAndStop, m_startNextAt, m_startSecondAt, m_lastTime, m_animOut, _parent, removeMovieClip, m_animPiece1, m_animPiece2, piece_1, piece_2;
function BigSign () {
super();
m_targetFrame = -1;
m_pinO = [];
}
function setup(targetFrame, animationParent) {
dead_pins._visible = targetFrame >= 3;
m_animationParent = animationParent;
if (targetFrame != 1) {
_x = -500;
_y = 150;
m_animIn = new com.midasplayer.util.EaseOutQuadAnimator(this);
m_animIn.setPosition(128 - 75, 150);
m_animIn.setDuration(300);
} else {
_x = 120;
_y = -300;
m_animIn = new com.midasplayer.util.EaseOutQuadAnimator(this);
m_animIn.setPosition(120, 100);
m_animIn.setDuration(300);
}
gotoAndStop(targetFrame);
m_startNextAt = -1;
m_startSecondAt = -1;
m_targetFrame = targetFrame;
m_lastTime = getTimer();
}
function onEnterFrame() {
if (m_targetFrame == -1) {
return(undefined);
}
var _local2 = getTimer();
if (m_targetFrame != 1) {
var _local3 = (_local2 - m_lastTime) / 20;
m_lastTime = _local2;
for (var i in m_pinO) {
var _local4 = m_pinO[i];
var _local5 = _local4.t;
var _local6 = _local4.p;
var _local7 = _local4.r;
var _local8 = (_local5 * _local6) * Math.cos(_local7);
var _local9 = -(((_local5 * _local6) * Math.sin(_local7)) - ((16 * _local5) * _local5));
_local4.clip._x = _local8 + _local4.ox;
_local4.clip._y = _local9 + _local4.oy;
_local4.clip._rotation = _local4.clip._rotation + _local4.rotd;
_local4.t = _local4.t + (_local3 / 4);
}
if (m_animOut && (m_animOut.update())) {
var _local10 = 0;
var _local11 = 0;
for (var i in m_pinO) {
_local11++;
if (m_pinO[i].clip._y > 700) {
_local10++;
}
}
if (_local10 == _local11) {
m_animOut = undefined;
_parent._x = 0;
_parent._visible = false;
m_animationParent._visible = false;
removeMovieClip();
for (var i in m_pinO) {
m_pinO[i].clip.removeMovieClip();
}
return(undefined);
}
}
if (m_animIn && (m_animIn.update())) {
m_animIn = undefined;
m_startNextAt = getTimer() + 1000;
}
if ((m_startNextAt != -1) && (getTimer() > m_startNextAt)) {
if ((m_startSecondAt == -1) && (m_targetFrame >= 3)) {
var _local12 = m_animationParent.attachMovie("big_pin_collection", "flying", m_animationParent.getNextHighestDepth());
_local12._x = 755 / 2;
_local12._y = 150;
var _local13 = 0;
for ( ; _local13 < 10 ; _local13++) {
var _local14 = _local12["p" + (_local13 + 1)];
var _local15 = Math.PI - (Math.PI / 3);
var _local16 = (Math.random() * _local15) + 0.15;
var _local17 = (Math.random() * 50) + 100;
m_pinO.push({ox:_local14._x, oy:_local14._y, id:_local13, clip:_local14, r:_local16, p:_local17, t:1, rotd:(Math.random() * 10) - 5});
}
m_animationParent._visible = true;
dead_pins._visible = false;
m_startSecondAt = getTimer() + 200;
} else {
m_animOut = new com.midasplayer.util.EaseInQuadAnimator(this);
m_animOut.setPosition(755, 150);
m_animOut.setDuration(300);
m_startNextAt = -1;
}
}
if ((m_startSecondAt >= 0) && (getTimer() > m_startSecondAt)) {
m_animOut = new com.midasplayer.util.EaseInQuadAnimator(this);
m_animOut.setPosition(755, 150);
m_animOut.setDuration(200);
m_startSecondAt = -2;
}
_parent._x = _parent._x + _local3;
} else {
if (m_animPiece1 && (m_animPiece1.update())) {
m_animPiece1 = undefined;
}
if (m_animPiece2 && (m_animPiece2.update())) {
m_animPiece2 = undefined;
_parent._x = 0;
_parent._visible = false;
removeMovieClip();
return(undefined);
}
if (m_animPiece1) {
var _local18 = 1 - m_animPiece1.getElapsed();
piece_1._rotation = -360 * _local18;
}
if (m_animPiece2) {
var _local19 = 1 - m_animPiece2.getElapsed();
piece_2._rotation = 360 * _local19;
}
if (m_animIn && (m_animIn.update())) {
m_animIn = undefined;
m_startNextAt = getTimer() + 1000;
}
if ((m_startNextAt != -1) && (getTimer() > m_startNextAt)) {
m_animPiece1 = new com.midasplayer.util.EaseOutQuadAnimator(piece_1);
m_animPiece1.setPosition(-300, 29);
m_animPiece1.setDuration(500);
m_animPiece2 = new com.midasplayer.util.EaseOutQuadAnimator(piece_2);
m_animPiece2.setPosition(800, 29);
m_animPiece2.setDuration(500);
m_startNextAt = -1;
}
if (m_animIn) {
var _local20 = (_local2 - m_lastTime) / 20;
m_lastTime = _local2;
_parent._y = _parent._y + _local20;
}
}
}
}
Symbol 1234 MovieClip [__Packages.bw.PowerMeter] Frame 0
class bw.PowerMeter extends MovieClip
{
var m_posX, m_posY, _x, _y, gotoAndStop, isVisible, m_anim, spin;
function PowerMeter () {
super();
}
function setPosition(x, y) {
m_posX = x;
m_posY = y;
_x = x;
_y = y;
}
function appear() {
gotoAndStop(50);
isVisible = true;
m_anim = new com.midasplayer.util.EaseInQuadAnimator(this);
m_anim.setPosition(m_posX - 81, m_posY);
m_anim.setDuration(400);
}
function setPower(a) {
gotoAndStop(int(a * 49) + 1);
}
function setSpinForce(d, a) {
var _local4 = 1;
if (d > 0) {
_local4 = 12;
}
var _local5 = Math.min(10, 10 * Math.abs(a));
_local4 = _local4 + _local5;
spin.gotoAndStop(int(_local4));
}
function remove() {
isVisible = false;
gotoAndStop(1);
spin.gotoAndStop(1);
m_anim = new com.midasplayer.util.EaseInQuadAnimator(this);
m_anim.setPosition(m_posX, m_posY);
m_anim.setDuration(400);
}
function onEnterFrame() {
if (m_anim && (m_anim.update())) {
m_anim = undefined;
}
}
}