Symbol 43 MovieClip [Lightning] Frame 1
#initclip 35
Object.registerClass("Lightning", com.king.bejeweled2.Lightning);
#endinitclip
Symbol 84 MovieClip Frame 1
stop();
Symbol 84 MovieClip Frame 20
gotoAndStop (1);
Symbol 103 MovieClip Frame 1
stop();
Symbol 103 MovieClip Frame 10
gotoAndStop (1);
Symbol 106 MovieClip Frame 1
stop();
Symbol 185 MovieClip Frame 1
stop();
Symbol 188 MovieClip Frame 1
stop();
Symbol 229 MovieClip Frame 1
stop();
Symbol 229 MovieClip Frame 20
gotoAndStop (1);
Symbol 248 MovieClip Frame 1
stop();
Symbol 248 MovieClip Frame 10
gotoAndStop (1);
Symbol 289 MovieClip Frame 1
stop();
Symbol 289 MovieClip Frame 20
gotoAndStop (1);
Symbol 308 MovieClip Frame 1
stop();
Symbol 308 MovieClip Frame 10
gotoAndStop (1);
Symbol 349 MovieClip Frame 1
stop();
Symbol 349 MovieClip Frame 20
gotoAndStop (1);
Symbol 368 MovieClip Frame 1
stop();
Symbol 368 MovieClip Frame 10
gotoAndStop (1);
Symbol 409 MovieClip Frame 1
stop();
Symbol 409 MovieClip Frame 20
gotoAndStop (1);
Symbol 428 MovieClip Frame 1
stop();
Symbol 428 MovieClip Frame 10
gotoAndStop (1);
Symbol 469 MovieClip Frame 1
stop();
Symbol 469 MovieClip Frame 20
gotoAndStop (1);
Symbol 488 MovieClip Frame 1
stop();
Symbol 488 MovieClip Frame 10
gotoAndStop (1);
Symbol 529 MovieClip Frame 1
stop();
Symbol 529 MovieClip Frame 20
gotoAndStop (1);
Symbol 548 MovieClip Frame 1
stop();
Symbol 548 MovieClip Frame 10
gotoAndStop (1);
Symbol 549 MovieClip [Jewel] Frame 1
#initclip 26
Object.registerClass("Jewel", com.king.bejeweled2.Jewel);
#endinitclip
stop();
Symbol 550 MovieClip [Score] Frame 1
#initclip 27
Object.registerClass("Score", com.king.bejeweled2.Score);
#endinitclip
Symbol 551 MovieClip [Explosion] Frame 1
#initclip 28
Object.registerClass("Explosion", com.king.bejeweled2.Explosion);
#endinitclip
Symbol 633 MovieClip [JewelShard] Frame 1
#initclip 29
Object.registerClass("JewelShard", com.king.bejeweled2.JewelShard);
#endinitclip
stop();
Symbol 636 MovieClip [HintArrow] Frame 1
#initclip 30
Object.registerClass("HintArrow", com.king.bejeweled2.HintArrow);
#endinitclip
Symbol 707 MovieClip Frame 1
stop();
Symbol 707 MovieClip Frame 20
gotoAndStop (1);
Symbol 708 MovieClip [JewelFire] Frame 1
#initclip 31
Object.registerClass("JewelFire", com.king.bejeweled2.JewelFire);
#endinitclip
Symbol 740 MovieClip Frame 160
gotoAndPlay (1);
Symbol 742 MovieClip [Introt] Frame 1
#initclip 32
Object.registerClass("Introt", com.king.bejeweled2.Introt);
#endinitclip
stop();
Symbol 744 MovieClip [Game] Frame 1
#initclip 33
Object.registerClass("Game", com.king.bejeweled2.Game);
#endinitclip
Symbol 759 MovieClip Frame 1
stop();
Symbol 816 MovieClip Frame 1
stop();
Symbol 816 MovieClip Frame 6
stop();
Symbol 820 MovieClip Frame 1
function randomize(min, max) {
var _local1 = Math.floor(Math.random() * ((max - min) + 1)) + min;
return(_local1);
}
_rotation = randomize(0, 359);
_xscale = randomize(35, 100);
_yscale = _xscale;
Symbol 820 MovieClip Frame 80
stop();
this.removeMovieClip();
Symbol 821 MovieClip Frame 1
stop();
i = 0;
while (i < 40) {
duplicateMovieClip ("particle1", "copy" + i, this.getNextHighestDepth());
i++;
}
Symbol 822 MovieClip Frame 1
stop();
Symbol 822 MovieClip Frame 50
gotoAndStop (1);
Symbol 824 MovieClip [Bejeweled2] Frame 1
#initclip 34
Object.registerClass("Bejeweled2", com.king.bejeweled2.Bejeweled2);
#endinitclip
stop();
Symbol 828 MovieClip Frame 1
stop();
Symbol 830 MovieClip [__Packages.com.king.bejeweled2.Jewel] Frame 0
class com.king.bejeweled2.Jewel extends MovieClip
{
var jewelWidth, jewelHeight, blingAlpha1, blingAlpha2, mcSelector, mcJewelBling, mcJewelBling2, mcHyperCube, active, shine, bomb, hyper, hyperAnim, explode, removeMe, removeCounter, moving, mStartTime, mStart, mEnd, mGemOnGem, _y, _parent, mFunct, mVals, _width, _height, _x, removeMovieClip, now, startTime, timeLeft, lastTime, gotoFrame, mcJewel, sNow, sStartTime, sTimeLeft, sLastTime, sGotoFrame, mcJewel_HL, bNow, bStartTime, timer1, bLastTime, timer2, blingAlphaUp1, blingAlphaUp2, hNow, hStartTime, hyperAnimTime, hLastTime, hGotoFrame, gotoAndStop, x, y, jewelType, explVert, explHori, explBomb, _xmouse, _ymouse;
function Jewel () {
super();
jewelWidth = 63;
jewelHeight = 63;
blingAlpha1 = 100;
blingAlpha2 = 100;
mcSelector._visible = false;
mcJewelBling._visible = false;
mcJewelBling2._visible = false;
mcHyperCube._visible = false;
active = false;
shine = false;
bomb = false;
hyper = false;
hyperAnim = false;
explode = false;
removeMe = false;
removeCounter = 0;
}
function onEnterFrame() {
if (moving) {
var _local2 = (getTimer() - mStartTime) / 1000;
var _local3 = mStart + ((_local2 * _local2) * acceleration);
if (_local3 >= mEnd) {
if (mGemOnGem) {
com.king.util.SoundManager.play("GemOnGem", 100, false);
}
_y = mEnd;
_parent.jewelMoving--;
mFunct.apply(_parent, mVals);
moving = false;
} else {
_y = _local3;
}
}
if (removeMe) {
removeCounter++;
_width = _width - 8;
_height = _height - 8;
_x = _x + 4;
_y = _y + 4;
if (removeCounter == 7) {
removeMovieClip();
}
}
if (active) {
now = getTimer() - startTime;
timeLeft = timeLeft - (now - lastTime);
lastTime = now;
gotoFrame = Math.ceil(20 - ((timeLeft / 500) * 20));
mcJewel.gotoAndStop(gotoFrame);
if (gotoFrame >= 20) {
startTime = getTimer();
timeLeft = 500;
lastTime = 0;
}
}
if ((shine == true) && (active == false)) {
sNow = getTimer() - sStartTime;
sTimeLeft = sTimeLeft - (sNow - sLastTime);
sLastTime = sNow;
sGotoFrame = Math.ceil(10 - ((sTimeLeft / 1000) * 10));
mcJewel_HL.gotoAndStop(sGotoFrame);
if (sGotoFrame >= 10) {
sStartTime = getTimer();
sTimeLeft = 1000;
sLastTime = 0;
}
}
if (bomb) {
bNow = getTimer() - bStartTime;
timer1 = timer1 - (bNow - bLastTime);
timer2 = timer2 - (bNow - bLastTime);
if (timer1 <= 0) {
if (blingAlphaUp1) {
blingAlpha1 = blingAlpha1 + (((bNow - bLastTime) / 100) * 6);
if (blingAlpha1 >= 100) {
blingAlphaUp1 = false;
timer1 = 1000;
}
} else {
blingAlpha1 = blingAlpha1 - (((bNow - bLastTime) / 100) * 6);
if (blingAlpha1 <= 0) {
blingAlphaUp1 = true;
}
}
}
if (timer2 <= 0) {
if (blingAlphaUp2) {
blingAlpha2 = blingAlpha2 + (((bNow - bLastTime) / 100) * 8);
if (blingAlpha2 >= 100) {
blingAlphaUp2 = false;
timer2 = 2700;
}
} else {
blingAlpha2 = blingAlpha2 - (((bNow - bLastTime) / 100) * 8);
if (blingAlpha2 <= 0) {
blingAlphaUp2 = true;
}
}
}
mcJewelBling._rotation = mcJewelBling._rotation + (((bNow - bLastTime) / 100) * 8);
mcJewelBling._alpha = blingAlpha1;
mcJewelBling2._rotation = mcJewelBling2._rotation - (((bNow - bLastTime) / 100) * 2);
mcJewelBling2._alpha = blingAlpha2;
bLastTime = bNow;
}
if (hyperAnim) {
hNow = getTimer() - hStartTime;
hyperAnimTime = hyperAnimTime - (hNow - hLastTime);
hLastTime = hNow;
hGotoFrame = Math.ceil(39 - ((hyperAnimTime / 1000) * 39));
mcHyperCube.gotoAndStop(hGotoFrame);
if (hyperAnimTime <= 0) {
hyperAnimTime = 1000;
}
}
}
function init(theY, theX, jewel, counter, delayer, firstPosMod, expSound, speed, nBoard) {
gotoAndStop(jewel);
x = theX;
y = theY;
jewelType = jewel;
newBoard = nBoard;
_x = x * jewelWidth;
_y = (y - firstPosMod) * jewelHeight;
explVert = false;
explHori = false;
explBomb = false;
com.king.util.Delay.oneShot(this, fall, counter * delayer, "_y", _y, y * jewelHeight, speed, expSound, _parent.boardCheckForPairs, _parent);
}
function removeJewel() {
removeMe = true;
}
function onPress() {
_parent.jewelClicked(this);
}
function onRollOver() {
sStartTime = getTimer();
sLastTime = 0;
sTimeLeft = 1000;
shine = true;
}
function onRollOut() {
shine = false;
mcJewel_HL.gotoAndStop(1);
}
function activate() {
com.king.util.SoundManager.play("Select", 100, false);
mcJewel_HL.gotoAndStop(1);
startTime = getTimer();
lastTime = 0;
timeLeft = 500;
active = true;
}
function deactivate() {
active = false;
mcJewel.gotoAndStop(1);
mcSelector._visible = false;
}
function onDragOut() {
shine = false;
mcJewel_HL.gotoAndStop(1);
var _local2;
if ((_xmouse >= 63) && (x < 7)) {
_local2 = _parent.gameGridObj[y][x + 1];
} else if ((_xmouse <= 0) && (x > 0)) {
_local2 = _parent.gameGridObj[y][x - 1];
}
if ((_ymouse >= 63) && (y < 7)) {
_local2 = _parent.gameGridObj[y + 1][x];
} else if ((_ymouse <= 0) && (y > 0)) {
_local2 = _parent.gameGridObj[y - 1][x];
}
if (_local2 != undefined) {
_parent.jewelClicked(_local2);
}
}
function fall(direction, start, end, timeMultiply, gemOnGem, fn, parent, vals) {
moving = true;
mStart = start;
mEnd = end;
mGemOnGem = gemOnGem;
mFunct = fn;
mVals = vals;
mStartTime = getTimer();
_parent.jewelMoving++;
}
function goTo(direction, start, end, timeMultiply, gemOnGem, fn, parent, vals) {
deactivate();
if (start < end) {
var _local4 = ((end - start) * 0.0055) * timeMultiply;
} else {
var _local4 = ((start - end) * 0.0055) * timeMultiply;
}
var _local5 = new mx.transitions.Tween(this, direction, mx.transitions.easing.Regular.easeInOut, start, end, _local4, true);
parent.jewelMoving++;
_local5.onMotionFinished = function () {
if (gemOnGem) {
com.king.util.SoundManager.play("GemOnGem", 100, false);
}
parent.jewelMoving--;
fn.apply(parent, vals);
};
}
function hyperOn() {
_parent.noOfHyperCubes++;
hyper = true;
hStartTime = getTimer();
hLastTime = 0;
hyperAnimTime = 1000;
hyperAnim = true;
mcHyperCube._visible = true;
mcJewel._visible = false;
mcJewel_HL._visible = false;
}
function bombOn() {
_parent.noOfBombs++;
bomb = true;
bStartTime = getTimer();
bLastTime = 0;
blingAlphaUp1 = false;
blingAlphaUp2 = false;
timer1 = 1000;
timer2 = 2700;
mcJewelBling._visible = true;
mcJewelBling2._visible = true;
}
function dummy() {
trace("dummy");
}
var newBoard = false;
var pMove = false;
var fireJewel = false;
var acceleration = 900;
}
Symbol 831 MovieClip [__Packages.com.king.util.Map] Frame 0
class com.king.util.Map
{
var map, lastSize;
function Map (init) {
map = new Object();
for (var _local3 in init) {
map["" + _local3] = init[_local3];
}
lastSize = -1;
}
function put(key, value) {
map["" + key] = value;
lastSize = -1;
}
function get(key) {
return(map["" + key]);
}
function remove(key) {
var _local2 = "" + key;
var _local3 = map[_local2];
delete map[_local2];
lastSize = -1;
return(_local3);
}
function contains(key) {
return(map["" + key] != undefined);
}
function count() {
if (lastSize < 0) {
lastSize = 0;
for (var _local2 in map) {
lastSize++;
}
}
return(lastSize);
}
function size() {
return(count());
}
function clear() {
map = {};
lastSize = 0;
}
function dump() {
var _local2 = "";
for (var _local3 in map) {
_local2 = _local2 + (((_local3 + "=>") + map[_local3]) + newline);
}
trace(_local2);
}
function toArray() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = map[_local3];
}
return(_local2);
}
function keySet() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = _local3;
}
return(_local2);
}
function get iterator() {
return(new com.king.util.MapIterator(this));
}
function get valueIterator() {
return(new com.king.util.MapValueIterator(this));
}
function foreach(fn) {
var _local3 = arguments.slice(1);
if (_local3.length > 0) {
do {
if ((in map) == null) {
break;
}
var _local5 = in map;
} while (fn(_local5, map[_local5], _local3[0], _local3[1], _local3[2], _local3[3], _local3[4]) != false);
do {
} while ("foreach" != null);
} else {
do {
if ((in map) == null) {
break;
}
var _local5 = in map;
} while (fn(_local5, map[_local5]) != false);
do {
} while (_local2 != null);
}
lastSize = -1;
}
function get _content() {
return(map);
}
}
Symbol 832 MovieClip [__Packages.com.king.util.Iterator] Frame 0
interface com.king.util.Iterator
{
}
Symbol 833 MovieClip [__Packages.com.king.util.MapIterator] Frame 0
class com.king.util.MapIterator implements com.king.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 834 MovieClip [__Packages.com.king.util.MapValueIterator] Frame 0
class com.king.util.MapValueIterator implements com.king.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 835 MovieClip [__Packages.com.king.util.SoundManager] Frame 0
class com.king.util.SoundManager
{
static var globalSound, preloadLastId, progressCallback, preloadList, preloadNum, preloadLast, beginLoadCallback;
function SoundManager () {
}
static function isSoundEnabled() {
return(soundEnabled);
}
static function enableSounds(enabled) {
soundEnabled = enabled;
if (!enabled) {
muteAll();
} else {
restoreMuteAll();
}
}
static function toggleSound() {
if (globalSound == undefined) {
globalSound = new Sound(_root);
}
soundOn = !soundOn;
globalSound.setVolume((soundOn ? 100 : 0));
}
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 _local1 = sounds.get(resource);
if (_local1 != undefined) {
_local1.sound.stop();
_local1.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 _local1 = sounds.get(resource);
if ((_local1 != undefined) && (_local1.playStatus == true)) {
var _local2 = getCalibratedVolume(percent);
if (!_local1.isMuted) {
_local1.sound.setVolume(_local2);
}
_local1.realVol = _local2;
}
}
static function getPosition(resource) {
var _local1 = sounds.get(resource);
if ((_local1 != undefined) && (_local1.playStatus == true)) {
return(_local1.sound.position);
}
return(-1);
}
static function getLength(resource) {
var _local1 = sounds.get(resource);
if (_local1 != undefined) {
return(_local1.sound.duration);
}
return(-1);
}
static function isPlaying(resource) {
var _local1 = sounds.get(resource);
return((_local1 != undefined) && (_local1.playStatus == true));
}
static function initialize(list) {
for (var _local8 in list) {
var resource = list[_local8];
var _local2 = m_placeholder.getNextHighestDepth();
var _local1 = new Sound(m_placeholder.createEmptyMovieClip("sm_sndhold_" + _local2, _local2));
_local1.attachSound(resource);
_local1.onSoundComplete = function () {
var _local1 = com.king.util.SoundManager.sounds.get(resource);
_local1.playStatus = false;
};
sounds.put(resource, {realVol:100, sound:_local1, playStatus:false});
}
}
static function killPreload() {
trace(("auto unloading pending \"" + preloadLastId) + "\"");
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 _local2 in urlList) {
preloadList.push(urlList[_local2]);
}
preloadLast = "";
preloadNum = urlList.length;
loadUrl_();
}
static function unload(name) {
var _local1 = sounds.get(name);
if ((_local1 != undefined) && (_local1.runtime == true)) {
var _local2 = m_placeholder[_local1.clipId];
_local2.removeMovieClip();
delete _local1.sound;
_local1.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 _local1 = sounds.get(resource);
if (_local1 != undefined) {
_local1.sound.setVolume((soundEnabled ? (volume) : 0));
_local1.realVol = volume;
_local1.isMuted = !soundEnabled;
_local1.playStatus = true;
_local1.onPlayedFn = fn;
_local1.sound.start(0, (isLoop ? 65535 : 1));
} else {
var _local5 = m_placeholder.getNextHighestDepth();
var _local3 = new Sound(m_placeholder.createEmptyMovieClip("sm_sndhold_" + _local5, _local5));
_local3.attachSound(resource);
_local3.onSoundComplete = function () {
var _local1 = com.king.util.SoundManager.sounds.get(resource);
_local1.playStatus = false;
com.king.util.SoundManager.onPlayed_(resource);
};
_local3.setVolume((soundEnabled ? (volume) : 0));
_local3.start(0, (isLoop ? 65535 : 1));
sounds.put(resource, {isMuted:!soundEnabled, realVol:volume, onPlayedFn:fn, sound:_local3, playStatus:true});
}
}
static function onPlayed_(name) {
var _local1 = sounds.get(name);
if ((_local1 != undefined) && (_local1.onPlayedFn != undefined)) {
_local1.onPlayedFn();
}
}
static function loadUrl_(success) {
var _local8 = preloadNum - preloadList.length;
if (_local8 != 0) {
if (success == false) {
trace(("SoundManager.preload(): FAILED TO LOAD " + preloadLast) + ", SKIPPED!");
}
progressCallback(_local8, success);
}
if (preloadList.length == 0) {
progressCallback = undefined;
preloadList = undefined;
preloadNum = 0;
preloadLast = undefined;
return(undefined);
}
var _local5 = preloadList.pop();
preloadLast = _local5.url;
var nextId = _local5.id;
if (!_local5.id) {
var _local3 = preloadLast.lastIndexOf("/");
if (_local3 == -1) {
_local3 = 0;
} else {
_local3++;
}
var _local4 = preloadLast.lastIndexOf(".");
if (_local4 == -1) {
_local4 = preloadLast.length;
}
nextId = preloadLast.substring(_local3, _local4);
trace((("SoundManager.preload(): assigned id: " + preloadLast) + " => ") + nextId);
}
var _local7 = m_placeholder.getNextHighestDepth();
var _local6 = "dn_sndhold_" + _local7;
var _local2 = new Sound(m_placeholder.createEmptyMovieClip(_local6, _local7));
_local2.onLoad = function (a) {
var _local2 = com.king.util.SoundManager.loadUrl_;
com.king.util.Delay.oneShot(this, _local2, 50, a);
};
_local2.onSoundComplete = function () {
var _local1 = com.king.util.SoundManager.sounds.get(nextId);
_local1.playStatus = false;
com.king.util.SoundManager.onPlayed_(nextId);
};
preloadLastId = nextId;
_local2.loadSound("" + preloadLast, false);
sounds.put(nextId, {realVol:100, clipId:_local6, sound:_local2, playStatus:false, runtime:true});
if (beginLoadCallback) {
beginLoadCallback(_local2, preloadLast, nextId, (preloadNum - preloadList.length) - 1);
}
}
static var m_placeholder = _root;
static var sounds = new com.king.util.Map();
static var soundEnabled = true;
static var soundOn = true;
}
Symbol 836 MovieClip [__Packages.com.king.util.Delay] Frame 0
class com.king.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 _local3 = 3;
while (_local3 < arguments.length) {
m_param.push(arguments[_local3]);
_local3++;
}
m_context = context;
m_delay = delay;
m_started = getTimer();
m_timerId = setInterval(mx.utils.Delegate.create(this, onEvent), delay);
}
function onEvent() {
if (getTimer() >= (m_delay + m_started)) {
clearInterval(m_timerId);
m_fn.apply(m_context, m_param);
m_fn = undefined;
m_param = undefined;
}
}
static function oneShot(context, fn, delay) {
var _local3 = new com.king.util.Delay(context, fn, delay);
_local3.m_param = new Array();
var _local2 = 3;
while (_local2 < arguments.length) {
_local3.m_param.push(arguments[_local2]);
_local2++;
}
}
}
Symbol 837 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 838 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 839 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 840 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var version = "1.1.0.52";
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 841 MovieClip [__Packages.mx.transitions.easing.Regular] Frame 0
class mx.transitions.easing.Regular
{
function Regular () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return(((c * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = t / d;
return((((-c) * t) * (t - 2)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((c / 2) * t) * t) + b);
}
t--;
return((((-c) / 2) * ((t * (t - 2)) - 1)) + b);
}
static var version = "1.1.0.52";
}
Symbol 842 MovieClip [__Packages.com.king.bejeweled2.Score] Frame 0
class com.king.bejeweled2.Score extends MovieClip
{
var delay, _y, _x, txtScore, attachMovie, filters;
function Score () {
super();
delay = new com.king.util.Delay();
}
function init(y, x, num, self, type) {
_y = y;
_x = x;
txtScore.text = "";
var _local10 = num.toString();
var _local8 = _local10.split("");
var _local3 = 0;
while (_local3 < _local8.length) {
var _local4 = attachMovie("Digit_" + _local8[_local3], "score_" + _local3, _local3);
_local4._y = 0;
_local4._x = 28 * _local3;
var _local6 = new flash.geom.Transform(_local4);
switch (Number(type)) {
case 1 :
var _local7 = new flash.geom.ColorTransform(1, 1, 0, 1, 60, 50, 0, 0);
var _local5 = new flash.filters.GlowFilter(0, 1, 2, 2, 2, 3);
break;
case 2 :
_local7 = new flash.geom.ColorTransform(1, 1, 1, 1, 100, 100, 100, 0);
_local5 = new flash.filters.GlowFilter(0, 1, 2, 2, 2, 3);
break;
case 3 :
_local7 = new flash.geom.ColorTransform(0, 0, 1, 1, 0, 0, 100, 0);
_local5 = new flash.filters.GlowFilter(0, 1, 2, 2, 2, 3);
break;
case 4 :
_local7 = new flash.geom.ColorTransform(1, 0, 0, 1, 75, 0, 0, 0);
_local5 = new flash.filters.GlowFilter(0, 1, 2, 2, 2, 3);
break;
case 5 :
_local7 = new flash.geom.ColorTransform(1, 0, 1, 1, 100, 0, 100, 0);
_local5 = new flash.filters.GlowFilter(0, 1, 2, 2, 2, 3);
break;
case 6 :
_local7 = new flash.geom.ColorTransform(1, 0.5, 0, 1, 100, 30, 0, 0);
_local5 = new flash.filters.GlowFilter(0, 1, 2, 2, 2, 3);
break;
case 7 :
_local7 = new flash.geom.ColorTransform(0, 1, 0, 1, 0, 100, 0, 0);
_local5 = new flash.filters.GlowFilter(0, 1, 2, 2, 2, 3);
break;
default :
_local7 = new flash.geom.ColorTransform(1, 1, 1, 1, 100, 100, 100, 0);
_local5 = new flash.filters.GlowFilter(0, 1, 2, 2, 2, 3);
}
_local6.colorTransform = _local7;
filters = [_local5];
_local3++;
}
var _local11 = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Regular.easeIn, _y, _y - 100, 1, true);
com.king.util.Delay.oneShot(this, fadeOut, 500);
_local11.onMotionFinished = function () {
self.removeMovieClip();
_root.mcPre.mcBejeweled2.mcGame.scoreMoving--;
};
}
function fadeOut() {
var _local2 = new mx.transitions.Tween(this, "_alpha", mx.transitions.easing.Regular.easeIn, 100, 0, 0.5, true);
}
}
Symbol 843 MovieClip [__Packages.com.king.bejeweled2.Explosion] Frame 0
class com.king.bejeweled2.Explosion extends MovieClip
{
var _y, _x, attachMovie, getNextHighestDepth, _parent;
function Explosion () {
super();
}
function init(y, x, num, self) {
_y = y;
_x = x;
var _local2 = 0;
while (_local2 < 3) {
var _local3 = attachMovie("JewelShard", (self + "jewelShard_") + _local2, getNextHighestDepth());
_local3.init(_local2, _local3, num);
_parent.shardMoving++;
_local2++;
}
}
}
Symbol 844 MovieClip [__Packages.com.king.bejeweled2.JewelShard] Frame 0
class com.king.bejeweled2.JewelShard extends MovieClip
{
var _y, _x, gotoAndStop;
function JewelShard () {
super();
}
function init(num, self, goto) {
_y = 0;
_x = 0;
gotoAndStop(goto);
var _local4 = (Math.random() * 200) - 100;
var _local5 = (Math.random() * 300) - 150;
var _local3 = ((Math.random() * 300) + 1) / 1000;
var _local8 = new mx.transitions.Tween(this, "_x", mx.transitions.easing.None.easeIn, _x, (_x + (100 - (100 * num))) + _local5, 1 + _local3, true);
var _local7 = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Regular.easeOut, _y, (_y - 50) + _local4, 0.3 + _local3, true);
_local7.onMotionFinished = function () {
var _local2 = new mx.transitions.Tween(self, "_y", mx.transitions.easing.Regular.easeIn, self._y, self._y + 250, 0.5, true);
_local2.onMotionFinished = function () {
self.removeMovieClip();
_root.mcPre.mcBejeweled2.mcGame.shardMoving--;
};
};
}
}
Symbol 845 MovieClip [__Packages.mx.transitions.easing.None] Frame 0
class mx.transitions.easing.None
{
function None () {
}
static function easeNone(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeIn(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeInOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static var version = "1.1.0.52";
}
Symbol 846 MovieClip [__Packages.com.king.bejeweled2.HintArrow] Frame 0
class com.king.bejeweled2.HintArrow extends MovieClip
{
var y, x, _y, _x, startTimer, timeLeft, animTimeLeft, lastTime, anim, animDown, now, _parent, removeMovieClip;
function HintArrow () {
super();
}
function init(yT, xT) {
y = yT;
x = xT;
_y = y;
_x = x;
startTimer = getTimer();
timeLeft = 1500;
animTimeLeft = 250;
lastTime = 0;
anim = true;
animDown = true;
}
function onEnterFrame() {
if (anim) {
now = getTimer() - startTimer;
timeLeft = timeLeft - (now - lastTime);
animTimeLeft = animTimeLeft - (now - lastTime);
lastTime = now;
if (animDown) {
_y = y + (10 * (1 - (Math.max(animTimeLeft, 0) / 250)));
if (animTimeLeft <= 0) {
animTimeLeft = 250;
animDown = false;
y = _y;
}
} else {
_y = y - (10 * (1 - (Math.max(animTimeLeft, 0) / 250)));
if (animTimeLeft <= 0) {
animTimeLeft = 250;
animDown = true;
y = _y;
}
}
if (timeLeft <= 0) {
_parent.hintOn = false;
removeMovieClip();
}
}
}
}
Symbol 847 MovieClip [__Packages.com.king.bejeweled2.JewelFire] Frame 0
class com.king.bejeweled2.JewelFire extends MovieClip
{
var length, duration, startTimer, mcAnim1, mcAnim2, mcAnim3, mcAnim4, mcAnim5, mcAnim6, mcAnim7, mcAnim8, mcAnim9, mcAnim10, mcAnim11, removeMovieClip, _y, _x;
function JewelFire () {
super();
}
function onEnterFrame() {
var _local2 = Math.round(((getTimer() - startTimer) / duration) * length);
mcAnim1.gotoAndStop(_local2);
mcAnim2.gotoAndStop(_local2);
mcAnim3.gotoAndStop(_local2);
mcAnim4.gotoAndStop(_local2);
mcAnim5.gotoAndStop(_local2);
mcAnim6.gotoAndStop(_local2);
mcAnim7.gotoAndStop(_local2);
mcAnim8.gotoAndStop(_local2);
mcAnim9.gotoAndStop(_local2);
mcAnim10.gotoAndStop(_local2);
mcAnim11.gotoAndStop(_local2);
if (_local2 >= 20) {
removeMovieClip();
}
}
function init(y, x, self) {
startTimer = getTimer();
duration = 400;
length = 20;
_y = y;
_x = x;
fC = 1;
}
var fC = 1;
}
Symbol 848 MovieClip [__Packages.com.king.bejeweled2.Introt] Frame 0
class com.king.bejeweled2.Introt extends MovieClip
{
var now, startTime, timeLeft, lastTime, animTime, gotoAndStop, _visible, mcIntroButton, mcPreIntro;
function Introt () {
super();
}
function onEnterFrame() {
if (run) {
now = getTimer() - startTime;
timeLeft = timeLeft - (now - lastTime);
lastTime = now;
var _local2 = Math.ceil((1 - (timeLeft / animTime)) * 498);
gotoAndStop(_local2);
}
}
function show(time) {
animTime = time;
timeLeft = time;
startTime = getTimer();
lastTime = 0;
run = true;
_visible = true;
mcIntroButton.onPress = function () {
_root.mcPre.mcBejeweled2.timeLeft = 0;
this._parent.mcBling._visible = false;
this._parent.run = false;
};
mcPreIntro.onPress = function () {
this._parent.timeLeft = 0.809236947791165 * this._parent.animTime;
};
}
var run = false;
}
Symbol 849 MovieClip [__Packages.com.king.bejeweled2.Game] Frame 0
class com.king.bejeweled2.Game extends MovieClip
{
var moveAllowed, score, consecutiveExplosion, consecutiveBombExplosion, jewelCounter, scoreSignCounter, explosionCounter, lightningCounter, jewelMoving, scoreMoving, shardMoving, jFireCounter, activeJewel, delay, openUserEnd, communicator, lightningArr, gameState, delayedFunction, _parent, level, levelScoreCap, random, noOfGems, attachMovie, switchJewel, hint;
function Game () {
super();
moveAllowed = false;
score = 0;
consecutiveExplosion = 0;
consecutiveBombExplosion = 1;
jewelCounter = 0;
scoreSignCounter = 0;
explosionCounter = 0;
lightningCounter = 0;
jewelMoving = 0;
scoreMoving = 0;
shardMoving = 0;
jFireCounter = 0;
activeJewel = undefined;
delay = new com.king.util.Delay();
openUserEnd = false;
communicator = new com.king.util.Communicator();
lightningArr = new Array();
gameState = STATE_NOT_RUNNING;
}
function onEnterFrame() {
if (frameDelay) {
delayCounter++;
if (delayCounter > 1) {
delayCounter = 0;
frameDelay = false;
delayedFunction.apply(this);
}
}
if (!(gameState === STATE_END_LEVEL)) {
} else if (((jewelMoving == 0) && (scoreMoving == 0)) && (shardMoving == 0)) {
clearLevel();
if (gameOver) {
_parent.gameOver();
} else {
_parent.nextLevel();
}
gameState = STATE_NOT_RUNNING;
}
}
function openGameStart(rnd, noGems, lvl, lvlSC) {
level = lvl;
levelScoreCap = lvlSC;
random = rnd;
jewelCounter = 0;
_root.mcPre.mcBejeweled2.mcScorePod.txtLevel.text = level;
_root.mcPre.mcBejeweled2.mcScorePod.txtScore.text = score;
noOfGems = noGems;
openUserEnd = true;
makeGameGrid();
com.king.util.Delay.oneShot(this, openGameEnd, 2000);
}
function openGameEnd() {
_parent.mcGameOver.gotoAndStop("opengame");
_parent.gameOver();
}
function startGame(rnd, noGems, lvl, lvlSC) {
level = lvl;
levelScoreCap = lvlSC;
random = rnd;
jewelCounter = 0;
_root.mcPre.mcBejeweled2.mcScorePod.txtLevel.text = level;
_root.mcPre.mcBejeweled2.mcScorePod.txtScore.text = score;
noOfGems = noGems;
makeGameGrid();
gameState = STATE_RUNNING;
}
function endLevel() {
moveAllowed = false;
gameState = STATE_END_LEVEL;
}
function clearLevel() {
var _local3 = 0;
while (_local3 < 8) {
var _local2 = 0;
while (_local2 < 8) {
gameGridObj[_local3][_local2].removeMovieClip();
_local2++;
}
_local3++;
}
gameGridObj = [];
}
function makeGameGrid() {
var _local3 = false;
while (_local3 == false) {
var _local8 = 0;
while (_local8 < 8) {
var _local7 = new Array();
var _local2 = 0;
while (_local2 < 8) {
_local7[_local2] = random.nextInt(noOfGems) + 1;
noOfRnd++;
_parent.txtRnd.text = noOfRnd;
_local2++;
}
gameGrid[_local8] = _local7;
_local8++;
}
_local3 = true;
_local8 = 0;
while (_local8 < 8) {
var _local2 = 0;
while (_local2 < 8) {
if (_local2 < 6) {
if ((gameGrid[_local8][_local2] == gameGrid[_local8][_local2 + 1]) && (gameGrid[_local8][_local2] == gameGrid[_local8][_local2 + 2])) {
_local3 = false;
}
}
if (_local8 < 6) {
if ((gameGrid[_local8][_local2] == gameGrid[_local8 + 1][_local2]) && (gameGrid[_local8][_local2] == gameGrid[_local8 + 2][_local2])) {
_local3 = false;
}
}
_local2++;
}
_local8++;
}
if (boardCheckForDeadRet()) {
_local3 = false;
}
}
var _local8 = 7;
while (_local8 >= 0) {
var _local7 = new Array();
var _local2 = 7;
while (_local2 >= 0) {
var _local5 = false;
if (_local2 == 7) {
_local5 = true;
}
var _local4 = attachMovie("Jewel", "jewel_" + jewelCounter, jewelDepth + jewelCounter);
_local4.init(_local8, _local2, gameGrid[_local8][_local2], jewelCounter, 10, 8, _local5, 0.5, true);
_local7[_local2] = _local4;
jewelCounter++;
_local2--;
}
gameGridObj[_local8] = _local7;
_local8--;
}
if (noOfBombs > 0) {
_local8 = 0;
while (_local8 < noOfBombs) {
var _local6 = gameGridObj[random.nextInt(8)][random.nextInt(8)];
noOfRnd++;
noOfRnd++;
_parent.txtRnd.text = noOfRnd;
if (_local6.bomb == false) {
_local6.bombOn();
noOfBombs--;
} else {
_local8--;
}
_local8++;
}
}
if (noOfHyperCubes > 0) {
_local8 = 0;
while (_local8 < noOfHyperCubes) {
var _local6 = gameGridObj[random.nextInt(8)][random.nextInt(8)];
noOfRnd++;
noOfRnd++;
_parent.txtRnd.text = noOfRnd;
if ((_local6.bomb == false) && (_local6.hyper == false)) {
_local6.hyperOn();
_local6.jewelType = 8;
noOfHyperCubes--;
} else {
_local8--;
}
_local8++;
}
}
}
function jewelClicked(jewel) {
if (moveAllowed) {
consecutiveExplosion = 0;
consecutiveBombExplosion = 1;
if (activeJewel == undefined) {
activeJewel = jewel;
activeJewel.mcSelector._visible = true;
activeJewel.activate();
} else {
if (jewel == activeJewel) {
activeJewel.mcSelector._visible = false;
activeJewel.deactivate();
activeJewel = undefined;
}
if (((jewel.y == (activeJewel.y + 1)) || (jewel.y == (activeJewel.y - 1))) && (jewel.x == activeJewel.x)) {
communicator.sendMove(activeJewel.y, activeJewel.x, jewel.y, jewel.x, noOfRnd, noOfExplJewels);
moveAllowed = false;
switchJewel = jewel;
var _local3 = jewel._y;
var _local5 = activeJewel._y;
if (jewel.hyper) {
var _local7 = [jewel, activeJewel.jewelType];
jewel.pMove = true;
activeJewel.pMove = true;
jewel.goTo("_y", _local3, _local5, 1, false, hyperCubeTrigged, this, _local7);
activeJewel.goTo("_y", _local5, _local3, 1, false, hyperCubeTrigged, this, _local7);
} else if (activeJewel.hyper) {
var _local7 = [activeJewel, jewel.jewelType];
jewel.pMove = true;
activeJewel.pMove = true;
jewel.goTo("_y", _local3, _local5, 1, false, hyperCubeTrigged, this, _local7);
activeJewel.goTo("_y", _local5, _local3, 1, false, hyperCubeTrigged, this, _local7);
} else {
jewel.pMove = true;
activeJewel.pMove = true;
jewel.goTo("_y", _local3, _local5, 1, false, boardCheckForPairs, this);
activeJewel.goTo("_y", _local5, _local3, 1, false, boardCheckForPairs, this);
}
var _local10 = activeJewel.y;
activeJewel.y = jewel.y;
jewel.y = _local10;
var _local8 = gameGrid[activeJewel.y][activeJewel.x];
gameGrid[activeJewel.y][activeJewel.x] = gameGrid[jewel.y][jewel.x];
gameGrid[jewel.y][jewel.x] = _local8;
var _local9 = gameGridObj[activeJewel.y][activeJewel.x];
gameGridObj[activeJewel.y][activeJewel.x] = gameGridObj[jewel.y][jewel.x];
gameGridObj[jewel.y][jewel.x] = _local9;
} else if (((jewel.x == (activeJewel.x + 1)) || (jewel.x == (activeJewel.x - 1))) && (jewel.y == activeJewel.y)) {
communicator.sendMove(activeJewel.y, activeJewel.x, jewel.y, jewel.x, noOfRnd, noOfExplJewels);
moveAllowed = false;
switchJewel = jewel;
var _local4 = jewel._x;
var _local6 = activeJewel._x;
if (jewel.hyper) {
var _local7 = [jewel, activeJewel.jewelType];
jewel.pMove = true;
activeJewel.pMove = true;
jewel.goTo("_x", _local4, _local6, 1, false, hyperCubeTrigged, this, _local7);
activeJewel.goTo("_x", _local6, _local4, 1, false, hyperCubeTrigged, this, _local7);
} else if (activeJewel.hyper) {
var _local7 = [activeJewel, jewel.jewelType];
jewel.pMove = true;
activeJewel.pMove = true;
jewel.goTo("_x", _local4, _local6, 1, false, hyperCubeTrigged, this, _local7);
activeJewel.goTo("_x", _local6, _local4, 1, false, hyperCubeTrigged, this, _local7);
} else {
jewel.pMove = true;
activeJewel.pMove = true;
jewel.goTo("_x", _local4, _local6, 1, false, boardCheckForPairs, this);
activeJewel.goTo("_x", _local6, _local4, 1, false, boardCheckForPairs, this);
}
var _local11 = activeJewel.x;
activeJewel.x = jewel.x;
jewel.x = _local11;
var _local8 = gameGrid[activeJewel.y][activeJewel.x];
gameGrid[activeJewel.y][activeJewel.x] = gameGrid[jewel.y][jewel.x];
gameGrid[jewel.y][jewel.x] = _local8;
var _local9 = gameGridObj[activeJewel.y][activeJewel.x];
gameGridObj[activeJewel.y][activeJewel.x] = gameGridObj[jewel.y][jewel.x];
gameGridObj[jewel.y][jewel.x] = _local9;
} else {
activeJewel.deactivate();
activeJewel = undefined;
}
}
}
}
function hyperCubeTrigged(jewel, type) {
if (jewelMoving == 0) {
activeJewel = undefined;
lightningSound = true;
com.king.util.SoundManager.play("ElectroStart", 100, false);
noOfHyperCubes--;
jewel.hyper = false;
jewel.explVert = true;
var _local6 = jewel;
var _local7;
var _local4 = 0;
while (_local4 < 8) {
var _local3 = 0;
while (_local3 < 8) {
if (gameGridObj[_local4][_local3].jewelType == type) {
if (gameGridObj[_local4][_local3].bomb) {
gameGridObj[_local4][_local3].bomb = false;
noOfBombs--;
}
gameGridObj[_local4][_local3].explode = true;
gameGridObj[_local4][_local3].explVert = true;
gameGridObj[_local4][_local3].explode = true;
gameGridObj[_local4][_local3].fireJewel = true;
var _local5 = 10 * (1 + ((0.5 * level) - 0.5));
score = score + Number(_local5);
createScore(gameGridObj[_local4][_local3]._y, gameGridObj[_local4][_local3]._x + 31.5, _local5, type);
_root.mcPre.mcBejeweled2.mcScorePod.txtScore.text = score;
_local7 = attachMovie("Lightning", "lightning_" + lightningCounter, lightningDepth + lightningCounter);
_local7.init(_local6._y, _local6._x, gameGridObj[_local4][_local3]._y, gameGridObj[_local4][_local3]._x, 31.5, lightningCounter);
lightningArr[lightningCounter] = _local7;
lightningCounter++;
_local6 = gameGridObj[_local4][_local3];
}
_local3++;
}
_local4++;
}
com.king.util.Delay.oneShot(this, removeLightning, (50 * lightningCounter) + 400);
}
}
function removeLightning() {
var _local2 = 0;
while (_local2 < lightningArr.length) {
lightningArr[_local2].removeMovieClip();
_local2++;
}
lightningArr = [];
lightningCounter = 0;
explodeJewel();
refillBoard();
}
function markForBombExplosion(yFrom, yTo, xFrom, xTo, type, bombJewel) {
var _local15 = attachMovie("JewelFire", "jewelFire_" + jFireCounter, jewelFireDepth + jFireCounter);
_local15.init(bombJewel._y, bombJewel._x, bombJewel);
jFireCounter++;
var _local13 = Math.round((35 * (1 + ((0.5 * level) - 0.5))) + (10 * (1 + ((0.5 * level) - 0.5)))) * consecutiveBombExplosion;
score = score + Number(_local13);
createScore(gameGridObj[yFrom][xFrom]._y + (((yTo - yFrom) * 63) / 2), gameGridObj[yFrom][xFrom]._x + (((xTo - xFrom) * 63) / 2), _local13, type);
_root.mcPre.mcBejeweled2.mcScorePod.txtScore.text = score;
consecutiveBombExplosion++;
var _local4 = yFrom;
while (_local4 <= yTo) {
var _local3 = xFrom;
while (_local3 <= xTo) {
if (gameGridObj[_local4][_local3].hyper == true) {
noOfHyperCubes--;
}
if (gameGridObj[_local4][_local3].bomb == true) {
gameGridObj[_local4][_local3].bomb = false;
noOfBombs--;
var _local5 = Math.max(_local3 - 1, 0);
var _local8 = Math.min(_local3 + 1, 7);
var _local6 = Math.max(_local4 - 1, 0);
var _local7 = Math.min(_local4 + 1, 7);
markForBombExplosion(_local6, _local7, _local5, _local8, gameGridObj[_local4][_local3].jewelType, gameGridObj[_local4][_local3]);
}
gameGridObj[_local4][_local3].explBomb = true;
gameGridObj[_local4][_local3].explode = true;
gameGridObj[_local4][_local3].hyper = false;
_local3++;
}
_local4++;
}
}
function delayFrame(fn) {
delayedFunction = fn;
frameDelay = true;
}
function boardCheckForPairs() {
var _local16 = 0;
if (jewelMoving == 0) {
noOfFalls++;
var _local8 = 0;
while (_local8 < 8) {
var _local4 = 0;
while (_local4 < 8) {
if (_local4 < 6) {
if (((gameGrid[_local8][_local4] == gameGrid[_local8][_local4 + 1]) && (gameGrid[_local8][_local4] == gameGrid[_local8][_local4 + 2])) && (gameGridObj[_local8][_local4].explHori == false)) {
_local16++;
consecutiveExplosion++;
var _local9 = _local4 + 1;
var _local7 = 1;
while (gameGridObj[_local8][_local4].jewelType == gameGridObj[_local8][_local9].jewelType) {
_local7++;
_local9++;
}
var _local14 = false;
var _local3 = 0;
while (_local3 < _local7) {
gameGridObj[_local8][_local4 + _local3].explHori = true;
if (gameGridObj[_local8][_local4 + _local3].bomb) {
com.king.util.SoundManager.play("BombExplode", 80, false);
_local14 = true;
gameGridObj[_local8][_local4 + _local3].bomb = false;
noOfBombs--;
var _local11 = Math.max((_local4 + _local3) - 1, 0);
var _local12 = Math.min((_local4 + _local3) + 1, 7);
var _local10 = Math.max(_local8 - 1, 0);
var _local13 = Math.min(_local8 + 1, 7);
markForBombExplosion(_local10, _local13, _local11, _local12, gameGridObj[_local8][_local4].jewelType, gameGridObj[_local8][_local4 + _local3]);
}
_local3++;
}
if (_local7 == 3) {
if (noOfFalls == 1) {
if (com.king.util.SoundManager.isPlaying("GotSetBig") == false) {
com.king.util.SoundManager.stop("GotSet");
com.king.util.SoundManager.play("GotSet", 100, false);
}
}
var _local15 = (10 * (1 + ((0.5 * level) - 0.5))) * consecutiveExplosion;
}
if (_local7 == 4) {
if (noOfFalls == 1) {
com.king.util.SoundManager.stop("GotSet");
com.king.util.SoundManager.stop("GotSetBig");
com.king.util.SoundManager.play("bombCreate", 90, false);
}
var _local5 = false;
var _local6 = 0;
while (_local6 < 4) {
if ((gameGridObj[_local8][_local4 + _local6] == activeJewel) && (_local5 == false)) {
activeJewel.bombOn();
_local5 = true;
}
if ((gameGridObj[_local8][_local4 + _local6] == switchJewel) && (_local5 == false)) {
switchJewel.bombOn();
_local5 = true;
}
_local6++;
}
if (_local5 == false) {
gameGridObj[_local8][_local4].bombOn();
}
var _local15 = (20 * (1 + ((0.5 * level) - 0.5))) * consecutiveExplosion;
}
if (_local7 >= 5) {
com.king.util.SoundManager.play("HyperGemCreation", 100, false);
var _local5 = false;
var _local6 = 0;
while (_local6 < 5) {
if ((gameGridObj[_local8][_local4 + _local6] == activeJewel) && (_local5 == false)) {
activeJewel.hyperOn();
_local5 = true;
}
if ((gameGridObj[_local8][_local4 + _local6] == switchJewel) && (_local5 == false)) {
switchJewel.hyperOn();
_local5 = true;
}
_local6++;
}
if (_local5 == false) {
gameGridObj[_local8][_local4].hyperOn();
}
var _local15 = (30 * (1 + ((0.5 * level) - 0.5))) * consecutiveExplosion;
}
if (_local14 == false) {
score = score + Number(_local15);
createScore(gameGridObj[_local8][_local4]._y, gameGridObj[_local8][_local4]._x + (((_local7 - 1) * 63) / 2), _local15, gameGridObj[_local8][_local4].jewelType);
_root.mcPre.mcBejeweled2.mcScorePod.txtScore.text = score;
}
}
}
if (_local8 < 6) {
if (((gameGrid[_local8][_local4] == gameGrid[_local8 + 1][_local4]) && (gameGrid[_local8][_local4] == gameGrid[_local8 + 2][_local4])) && (gameGridObj[_local8][_local4].explVert == false)) {
_local16++;
consecutiveExplosion++;
var _local9 = _local8 + 1;
var _local7 = 1;
while (gameGridObj[_local8][_local4].jewelType == gameGridObj[_local9][_local4].jewelType) {
_local7++;
_local9++;
}
var _local14 = false;
var _local3 = 0;
while (_local3 < _local7) {
gameGridObj[_local8 + _local3][_local4].explVert = true;
if (gameGridObj[_local8 + _local3][_local4].bomb) {
com.king.util.SoundManager.play("BombExplode", 80, false);
_local14 = true;
gameGridObj[_local8 + _local3][_local4].bomb = false;
noOfBombs--;
var _local11 = Math.max(_local4 - 1, 0);
var _local12 = Math.min(_local4 + 1, 7);
var _local10 = Math.max((_local8 + _local3) - 1, 0);
var _local13 = Math.min((_local8 + _local3) + 1, 7);
markForBombExplosion(_local10, _local13, _local11, _local12, gameGridObj[_local8][_local4].jewelType, gameGridObj[_local8 + _local3][_local4]);
}
_local3++;
}
if (_local7 == 3) {
if (noOfFalls == 1) {
if (com.king.util.SoundManager.isPlaying("GotSetBig") == false) {
com.king.util.SoundManager.stop("GotSet");
com.king.util.SoundManager.play("GotSet", 100, false);
}
}
var _local15 = (10 * (1 + ((0.5 * level) - 0.5))) * consecutiveExplosion;
}
if (_local7 == 4) {
if (noOfFalls == 1) {
com.king.util.SoundManager.stop("GotSet");
com.king.util.SoundManager.stop("GotSetBig");
com.king.util.SoundManager.play("bombCreate", 90, false);
}
var _local5 = false;
var _local6 = 0;
while (_local6 < 4) {
if ((gameGridObj[_local8 + _local6][_local4] == activeJewel) && (_local5 == false)) {
activeJewel.bombOn();
_local5 = true;
}
if ((gameGridObj[_local8 + _local6][_local4] == switchJewel) && (_local5 == false)) {
switchJewel.bombOn();
_local5 = true;
}
_local6++;
}
if (_local5 == false) {
gameGridObj[_local8][_local4].bombOn();
}
var _local15 = (20 * (1 + ((0.5 * level) - 0.5))) * consecutiveExplosion;
}
if (_local7 >= 5) {
com.king.util.SoundManager.play("HyperGemCreation", 100, false);
var _local5 = false;
var _local6 = 0;
while (_local6 < 5) {
if ((gameGridObj[_local8 + _local6][_local4] == activeJewel) && (_local5 == false)) {
activeJewel.hyperOn();
_local5 = true;
}
if ((gameGridObj[_local8 + _local6][_local4] == switchJewel) && (_local5 == false)) {
switchJewel.hyperOn();
_local5 = true;
}
_local6++;
}
if (_local5 == false) {
gameGridObj[_local8][_local4].hyperOn();
}
var _local15 = (30 * (1 + ((0.5 * level) - 0.5))) * consecutiveExplosion;
}
if (_local14 == false) {
score = score + Number(_local15);
createScore(gameGridObj[_local8][_local4]._y + (((_local7 - 1) * 63) / 2), gameGridObj[_local8][_local4]._x, _local15, gameGridObj[_local8][_local4].jewelType);
_root.mcPre.mcBejeweled2.mcScorePod.txtScore.text = score;
}
}
}
if ((gameGridObj[_local8][_local4].explVert == true) && (gameGridObj[_local8][_local4].explHori == true)) {
com.king.util.SoundManager.stop("GotSet");
com.king.util.SoundManager.stop("GotSetBig");
com.king.util.SoundManager.play("GotSetBig", 90, false);
gameGridObj[_local8][_local4].bombOn();
}
_local4++;
}
_local8++;
}
_local8 = 0;
while (_local8 < 8) {
var _local4 = 0;
while (_local4 < 8) {
if (gameGridObj[_local8][_local4].hyper == true) {
gameGridObj[_local8][_local4].jewelType = 8;
gameGrid[_local8][_local4] = 8;
if (gameGridObj[_local8][_local4].bomb == true) {
noOfBombs--;
gameGridObj[_local8][_local4].bomb = false;
gameGridObj[_local8][_local4].mcJewelBling._visible = true;
gameGridObj[_local8][_local4].mcJewelBling2._visible = true;
}
}
_local4++;
}
_local8++;
}
if ((_local16 == 0) && (openUserEnd == false)) {
moveAllowed = true;
}
if (_local16 > 0) {
switch (noOfFalls) {
case 1 :
break;
case 2 :
com.king.util.SoundManager.play("combo2", 80, false);
break;
case 3 :
com.king.util.SoundManager.play("combo3", 80, false);
com.king.util.SoundManager.play("Good", 100, false);
break;
case 4 :
com.king.util.SoundManager.play("combo4", 80, false);
break;
case 5 :
com.king.util.SoundManager.play("combo5", 80, false);
com.king.util.SoundManager.play("Excellent", 100, false);
break;
case 7 :
com.king.util.SoundManager.play("combo7", 80, false);
com.king.util.SoundManager.play("Incredible", 100, false);
break;
default :
com.king.util.SoundManager.play("combo6", 80, false);
}
explodeJewel();
refillBoard();
activeJewel = undefined;
switchJewel = undefined;
} else if (_local16 == 0) {
if (activeJewel != undefined) {
trace("GEM MOVES BACK!");
com.king.util.SoundManager.play("Bad", 100, false);
jewelClicked(switchJewel);
activeJewel.deactivate();
}
noOfFalls = 0;
if ((score >= levelScoreCap) || (gameOver == true)) {
endLevel();
} else {
delayFrame(boardCheckForDead);
}
activeJewel = undefined;
switchJewel = undefined;
}
}
}
function explodeJewel() {
if (lightningSound) {
com.king.util.SoundManager.play("ElectroExplode", 100, false);
lightningSound = false;
}
var _local3 = 0;
while (_local3 < 8) {
var _local2 = 0;
while (_local2 < 8) {
if (((((gameGridObj[_local3][_local2].explVert == true) || (gameGridObj[_local3][_local2].explHori == true)) || (gameGridObj[_local3][_local2].explBomb == true)) && (gameGridObj[_local3][_local2].bomb == false)) && (gameGridObj[_local3][_local2].hyper == false)) {
if (gameGridObj[_local3][_local2].explode) {
var _local4 = attachMovie("Explosion", "explosion_" + explosionCounter, explosionDepth + explosionCounter);
_local4.init(gameGridObj[_local3][_local2]._y, gameGridObj[_local3][_local2]._x, gameGridObj[_local3][_local2].jewelType, _local4);
explosionCounter++;
}
gameGridObj[_local3][_local2].removeJewel();
noOfExplJewels++;
gameGrid[_local3][_local2] = 0;
} else if ((gameGridObj[_local3][_local2].bomb == true) || (gameGridObj[_local3][_local2].hyper == true)) {
gameGridObj[_local3][_local2].explVert = false;
gameGridObj[_local3][_local2].explHori = false;
gameGridObj[_local3][_local2].explBomb = false;
}
_local2++;
}
_local3++;
}
}
function refillBoard() {
var _local9 = 0;
var _local11 = new Array(true, true, true, true, true, true, true, true);
var _local10 = false;
var _local3 = 7;
while (_local3 >= 0) {
var _local2 = 7;
while (_local2 >= 0) {
if (gameGrid[_local3][_local2] == 0) {
var _local5 = _local3;
while (_local5 >= 0) {
if (gameGrid[_local5][_local2] != 0) {
gameGridObj[_local3][_local2] = gameGridObj[_local5][_local2];
gameGridObj[_local3][_local2].y = _local3;
gameGridObj[_local3][_local2].x = _local2;
gameGrid[_local5][_local2] = 0;
gameGrid[_local3][_local2] = gameGridObj[_local3][_local2].jewelType;
com.king.util.Delay.oneShot(gameGridObj[_local3][_local2], gameGridObj[_local3][_local2].fall, 100, "_y", gameGridObj[_local3][_local2]._y, gameGridObj[_local3][_local2]._y + (gameGridObj[_local3][_local2].jewelHeight * (_local3 - _local5)), 1, _local10, boardCheckForPairs, this);
_local11[_local2] = false;
_local10 = false;
_local5 = -1;
} else if (_local5 == 0) {
var _local4 = _local3;
while (_local4 >= 0) {
var _local8 = false;
if (_local4 == _local3) {
_local8 = true;
}
var _local6 = attachMovie("Jewel", "jewel_" + jewelCounter, jewelDepth + jewelCounter);
var _local7 = random.nextInt(noOfGems) + 1;
noOfRnd++;
_parent.txtRnd.text = noOfRnd;
_local6.init(_local4, _local2, _local7, _local9 + 1, 100, _local3 + 2, true, 0.5, false);
gameGridObj[_local4][_local2] = _local6;
gameGrid[_local4][_local2] = _local7;
jewelCounter++;
_local9++;
_local4--;
}
_local9 = 0;
}
_local5--;
}
}
_local2--;
}
_local3--;
}
}
function createScore(y, x, num, type) {
var _local2 = attachMovie("Score", "Score_" + scoreSignCounter, scoreDepth + scoreSignCounter);
_local2.init(y, x, num, _local2, type);
scoreMoving++;
scoreSignCounter++;
}
function boardCheckForDead() {
if (boardCheckForDeadRet()) {
com.king.util.SoundManager.play("NoMoreMoves", 100, false);
clearLevel();
_parent.showSign(_parent.signDeadBoard);
makeGameGrid();
}
}
function boardCheckForDeadRet() {
var _local5 = true;
var _local2;
hint = "";
var _local6 = getTimer();
var _local4 = 0;
while (_local4 < 8) {
var _local3 = 0;
while (_local3 < 8) {
if (_local3 < 7) {
_local2 = gameGrid[_local4][_local3];
gameGrid[_local4][_local3] = gameGrid[_local4][_local3 + 1];
gameGrid[_local4][_local3 + 1] = _local2;
if (confirmDeadBoard()) {
gameGrid[_local4][_local3 + 1] = gameGrid[_local4][_local3];
gameGrid[_local4][_local3] = _local2;
hint = gameGridObj[_local4][_local3];
_local5 = false;
_local4 = 8;
_local3 = 8;
} else {
gameGrid[_local4][_local3 + 1] = gameGrid[_local4][_local3];
gameGrid[_local4][_local3] = _local2;
}
}
if (_local4 < 7) {
_local2 = gameGrid[_local4][_local3];
gameGrid[_local4][_local3] = gameGrid[_local4 + 1][_local3];
gameGrid[_local4 + 1][_local3] = _local2;
if (confirmDeadBoard()) {
gameGrid[_local4 + 1][_local3] = gameGrid[_local4][_local3];
gameGrid[_local4][_local3] = _local2;
hint = gameGridObj[_local4][_local3];
_local5 = false;
_local4 = 8;
_local3 = 8;
} else {
gameGrid[_local4 + 1][_local3] = gameGrid[_local4][_local3];
gameGrid[_local4][_local3] = _local2;
}
}
_local3++;
}
_local4++;
}
if (noOfHyperCubes > 0) {
_local4 = 0;
while (_local4 < 8) {
var _local3 = 0;
while (_local3 < 8) {
if (gameGridObj[_local4][_local3].hyper == true) {
hint = gameGridObj[_local4][_local3];
}
_local3++;
}
_local4++;
}
_local5 = false;
}
if (_local5) {
return(true);
}
return(false);
}
function confirmDeadBoard() {
if (noOfHyperCubes > 0) {
return(true);
}
var _local3 = 0;
while (_local3 < 8) {
var _local2 = 0;
while (_local2 < 8) {
if (_local2 < 6) {
if ((gameGrid[_local3][_local2] == gameGrid[_local3][_local2 + 1]) && (gameGrid[_local3][_local2] == gameGrid[_local3][_local2 + 2])) {
return(true);
}
}
if (_local3 < 6) {
if ((gameGrid[_local3][_local2] == gameGrid[_local3 + 1][_local2]) && (gameGrid[_local3][_local2] == gameGrid[_local3 + 2][_local2])) {
return(true);
}
}
_local2++;
}
_local3++;
}
return(false);
}
function showHint() {
if (((hint != undefined) && (hint != "")) && (moveAllowed == true)) {
communicator.sendHint();
var _local3 = 50 * (1 + ((0.5 * level) - 0.5));
score = score - _local3;
score = Math.max(score, 0);
_root.mcPre.mcBejeweled2.mcScorePod.txtScore.text = score;
_parent.createHintArrow(hint);
}
}
function printGrid() {
var _local2 = 0;
while (_local2 < 8) {
trace(gameGrid[_local2]);
_local2++;
}
}
static var STATE_RUNNING = 0;
static var STATE_NOT_RUNNING = 1;
static var STATE_END_LEVEL = 2;
static var POINTS_PER_LEVEL = 5;
var gameGrid = new Array();
var gameGridObj = new Array();
var jewelDepth = 0;
var explosionDepth = 20000;
var scoreDepth = 40000;
var lightningDepth = 60000;
var jewelFireDepth = 80000;
var noOfRnd = 0;
var noOfExplJewels = 0;
var gameOver = false;
var noOfFalls = 0;
var noOfBombs = 0;
var noOfHyperCubes = 0;
var delayCounter = 0;
var frameDelay = false;
var lightningSound = false;
var DBT = 0;
}
Symbol 850 MovieClip [__Packages.com.king.util.Communicator] Frame 0
class com.king.util.Communicator
{
var levelDatas, randomSeed;
function Communicator () {
levelDatas = new Array();
}
function gameStarted() {
if (!hasSentGameStart) {
hasSentGameStart = true;
fscommand ("gameStart");
}
}
function gameQuit() {
if (!hasSentGameOver) {
hasSentGameOver = true;
fscommand ("gameQuit");
}
}
function gameEnd(score) {
if (!hasSentGameEnd) {
hasSentGameEnd = true;
fscommand ("gameEnd", score);
}
}
function sendLevelStart(lvl) {
if (_global.relaxGame == true) {
return(undefined);
}
fscommand ("playData", (CMD_START_LEVEL + ",") + lvl);
}
function sendMove(aY, aX, tY, tX, no, no2) {
if (_global.relaxGame == true) {
return(undefined);
}
fscommand ("playData", (((((((((((CMD_SEND_MOVE + ",") + aY) + " ") + aX) + " ") + tY) + " ") + tX) + " ") + no) + " ") + no2);
}
function sendHint() {
if (_global.relaxGame == true) {
return(undefined);
}
fscommand ("playData", (CMD_SEND_HINT + ",") + 1);
}
function parseGameData(gameData) {
var _local6 = new XML(_root.gameData);
_global.textMappings = new Object();
_global.userType = new Object();
var _local5 = _local6.childNodes[0].childNodes;
randomSeed = new Number(_local6.childNodes[0].attributes.randomseed).valueOf();
var _local7 = new String(_local6.childNodes[0].attributes.relaxMode).valueOf();
if (_local7 == "true") {
_global.relaxGame = true;
} else {
_global.relaxGame = false;
}
var _local4 = 0;
while (_local4 < _local5.length) {
_root.debugText.text = _root.debugText.text + ("\r" + _local5[_local4].nodeName);
if (_local5[_local4].nodeName == "text") {
_global.textMappings[_local5[_local4].attributes.id] = new String(_local5[_local4].firstChild.nodeValue);
}
if (_local5[_local4].nodeName == "level") {
levelDatas[_local5[_local4].attributes.id] = new String(_local5[_local4].firstChild.nodeValue);
}
if (_local5[_local4].nodeName == "userType") {
_global.userType[_local5[_local4].attributes.id] = new String(_local5[_local4].firstChild.nodeValue);
}
_local4++;
}
}
static var CMD_START_LEVEL = 231;
static var CMD_SEND_MOVE = 848;
static var CMD_SEND_HINT = 652;
var hasSentGameStart = false;
var hasSentGameEnd = false;
var hasSentGameOver = false;
}
Symbol 851 MovieClip [__Packages.com.king.bejeweled2.Bejeweled2] Frame 0
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.king) {
_global.com.king = new Object();
}
if (!_global.com.king.bejeweled2) {
_global.com.king.bejeweled2 = new Object();
}
if (!_global.com.king.bejeweled2.Bejeweled2) {
var _local1 = function () {
super();
trace("construct");
this.bgImage = 0;
this.bgArr[0] = this.mcBackGround.mcBG1;
this.bgArr[1] = this.mcBackGround.mcBG2;
this.bgArr[2] = this.mcBackGround.mcBG3;
this.bgArr[1]._visible = false;
this.bgArr[2]._visible = false;
this.communicator = new com.king.util.Communicator();
this.gamePlayTimer = 240000 /* 0x03A980 */;
this.noOfGems = 7;
this.frames = 0;
this.lastFps = 0;
this.level = 0;
this.sign = false;
this.delay = new com.king.util.Delay();
this.incer = 0;
this.levelScoreCap = 0;
this.mcNextLevel._visible = false;
this.mcSign._visible = false;
this.mcMenu.mcHint.onPress = function () {
_root.mcPre.mcBejeweled2.mcGame.showHint();
};
this.mcMenu.mcHintRollOver._visible = false;
this.mcMenu.mcSoundRollOver._visible = false;
this.mcMenu.mcQuitRollOver._visible = false;
this.mcMenu.mcHint.onRollOver = function () {
this._parent.mcHintRollOver._visible = true;
};
this.mcMenu.mcHint.onRollOut = function () {
this._parent.mcHintRollOver._visible = false;
};
this.mcMenu.mcHint.onDragOut = function () {
this._parent.mcHintRollOver._visible = false;
};
this.mcMenu.mcToggleSound.onRollOver = function () {
this._parent.mcSoundRollOver._visible = true;
};
this.mcMenu.mcToggleSound.onRollOut = function () {
this._parent.mcSoundRollOver._visible = false;
};
this.mcMenu.mcToggleSound.onDragOut = function () {
this._parent.mcSoundRollOver._visible = false;
};
this.mcMenu.mcEndGame.onRollOver = function () {
this._parent.mcQuitRollOver._visible = true;
};
this.mcMenu.mcEndGame.onRollOut = function () {
this._parent.mcQuitRollOver._visible = false;
};
this.mcMenu.mcEndGame.onDragOut = function () {
this._parent.mcQuitRollOver._visible = false;
};
this.mcFrame._visible = false;
this.mcTimer._visible = false;
this.mcTimer2._alpha = 0;
this.mcScorePod._visible = false;
this.mcMenu._visible = false;
this.mcGameOver._visible = false;
this.mcFireWork1._visible = false;
this.mcFireWork2._visible = false;
this.mcFireWork3._visible = false;
this.mcBackGround.mcBG1Mask._visible = false;
this.mcBackGround.mcBG2Mask._visible = false;
this.mcBackGround.mcBG3Mask._visible = false;
this.mcBlinker1._alpha = 0;
this.mcBlinker2._alpha = 0;
this.mcBlinker3._alpha = 0;
this.mcBlinker4._alpha = 0;
this.mcTimer._visible = false;
this.mcTimer2._visible = false;
this.gameState = com.king.bejeweled2.Bejeweled2.STATE_WAIT_FOR_GAMEDATA;
this.mcMenu.mcToggleSound.onPress = function () {
com.king.util.SoundManager.toggleSound();
if (_root.mcPre.mcBejeweled2.soundOn == true) {
_root.mcPre.mcBejeweled2.soundOn = false;
this.txtToggleSound.text = _global.textMappings.sound_on;
} else {
_root.mcPre.mcBejeweled2.soundOn = true;
this.txtToggleSound.text = _global.textMappings.sound_off;
}
};
this.mcMenu.mcEndGame.onPress = function () {
_root.mcPre.mcBejeweled2.mcGame.gameOver = true;
if (_root.mcPre.mcBejeweled2.mcGame.moveAllowed) {
_root.mcPre.mcBejeweled2.mcGame.endLevel();
}
};
this.mcGameOver.onPress = function () {
this._parent.timeLeft = 0;
};
};
_global.com.king.bejeweled2.Bejeweled2 = _local1;
//_global.com.king.bejeweled2.Bejeweled2 extends MovieClip
var _local2 = _local1.prototype;
_local2.onEnterFrame = function () {
this.fpsTimer = getTimer();
this.frames++;
if ((this.fpsTimer - this.lastFps) > 250) {
this.fps = (1000 / (this.fpsTimer - this.lastFps)) * this.frames;
this.txtFPS.text = Math.round(this.fps);
this.frames = 0;
this.lastFps = this.fpsTimer;
}
switch (this.gameState) {
case com.king.bejeweled2.Bejeweled2.STATE_WAIT_FOR_GAMEDATA :
if (com.king.bejeweled2.Bejeweled2.DEBUG_MODE) {
_root.gameData = com.king.bejeweled2.Bejeweled2.DEBUG_GAME_DATA;
}
if (_root.gameData != undefined) {
this.communicator.parseGameData(_root.gameData);
this.random = new com.king.util.Random(this.communicator.randomSeed);
this.signDeadBoard = _global.textMappings.no_more_moves;
this.mcGameOver.txtGameOver.text = _global.textMappings.game_over;
this.mcGameOver.txtScoreTitle.text = _global.textMappings.score;
this.txtOpenGameOver = _global.textMappings.open_game_over;
this.mcIntro.txtTitle.text = _global.textMappings.intro_title;
this.mcIntro.txtFrame_1.text = _global.textMappings.intro_text_1;
this.mcIntro.txtFrame_2.text = _global.textMappings.intro_text_2;
this.mcIntro.txtFrame_3.text = _global.textMappings.intro_text_3;
this.mcIntro.txtFrame_4.text = _global.textMappings.intro_text_4;
this.mcIntro.txtButton.text = _global.textMappings.start_game;
this.mcMenu.mcToggleSound.txtToggleSound.text = _global.textMappings.sound_off;
this.mcMenu.mcHint.txtHint.text = _global.textMappings.hint;
this.mcMenu.mcEndGame.txtEndGame.text = _global.textMappings.end_game;
this.showInfoScreen();
}
break;
case com.king.bejeweled2.Bejeweled2.STATE_SHOW_INFO_SCREEN :
this.now = getTimer() - this.startTimer;
this.timeLeft = this.timeLeft - (this.now - this.lastTime);
this.lastTime = this.now;
if (this.timeLeft < 0) {
this.timeLeft = 0;
}
if (this.timeLeft <= 0) {
this.mcFrame._visible = true;
this.mcTimer._visible = true;
this.mcScorePod._visible = true;
this.mcMenu._visible = true;
this.mcIntro._visible = false;
this.showSign(_global.textMappings.go);
com.king.util.SoundManager.play("Go", 100, false);
com.king.util.SoundManager.play("Loop", 25, true);
trace("communicator.gameStarted()");
this.communicator.gameStarted();
this.startGame();
}
break;
case com.king.bejeweled2.Bejeweled2.STATE_PLAY_GAME :
if (_global.relaxGame == false) {
var _local4 = ((537 * (this.gamePlayTimer - (getTimer() - this.gamePlayStartTimer))) / this.gamePlayTimer) - 537;
this.mcTimer.mcTimebar._x = _local4;
this.mcTimer2.mcTimebar._x = _local4;
if (this.mcTimer.mcTimebar._x <= -513) {
this.endAdder = this.endAdder + (_local4 - this.lastPosX);
this.mcTimer.mcTimebarLeftEnd._x = -12 + this.endAdder;
this.mcTimer2.mcTimebarLeftEnd._x = -12 + this.endAdder;
}
if ((this.gamePlayTimer - (getTimer() - this.gamePlayStartTimer)) < 20000) {
if (this.warnSound == false) {
com.king.util.SoundManager.play("warning", 100, true);
this.warnSound = true;
}
this.mcTimer2._alpha = this.mcTimer2._alpha + this.incer;
this.mcBlinker1._alpha = this.mcBlinker1._alpha + this.incer;
this.mcBlinker2._alpha = this.mcBlinker2._alpha + this.incer;
this.mcBlinker3._alpha = this.mcBlinker3._alpha + this.incer;
this.mcBlinker4._alpha = this.mcBlinker4._alpha + this.incer;
if (this.mcTimer2._alpha <= 0) {
this.incer = 25;
} else if (this.mcTimer2._alpha >= 100) {
this.incer = -25;
}
}
this.lastPosX = _local4;
if ((getTimer() - this.gamePlayStartTimer) > this.gamePlayTimer) {
if (this.mcGame.moveAllowed == true) {
this.mcGame.gameOver = true;
this.mcGame.endLevel();
} else {
this.mcGame.gameOver = true;
}
}
}
break;
case com.king.bejeweled2.Bejeweled2.STATE_BETWEEN_ROUNDS :
if ((((this.stepper < 40) && (this.firstPhase == false)) && (this.nextPhase == false)) && (this.thirdPhase == false)) {
this.mcMenu._x = this.mcMenu._x - 10;
this.mcScorePod._x = this.mcScorePod._x - 10;
this.mcFrame._x = this.mcFrame._x + 20;
this.mcTimer._x = this.mcTimer._x + 20;
this.stepper++;
if (this.stepper == 40) {
com.king.util.SoundManager.play("wshort", 75, false);
this.firstPhase = false;
this.nextPhase = true;
this.stepper = 1;
this.startTimer = getTimer();
this.timeLeft = 800;
this.lastTime = 0;
this.gamePlayStartTimer = this.gamePlayStartTimer + this.timeLeft;
this.lastImage = this.bgImage;
var _local5 = this.bgImage;
switch (_local5) {
case 0 :
this.bgImage++;
this.mcBackGround.mcBG2Mask._visible = true;
break;
case 1 :
this.bgImage++;
this.mcBackGround.mcBG3Mask._visible = true;
break;
case 2 :
this.bgImage = 0;
this.mcBackGround.mcBG1Mask._visible = true;
}
}
}
if (this.nextPhase) {
this.now = getTimer() - this.startTimer;
this.timeLeft = this.timeLeft - (this.now - this.lastTime);
this.lastTime = this.now;
this.mcBackGround.gotoAndStop(Math.round(25 - (25 * (this.timeLeft / 800))));
if (this.timeLeft <= 0) {
this.bgArr[this.lastImage]._visible = false;
this.bgArr[this.bgImage]._visible = true;
this.mcBackGround.mcBG1Mask._visible = false;
this.mcBackGround.mcBG2Mask._visible = false;
this.mcBackGround.mcBG3Mask._visible = false;
this.mcBackGround.gotoAndStop(1);
this.nextPhase = false;
this.thirdPhase = true;
this.stepper = 1;
}
}
if ((this.stepper < 40) && (this.thirdPhase == true)) {
this.mcMenu._x = this.mcMenu._x + 10;
this.mcScorePod._x = this.mcScorePod._x + 10;
this.mcFrame._x = this.mcFrame._x - 20;
this.mcTimer._x = this.mcTimer._x - 20;
this.stepper++;
if (this.stepper == 40) {
this.mcGame.mcMenu._x = 9;
this.mcGame.mcScorePod._x = 16;
this.mcGame.mcFrame._x = 192;
this.firstPhase = false;
this.nextPhase = false;
this.thirdPhase = false;
this.showSign(_global.textMappings.next_level);
this.startGame();
}
}
break;
case com.king.bejeweled2.Bejeweled2.STATE_GAME_OVER :
this.now = getTimer() - this.startTimer;
this.timeLeft = this.timeLeft - (this.now - this.lastTime);
this.lastTime = this.now;
this.mcGameOver.txtTimeLeft.text = _global.textMappings.game_ends.split("[0]").join("" + Math.round(this.timeLeft / 1000));
this.mcGameOver.txtScore.text = this.mcGame.score;
if (this.timeLeft > 0) {
break;
}
this.gamePreQuit();
break;
case com.king.bejeweled2.Bejeweled2.STATE_NOT_RUNNING :
}
if (this.sign) {
this.now = getTimer() - this.signStartTimer;
this.signTimeLeft = this.signTimeLeft - (this.now - this.signLastTime);
this.signLastTime = this.now;
if (this.signTimeLeft <= 0) {
this.mcSign._visible = false;
this.sign = false;
}
}
if (_global.relaxGame == true) {
this.mcTimer._visible = false;
this.mcTimer2._visible = false;
}
};
_local2.showInfoScreen = function () {
com.king.util.SoundManager.play("MusicIntro", 65, false);
this.startTimer = getTimer();
this.timeLeft = 15000;
this.lastTime = 0;
this.mcIntro.show(this.timeLeft);
this.gameState = com.king.bejeweled2.Bejeweled2.STATE_SHOW_INFO_SCREEN;
};
_local2.nextLevel = function () {
trace("nextLevel()");
this.nextLvlAnim = true;
this.stepper = 1;
com.king.util.SoundManager.play("LevelComplete", 100, false);
this.gameState = com.king.bejeweled2.Bejeweled2.STATE_BETWEEN_ROUNDS;
};
_local2.startGame = function () {
com.king.util.SoundManager.stop("MusicIntro");
if ((_global.userType[0] == 0) && (this.level > 0)) {
trace("no soup for you!");
this.gameState = com.king.bejeweled2.Bejeweled2.STATE_NOT_RUNNING;
this.level++;
this.levelScoreCap = this.levelScoreCap + (this.level * 500);
this.mcGame.openGameStart(this.random, this.noOfGems, this.level, this.levelScoreCap);
} else {
this.level++;
this.communicator.sendLevelStart(this.level);
this.gameState = com.king.bejeweled2.Bejeweled2.STATE_PLAY_GAME;
if (this.level == 1) {
this.gamePlayStartTimer = getTimer();
}
this.levelScoreCap = this.levelScoreCap + (this.level * 500);
this.mcGame.startGame(this.random, this.noOfGems, this.level, this.levelScoreCap);
}
};
_local2.gameOver = function () {
this.startTimer = getTimer();
this.timeLeft = 10000;
if ((_global.userType[0] == 0) && (this.level > 0)) {
this.timeLeft = 4000;
}
this.lastTime = 0;
com.king.util.SoundManager.stop("Loop");
com.king.util.SoundManager.stop("warning");
com.king.util.SoundManager.play("Outro", 100, false);
this.mcSign._visible = false;
this.mcGameOver._visible = true;
trace("communicator.gameEnd()");
this.communicator.gameEnd(this.mcGame.score);
this.gameState = com.king.bejeweled2.Bejeweled2.STATE_GAME_OVER;
};
_local2.gamePreQuit = function () {
this.gameState = com.king.bejeweled2.Bejeweled2.STATE_NOT_RUNNING;
com.king.util.Delay.oneShot(this, this.gameQuit, 1500);
};
_local2.gameQuit = function () {
com.king.util.SoundManager.stop("Outro");
trace("communicator.gameQuit()");
this.communicator.gameQuit();
};
_local2.showSign = function (signText) {
this.signTimeLeft = 2000;
this.signLastTime = 0;
this.signStartTimer = getTimer();
this.mcSign.txtSign.text = signText;
this.mcSign._visible = true;
this.sign = true;
};
_local2.createHintArrow = function (hint) {
if (this.hintOn != true) {
var _local3 = this.attachMovie("HintArrow", "hintarrow_" + this.hintArrowCounter, 10 + this.hintArrowCounter);
_local3.init((_local3._y = (this.mcGame._y + hint._y) - 20), (_local3._x = (this.mcGame._x + hint._x) + 31));
this.hintOn = true;
this.hintArrowCounter++;
}
};
_local1.STATE_WAIT_FOR_GAMEDATA = 0;
_local1.STATE_SHOW_INFO_SCREEN = 1;
_local1.STATE_PLAY_GAME = 2;
_local1.STATE_BETWEEN_ROUNDS = 3;
_local1.STATE_GAME_OVER = 4;
_local1.STATE_NOT_RUNNING = 6;
_local2.soundOn = true;
_local2.hintOn = false;
_local2.hintArrowCounter = 0;
_local2.bgArr = new Array();
_local2.endAdder = 0;
_local2.nextLvlAnim = false;
_local2.firstPhase = false;
_local2.nextPhase = false;
_local2.thirdPhase = false;
_local2.warnSound = false;
_local1.DEBUG_MODE = true;
_local1.DEBUG_GAME_DATA = "<gamedata randomseed=\"4600\" timelimit=\"660\" relaxMode=\"true\"><text id=\"game_start_count\">The game starts in [0] seconds!</text><text id=\"next_level\">Next level!</text><text id=\"game_over\">Game Over</text><text id=\"score\">score:</text><text id=\"game_ends\">Game ends in [0] seconds</text><text id=\"start_game\">Start Game</text><text id=\"intro_title\">How to play</text><text id=\"intro_text_1\">SWAP ADJACENT GEMS TO MAKE SETS OF 3</text><text id=\"intro_text_2\">CLEAR MULTIPLE SETS FOR EXTRA POINTS</text><text id=\"intro_text_3\">4 GEMS WILL CREATE A POWER GEM</text><text id=\"intro_text_4\">5 GEMS WILL CREATE A HYPER CUBE</text><text id=\"open_game_over\">Register to bring back the bacon and save Trogdor the Burninator!!</text><text id=\"hint\">Hint</text><text id=\"end_game\">End Game</text><text id=\"sound_off\">Sound Off</text><text id=\"sound_on\">Sound On</text><text id=\"no_more_moves\">No more moves!</text><text id=\"go\">Go</text><userType id=\"0\">2</userType></gamedata>";
(ASSetPropFlags(_global.com.king.bejeweled2.Bejeweled2.prototype, null, 1));// not popped
}
#endinitclip
Symbol 852 MovieClip [__Packages.com.king.util.Random] Frame 0
class com.king.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) / 16777216);
}
function next(bits) {
if (bits < 32) {
return(genrand_int32() & ((1 << bits) - 1));
}
return(genrand_int32());
}
function init_genrand(s) {
s = int(s);
var _local5 = getTimer();
lastSeed = s;
mta[0] = s;
var _local2 = s;
var _local3 = new com.king.util.Integer64();
mti = 1;
while (mti < N) {
_local3.init32((_local2 >>> 30) ^ _local2);
_local3.mulu32(1812433253);
_local2 = (mta[mti] = int(_local3.lsb + mti));
mti++;
}
var _local6 = getTimer();
}
function genrand_int32() {
var _local3 = 0;
if (mti >= N) {
if (mti == (N + 1)) {
init_genrand(5489);
}
var _local4 = getTimer();
var _local2 = 0;
_local2 = 0;
while (_local2 < (N - M)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + M] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
while (_local2 < (N - 1)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + (M - N)] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
_local3 = (mta[N - 1] & UPPER_MASK) | (mta[0] & LOWER_MASK);
mta[N - 1] = (mta[M - 1] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
mti = 0;
var _local5 = getTimer();
}
_local3 = mta[mti++];
_local3 = _local3 ^ (_local3 >>> 11);
_local3 = _local3 ^ ((_local3 << 7) & 2636928640);
_local3 = _local3 ^ ((_local3 << 15) & 4022730752);
_local3 = _local3 ^ (_local3 >>> 18);
return(_local3);
}
static var N = 624;
static var M = 397;
static var MATRIX_A = 2567483615;
static var UPPER_MASK = 2147483648;
static var LOWER_MASK = 2147483647;
static var mag01 = [0, 2567483615];
}
Symbol 853 MovieClip [__Packages.com.king.util.Integer64] Frame 0
class com.king.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 _local2 = 0;
while (_local2 < p.length) {
p[_local2] = v.p[_local2];
_local2++;
}
}
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] << SH)) | ((p[2] & 3) << 30));
}
function get msb() {
return((((p[2] >> 2) | ((p[3] << SH) >> 2)) | ((p[4] << (SH * 2)) >> 2)) & 2147483647);
}
function binaryShiftLeft(step) {
var _local2 = 0;
while (_local2 < step) {
shl();
_local2++;
}
}
function binaryShiftRight(step) {
var _local4 = (step / SH) >> 0;
var _local5 = step - (_local4 * SH);
var _local2 = p.length - 1;
while (_local2 > 0) {
var _local3 = 0;
while (_local3 < _local4) {
p[_local3] = p[_local3 + 1];
_local3++;
}
p[_local2--] = 0;
}
if (_local5 > 0) {
var _local3 = 0;
while (_local3 < _local5) {
shr();
_local3++;
}
}
}
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 _local4 = 0;
var _local3 = 1;
var _local2 = 0;
while ((_local3 < p.length) && (o.p[_local2] != 0)) {
_local3++;
}
_local2 = 0;
while (_local2 < _local3) {
_local4 = _local4 + (p[_local2] + o.p[_local2]);
p[_local2] = _local4 & MASK;
_local4 = _local4 >> SH;
_local2++;
}
}
function add32(num) {
var _local2 = 0;
var _local5 = num & MASK;
num = num >> SH;
var _local6 = num & MASK;
num = num >> SH;
var _local4 = num & 3;
_local2 = _local2 + (p[0] + _local5);
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[1] + _local6);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[2] + _local4);
p[2] = _local2 & MASK;
}
function mulu32(num) {
var _local3 = 0;
s[0] = num & MASK;
num = num >>> 15;
s[1] = num & MASK;
num = num >>> 15;
s[2] = num & 3;
var _local2 = 0;
while (_local2 < 3) {
var _local4 = s[_local2];
_local3 = _local4 * p[0];
r[_local2][0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[1]);
r[_local2][1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[2]);
r[_local2][2] = _local3 & 3;
_local2++;
}
_local3 = r[0][0];
p[0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (r[0][1] + r[1][0]);
p[1] = _local3 & MASK;
_local3 = _local3 >> SH;
_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 _local2 = 0;
var _local3 = 0;
while (_local3 < 5) {
var _local4 = o.p[_local3];
_local2 = _local4 * p[0];
r[_local3][0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[1]);
r[_local3][1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[2]);
r[_local3][2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[3]);
r[_local3][3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[4]);
r[_local3][4] = _local2 & MASK;
_local3++;
}
_local2 = r[0][0];
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (r[0][1] + r[1][0]);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (((r[0][3] + r[1][2]) + r[2][1]) + r[3][0]);
p[3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((((r[0][4] + r[1][3]) + r[2][2]) + r[3][1]) + r[4][0]);
p[4] = _local2 & 7;
}
function mul32(value) {
mul64(new com.king.util.Integer64(value));
}
function merge(a) {
var _local2 = 0;
while (_local2 < 3) {
p[_local2] = p[_local2] + (a & 32767);
a = a >>> 15;
_local2++;
}
return(a);
}
function shl() {
var _local5 = 0;
var _local4 = 0;
var _local2 = 0;
var _local3 = p.length;
while (_local2 < _local3) {
_local5 = (p[_local2] & 16384) >> 14;
p[_local2] = p[_local2] << 1;
p[_local2] = (p[_local2] | _local4) & 32767;
_local2++;
_local4 = _local5;
}
}
function shr() {
var _local4 = 0;
var _local3 = 0;
var _local2 = p.length - 1;
while (_local2 >= 0) {
_local4 = (p[_local2] & 1) << 14;
p[_local2] = p[_local2] >> 1;
p[_local2] = (p[_local2] | _local3) & 32767;
_local2--;
_local3 = _local4;
}
}
static var MASK = 32767;
static var SH = 15;
}
Symbol 854 MovieClip [__Packages.com.king.bejeweled2.Lightning] Frame 0
class com.king.bejeweled2.Lightning extends MovieClip
{
var _visible, startY, startX, destY, destX, Offset, _y, _x, _width, _rotation;
function Lightning () {
super();
_visible = false;
}
function init(sY, sX, dY, dX, os, count) {
startY = sY;
startX = sX;
destY = dY;
destX = dX;
Offset = os;
com.king.util.Delay.oneShot(this, startLightning, 50 * count);
}
function startLightning() {
com.king.util.SoundManager.play("ElectroPath", 80, false);
_visible = true;
if (startY > destY) {
_y = ((startY + destY) / 2) + Offset;
} else {
_y = ((startY + destY) / 2) + Offset;
}
if (startX > destX) {
_x = ((startX + destX) / 2) + Offset;
_width = startX - destX;
} else {
_x = ((startX + destX) / 2) + Offset;
_width = destX - startX;
}
if (startY != destY) {
var _local4 = startY - destY;
var _local3 = startX - destX;
var _local5 = _local4 / _local3;
var _local2 = 45 * _local5;
var _local6 = _local2;
if (_local2 < 0) {
_local2 * -1;
}
var _local9 = 45 / _local2;
var _local8 = (_local4 * _local4) + (_local3 * _local3);
var _local7 = Math.sqrt(_local8);
_width = _local7;
_rotation = _local6;
}
}
}