Frame 1
Frame 2
fscommand ("ictvcmd", "focus");
Array.prototype.getItemIndex = function (tItem) {
var _local3 = this.length;
var _local2 = 0;
while (_local2 < _local3) {
if (this[_local2] == tItem) {
return(_local2);
}
_local2++;
}
return(-1);
};
String.prototype.replace = function (replaceFrom, replaceTo, caseSensitive) {
var _local4 = this.split(replaceFrom);
tmp = _local4.join(replaceTo);
if (!caseSensitive) {
_local4 = tmp.split(replaceFrom.toLowerCase());
tmp = _local4.join(replaceTo);
_local4 = tmp.split(replaceFrom.toUpperCase());
tmp = _local4.join(replaceTo);
}
return(tmp);
};
this.goto = function (tStr) {
_global.gGameState = tStr;
this.gotoAndPlay(tStr);
};
this.setKeys = function () {
this.keyDetect = new Object();
this.keyDetect.onKeyDown = function () {
keyPressed(Key.isDown(38), Key.isDown(40), Key.isDown(37), Key.isDown(39), Key.isDown(32));
if (Selection.getFocus() == null) {
fscommand ("ictvcmd", "focus");
}
};
Key.addListener(this.keyDetect);
this.pKeyDelay = 0;
this.pKeyActive = true;
};
this.setKeyInt = function () {
};
this.clearKeyInt = function () {
this.pKeyActive = true;
clearInterval(this.pKeyDelay);
};
this.keyPressed = function (aUp, aDown, aLeft, aRight, aAction) {
if (this.pKeyActive) {
this.pKeyActive = false;
this.pKeyDelay = setInterval(this, "clearKeyInt", 100);
switch (gGameState) {
case "menu" :
if (aAction) {
this.soul_mc.clearMap();
this.goto("newGame");
}
break;
case "newGame" :
if (aAction) {
this.goto("game");
}
break;
case "game" :
this.grid_mc.selector_mc.moveSelect(aRight - aLeft, aDown - aUp);
if (!aAction) {
break;
}
this.grid_mc.selector_mc.pressSelect();
}
}
};
this.setKeys();
this.goto("menu");
Frame 9
stop();
Frame 15
stop();
Frame 21
this.init = function () {
this.grid_mc.loadGrid(5);
};
this.init();
stop();
Frame 22
this.gameover_mc.gotoAndStop("full");
Frame 36
stop();
Frame 44
this.goto("menu");
Symbol 22 MovieClip [mc.tile] Frame 1
this.init = function () {
this._x = this.pPos.x;
this._y = this.pPos.y;
if (this._parent._name == "grid_mc") {
var _local2 = Math.floor(this.pNum / 8);
var _local3 = this.pNum - (Math.floor(this.pNum / 8) * 8);
this._y = (-80 - ((8 - _local2) * 100)) - (_local3 * 15);
} else {
this._y = this._y - 160;
}
this.pSpeedX = 0;
this.pSpeedY = 0;
this.pLandTest = false;
this.pCenter = new Object();
this.pCenter.x = (this.pCenter.y = 0);
this.pAngle = 0;
this.pAngleStep = 0.628318530717959;
this.pDirection = 1;
this.pDepth = this.getDepth();
this.pState = 0;
this.gotoAndStop(this.pColour + 1);
};
this.scaleTile = function () {
this.pSpeedY = 0;
this.pState = 4;
this.addEnterFrame();
};
this.destroyTile = function () {
this.pSpeedX = 0;
this.pSpeedY = Math.random() * -8;
this.pState = 5;
this.addEnterFrame();
};
this.startTile = function () {
this._x = this.pPos.x;
this._y = this.pPos.y;
this._xscale = 100;
this._yscale = 100;
this._alpha = 100;
var _local2 = Math.floor(this.pNum / 8);
var _local3 = this.pNum - (Math.floor(this.pNum / 8) * 8);
this.pSpeedY = 15;
this.pLandTest = false;
this.pState = 1;
this.addEnterFrame();
this.gotoAndStop(this.pColour + 1);
this._parent.tileDropDone();
};
this.renewTile = function (n, c) {
this.pPos.y = -140 + (40 * Math.floor(n / 8));
this._x = pPos.x;
this._y = -250;
this.pNum = n;
this.pColour = c;
this.gotoAndStop(this.pColour + 1);
this.pSpeedY = 0;
this.pState = 1;
this.addEnterFrame();
};
this.hideTile = function () {
this._y = this.pPos.y - 160;
this.pState = 0;
this.removeEnterFrame();
};
this.placeTile = function (tY, tC) {
this._xscale = 100;
this._yscale = 100;
this._y = this.pPos.y - tY;
this.pColour = tC;
this.gotoAndStop(this.pColour + 1);
this.pSpeedY = 0;
this.pState = 1;
this.addEnterFrame();
};
this.dropTile = function (d, tId) {
this.pPos.y = this.pPos.y + (d * 40);
this.pNum = this.pNum + (d * 8);
this.pSpeedY = 0;
this.pState = 1;
this.addEnterFrame();
};
this.removeTile = function () {
this.pSpeedY = 0;
this.pState = 3;
this.addEnterFrame();
};
this.moveTile = function (aX, aY, aDir, aNewNum) {
this.pCenter.x = this.pPos.x - ((this.pPos.x - aX) / 2);
this.pCenter.y = this.pPos.y - ((this.pPos.y - aY) / 2);
this.pDirection = aDir;
switch (true) {
case this.pPos.x < aX :
this.pAngle = -3.14159265358979;
break;
case this.pPos.x > aX :
this.pAngle = 0;
break;
case this.pPos.y < aY :
this.pAngle = -1.5707963267949;
break;
case this.pPos.y > aY :
this.pAngle = (Math.PI/2);
}
this.pPos.x = aX;
this.pPos.y = aY;
this.pNum = aNewNum;
this.pState = 2;
this.addEnterFrame();
};
this.removeEnterFrame = function () {
delete this.onEnterFrame;
};
this.addEnterFrame = function () {
this.onEnterFrame = function () {
switch (this.pState) {
case 1 :
this.pSpeedY = Math.min(this.pSpeedY + 2, 50);
this._y = this._y + this.pSpeedY;
if (this._y >= this.pPos.y) {
this._y = this.pPos.y;
this.pState = 0;
this._parent.tileDropDone();
}
break;
case 2 :
this.pAngle = this.pAngle + (this.pAngleStep * this.pDirection);
this._x = this.pCenter.x + (Math.cos(this.pAngle) * 20);
this._y = this.pCenter.y + (Math.sin(this.pAngle) * 20);
if (Math.abs(this._x - this.pPos.x) < 1) {
if (Math.abs(this._y - this.pPos.y) < 1) {
this._x = this.pPos.x;
this._y = this.pPos.y;
this.pState = 0;
this._parent.tileSwapDone();
}
}
break;
case 3 :
this.pSpeedY = this.pSpeedY + 10;
this._xscale = this._xscale - this.pSpeedY;
this._yscale = this._yscale - this.pSpeedY;
if (this._xscale <= 0) {
this._xscale = 100;
this._yscale = 100;
this._y = -180;
this.pState = 0;
this._parent.tileClearDone();
}
break;
case 4 :
this.pSpeedY = this.pSpeedY + 5;
this._xscale = this._xscale - this.pSpeedY;
this._yscale = this._yscale - this.pSpeedY;
if (this._xscale <= 0) {
this._xscale = 0;
this._yscale = 0;
this.pState = 0;
this._parent.tileScaleDone();
}
break;
case 5 :
this.pSpeedY = Math.min(this.pSpeedY + 2, 50);
this._x = this._x + this.pSpeedX;
this._y = this._y + this.pSpeedY;
if (this._y < 180) {
break;
}
this.pState = 0;
this._parent.tileDestroyDone();
}
if (pState == 0) {
this.removeEnterFrame();
}
};
};
this.init();
stop();
Symbol 34 MovieClip [mc.selector] Frame 1
this.init = function () {
this.pPosX = (this.pPosY = 3);
this.pPosNum = (this.pPosY * 8) + this.pPosX;
this._x = 20 + ((this.pPosX - 4) * 40);
this._y = 20 + ((this.pPosY - 4) * 40);
this.pSelection = -1;
this.pActive = false;
this.pVisible = true;
this.hilite1_mc._visible = false;
this.hilite2_mc._visible = false;
this.hilite3_mc._visible = false;
this.hilite4_mc._visible = false;
this.hideSelector();
this.pSelectSnd = new Sound(this);
this.pSelectSnd.attachSound("snd.select");
};
this.setActive = function (tState) {
this.pActive = tState;
if (tState) {
this._x = 20 + ((this.pPosX - 4) * 40);
this._y = 20 + ((this.pPosY - 4) * 40);
}
};
this.hideSelector = function () {
this._y = -200;
};
this.removeSelector = function () {
this.removeMovieClip();
};
this.moveSelect = function (aX, aY) {
this.pPosX = this.pPosX + aX;
this.pPosY = this.pPosY + aY;
this.pPosX = Math.max(0, Math.min(7, this.pPosX));
this.pPosY = Math.max(0, Math.min(7, this.pPosY));
this._x = 20 + ((this.pPosX - 4) * 40);
this._y = 20 + ((this.pPosY - 4) * 40);
if (this.pSelection != -1) {
if (this.pSelection != ((this.pPosY * 8) + this.pPosX)) {
this._parent.swapBlocks(this.pSelection, (this.pPosY * 8) + this.pPosX);
this.pSelection = -1;
this.gotoAndStop("hilite");
this.hilite1_mc._visible = false;
this.hilite2_mc._visible = false;
this.hilite3_mc._visible = false;
this.hilite4_mc._visible = false;
}
}
};
this.pressSelect = function () {
if (this.pActive) {
if (this.pSelection == -1) {
this.pSelection = (this.pPosY * 8) + this.pPosX;
this.gotoAndStop("select");
this.hilite1_mc._visible = true;
this.hilite2_mc._visible = true;
this.hilite3_mc._visible = true;
this.hilite4_mc._visible = true;
this.pSelectSnd.start();
} else {
this.pSelection = -1;
this.gotoAndStop("hilite");
this.hilite1_mc._visible = false;
this.hilite2_mc._visible = false;
this.hilite3_mc._visible = false;
this.hilite4_mc._visible = false;
}
}
};
this.init();
Symbol 34 MovieClip [mc.selector] Frame 4
stop();
Symbol 48 MovieClip [mc.number] Frame 1
this.numbers_mc.stop();
this.init = function () {
if (this.pId == undefined) {
this.pTotal = 0;
} else if (this.pId != 1) {
this._x = -20;
} else {
this.pTotal = 0;
}
if (this.pId < 5) {
this.attachMovie("mc.number", "num_mc", 0);
this.num_mc.pId = this.pId + 1;
this.num_mc.pSnapping = this.pSnapping;
}
};
this.step = function (tStep) {
this.pTotal = this.pTotal + (tStep * 30);
this.setTo(this.pTotal);
};
this.setValue = function (t) {
this.pTotal = t * 30;
this.setTo(this.pTotal);
};
this.setTo = function (tY) {
var _local2 = tY % 300;
var _local4 = -(_local2 - (_local2 % 30));
this.numbers_mc._y = -(_local2 - (_local2 % 30));
this.num_mc.setTo(tY / 10);
};
this.init();
stop();
Symbol 106 MovieClip [__Packages.md5] Frame 0
class md5
{
function md5 (b64pad, chrsz) {
if (b64pad != undefined) {
this.b64pad = b64pad;
}
if (((chrsz != undefined) && (chrsz == 8)) || (chrsz == 16)) {
this.chrsz = chrsz;
}
}
function hash(s) {
return(hex_md5(s));
}
function hex_md5(s) {
return(binl2hex(core_md5(str2binl(s), s.length * chrsz)));
}
function b64_md5(s) {
return(binl2b64(core_md5(str2binl(s), s.length * chrsz)));
}
function str_md5(s) {
return(binl2str(core_md5(str2binl(s), s.length * chrsz)));
}
function hex_hmac_md5(key, data) {
return(binl2hex(core_hmac_md5(key, data)));
}
function b64_hmac_md5(key, data) {
return(binl2b64(core_hmac_md5(key, data)));
}
function str_hmac_md5(key, data) {
return(binl2str(core_hmac_md5(key, data)));
}
function md5_cmn(q, a, b, x, s, t) {
return(safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b));
}
function md5_ff(a, b, c, d, x, s, t) {
return(md5_cmn((b & c) | ((~b) & d), a, b, x, s, t));
}
function md5_gg(a, b, c, d, x, s, t) {
return(md5_cmn((b & d) | (c & (~d)), a, b, x, s, t));
}
function md5_hh(a, b, c, d, x, s, t) {
return(md5_cmn((b ^ c) ^ d, a, b, x, s, t));
}
function md5_ii(a, b, c, d, x, s, t) {
return(md5_cmn(c ^ (b | (~d)), a, b, x, s, t));
}
function core_md5(x, len) {
x[len >> 5] = x[len >> 5] | (128 << (len % 32));
x[(((len + 64) >>> 9) << 4) + 14] = len;
var _local5 = 1732584193 /* 0x67452301 */;
var _local4 = -271733879;
var _local3 = -1732584194;
var _local2 = 271733878 /* 0x10325476 */;
var _local6 = 0;
while (_local6 < x.length) {
var _local11 = _local5;
var _local10 = _local4;
var _local9 = _local3;
var _local8 = _local2;
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 0], 7, -680876936);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 1], 12, -389564586);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 2], 17, 606105819);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 3], 22, -1044525330);
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 4], 7, -176418897);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 5], 12, 1200080426);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 6], 17, -1473231341);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 7], 22, -45705983);
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 8], 7, 1770035416);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 9], 12, -1958414417);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 10], 17, -42063);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 11], 22, -1990404162);
_local5 = md5_ff(_local5, _local4, _local3, _local2, x[_local6 + 12], 7, 1804603682);
_local2 = md5_ff(_local2, _local5, _local4, _local3, x[_local6 + 13], 12, -40341101);
_local3 = md5_ff(_local3, _local2, _local5, _local4, x[_local6 + 14], 17, -1502002290);
_local4 = md5_ff(_local4, _local3, _local2, _local5, x[_local6 + 15], 22, 1236535329);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 1], 5, -165796510);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 6], 9, -1069501632);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 11], 14, 643717713);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 0], 20, -373897302);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 5], 5, -701558691);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 10], 9, 38016083);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 15], 14, -660478335);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 4], 20, -405537848);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 9], 5, 568446438);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 14], 9, -1019803690);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 3], 14, -187363961);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 8], 20, 1163531501);
_local5 = md5_gg(_local5, _local4, _local3, _local2, x[_local6 + 13], 5, -1444681467);
_local2 = md5_gg(_local2, _local5, _local4, _local3, x[_local6 + 2], 9, -51403784);
_local3 = md5_gg(_local3, _local2, _local5, _local4, x[_local6 + 7], 14, 1735328473);
_local4 = md5_gg(_local4, _local3, _local2, _local5, x[_local6 + 12], 20, -1926607734);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 5], 4, -378558);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 8], 11, -2022574463);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 11], 16, 1839030562);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 14], 23, -35309556);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 1], 4, -1530992060);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 4], 11, 1272893353);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 7], 16, -155497632);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 10], 23, -1094730640);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 13], 4, 681279174);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 0], 11, -358537222);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 3], 16, -722521979);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 6], 23, 76029189);
_local5 = md5_hh(_local5, _local4, _local3, _local2, x[_local6 + 9], 4, -640364487);
_local2 = md5_hh(_local2, _local5, _local4, _local3, x[_local6 + 12], 11, -421815835);
_local3 = md5_hh(_local3, _local2, _local5, _local4, x[_local6 + 15], 16, 530742520);
_local4 = md5_hh(_local4, _local3, _local2, _local5, x[_local6 + 2], 23, -995338651);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 0], 6, -198630844);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 7], 10, 1126891415);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 14], 15, -1416354905);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 5], 21, -57434055);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 12], 6, 1700485571);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 3], 10, -1894986606);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 10], 15, -1051523);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 1], 21, -2054922799);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 8], 6, 1873313359);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 15], 10, -30611744);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 6], 15, -1560198380);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 13], 21, 1309151649);
_local5 = md5_ii(_local5, _local4, _local3, _local2, x[_local6 + 4], 6, -145523070);
_local2 = md5_ii(_local2, _local5, _local4, _local3, x[_local6 + 11], 10, -1120210379);
_local3 = md5_ii(_local3, _local2, _local5, _local4, x[_local6 + 2], 15, 718787259);
_local4 = md5_ii(_local4, _local3, _local2, _local5, x[_local6 + 9], 21, -343485551);
_local5 = safe_add(_local5, _local11);
_local4 = safe_add(_local4, _local10);
_local3 = safe_add(_local3, _local9);
_local2 = safe_add(_local2, _local8);
_local6 = _local6 + 16;
}
return(Array(_local5, _local4, _local3, _local2));
}
function core_hmac_md5(key, data) {
var _local3 = new Array(str2binl(key));
if (_local3.length > 16) {
_local3 = core_md5(_local3, key.length * chrsz);
}
var _local4 = new Array(16);
var _local5 = new Array(16);
var _local2 = 0;
while (_local2 < 16) {
_local4[_local2] = _local3[_local2] ^ 909522486;
_local5[_local2] = _local3[_local2] ^ 1549556828;
_local2++;
}
var _local6 = new Array(core_md5(_local4.concat(str2binl(data)), 512 + (data.length * chrsz)));
return(core_md5(_local5.concat(_local6), 640));
}
function safe_add(x, y) {
var _local1 = new Number((x & 65535) + (y & 65535));
var _local2 = new Number(((x >> 16) + (y >> 16)) + (_local1 >> 16));
return((_local2 << 16) | (_local1 & 65535));
}
function bit_rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
function str2binl(str) {
var _local4 = new Array();
var _local5 = (1 << chrsz) - 1;
var _local2 = 0;
while (_local2 < (str.length * chrsz)) {
_local4[_local2 >> 5] = _local4[_local2 >> 5] | ((str.charCodeAt(_local2 / chrsz) & _local5) << (_local2 % 32));
_local2 = _local2 + chrsz;
}
return(_local4);
}
function binl2str(bin) {
var _local4 = new String("");
var _local5 = (1 << chrsz) - 1;
var _local2 = 0;
while (_local2 < (bin.length * 32)) {
_local4 = _local4 + String.fromCharCode((bin[_local2 >> 5] >>> (_local2 % 32)) & _local5);
_local2 = _local2 + chrsz;
}
return(_local4);
}
function binl2hex(binarray) {
var _local3 = "0123456789abcdef";
var _local4 = new String("");
var _local1 = 0;
while (_local1 < (binarray.length * 4)) {
_local4 = _local4 + (_local3.charAt((binarray[_local1 >> 2] >> (((_local1 % 4) * 8) + 4)) & 15) + _local3.charAt((binarray[_local1 >> 2] >> ((_local1 % 4) * 8)) & 15));
_local1++;
}
return(_local4);
}
function binl2b64(binarray) {
var _local7 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var _local5 = new String("");
var _local3 = 0;
while (_local3 < (binarray.length * 4)) {
var _local6 = ((((binarray[_local3 >> 2] >> (8 * (_local3 % 4))) & 255) << 16) | (((binarray[(_local3 + 1) >> 2] >> (8 * ((_local3 + 1) % 4))) & 255) << 8)) | ((binarray[(_local3 + 2) >> 2] >> (8 * ((_local3 + 2) % 4))) & 255);
var _local2 = 0;
while (_local2 < 4) {
if (((_local3 * 8) + (_local2 * 6)) > (binarray.length * 32)) {
_local5 = _local5 + b64pad;
} else {
_local5 = _local5 + _local7.charAt((_local6 >> (6 * (3 - _local2))) & 63);
}
_local2++;
}
_local3 = _local3 + 3;
}
return(_local5);
}
var b64pad = new String("");
var chrsz = new Number(8);
}
Symbol 107 MovieClip [__Packages.Base64] Frame 0
class Base64 extends Object
{
static var _CharsReverseLookup;
var _base64Str, _base64Count;
function Base64 () {
super();
}
static function Encode(str) {
var _local1 = new Base64();
return(_local1.encodeBase64(str));
}
static function Decode(str) {
var _local1 = new Base64();
return(_local1.decodeBase64(str));
}
static function StringReplaceAll(source, find, replacement) {
return(source.split(find).join(replacement));
}
static function InitReverseChars() {
_CharsReverseLookup = new Array();
var _local1 = 0;
while (_local1 < _Chars.length) {
_CharsReverseLookup[_Chars[_local1]] = _local1;
_local1++;
}
return(true);
}
static function UrlDecode(str) {
str = StringReplaceAll(str, "\\", " ");
str = unescape(str);
return(str);
}
static function UrlEncode(str) {
str = escape(str);
str = StringReplaceAll(str, "\\", "%2B");
str = StringReplaceAll(str, "%20", "+");
return(str);
}
function setBase64Str(str) {
_base64Str = str;
_base64Count = 0;
}
function readBase64() {
if (_base64Str == undefined) {
return(_EndOfInput);
}
if (_base64Count >= _base64Str.length) {
return(_EndOfInput);
}
var _local2 = _base64Str.charCodeAt(_base64Count) & 255;
_base64Count++;
return(_local2);
}
function encodeBase64(str) {
setBase64Str(str);
var _local3 = "";
var _local2 = new Array(3);
var _local5 = 0;
var _local4 = false;
while ((!_local4) && (((_local2[0] = readBase64())) != _EndOfInput)) {
_local2[1] = readBase64();
_local2[2] = readBase64();
_local3 = _local3 + _Chars[_local2[0] >> 2];
if (_local2[1] != _EndOfInput) {
_local3 = _local3 + _Chars[((_local2[0] << 4) & 48) | (_local2[1] >> 4)];
if (_local2[2] != _EndOfInput) {
_local3 = _local3 + _Chars[((_local2[1] << 2) & 60) | (_local2[2] >> 6)];
_local3 = _local3 + _Chars[_local2[2] & 63];
} else {
_local3 = _local3 + _Chars[(_local2[1] << 2) & 60];
_local3 = _local3 + "=";
_local4 = true;
}
} else {
_local3 = _local3 + _Chars[(_local2[0] << 4) & 48];
_local3 = _local3 + "=";
_local3 = _local3 + "=";
_local4 = true;
}
_local5 = _local5 + 4;
if (_local5 >= 76) {
_local3 = _local3 + newline;
_local5 = 0;
}
}
return(_local3);
}
function readReverseBase64() {
if (_base64Str == undefined) {
return(_EndOfInput);
}
while (true) {
if (_base64Count >= _base64Str.length) {
return(_EndOfInput);
}
var _local2 = _base64Str.charAt(_base64Count);
_base64Count++;
if (_CharsReverseLookup[_local2]) {
return(_CharsReverseLookup[_local2]);
}
if (_local2 == "A") {
return(0);
}
}
}
function ntos(n) {
var _local1 = n.toString(16);
if (_local1.length == 1) {
_local1 = "0" + _local1;
}
_local1 = "%" + _local1;
return(unescape(_local1));
}
function decodeBase64(str) {
setBase64Str(str);
var _local3 = "";
var _local2 = new Array(4);
var _local4 = false;
while (((!_local4) && (((_local2[0] = readReverseBase64())) != _EndOfInput)) && (((_local2[1] = readReverseBase64())) != _EndOfInput)) {
_local2[2] = readReverseBase64();
_local2[3] = readReverseBase64();
_local3 = _local3 + ntos(((_local2[0] << 2) & 255) | (_local2[1] >> 4));
if (_local2[2] != _EndOfInput) {
_local3 = _local3 + ntos(((_local2[1] << 4) & 255) | (_local2[2] >> 2));
if (_local2[3] != _EndOfInput) {
_local3 = _local3 + ntos(((_local2[2] << 6) & 255) | _local2[3]);
} else {
_local4 = true;
}
} else {
_local4 = true;
}
}
return(_local3);
}
function toHex(n) {
var _local4 = "";
var _local3 = true;
var _local1 = 32;
while (_local1 > 0) {
_local1 = _local1 - 4;
var _local2 = (n >> _local1) & 15;
if ((!_local3) || (_local2 != 0)) {
_local3 = false;
_local4 = _local4 + _Digits[_local2];
}
}
return(((_local4 == "") ? "0" : (_local4)));
}
function pad(str, len, pad) {
var _local2 = str;
var _local1 = str.length;
while (_local1 < len) {
_local2 = pad + _local2;
_local1++;
}
return(_local2);
}
function encodeHex(str) {
var _local4 = "";
var _local2 = 0;
while (_local2 < str.length) {
_local4 = _local4 + pad(toHex(str.charCodeAt(_local2) & 255), 2, "0");
_local2++;
}
return(_local4);
}
function decodeHex(str) {
var _local5 = "";
var _local3 = "";
var _local2 = 0;
while (_local2 < str.length) {
_local3 = _local3 + str.charAt(_local2);
if (_local3.length == 2) {
_local5 = _local5 + ntos(parseInt("0x" + _local3));
_local3 = "";
}
_local2++;
}
return(_local5);
}
static var _EndOfInput = -1;
static var _Chars = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/");
static var _CharsReverseLookupInited = InitReverseChars();
static var _Digits = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
}
Symbol 72 Button
on (release) {
this.goto("newGame");
}
Symbol 79 MovieClip Frame 2
this.init = function () {
this.attachMovie("mc.number", "nums_mc", 1);
this.nums_mc.pId = 1;
this.nums_mc.pSnapping = true;
this.nums_mc._x = 125;
this.nums_mc._y = 18;
this.nums_mc._xscale = 75;
this.nums_mc._yscale = 75;
this.pScore = 0;
this.pBonus = 0;
this.pLevel = 0;
};
this.getScore = function () {
return(this.pScore);
};
this.updateScore = function (t) {
this.pScore = this.pScore + ((t * 5) * this.pBonus);
this.nums_mc.setValue(this.pScore);
};
this.updateBonus = function (t) {
this.pBonus++;
this.bonus_mc.setValue(this.pBonus);
};
this.clearBonus = function (t) {
this.pBonus = 0;
this.bonus_mc.setValue(this.pBonus);
};
this.updateLevel = function () {
this.pLevel++;
if (this.pLevel >= 9) {
this.pLevel = 9;
}
this.level_mc.setValue(this.pLevel);
};
this.init();
this.updateLevel();
Symbol 79 MovieClip Frame 5
this.stop();
Symbol 88 MovieClip Frame 1
this.timerMask_mc._yscale = 0;
this.init = function () {
if (this.pPause == undefined) {
this.pPause = true;
this.pSpeed = 0.05;
this.pTime = 100;
this.pStep = 100;
trace("speed2 = " + this.pSpeed);
}
};
this.increaseSpeed = function () {
this.pSpeed = this.pSpeed + 0.02;
trace("speed = " + this.pSpeed);
};
this.addTimer = function (t) {
this.pTime = this.pTime + (t * 1.5);
this.pStep = this.pTime;
this.drawTimer();
};
this.resetTimer = function () {
this.pPause = true;
this.pStep = 100;
this.pTime = 100;
};
this.pauseTimer = function () {
delete onEnterFrame;
this.pPause = true;
};
this.resumeTimer = function () {
this.onEnterFrame = animate;
this.pPause = false;
};
this.fire = function () {
this.pauseTimer();
this._parent.grid_mc.gameOver();
this._parent.grid_mc.selector_mc.removeSelector();
};
this.drawTimer = function () {
if (this.pTime > 100) {
this.pTime = 100;
} else if (this.pTime < 0) {
this.pTime = 0;
this.fire();
}
if (this.pTime <= this.pStep) {
this.pStep = this.pStep - 2;
this.timerMask_mc._yscale = 100 - this.pTime;
}
};
this.animate = function () {
this.pTime = this.pTime - this.pSpeed;
this.drawTimer();
};
this.init();
stop();
Symbol 88 MovieClip Frame 14
this.fire();
this.gotoAndStop(1);
Symbol 91 MovieClip Frame 2
function SmallGrid(aRange) {
this.init();
}
SmallGrid.prototype.init = function () {
this.pData = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0);
};
SmallGrid.prototype.reorder = function () {
x = 0;
while (x < 3) {
var _local3 = 0;
y = 0;
while (y < 3) {
var _local2 = x + (y * 3);
if (this.pData[_local2] == 0) {
_local3++;
} else if (_local3 > 0) {
this.pData[_local2 - (_local3 * 3)] = this.pData[_local2] + 0;
this.pData[_local2] = 0;
}
y++;
}
x++;
}
};
SmallGrid.prototype.clearGrid = function () {
var _local2 = 0;
while (_local2 < 9) {
this.pData[_local2] = 0;
_local2++;
}
};
SmallGrid.prototype.checkGrid = function () {
var _local5;
var _local4;
var _local3;
var _local2;
var _local6 = new Array();
_local5 = 0;
while (_local5 < 9) {
_local4 = _local5 - Math.floor(_local5 / 3);
_local3 = _local5 % 3;
_local2 = this.getCellColour(_local4);
if (_local2 != 0) {
if ((this.getCellColour(_local4 + 1) == _local2) && (this.getCellColour(_local4 + 2) == _local2)) {
_local6.push(_local4, _local4 + 1, _local4 + 2);
}
}
_local2 = this.getCellColour(_local3);
if (_local2 != 0) {
if ((this.getCellColour(_local3 + 3) == _local2) && (this.getCellColour(_local3 + 6) == _local2)) {
_local6.push(_local3, _local3 + 3, _local3 + 6);
}
}
_local5 = _local5 + 4;
}
return(_local6);
};
SmallGrid.prototype.removeBlocks = function () {
var _local9 = new Array([], []);
var _local10 = this.pData.slice();
var _local3 = this.pColours.slice();
var _local5;
var _local2;
var _local8;
var _local7 = 6;
while (_local7 < 9) {
_local5 = 0;
_local2 = _local7 + 0;
_local8 = 0;
while (_local2 >= 0) {
if (_local10[_local2] == 0) {
if (_local3.length == 0) {
_local3 = this.pColours.slice();
} else {
var _local4 = _local3[Math.round(Math.random() * (_local3.length - 1))];
_local3.splice(_local3.getItemIndex(_local4), 1);
}
var _local6 = (_local7 - 6) + (_local8 * 3);
_local9[1].push(new Array(_local2, _local6, _local4));
this.pData[_local6] = _local4;
_local8++;
_local5++;
} else if (_local5 > 0) {
_local9[0].push(new Array(_local2, _local5));
this.pData[_local2 + (_local5 * 3)] = _local10[_local2];
}
_local2 = _local2 - 3;
}
_local7++;
}
return(_local9);
};
SmallGrid.prototype.checkBlocks = function (tCellNum) {
var _local12;
var _local11;
var _local6;
var _local14;
var _local16;
var _local15;
var _local17;
var _local3;
var _local7;
var _local8;
var _local10;
var _local9;
_local12 = new Array();
_local11 = new Array();
_local6 = this.getCellColour(tCellNum);
_local14 = Math.floor(tCellNum / 3);
_local16 = 2 - _local14;
_local15 = tCellNum - (Math.floor(tCellNum / 3) * 3);
_local17 = 2 - _local15;
_local7 = 1;
while (_local7 <= _local14) {
_local3 = tCellNum - (_local7 * 3);
if (this.getCellColour(_local3) == _local6) {
_local11.push(_local3);
} else {
break;
}
_local7++;
}
_local8 = 1;
while (_local8 <= _local16) {
_local3 = tCellNum + (_local8 * 3);
if (this.getCellColour(_local3) == _local6) {
_local11.push(_local3);
} else {
break;
}
_local8++;
}
_local10 = 1;
while (_local10 <= _local15) {
_local3 = tCellNum - _local10;
if (this.getCellColour(_local3) == _local6) {
_local12.push(_local3);
} else {
break;
}
_local10++;
}
_local9 = 1;
while (_local9 <= _local17) {
_local3 = tCellNum + _local9;
if (this.getCellColour(_local3) == _local6) {
_local12.push(_local3);
} else {
break;
}
_local9++;
}
var _local13 = new Array();
_local13.push(tCellNum);
if (_local12.length >= 2) {
_local13 = _local13.concat(_local12);
_parent.scores_mc.updateBonus();
_parent.scores_mc.updateScore(_local12.length + 1);
_parent.fuse_mc.addFuse(_local12.length + 1);
updateBlockCount();
}
if (_local11.length >= 2) {
_local13 = _local13.concat(_local11);
_parent.scores_mc.updateBonus();
_parent.scores_mc.updateScore(_local11.length + 1);
_parent.fuse_mc.addFuse(_local11.length + 1);
updateBlockCount();
}
if (_local13.length > 1) {
var _local18 = _local13.length;
var _local4 = 0;
while (_local4 < _local18) {
this.pData[_local13[_local4]] = 0;
_local4++;
}
}
return(_local13);
};
SmallGrid.prototype.swapBlocks = function (tCellID1, tCellID2) {
var _local3 = this.getCellColour(tCellID1);
var _local2 = this.getCellColour(tCellID2);
this.pData[tCellID1] = _local2;
this.pData[tCellID2] = _local3;
};
SmallGrid.prototype.fillGrid = function () {
var _local3;
var _local5;
var _local6;
var _local4;
var _local2 = 0;
while (_local2 < 9) {
_local3 = this.pColours.slice();
if (Math.round(_local2 % 3) > 1) {
_local6 = this.getCellColour(_local2 - 1);
if ((_local6 - this.getCellColour(_local2 - 2)) == 0) {
_local4 = _local3.getItemIndex(_local6);
_local3.splice(_local4, 1);
}
}
if (Math.floor(_local2 / 3) > 1) {
_local5 = this.getCellColour(_local2 - 3);
if ((_local5 - this.getCellColour(_local2 - 6)) == 0) {
_local4 = _local3.getItemIndex(_local5);
_local3.splice(_local4, 1);
}
}
this.pData[_local2] = _local3[Math.round(Math.random() * (_local3.length - 1))];
_local2++;
}
};
SmallGrid.prototype.getCellColour = function (aNum) {
var _local2 = this.pData[aNum];
return(_local2);
};
SmallGrid.prototype.setCellColour = function (aId, aColour) {
this.pData[aId] = aColour + 0;
};
SmallGrid.prototype.printGrid = function () {
var _local3 = "";
var _local4 = 0;
while (_local4 < 3) {
_local3 = "";
var _local2 = 0;
while (_local2 < 3) {
_local3 = _local3 + this.getCellColour((_local4 * 3) + _local2);
_local2++;
}
trace(_local3);
_local4++;
}
trace("");
};
this.init = function () {
this.pGrid = new SmallGrid();
this.pBlockCount = 0;
this.pSpaces = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0);
this.pTileLocs = new Array(9);
this.pTileCheck = 0;
this.pClearedTiles = new Array();
this.setMask(this.soulMask_mc);
var _local3;
var _local2 = 0;
while (_local2 < 9) {
_local3 = new Object();
_local3.pNum = _local2;
_local3.pPos = new Object();
_local3.pPos.x = -40 + (40 * (_local2 % 3));
_local3.pPos.y = 40 - (40 * Math.floor(_local2 / 3));
_local3.pColour = _local2 + 1;
this.attachMovie("mc.tile", ("t" + _local2) + "_mc", _local2, _local3);
this.pTileLocs[_local2] = ("t" + _local2) + "_mc";
_local2++;
}
};
this.clearMap = function () {
var _local2 = 0;
while (_local2 < 9) {
this[this.pTileLocs[_local2]].hideTile();
this.pSpaces[_local2] = 0;
_local2++;
}
this.pBlockCount = 0;
this.pGrid.clearGrid();
};
this.addTile = function (tTileC) {
if (this.pBlockCount < 9) {
this.pBlockCount++;
var _local2 = this.pSpaces.getItemIndex(0);
this[this.pTileLocs[_local2]].placeTile(140, tTileC);
this.pSpaces[_local2] = 1;
this.pGrid.setCellColour(_local2, tTileC);
this.pTileCheck++;
}
};
this.tileScaleDone = function () {
if ((--this.pTileCheck) == 0) {
var _local8 = this.pClearedTiles.length / 3;
var _local6 = 0;
while (_local6 < _local8) {
var _local7 = this.pClearedTiles[_local6 * 3];
if (_local7 < 6) {
if (_local7 == (this.pClearedTiles[(_local6 * 3) + 1] - 1)) {
var _local4 = 0;
while (_local4 < 3) {
var _local5 = ((_local6 * 3) + _local4) % 3;
var _local3 = 0;
var _local2 = _local5;
while (_local2 < (_local5 + 7)) {
if (this.pSpaces[_local2] == 0) {
_local3++;
} else if (_local3 > 0) {
this[this.pTileLocs[_local2]].hideTile();
this[this.pTileLocs[_local2 - (_local3 * 3)]].placeTile(40, this.pGrid.getCellColour(_local2));
this.pSpaces[_local2] = 0;
this.pSpaces[_local2 - (_local3 * 3)] = 1;
this.pTileCheck++;
}
_local2 = _local2 + 3;
}
_local4++;
}
this.pGrid.reorder();
}
}
_local6++;
}
}
};
this.tileDropDone = function () {
if ((--this.pTileCheck) == 0) {
var _local3 = this.pGrid.checkGrid();
var _local4 = _local3.length;
if (_local4 > 0) {
this.pClearedTiles.splice(0);
var _local2 = 0;
while (_local2 < _local4) {
this[this.pTileLocs[_local3[_local2]]].scaleTile();
this.pGrid.setCellColour(_local3[_local2], 0);
this.pSpaces[_local3[_local2]] = 0;
this.pBlockCount--;
this.pClearedTiles.push(_local3[_local2]);
this.pTileCheck++;
_local2++;
}
if (this._parent._currentframe > 16) {
this._parent.scores_mc.updateScore(100);
}
}
}
};
this.init();
stop();
Symbol 94 MovieClip Frame 53
this._parent.demoSoul_mc.addTile(4);
Symbol 97 MovieClip Frame 1
stop();
Symbol 97 MovieClip Frame 25
this._parent.gotoAndPlay("exit");
Symbol 100 MovieClip Frame 2
function GameGrid(aRange) {
this.init(aRange);
}
GameGrid.prototype.init = function (aRange) {
this.pData = new Array(64);
};
GameGrid.prototype.setRange = function (aRange) {
this.pColours = [1, 2, 3, 4, 5, 6, 7, 8].slice(0, aRange);
this.fillGrid();
};
GameGrid.prototype.checkGrid = function () {
var _local4;
var _local3;
var _local11;
var _local12;
var _local5;
var _local9;
var _local10;
var _local6 = new Array();
_local12 = 0;
_local11 = _local12;
_local3 = _local11;
_local4 = _local3;
_local5 = 0;
while (_local5 < 64) {
_local9 = ((_local5 < 63) ? ((_local5 * 8) % 63) : (_local5));
_local10 = this.getCellColour(_local9);
if (_local10 == _local12) {
_local3++;
} else {
_local12 = _local10;
if (_local3 > 2) {
var _local7 = 1;
while (_local7 <= _local3) {
_local6.push(_local9 - (_local7 * 8));
_local7++;
}
_parent.scores_mc.updateBonus();
_parent.scores_mc.updateScore(_local3);
_parent.pirate_mc.parrot_mc.playCombo();
_parent.timer_mc.addTimer(_local3);
updateBlockCount();
}
_local3 = 1;
}
if (_local9 > 55) {
if (_local3 > 2) {
var _local7 = 0;
while (_local7 < _local3) {
_local6.push(_local9 - (_local7 * 8));
_local7++;
}
_parent.scores_mc.updateBonus();
_parent.scores_mc.updateScore(_local3);
_parent.pirate_mc.parrot_mc.playCombo();
_parent.timer_mc.addTimer(_local3);
updateBlockCount();
}
_local3 = 0;
}
_local10 = this.getCellColour(_local5);
if (_local10 == _local11) {
_local4++;
} else {
_local11 = _local10;
if (_local4 > 2) {
var _local7 = 1;
while (_local7 <= _local4) {
_local6.push(_local5 - _local7);
_local7++;
}
_parent.scores_mc.updateBonus();
_parent.scores_mc.updateScore(_local4);
_parent.pirate_mc.parrot_mc.playCombo();
_parent.timer_mc.addTimer(_local4);
updateBlockCount();
}
_local4 = 1;
}
if (((_local5 + 1) % 8) == 0) {
if (_local4 > 2) {
var _local7 = 0;
while (_local7 < _local4) {
_local6.push(_local5 - _local7);
_local7++;
}
_parent.scores_mc.updateBonus();
_parent.scores_mc.updateScore(_local4);
_parent.pirate_mc.parrot_mc.playCombo();
_parent.timer_mc.addTimer(_local4);
updateBlockCount();
}
_local4 = 0;
}
_local5++;
}
if (_local6.length > 1) {
var _local13 = _local6.length;
var _local8 = 0;
while (_local8 < _local13) {
if (this.getCellColour(_local6[_local8]) == 0) {
_local6.splice(_local8, 1);
_local13--;
_local8--;
} else {
this.pData[_local6[_local8]] = 0;
}
_local8++;
}
}
return(_local6);
};
GameGrid.prototype.removeBlocks = function () {
var _local9 = new Array([], []);
var _local10 = this.pData.slice();
var _local3 = this.pColours.slice();
var _local5;
var _local2;
var _local8;
var _local7 = 56;
while (_local7 < 64) {
_local5 = 0;
_local2 = _local7 + 0;
_local8 = 0;
while (_local2 >= 0) {
if (_local10[_local2] == 0) {
if (_local3.length == 0) {
_local3 = this.pColours.slice();
} else {
var _local4 = _local3[Math.round(Math.random() * (_local3.length - 1))];
_local3.splice(_local3.getItemIndex(_local4), 1);
}
var _local6 = (_local7 - 56) + (_local8 * 8);
_local9[1].push(new Array(_local2, _local6, _local4));
this.pData[_local6] = _local4;
_local8++;
_local5++;
} else if (_local5 > 0) {
_local9[0].push(new Array(_local2, _local5));
this.pData[_local2 + (_local5 * 8)] = _local10[_local2];
}
_local2 = _local2 - 8;
}
_local7++;
}
return(_local9);
};
GameGrid.prototype.checkBlocks = function (tCellNum) {
var _local12;
var _local11;
var _local6;
var _local14;
var _local16;
var _local15;
var _local17;
var _local3;
var _local7;
var _local8;
var _local10;
var _local9;
_local12 = new Array();
_local11 = new Array();
_local6 = this.getCellColour(tCellNum);
_local14 = Math.floor(tCellNum / 8);
_local16 = 7 - _local14;
_local15 = tCellNum - (Math.floor(tCellNum / 8) * 8);
_local17 = 7 - _local15;
_local7 = 1;
while (_local7 <= _local14) {
_local3 = tCellNum - (_local7 * 8);
if (this.getCellColour(_local3) == _local6) {
_local11.push(_local3);
} else {
break;
}
_local7++;
}
_local8 = 1;
while (_local8 <= _local16) {
_local3 = tCellNum + (_local8 * 8);
if (this.getCellColour(_local3) == _local6) {
_local11.push(_local3);
} else {
break;
}
_local8++;
}
_local10 = 1;
while (_local10 <= _local15) {
_local3 = tCellNum - _local10;
if (this.getCellColour(_local3) == _local6) {
_local12.push(_local3);
} else {
break;
}
_local10++;
}
_local9 = 1;
while (_local9 <= _local17) {
_local3 = tCellNum + _local9;
if (this.getCellColour(_local3) == _local6) {
_local12.push(_local3);
} else {
break;
}
_local9++;
}
var _local13 = new Array();
_local13.push(tCellNum);
if (_local12.length >= 2) {
_local13 = _local13.concat(_local12);
_parent.scores_mc.updateBonus();
_parent.scores_mc.updateScore(_local12.length + 1);
_parent.timer_mc.addTimer(_local12.length + 1);
updateBlockCount();
}
if (_local11.length >= 2) {
_local13 = _local13.concat(_local11);
_parent.scores_mc.updateBonus();
_parent.scores_mc.updateScore(_local11.length + 1);
_parent.timer_mc.addTimer(_local11.length + 1);
updateBlockCount();
}
if (_local13.length > 1) {
_parent.soul_mc.addTile(_local6);
var _local18 = _local13.length;
var _local4 = 0;
while (_local4 < _local18) {
this.pData[_local13[_local4]] = 0;
_local4++;
}
}
return(_local13);
};
GameGrid.prototype.swapBlocks = function (tCellID1, tCellID2) {
var _local3 = this.getCellColour(tCellID1);
var _local2 = this.getCellColour(tCellID2);
this.pData[tCellID1] = _local2;
this.pData[tCellID2] = _local3;
};
GameGrid.prototype.fillGrid = function () {
var _local3;
var _local5;
var _local6;
var _local4;
var _local2 = 0;
while (_local2 < 64) {
_local3 = this.pColours.slice();
if (Math.round(_local2 % 8) > 1) {
_local6 = this.getCellColour(_local2 - 1);
if ((_local6 - this.getCellColour(_local2 - 2)) == 0) {
_local4 = _local3.getItemIndex(_local6);
_local3.splice(_local4, 1);
}
}
if (Math.floor(_local2 / 8) > 1) {
_local5 = this.getCellColour(_local2 - 8);
if ((_local5 - this.getCellColour(_local2 - 16)) == 0) {
_local4 = _local3.getItemIndex(_local5);
_local3.splice(_local4, 1);
}
}
this.pData[_local2] = _local3[Math.round(Math.random() * (_local3.length - 1))];
_local2++;
}
};
GameGrid.prototype.getCellColour = function (aNum) {
var _local2 = this.pData[aNum];
return(_local2);
};
GameGrid.prototype.printGrid = function () {
var _local3 = "";
var _local4 = 0;
while (_local4 < 8) {
_local3 = "";
var _local2 = 0;
while (_local2 < 8) {
_local3 = _local3 + this.getCellColour((_local4 * 8) + _local2);
_local2++;
}
trace(_local3);
_local4++;
}
trace("");
};
this.init = function () {
this.pBlockCount = 0;
this.pLevelEnd = false;
this.pRange = 0;
this.pLevel = 1;
this.attachMovie("mc.selector", "selector_mc", 10000);
this.pGrid = new GameGrid(8);
this.pTileLocs = new Array(64);
this.pTileCheck = 0;
this.pSwappedTiles = new Array(2);
this.pClearedTiles = new Array();
this.setMask(this.tileMask_mc);
this.pComboSnd = new Sound(this);
this.pComboSnd.attachSound("snd.combo");
this.pErrorSnd = new Sound(this);
this.pErrorSnd.attachSound("snd.error");
this.pSwishSnd = new Sound(this);
this.pSwishSnd.attachSound("snd.swish");
this.pBellsSnd = new Sound(this);
this.pBellsSnd.attachSound("snd.bells");
var _local3;
var _local2 = 0;
while (_local2 < 64) {
_local3 = new Object();
_local3.pNum = _local2;
_local3.pPos = new Object();
_local3.pPos.x = -140 + (40 * (_local2 % 8));
_local3.pPos.y = -140 + (40 * Math.floor(_local2 / 8));
_local3.pColour = 1;
this.attachMovie("mc.tile", ("t" + _local2) + "_mc", _local2, _local3);
this.pTileLocs[_local2] = ("t" + _local2) + "_mc";
_local2++;
}
};
this.printTileLocs = function () {
var _local6 = 0;
while (_local6 < 8) {
var _local4 = "";
var _local3 = 0;
while (_local3 < 8) {
var _local5 = (_local6 * 8) + _local3;
var _local2 = this.pTileLocs[_local5];
_local2 = _local2.slice(1, -3);
_local4 = (_local4 + _local2) + ", ";
_local3++;
}
trace(_local4);
_local6++;
}
};
this.updateBlockCount = function () {
this.pComboSnd.start();
this.pBlockCount++;
if (this.pLevel < 5) {
this.pLevelEnd = this.pBlockCount >= 20;
}
};
this.gameOver = function () {
trace("GAME SCORE: " + _parent.scores_mc.getScore());
System.useCodepage = false;
var _local8 = new LoadVars();
_local8.onLoad = function () {
var _local4 = this.passok;
var _local5 = this.status;
var _local3 = this.sql;
var _local2 = new LocalConnection();
_local2.send("lc_update_top5", "update_top5");
trace(_local3);
};
var _local5 = new LoadVars();
var _local6 = _root.username.replace("~", "\\");
_local6 = _local6.replace("!", "\\");
var _local7 = (((((((_local6 + "~!~") + _root.country) + "~!~") + _root.weekno) + "~!~") + _parent.scores_mc.getScore()) + "~!~") + "yes";
var _local11 = _local7 + "~!~holanwan";
var _local9 = Base64.Encode(_local7);
var _local13 = new md5();
var _local12 = _local13.hash(_local11);
_local5.partb = _local9;
_local5.partm = _local12;
_local5.sendAndLoad("flash_savedata.jsp", _local8, "POST");
var _local10 = new LocalConnection();
_local10.send("lc_update_yourscore", "update_yourscore", _parent.scores_mc.getScore());
this.pTileCheck = 0;
var _local4 = 0;
while (_local4 < 64) {
this[this.pTileLocs[_local4]].destroyTile();
this.pTileCheck++;
_local4++;
}
this.pBellsSnd.start();
};
this.tileDestroyDone = function () {
if ((--this.pTileCheck) == 0) {
this._parent.gameover_mc.gotoAndPlay("end");
}
};
this.swapBlocks = function (aB1, aB2, aReturn) {
this.selector_mc.setActive(false);
var _local5 = -140 + (40 * (aB1 % 8));
var _local7 = -140 + (40 * Math.floor(aB1 / 8));
var _local8 = this.pTileLocs[aB1];
var _local4 = -140 + (40 * (aB2 % 8));
var _local6 = -140 + (40 * Math.floor(aB2 / 8));
var _local9 = this.pTileLocs[aB2];
if (_local4 != _local5) {
var _local10 = ((_local4 > _local5) * 2) - 1;
} else {
var _local10 = ((_local6 > _local7) * 2) - 1;
}
this[_local8].moveTile(_local4, _local6, _local10, aB2);
this[_local9].moveTile(_local5, _local7, _local10, aB1);
this.pSwappedTiles[0] = aB1;
this.pSwappedTiles[1] = aB2;
if (!aReturn) {
this.pSwishSnd.start();
this.pTileCheck = 2;
} else {
this.pErrorSnd.start();
this.selector_mc.setActive(true);
}
this.pTileLocs[aB1] = _local9;
this.pTileLocs[aB2] = _local8;
this.pGrid.swapBlocks(aB1, aB2);
};
this.tileClearDone = function () {
if ((--this.pTileCheck) == 0) {
var _local3 = this.pGrid.removeBlocks();
var _local4 = this.pTileLocs.slice();
var _local9 = _local3[0].length;
var _local2 = 0;
while (_local2 < _local9) {
var _local5 = _local3[0][_local2][0];
var _local6 = _local3[0][_local2][1];
this[_local4[_local5]].dropTile(_local6, _local5);
this.pTileLocs[_local5 + (_local6 * 8)] = _local4[_local5];
this.pTileCheck++;
_local2++;
}
_local9 = _local3[1].length;
_local2 = 0;
while (_local2 < _local9) {
var _local5 = _local3[1][_local2][0];
var _local7 = _local3[1][_local2][1];
var _local8 = _local3[1][_local2][2];
this[_local4[_local5]].renewTile(_local7, _local8);
this.pTileLocs[_local7] = _local4[_local5];
this.pTileCheck++;
_local2++;
}
}
};
this.tileScaleDone = function () {
if ((--this.pTileCheck) == 0) {
this._parent.scores_mc.clearBonus();
this._parent.scores_mc.updateLevel();
this.pRange = Math.min(++this.pRange, 8);
this.loadGrid(this.pRange);
this._parent.timer_mc.increaseSpeed();
this.pLevelEnd = false;
}
};
this.tileDropDone = function () {
if ((--this.pTileCheck) == 0) {
var _local3 = this.pGrid.checkGrid();
var _local4 = _local3.length;
this.pTileCheck = 0;
this.pClearedTiles.splice(0);
if (_local4 > 2) {
var _local2 = 0;
while (_local2 < _local4) {
this[this.pTileLocs[_local3[_local2]]].removeTile();
this.pClearedTiles.push(_local3[_local2]);
this.pTileCheck++;
_local2++;
}
}
if (_local4 == 0) {
if (this.pLevelEnd) {
var _local2 = 0;
while (_local2 < 64) {
this[this.pTileLocs[_local2]].scaleTile();
this.pTileCheck++;
_local2++;
}
this.pLevel++;
this._parent.soul_mc.clearMap();
} else {
this._parent.scores_mc.clearBonus();
this.selector_mc.setActive(true);
this._parent.timer_mc.resumeTimer();
if (this.pBlockCount == 0) {
this.pBellsSnd.start();
}
}
}
}
};
this.tileSwapDone = function () {
if ((--this.pTileCheck) == 0) {
this._parent.timer_mc.pauseTimer();
var _local4 = this.pGrid.checkBlocks(this.pSwappedTiles[0]);
var _local3 = this.pGrid.checkBlocks(this.pSwappedTiles[1]);
var _local5 = _local4.length;
var _local6 = _local3.length;
if (!((_local5 > 2) || (_local6 > 2))) {
this.swapBlocks(this.pSwappedTiles[1], this.pSwappedTiles[0], 1);
this._parent.timer_mc.resumeTimer();
} else {
this.pTileCheck = 0;
this.pClearedTiles.splice(0);
if (_local5 > 2) {
var _local2 = 0;
while (_local2 < _local5) {
this[this.pTileLocs[_local4[_local2]]].removeTile();
this.pClearedTiles.push(_local4[_local2]);
this.pTileCheck++;
_local2++;
}
}
if (_local6 > 2) {
var _local2 = 0;
while (_local2 < _local6) {
this[this.pTileLocs[_local3[_local2]]].removeTile();
this.pClearedTiles.push(_local3[_local2]);
this.pTileCheck++;
_local2++;
}
}
}
}
};
this.loadGrid = function (tRange) {
this.pRange = tRange;
this._parent.timer_mc.resetTimer();
this.pGrid.setRange(tRange);
this.pBlockCount = 0;
var _local3;
var _local2 = 0;
while (_local2 < 64) {
_local3 = this[("t" + _local2) + "_mc"];
_local3.pNum = _local2;
_local3.pPos.x = -140 + (40 * (_local2 % 8));
_local3.pPos.y = -140 + (40 * Math.floor(_local2 / 8));
_local3.pColour = this.pGrid.getCellColour(_local2);
this.pTileLocs[_local2] = ("t" + _local2) + "_mc";
_local3.startTile();
_local2++;
}
this.pTileCheck = 64;
};
this.init();
stop();
Symbol 105 Button
on (release) {
scores_mc.pLevel = 1;
scores_mc.level_mc.setValue(scores_mc.pLevel);
scores_mc.pScore = 0;
scores_mc.nums_mc.setValue(scores_mc.pScore);
timer_mc.pSpeed = 0.05;
goto("newGame");
}