Frame 1
if (_url.substr(0, 4) == "http") {
MochiAd.showPreloaderAd({id:"0b5aa8644a01e384", res:"500x450"});
}
Frame 2
Stage.scaleMode = "noScale";
Stage.showMenu = false;
gotoAndStop ("finLoad");
Frame 26
function URLValidate() {
gotoAndPlay ("game");
clearInterval(meInt);
}
stop();
meInt = setInterval(URLValidate, 2000);
Frame 28
function gotoScreen(newScreen, oldScreen) {
if (oldScreen != undefined) {
trace("oldScreen:" + oldScreen);
oldScreen.removeMovieClip();
}
switch (newScreen) {
case "start" :
attachMovie("startScreen", "ss", 0);
break;
case "game" :
theGame = attachMovie("Game", "game", 0);
break;
case "scores" :
scoreTable = attachMovie("highScoreTable", "hst", 0);
scoreClass = new HighScoreTable(scoreTable, "presents_panic");
}
}
function __com_mochibot__(swfid, mc, lv, trk) {
var x;
var g;
var s;
var fv;
var sb;
var u;
var res;
var mb;
var mbc;
mb = "__mochibot__";
mbc = "mochibot.com";
g = (_global ? (_global) : (_level0._root));
if (g[mb + swfid]) {
return(g[mb + swfid]);
}
s = System.security;
x = mc._root.getSWFVersion;
fv = (x ? (mc.getSWFVersion()) : ((_global ? 6 : 5)));
if (!s) {
s = {};
}
sb = s.sandboxType;
if (sb == "localWithFile") {
return(null);
}
x = s.allowDomain;
if (x) {
s.allowDomain(mbc);
}
x = s.allowInsecureDomain;
if (x) {
s.allowInsecureDomain(mbc);
}
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=7&fv=") + fv) + "&v=") + escape(getVersion())) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=") + mc) + (sb ? ("&sb=" + sb) : "")) + (trk ? "&t=1" : "");
lv = ((fv > 6) ? (mc.getNextHighestDepth()) : ((g[mb + "level"] ? (g[mb + "level"] + 1) : (lv))));
g[mb + "level"] = lv;
if (fv == 5) {
res = "_level" + lv;
if (!eval (res)) {
loadMovieNum (u, lv);
}
} else {
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
}
return(res);
}
sq.onRelease = function () {
this._parent.theGame.cDebug();
};
gotoScreen("start", oldScreen);
_global.soundOn = true;
SoundManager.setMainClip(soundMC);
SoundManager.addSound("bgLoop");
SoundManager.addSound("ding");
var i = 0;
while (i < 6) {
SoundManager.addSound("tinkle" + i);
SoundManager.setSoundVol("tinkle" + i, 20);
i++;
}
stop();
if (_url.substr(0, 4) == "http") {
__com_mochibot__("30f709dc", this, 10301, true);
}
Symbol 2 MovieClip [Snowflake] Frame 1
#initclip 15
Object.registerClass("Snowflake", Snowflake);
#endinitclip
Symbol 3 MovieClip [star] Frame 1
#initclip 14
Object.registerClass("star", Star);
#endinitclip
Symbol 23 Button
on (release) {
_parent._parent.gotoScreen("start", _parent);
}
Symbol 27 MovieClip Frame 1
stop();
Symbol 27 MovieClip Frame 2
stop();
Symbol 27 MovieClip Frame 3
stop();
Symbol 30 MovieClip Frame 1
stop();
Symbol 30 MovieClip Frame 2
stop();
Symbol 30 MovieClip Frame 3
stop();
Symbol 41 Button
on (release) {
getURL ("http://www.utterlysuperb.com/highscores/presents_panic_scores.htm", "_blank");
}
Symbol 45 Button
on (release) {
_parent._parent._parent.gotoScreen("start", _parent);
}
Symbol 46 MovieClip Frame 1
function doneIn() {
this.instructionsMC.gotoAndPlay(2);
trace("gfgdd:" + instructionsMC);
}
function makeWhite(mc) {
var _local1 = new Color(mc);
_local1.setRGB(16777215);
}
nextBtn.onRelease = function () {
this._parent._parent.changePage(1);
};
playBtn.onRelease = function () {
if (this._parent._parent.canMove) {
_global.hasPlayed = true;
this._parent._parent.changePage(10);
}
};
if (_global.hasPlayed != true) {
playBtn._visible = false;
}
stop();
Symbol 47 MovieClip Frame 1
function showMe() {
if (myPage <= numPages) {
gotoAndPlay ("in");
instructions.gotoAndStop(myPage);
}
}
function changePage(val) {
if (canMove) {
canMove = false;
myPage = myPage + val;
gotoAndPlay ("out");
}
}
numPages = 5;
myPage = 1;
canMove = false;
stop();
Symbol 47 MovieClip Frame 19
stop();
canMove = true;
this.instructions.doneIn();
Symbol 48 MovieClip [highScoreTable] Frame 1
stop();
this.scoreTable.tableIn();
var i = 0;
while (i < 30) {
snowFlakeHolder0.attachMovie("Snowflake", "sf" + i, i);
i++;
}
var i = 0;
while (i < 50) {
snowFlakeHolder1.attachMovie("Snowflake", "sf" + i, i);
i++;
}
Symbol 55 MovieClip Frame 1
stop();
Symbol 55 MovieClip Frame 2
stop();
Symbol 55 MovieClip Frame 3
stop();
Symbol 66 Button
on (release) {
this._parent.startGame(this.difficulty);
this.removeMovieClip();
}
Symbol 67 MovieClip [difficultySelector] Frame 1
function setUpSlider() {
this.startP = (this.slider._x = this.bg._x);
this.endP = this.bg._x + this.bg._width;
this.slideDist = this.endP - this.startP;
this.maxDif = 25;
this.slider.onPress = function () {
this._parent.startSlide();
};
this.slider.onRelease = (this.slider.onReleaseOutside = function () {
this._parent.stopSlide();
});
this.levelShow.text = (this.difficulty = 1);
}
function startSlide() {
this.slider.startDrag(false, this.startP, this.slider._y, this.endP, this.slider._y);
this.onMouseMove = this.setDifficulty;
}
function stopSlide() {
this.slider.stopDrag();
}
function setDifficulty() {
this.difficulty = Math.ceil((this.maxDif / this.slideDist) * (this.slider._x - this.startP));
if (this.difficulty < 1) {
this.difficulty = 1;
}
this.levelShow.text = this.difficulty;
}
setUpSlider();
Symbol 348 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function showPreloaderAd(options) {
var _local29 = {clip:_root, ad_msec:11000, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812};
options = _parseOptions(options, _local29);
var _local15 = options.clip;
var _local25 = options.ad_msec;
delete options.ad_msec;
var _local28 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
return(null);
}
_local15.stop();
var mc = _local15._mochiad;
mc.onUnload = function () {
this._parent.play();
};
var _local16 = _getRes(options);
var _local5 = _local16[0];
var _local14 = _local16[1];
mc._x = _local5 * 0.5;
mc._y = _local14 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local5 * -0.5;
chk._y = _local14 * -0.5;
var _local8 = chk.createEmptyMovieClip("_mochiad_bar", 4);
_local8._x = 10;
_local8._y = _local14 - 20;
var _local24 = options.color;
delete options.color;
var _local21 = options.background;
delete options.background;
var _local26 = options.outline;
delete options.outline;
var _local6 = _local8.createEmptyMovieClip("_outline", 1);
_local6.beginFill(_local21);
_local6.moveTo(0, 0);
_local6.lineTo(_local5 - 20, 0);
_local6.lineTo(_local5 - 20, 10);
_local6.lineTo(0, 10);
_local6.lineTo(0, 0);
_local6.endFill();
var _local4 = _local8.createEmptyMovieClip("_inside", 2);
_local4.beginFill(_local24);
_local4.moveTo(0, 0);
_local4.lineTo(_local5 - 20, 0);
_local4.lineTo(_local5 - 20, 10);
_local4.lineTo(0, 10);
_local4.lineTo(0, 0);
_local4.endFill();
_local4._xscale = 0;
var _local7 = _local8.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local26, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local5 - 20, 0);
_local7.lineTo(_local5 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local25;
chk.ad_timeout = _local28;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local12 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local10 = (100 * _local8) / _local4;
var _local11 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local2 = Math.min(100, Math.min(_local10 || 0, _local11));
_local2 = Math.max(this.last_pcnt, _local2);
this.last_pcnt = _local2;
_local9._xscale = _local2;
if (!chk.showing) {
var _local7 = _local12.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local5 > chk.ad_timeout) {
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showTimedAd(options) {
var _local15 = {clip:_root, ad_msec:11000, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd"};
options = _parseOptions(options, _local15);
var _local6 = options.clip;
var _local12 = options.ad_msec;
delete options.ad_msec;
var _local14 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
return(null);
}
_local6.stop();
var mc = _local6._mochiad;
mc.onUnload = function () {
this._parent.play();
};
var _local7 = _getRes(options);
var _local16 = _local7[0];
var _local13 = _local7[1];
mc._x = _local16 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local12;
chk.ad_timeout = _local14;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function load(options) {
var _local14 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local14);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = "1.3";
var _local7 = options.clip;
if (!_isNetworkAvailable()) {
return(false);
}
if (_local7._mochiad_loaded) {
return(false);
}
var _local13 = options.depth;
delete options.depth;
var _local6 = _local7.createEmptyMovieClip("_mochiad", _local13);
var _local12 = _getRes(options);
options.res = (_local12[0] + "x") + _local12[1];
options.server = options.server + options.id;
delete options.id;
_local7._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
if (_local7._url.indexOf("http") != 0) {
options.no_page = true;
}
var _local11 = _local4.server;
delete _local4.server;
var _local10 = _local11.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local10);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local10);
}
}
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local9 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local9;
_local5.hostname = _local10;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local9);
_local6.lc = _local5;
_local4.lc = _local9;
_local4.st = getTimer();
_local4.loadMovie(_local11 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local4);
}
}
Symbol 349 MovieClip [__Packages.Star] Frame 0
class Star extends MovieClip
{
var xv, yv, onEnterFrame, _x, _y, removeMovieClip;
function Star () {
super();
xv = (Math.random() * 10) - 5;
yv = -3 - (Math.random() * 6);
onEnterFrame = EF;
}
function EF() {
_x = _x + xv;
_y = _y + yv;
yv = yv + 1;
if (_y > 450) {
removeMovieClip();
}
}
}
Symbol 350 MovieClip [__Packages.Snowflake] Frame 0
class Snowflake extends MovieClip
{
var cacheAsBitmap, _x, _y, _xscale, _yscale, _rotation, yv, xv;
function Snowflake () {
super();
placeAtStart();
cacheAsBitmap = true;
}
function placeAtStart() {
_x = (Math.random() * (Stage.width + 400)) - 400;
_y = Math.random() * Stage.height;
resizeMe();
getSpeed();
}
function resizeMe() {
_xscale = (_yscale = 30 + (Math.random() * 40));
_rotation = Math.random() * 60;
}
function placeAtTop() {
_x = (Math.random() * (Stage.width + 400)) - 400;
_y = -10;
resizeMe();
getSpeed();
}
function getSpeed() {
yv = 1 + (Math.random() * 3);
xv = 1 + (Math.random() * 3);
}
function onEnterFrame() {
_x = _x + xv;
_y = _y + yv;
if ((_x > (Stage.width + 10)) || (_y > (Stage.height + 10))) {
placeAtTop();
}
}
}
Symbol 351 MovieClip [__Packages.Game] Frame 0
class Game extends MovieClip
{
var thirdPower, formations, score, powerGauge, numCollumns, numRows, rightWall, floorY, BlocksMC, createEmptyMovieClip, presentsMC, theInterface, attachMovie, effectsMC, nextBlock, level, blocksNeeded, timer, numColors, count, moveCount, shapeJustCome, onEnterFrame, canAction, doBomb, paused, presents, fallingPresents, usedColors, presentsNum, makeShapeCount, tShape, killRow, killCol, collumns, actionCount, destroyChain, destrCount, fallChecks, nextShape, selectedPresent, oldEF;
function Game () {
super();
thirdPower = Math.floor(maxPower / 3);
formations = [];
formations.push([[0, 1, 0], [0, 1, 0], [0, 1, 0], [0, 1, 0]]);
formations.push([[1, 0, 0], [1, 0, 0], [1, 1, 0], [0, 0, 0]]);
formations.push([[0, 1, 0], [0, 1, 0], [1, 1, 0], [0, 0, 0]]);
formations.push([[0, 1, 0], [1, 1, 1], [0, 0, 0], [0, 0, 0]]);
formations.push([[1, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 0]]);
formations.push([[0, 1, 0], [1, 1, 0], [1, 0, 0], [0, 0, 0]]);
formations.push([[1, 1, 0], [1, 1, 0], [1, 1, 0], [0, 0, 0]]);
score = (powerGauge = 0);
numCollumns = 12;
numRows = 18;
rightWall = numCollumns * bSize;
floorY = numRows * bSize;
BlocksMC = createEmptyMovieClip("bmc", 1);
presentsMC = createEmptyMovieClip("pmc", 2);
theInterface = attachMovie("interface", "if", 3);
if (!_global.soundOn) {
theInterface.soundBtn.gotoAndStop(2);
}
effectsMC = createEmptyMovieClip("emc", 5);
nextBlock = createEmptyMovieClip("nbl", 4);
nextBlock._x = 330;
nextBlock._y = 30;
attachMovie("difficultySelector", "ds", 0);
}
function startGame(tLevel) {
level = tLevel;
SoundManager.fadeSoundIn("bgLoop", 100, 2, 0, 10000);
startLevel();
}
function levelUp() {
if (level > 1) {
SoundManager.playSound("ding");
theInterface.levelShow.gotoAndPlay("doFlash");
theInterface.levelShow.tLevel.tLevel.text = level;
trace("fdfsdsfd:" + theInterface.levelShow.tLevel);
}
theInterface.tLevel.text = level;
blocksNeeded = Math.floor(12 + (level * 2));
timer = 600 + (50 * level);
numColors = Math.ceil(5 + ((level - 1) / 7));
if (level < 3) {
numColors = 5;
} else if (level < 9) {
numColors = 6;
} else if (level < 17) {
numColors = 7;
} else {
numColors = 8;
}
if (numColors > colorsA.length) {
numColors = colorsA.length;
}
count = (moveCount = (shapeJustCome = 0));
onEnterFrame = tetrisShapeEF;
trace((("level:" + level) + ", numColors:") + numColors);
}
function startLevel() {
showScore();
showPower();
canAction = true;
doBomb = (paused = false);
buildArrays();
presents = [];
fallingPresents = [];
usedColors = [];
var _local3 = 0;
while (_local3 < colorsA.length) {
var _local2 = Math.floor(Math.random() * colorsA.length);
while (isInArray(usedColors, _local2)) {
_local2 = Math.floor(Math.random() * colorsA.length);
}
usedColors.push(_local2);
_local3++;
}
for (_local3 in usedColors) {
trace((_local3 + ":") + usedColors[_local3]);
}
effectsMC._x = (effectsMC._y = (presentsMC._x = (presentsMC._y = (BlocksMC._x = (BlocksMC._y = 18)))));
presentsNum = 0;
levelUp();
makeShowShape();
makeShapeCount = 10;
}
function finishLevel() {
level++;
levelUp();
}
function die() {
canAction = false;
SoundManager.fadeSoundOut("bgLoop", -2);
for (var _local2 in presents) {
presents[_local2].setGreyColor();
}
for (var _local2 in tShape.blocks) {
tShape.blocks[_local2].setGreyColor();
}
delete onEnterFrame;
theInterface.endSnow.gotoAndStop("snow");
}
function dieEF() {
var _local4 = 0;
while (_local4 < 5) {
if (killRow < 0) {
delete onEnterFrame;
} else {
var _local3 = effectsMC.getNextHighestDepth();
var _local2 = effectsMC.attachMovie("endSquare", "es" + _local3, _local3);
_local2._x = (killCol++) * bSize;
_local2._y = killRow * bSize;
_local2._height = (_local2._width = bSize);
if (killCol >= numCollumns) {
killRow--;
killCol = 0;
}
}
_local4++;
}
}
function buildArrays() {
collumns = [];
var _local2 = 0;
while (_local2 < numCollumns) {
collumns[_local2] = [];
_local2++;
}
}
function tetrisShapeEF() {
if (Key.isDown(32) && (powerGauge > 0)) {
powerGauge--;
showPower();
} else if ((count - shapeJustCome) < 2) {
} else {
if (canAction && (Key.isDown(flipButton) || (Key.isDown(87)))) {
actionCount = 3;
tShape.flip();
canAction = false;
}
var _local2 = 2.6 + (level / 10);
if (canAction && (Key.isDown(downKey) || (Key.isDown(83)))) {
_local2 = _local2 + 10;
}
if (_local2 > 12) {
_local2 = 12;
}
if (!canAction) {
if ((actionCount--) < 0) {
canAction = true;
}
}
tShape.goDown(_local2);
var _local3 = 0;
if (Key.isDown(leftKey) || (Key.isDown(65))) {
_local3--;
}
if (Key.isDown(rightKey) || (Key.isDown(68))) {
_local3++;
}
if ((_local3 != 0) && ((count - moveCount) > 1)) {
moveCount = count;
tShape.doMove(_local3);
}
tShape.placeBlocks();
if ((tShape == undefined) && ((makeShapeCount--) < 0)) {
makeShape();
}
}
count++;
doTimer();
}
function endEF() {
count++;
if (destroyChain.length > 0) {
var _local2 = destroyChain.shift();
destroyBlock(_local2);
destrCount = count;
} else if ((count - destrCount) > 20) {
startLevel();
}
}
function destroyEF() {
count++;
if (destroyChain.length > 0) {
var _local2 = destroyChain.shift();
destroyBlock(_local2);
destrCount = count;
} else if ((count - destrCount) > 5) {
stopDestrEF();
}
doTimer();
}
function stopDestrEF() {
var _local4 = false;
for (var _local2 in fallChecks) {
}
var _local3 = fallChecks.length - 1;
if (_local3 > 0) {
score = score + Math.round((_local3 * _local3) * (1 + (level / 10)));
}
showScore();
delete fallChecks;
canAction = true;
_local4 = checkFall(0, numRows, numCollumns);
if (_local4) {
checkForPresents();
}
if (blocksNeeded > 0) {
onEnterFrame = tetrisShapeEF;
} else {
finishLevel();
}
}
function makeShape() {
shapeJustCome = count;
tShape = new FallingShape(nextShape.formation, Math.floor((numCollumns - 2) / 2) * bSize, 0, this, nextShape.blocks);
makeShowShape();
makeShapeCount = 10 + Math.ceil(level / 5);
checkFallingShape();
}
function makeShowShape() {
nextBlock.removeMovieClip();
nextBlock = createEmptyMovieClip("nbl", 4);
nextBlock._x = 330;
nextBlock._y = 37;
nextBlock._rotation = -1;
nextShape = new ShowShape(Math.floor(Math.random() * 6), 0, 0, this);
if (nextBlock._width > 135) {
nextBlock._width = 135;
nextBlock._yscale = nextBlock._xscale;
}
nextBlock._x = 330 + ((135 - nextBlock._width) / 2);
if (nextBlock._height > 100) {
nextBlock._height = 100;
nextBlock._xscale = nextBlock._yscale;
}
nextBlock._y = 37 + ((100 - nextBlock._height) / 2);
}
function createBlock(col) {
var _local2 = BlocksMC.getNextHighestDepth();
var _local3 = new Block(_local2, BlocksMC, this, col);
return(_local3);
}
function createShowBlock(col) {
var _local2 = nextBlock.getNextHighestDepth();
var _local3 = new Block(_local2, nextBlock, this, col);
return(_local3);
}
function checkFallingShape() {
var _local2 = true;
for (var _local3 in tShape.blocks) {
if (!blockPosOk(tShape.blocks[_local3])) {
_local2 = false;
}
}
if (!_local2) {
die();
}
}
function blockPosOk(block) {
var _local2 = !(((block.x < 0) || ((block.x + bSize) > rightWall)) || ((block.y + bSize) > floorY));
for (var _local4 in presents) {
if (presents[_local4].collideWith(block)) {
_local2 = false;
}
}
return(_local2);
}
function placeShape() {
var _local7 = Math.round(tShape.x / bSize);
var _local8 = Math.round(tShape.y / bSize);
if (_local7 == numCollumns) {
_local7 = numCollumns - 1;
}
for (var _local9 in tShape.blocks) {
var _local2 = tShape.blocks[_local9];
var _local4 = _local7 + _local2.collumn;
_local2.collumn = 0;
_local2.x = (_local2._x = _local4 * bSize);
var _local5 = _local8 + _local2.row;
_local2.row = 0;
_local2.y = (_local2._y = _local5 * bSize);
var _local6 = presentsMC.attachMovie("presentMC", "pmc" + presentsNum, presentsNum);
var _local3 = new Present(presentsNum, _local2.x, _local2.y, this, _local2, _local4, _local5, _local6);
_local2.myPresent = _local3;
_local2.myMC.removeMovieClip();
collumns[_local3.collumn][_local3.row] = _local3;
presents[presentsNum] = _local3;
presentsNum++;
}
delete tShape;
checkFall(0, numRows, numCollumns);
checkForPresents();
}
function checktShapeForPresents() {
for (var _local2 in tShape) {
}
}
function checkForPresents() {
deselectBlock();
var _local8 = false;
for (var _local9 in presents) {
var _local3 = presents[_local9];
_local3.doneCheck = false;
delete _local3.combiePresent;
}
for (var _local9 in presents) {
var _local3 = presents[_local9];
var _local5 = collumns[_local3.collumn - 1][_local3.row];
var _local2 = 0;
if ((((_local5.myColor == _local3.myColor) && (_local5.row == _local3.row)) && (_local5.height == _local3.height)) && (_local5.size > _local2)) {
_local3.combiePresent = _local5;
_local2 = _local5.size;
}
var _local7 = collumns[_local3.collumn + _local3.width][_local3.row];
if ((((_local7.myColor == _local3.myColor) && (_local7.row == _local3.row)) && (_local7.height == _local3.height)) && (_local7.size > _local2)) {
_local3.combiePresent = _local7;
_local2 = _local7.size;
}
var _local6 = collumns[_local3.collumn][_local3.row - 1];
if ((((_local6.myColor == _local3.myColor) && (_local6.collumn == _local3.collumn)) && (_local6.width == _local3.width)) && (_local6.size > _local2)) {
_local3.combiePresent = _local6;
_local2 = _local6.size;
}
var _local4 = collumns[_local3.collumn][_local3.row + _local3.height];
if ((((_local4.myColor == _local3.myColor) && (_local4.collumn == _local3.collumn)) && (_local4.width == _local3.width)) && (_local4.size > _local2)) {
_local3.combiePresent = _local4;
_local2 = _local4.size;
}
}
for (var _local9 in presents) {
var _local3 = presents[_local9];
if (!_local3.doneCheck) {
if (_local3.combiePresent != undefined) {
if (_local3 == _local3.combiePresent.combiePresent) {
_local3.doneCheck = (_local3.combiePresent.doneCheck = true);
combine(_local3, _local3.combiePresent);
_local8 = true;
}
}
}
}
if (_local8) {
checkForPresents();
}
return(_local8);
}
function findBestCombo(pAr) {
var _local2 = 0;
for (var _local3 in pAr) {
if (pAr[_local3].size > _local2) {
_local2 = pAr[_local3].size;
}
}
}
function combine(pr0, pr1) {
if (pr1.row < pr0.row) {
pr0.height = (pr0.row - pr1.row) + pr0.height;
pr0.y = pr1.y;
for (var _local5 in pr0.blocks) {
pr0.blocks[_local5].row = pr0.blocks[_local5].row + (pr0.row - pr1.row);
}
pr0.row = pr1.row;
} else if (pr1.row > pr0.row) {
pr0.height = (pr1.row - pr0.row) + pr1.height;
for (var _local5 in pr1.blocks) {
pr1.blocks[_local5].row = pr1.blocks[_local5].row + (pr1.row - pr0.row);
}
}
if (pr1.collumn < pr0.collumn) {
pr0.x = pr1.x;
pr0.width = (pr0.collumn - pr1.collumn) + pr0.width;
for (var _local5 in pr0.blocks) {
pr0.blocks[_local5].collumn = pr0.blocks[_local5].collumn + (pr0.collumn - pr1.collumn);
}
pr0.collumn = pr1.collumn;
} else {
pr0.width = (pr1.collumn - pr0.collumn) + pr1.width;
for (var _local5 in pr0.blocks) {
pr1.blocks[_local5].collumn = pr1.blocks[_local5].collumn + (pr1.collumn - pr0.collumn);
}
}
for (var _local5 in pr1.blocks) {
var _local6 = pr1.blocks[_local5];
_local6.myPresent = pr0;
collumns[pr0.collumn + _local6.collumn][pr0.row + _local6.row] = pr0;
pr0.blocks.push(_local6);
_local6.nT.text = pr0.num;
}
var _local5 = pr0.collumn;
while (_local5 < (pr0.collumn + pr0.width)) {
var _local3 = pr0.row;
while (_local3 < (pr0.row + pr0.height)) {
if (collumns[_local5][_local3] != pr0) {
collumns[_local5][_local3] = pr0;
}
_local3++;
}
_local5++;
}
pr0.doSize();
delete presents[pr1.num];
pr0.doneCheck = (pr1.doneCheck = true);
pr1.myMC.removeMovieClip();
}
function drawPresentLines() {
effectsMC.clear();
effectsMC.lineStyle(1, 0);
effectsMC.moveTo(0, 0);
effectsMC.lineTo(0, floorY);
effectsMC.lineTo(rightWall, floorY);
effectsMC.lineTo(rightWall, 0);
effectsMC.lineTo(0, 0);
}
function clickPresent(pre) {
if (onEnterFrame == undefined) {
trace("pre.touches(selectedPresent):" + pre.touches(selectedPresent));
trace((((((((((((((("pre.num:" + pre.num) + ", presents[pre.num]:") + (presents[pre.num] == pre)) + ", pre.collumn:") + pre.collumn) + ", pre.row:") + pre.row) + ", pre.size:") + pre.size) + ", prre.width:") + pre.width) + ", pre.height:") + pre.height) + ", pre.myColor:") + pre.myColor);
var _local5 = pre.collumn;
while (_local5 < (pre.collumn + pre.width)) {
var _local4 = pre.row;
while (_local4 < (pre.row + pre.height)) {
trace(collumns[_local5][_local4] == pre);
_local4++;
}
_local5++;
}
selectedPresent = pre;
} else if (canAction && (doBomb)) {
doBomb = false;
if (pre != undefined) {
fallChecks = [];
destroyChain = [];
destroyChain.push(pre);
var _local5 = pre.collumn - 1;
while (_local5 <= (pre.collumn + pre.width)) {
var _local4 = pre.row - 1;
while (_local4 <= (pre.row + pre.height)) {
var _local3 = collumns[_local5][_local4];
if ((!isInArray(destroyChain, _local3)) && (_local3 != undefined)) {
destroyChain.push(_local3);
}
_local4++;
}
_local5++;
}
}
powerGauge = powerGauge - thirdPower;
showPower();
destroyDelay();
} else if (canAction) {
var _local8 = false;
fallingPresents = [];
if (selectedPresent == undefined) {
if (pre.size > 2) {
fallChecks = [];
destroyChain = [];
destroyBlock(pre);
destroyDelay();
} else {
var _local6 = getTouchingPresSize(pre);
if (_local6 > 2) {
fallChecks = [];
destroyChain = [];
destroyBlock(pre);
destroyDelay();
} else if (pre.size == 1) {
selectedPresent = pre;
pre.select();
}
}
} else if ((pre == undefined) && (selectedPresent != undefined)) {
selectedPresent.deselect();
delete selectedPresent;
} else if (selectedPresent == pre) {
if (pre.size > 2) {
fallChecks = [];
destroyChain = [];
destroyBlock(pre);
destroyDelay();
} else {
var _local6 = getTouchingPresSize(pre);
if (_local6 > 2) {
fallChecks = [];
destroyChain = [];
destroyBlock(pre);
destroyDelay();
} else {
pre.deselect();
}
}
delete selectedPresent;
} else {
if (pre.canSwap(selectedPresent)) {
var _local7 = getTouchingPresSize(pre) + getTouchingPresSize(selectedPresent);
swapPresents2(pre, selectedPresent);
if ((getTouchingPresSize(pre) + getTouchingPresSize(selectedPresent)) <= _local7) {
swapPresents2(pre, selectedPresent);
} else {
pre.placeBlocks();
selectedPresent.placeBlocks();
checkForPresents();
}
} else if ((pre.myColor == selectedPresent.myColor) && pre.touches(selectedPresent)) {
if ((pre.size + selectedPresent.size) > 2) {
fallChecks = [];
destroyChain = [];
destroyBlock(pre);
destroyDelay();
}
}
deselectBlock();
}
}
}
function destroyBlock(pre) {
removePreFromGrid(pre.collumn, pre.row, pre.width, pre.height);
var _local5 = pre.collumn - 1;
while (_local5 <= (pre.collumn + pre.width)) {
var _local3 = pre.row;
while (_local3 < (pre.row + pre.height)) {
var _local4 = collumns[_local5][_local3];
if ((_local4.myColor == pre.myColor) && (!isInArray(destroyChain, _local4))) {
destroyChain.push(_local4);
}
_local3++;
}
_local5++;
}
_local5 = pre.collumn;
while (_local5 < (pre.collumn + pre.width)) {
var _local3 = pre.row - 1;
while (_local3 <= (pre.row + pre.height)) {
var _local4 = collumns[_local5][_local3];
if ((_local4.myColor == pre.myColor) && (!isInArray(destroyChain, _local4))) {
destroyChain.push(_local4);
}
_local3++;
}
_local5++;
}
score = score + (Math.round(pre.size * pre.size) + level);
powerGauge = powerGauge + (pre.size * 3);
makeShapeCount = makeShapeCount + pre.size;
showPower();
blocksNeeded = blocksNeeded - pre.size;
makeStars(pre.collumn, pre.row, pre.width, pre.height);
showScore();
showBlocks();
delete presents[pre.num];
fallChecks.push(pre);
pre.removeMe();
var _local6 = fallChecks.length - 1;
while (_local6 > 5) {
_local6 = _local6 - 6;
}
SoundManager.playSound("tinkle" + _local6);
}
function deselectBlock() {
selectedPresent.deselect();
delete selectedPresent;
}
function swapPresents(pr0, pr1) {
var _local6 = pr1.row;
var _local4 = pr1.collumn;
pr1.row = pr0.row;
pr1.collumn = pr0.collumn;
pr0.row = _local6;
pr0.collumn = _local4;
pr0.findPos();
pr1.findPos();
collumns[pr0.collumn][pr0.row] = pr0;
collumns[pr1.collumn][pr1.row] = pr1;
var _local5 = checkForPresents();
return(_local5);
}
function swapPresents2(pr0, pr1) {
var _local5 = pr1.row;
var _local4 = pr1.collumn;
pr1.row = pr0.row;
pr1.collumn = pr0.collumn;
pr0.row = _local5;
pr0.collumn = _local4;
pr0.findPos();
pr1.findPos();
collumns[pr0.collumn][pr0.row] = pr0;
collumns[pr1.collumn][pr1.row] = pr1;
}
function getTouchingPresSize(pre) {
var _local6 = [];
var _local7 = pre.size;
var _local5 = pre.collumn - 1;
while (_local5 <= (pre.collumn + pre.width)) {
var _local4 = pre.row - 1;
while (_local4 <= (pre.row + pre.height)) {
var _local2 = collumns[_local5][_local4];
if (((_local2.myColor == pre.myColor) && (pre.touches(_local2))) && (!isInArray(_local6, _local2))) {
_local7 = _local7 + _local2.size;
_local6.push(_local2);
}
_local4++;
}
_local5++;
}
return(_local7);
}
function isInArray(ar, val) {
var _local2 = false;
for (var _local4 in ar) {
if (val == ar[_local4]) {
_local2 = true;
}
}
return(_local2);
}
function nInArray(ar) {
var _local1 = 0;
for (var _local2 in ar) {
_local1++;
}
return(_local1);
}
function checkFall(startCol, startRow, checkWidth) {
var _local6 = false;
var _local4 = startRow;
while (_local4 >= 0) {
var _local2 = startCol;
while (_local2 < (startCol + checkWidth)) {
var _local3 = collumns[_local2][_local4];
if (_local3.makeFall()) {
_local6 = true;
}
_local2++;
}
_local4--;
}
return(_local6);
}
function isSlotFree(tCol, tRow) {
var _local2 = collumns[tCol][tRow] == undefined;
if (tShape.isInSpot(tCol, tRow) || (tRow >= numRows)) {
_local2 = false;
}
return(_local2);
}
function removePreFromGrid(tCol, tRow, tWid, tHei) {
var _local3 = tCol;
while (_local3 < (tCol + tWid)) {
var _local2 = tRow;
while (_local2 < (tRow + tHei)) {
delete collumns[_local3][_local2];
_local2++;
}
_local3++;
}
}
function addPreToGrid(tCol, tRow, tWid, tHei, newPre) {
var _local3 = tCol;
while (_local3 < (tCol + tWid)) {
var _local2 = tRow;
while (_local2 < (tRow + tHei)) {
if (collumns[_local3][_local2] != undefined) {
trace("fuck fuck fuck");
}
collumns[_local3][_local2] = newPre;
_local2++;
}
_local3++;
}
}
function cDebug() {
delete onEnterFrame;
}
function destroyDelay() {
canAction = false;
destrCount = count;
onEnterFrame = destroyEF;
}
function showScore() {
theInterface.tScore.text = score * 10;
}
function showBlocks() {
theInterface.tBlocks.text = blocksNeeded;
}
function makeStars(tcol, trow, twidth, theight) {
var _local7 = (twidth * theight) * 5;
var _local10 = tcol * bSize;
var _local8 = trow * bSize;
var _local11 = twidth * bSize;
var _local9 = theight * bSize;
var _local4 = 0;
while (_local4 < _local7) {
var _local2 = effectsMC.getNextHighestDepth();
var _local3 = effectsMC.attachMovie("star", "star" + _local2, _local2, {_x:_local10 + (Math.random() * _local11), _y:_local8 + (Math.random() * _local9)});
_local3._rotation = Math.random() * 30;
_local3.cacheAsBitmap = true;
_local4++;
}
}
function doTimer() {
if (count > timer) {
}
}
function showPower() {
if (powerGauge > maxPower) {
powerGauge = maxPower;
}
theInterface.tPower.text = powerGauge;
theInterface.thermometer.pGauge.bar._height = theInterface.thermometer.pGauge.bg._height - ((theInterface.thermometer.pGauge.bg._height / maxPower) * powerGauge);
if (doBomb) {
theInterface.bombBtn.gotoAndStop(3);
} else if (powerGauge > thirdPower) {
theInterface.bombBtn.gotoAndStop(2);
} else {
theInterface.bombBtn.gotoAndStop(1);
}
if (powerGauge > thirdPower) {
theInterface.thermometer.pGauge.bg.gotoAndStop(2);
} else {
theInterface.thermometer.pGauge.bg.gotoAndStop(1);
}
}
function setUpBomb() {
if (canAction && (powerGauge > thirdPower)) {
deselectBlock();
doBomb = true;
theInterface.bombBtn.gotoAndStop(3);
}
}
function pauseToggle() {
paused = !paused;
if (paused) {
oldEF = onEnterFrame;
delete onEnterFrame;
theInterface.pauseBtn.gotoAndStop(2);
for (var _local2 in presents) {
presents[_local2].setGreyColor();
}
} else {
theInterface.pauseBtn.gotoAndStop(1);
onEnterFrame = oldEF;
for (var _local2 in presents) {
presents[_local2].setRealColor();
}
}
}
function soundToggle() {
_global.soundOn = !_global.soundOn;
if (_global.soundOn) {
theInterface.soundBtn.gotoAndStop(1);
SoundManager.setMasterVol(100);
} else {
theInterface.soundBtn.gotoAndStop(2);
SoundManager.setMasterVol(0);
}
}
function removeMCs() {
presentsMC.removeMovieClip();
}
var colorsA = [3355443, 65280, 16711680, 255, 16776960, 16711935, 6710988, 16737792];
var ribbonColorsA = [16776960, 16711884, 16777215, 16737792, 16711680, 16777215, 15658547, 1966233];
var bSize = 23;
var flipButton = 38;
var leftKey = 37;
var rightKey = 39;
var downKey = 40;
var maxPower = 699;
}
Symbol 352 MovieClip [__Packages.Shape] Frame 0
class Shape
{
var blocks, bottomY, y, controller, x, floorCount;
function Shape () {
}
function placeBlocks() {
placeBlocksVals();
placeBlocksPhys();
}
function placeBlocksPhys() {
for (var _local3 in blocks) {
var _local2 = blocks[_local3];
_local2.myMC._x = _local2.x;
_local2.myMC._y = _local2.y;
}
}
function placeBlocksVals() {
bottomY = y;
for (var _local3 in blocks) {
var _local2 = blocks[_local3];
_local2.x = x + (controller.bSize * _local2.collumn);
_local2.y = y + (controller.bSize * _local2.row);
if (_local2.y > bottomY) {
bottomY = _local2.y;
}
}
}
function goDown(dFactor) {
for (var _local4 in blocks) {
var _local2 = blocks[_local4].tryYMove(dFactor);
if (_local2 < dFactor) {
dFactor = _local2;
}
}
y = y + dFactor;
if (floorCount == undefined) {
floorCount = 0;
}
if (Math.floor(Math.abs(dFactor)) == 0) {
var _local5 = Math.round(y / controller.bSize);
y = controller.bSize * _local5;
if ((floorCount++) > 2) {
controller.placeShape();
}
} else {
floorCount = 0;
}
}
}
Symbol 353 MovieClip [__Packages.FallingShape] Frame 0
class FallingShape extends Shape
{
var controller, formation, x, y, createAr, placeBlocks, blocks, oldX, oldY, bottomY, placeBlocksVals, placeBlocksPhys;
function FallingShape (forma, tx, ty, contr, tBlockAr) {
super();
controller = contr;
formation = forma;
x = tx;
y = ty;
createAr = tBlockAr;
createBlocks();
placeBlocks();
}
function createBlocks() {
var _local5 = controller.formations[formation];
blocks = [];
var _local6 = 0;
var _local4 = 0;
while (_local4 < _local5.length) {
var _local2 = 0;
while (_local2 < _local5[_local4].length) {
if (_local5[_local4][_local2]) {
var _local3 = controller.createBlock(createAr[_local6++].myColor);
_local3.row = _local4;
_local3.collumn = _local2;
blocks.push(_local3);
}
_local2++;
}
_local4++;
}
}
function doMove(dir) {
var _local2;
var _local4;
_local4 = controller.bSize * dir;
_local2 = _local4;
for (var _local5 in blocks) {
var _local3 = blocks[_local5].tryXMove(_local4);
if (((_local3 < _local2) && (_local2 > 0)) || ((_local3 > _local2) && (_local2 < 0))) {
_local2 = _local3;
}
}
x = x + _local2;
}
function flip() {
oldX = x;
oldY = y;
var _local9 = bottomY;
for (var _local8 in blocks) {
var _local4 = blocks[_local8];
var _local6 = _local4.collumn;
_local4.collumn = 3 - _local4.row;
_local4.row = _local6;
}
placeBlocksVals();
y = y + (_local9 - bottomY);
placeBlocksVals();
var _local2 = true;
for (var _local8 in blocks) {
if (!controller.blockPosOk(blocks[_local8])) {
_local2 = false;
}
}
if (!_local2) {
var _local7 = false;
var _local5 = false;
var _local3 = 1;
while ((!_local2) && (!_local7)) {
x = oldX + _local3;
placeBlocksVals();
_local2 = true;
for (var _local8 in blocks) {
if (!controller.blockPosOk(blocks[_local8])) {
_local2 = false;
}
}
if (!_local2) {
if (_local3 > 0) {
_local3 = _local3 * -1;
} else if (_local3 < (-(controller.bSize * 2))) {
_local7 = true;
} else if (_local5) {
_local3 = _local3 * -1;
_local3++;
_local5 = false;
} else {
y--;
_local5 = true;
}
}
}
if (!_local2) {
unFlip();
}
}
placeBlocksPhys();
}
function unFlip() {
x = oldX;
y = oldY;
for (var _local4 in blocks) {
var _local2 = blocks[_local4];
var _local3 = _local2.collumn;
_local2.collumn = _local2.row;
_local2.row = 3 - _local3;
}
placeBlocksVals();
}
function isInSpot(tCol, tRow) {
var _local5 = false;
var _local3 = tCol * controller.bSize;
var _local4 = tRow * controller.bSize;
for (var _local6 in blocks) {
var _local2 = blocks[_local6];
if (((((_local2.x + controller.bSize) > _local3) && (_local2.x < (_local3 + controller.bSize))) && ((_local2.y + controller.bSize) > _local4)) && (_local2.y < (_local4 + controller.bSize))) {
_local5 = true;
}
}
return(_local5);
}
}
Symbol 354 MovieClip [__Packages.ShowShape] Frame 0
class ShowShape extends Shape
{
var controller, formation, x, y, placeBlocks, blocks;
function ShowShape (forma, tx, ty, contr) {
super();
controller = contr;
formation = forma;
x = tx;
y = ty;
createBlocks();
placeBlocks();
}
function createBlocks() {
var _local5 = controller.formations[formation];
blocks = [];
var _local4 = 0;
while (_local4 < _local5.length) {
var _local2 = 0;
while (_local2 < _local5[_local4].length) {
if (_local5[_local4][_local2]) {
var _local3 = controller.createShowBlock(controller.usedColors[Math.floor(Math.random() * controller.numColors)]);
_local3.row = _local4;
_local3.collumn = _local2;
blocks.push(_local3);
}
_local2++;
}
_local4++;
}
}
}
Symbol 355 MovieClip [__Packages.Present] Frame 0
class Present extends Shape
{
var num, x, y, controller, collumn, row, height, width, myColor, blocks, myMC, size, placeBlocks;
function Present (n, tx, ty, contr, firstBlock, tCol, tRow, tmyMC) {
super();
num = n;
x = tx;
y = ty;
controller = contr;
collumn = tCol;
row = tRow;
height = (width = 1);
myColor = firstBlock.myColor;
blocks = [];
blocks.push(firstBlock);
firstBlock.collumn = (firstBlock.row = 0);
myMC = tmyMC;
myMC.myPresent = this;
myMC.onRelease = function () {
this.myPresent.clickPresent();
};
setRealColor();
doSize();
myMC.cacheAsBitmap = true;
}
function setRealColor() {
var _local2 = new Color(myMC.bg);
_local2.setRGB(controller.colorsA[myColor]);
_local2 = new Color(myMC.ribbons);
_local2.setRGB(controller.ribbonColorsA[myColor]);
}
function setGreyColor() {
var _local2 = new Color(myMC.bg);
_local2.setRGB(3355443);
_local2 = new Color(myMC.ribbons);
_local2.setRGB(3355443);
}
function doSize() {
size = width * height;
var _local2 = width * controller.bSize;
var _local3 = height * controller.bSize;
setBits(myMC.bg);
setBits(myMC.outLines);
myMC.ribbons.vRibbon._x = (_local2 / 2) - 2;
myMC.ribbons.vRibbon._height = _local3;
myMC.ribbons.hRibbon._y = (_local3 / 2) - 2;
myMC.ribbons.hRibbon._width = _local2;
myMC.ribbons.bow._x = _local2 / 2;
placeBlocksPhys();
}
function placeBlocksPhys() {
myMC._x = x;
myMC._y = y;
}
function findPos() {
x = collumn * controller.bSize;
y = row * controller.bSize;
}
function setBits(mc) {
var _local4 = width * controller.bSize;
var _local3 = height * controller.bSize;
mc.l._height = (mc.r._height = (mc.c._height = _local3 - 8));
mc.t._width = (mc.c._width = (mc.b._width = _local4 - 8));
mc.bl._y = (mc.b._y = (mc.br._y = _local3 - 4));
mc.tr._x = (mc.r._x = (mc.br._x = _local4 - 4));
}
function clickPresent() {
controller.clickPresent(this);
}
function select() {
myMC._alpha = 50;
}
function deselect() {
myMC._alpha = 100;
}
function removeMe() {
myMC._alpha = 100;
myMC.remCount = 0;
var _local2 = new Color(myMC);
_local2.setRGB(16777215);
myMC.onEnterFrame = function () {
if (this.remCount == 3) {
var _local2 = new Color(this);
_local2.setRGB(0);
}
if ((this.remCount++) > 3) {
this.removeMovieClip();
}
};
}
function collideWith(blck) {
return(((((x + (width * controller.bSize)) > blck.x) && (x < (blck.x + blck.size))) && ((y + (height * controller.bSize)) > blck.y)) && (y < (blck.y + blck.size)));
}
function makeFall() {
var _local6 = true;
var _local7 = false;
var _local5 = row;
while (_local6) {
var _local3 = true;
var _local4 = _local5 + height;
var _local2 = collumn;
while (_local2 < (collumn + width)) {
if (!controller.isSlotFree(_local2, _local4)) {
_local3 = false;
}
_local2++;
}
if (_local3) {
_local5++;
_local7 = true;
} else {
_local6 = false;
}
}
if (_local7) {
controller.removePreFromGrid(collumn, row, width, height);
row = _local5;
y = row * controller.bSize;
controller.addPreToGrid(collumn, row, width, height, this);
placeBlocks();
}
return(_local7);
}
function canSwap(pre) {
var _local2 = false;
var _local3 = Math.abs(pre.collumn - collumn) + Math.abs(pre.row - row);
_local2 = ((_local3 == 1) && (size == 1)) && (pre.size == 1);
return(_local2);
}
function touches(pre) {
var _local3 = false;
if ((pre.collumn < (collumn + width)) && (((pre.collumn + pre.width) - 1) >= collumn)) {
if (((pre.row + pre.height) == row) || ((row + height) == pre.row)) {
_local3 = true;
}
}
if ((pre.row < (row + height)) && (((pre.row + pre.height) - 1) >= row)) {
if (((pre.collumn + pre.width) == collumn) || ((collumn + width) == pre.collumn)) {
_local3 = true;
}
}
return(_local3);
}
}
Symbol 356 MovieClip [__Packages.Block] Frame 0
class Block
{
var controller, myMC, myColor, size, x, y;
function Block (d, mc, contr, col) {
controller = contr;
myMC = mc.attachMovie("presentMC", "pmc" + d, d);
myColor = col;
var _local2 = new Color(myMC.bg);
_local2.setRGB(controller.colorsA[myColor]);
_local2 = new Color(myMC.ribbons);
_local2.setRGB(controller.ribbonColorsA[myColor]);
myMC.cacheAsBitmap = true;
size = controller.bSize;
doSize();
}
function setGreyColor() {
var _local2 = new Color(myMC.bg);
_local2.setRGB(3355443);
_local2 = new Color(myMC.ribbons);
_local2.setRGB(3355443);
}
function doSize() {
var _local2 = controller.bSize;
var _local3 = controller.bSize;
setBits(myMC.bg);
setBits(myMC.outLines);
myMC.ribbons.vRibbon._x = (_local2 / 2) - 2;
myMC.ribbons.vRibbon._height = _local3;
myMC.ribbons.hRibbon._y = (_local3 / 2) - 2;
myMC.ribbons.hRibbon._width = _local2;
myMC.ribbons.bow._x = _local2 / 2;
}
function setBits(mc) {
var _local4 = controller.bSize;
var _local3 = controller.bSize;
mc.l._height = (mc.r._height = (mc.c._height = _local3 - 8));
mc.t._width = (mc.c._width = (mc.b._width = _local4 - 8));
mc.bl._y = (mc.b._y = (mc.br._y = _local3 - 4));
mc.tr._x = (mc.r._x = (mc.br._x = _local4 - 4));
}
function tryXMove(movA) {
var _local4 = x;
var _local5;
if (movA > 0) {
_local5 = -1;
} else {
_local5 = 1;
}
x = _local4 + movA;
var _local3 = controller.blockPosOk(this);
while (!_local3) {
movA = movA + _local5;
x = _local4 + movA;
_local3 = controller.blockPosOk(this);
if (movA == 0) {
_local3 = true;
}
}
x = _local4;
return(movA);
}
function tryYMove(movA) {
var _local4 = y;
y = Math.ceil(_local4 + movA);
var _local3 = controller.blockPosOk(this);
while ((!_local3) && (movA > 0)) {
movA--;
y = _local4 + movA;
_local3 = controller.blockPosOk(this);
}
y = _local4;
return(movA);
}
function collideWith(blck) {
return(((((x + size) > blck.x) && (x < (blck.x + blck.size))) && ((y + size) > blck.y)) && (y < (blck.y + blck.size)));
}
}
Symbol 357 MovieClip [__Packages.SoundManager] Frame 0
class SoundManager
{
static var soundsA, mcsA, depthNum, myClip, masterSound;
function SoundManager () {
}
static function setMainClip(mc) {
soundsA = [];
mcsA = [];
depthNum = 0;
myClip = mc;
masterSound = new Sound(myClip);
}
static function addSound(soundID) {
if (soundsA[soundID] == undefined) {
mcsA[soundID] = myClip.createEmptyMovieClip(soundID, depthNum++);
soundsA[soundID] = new Sound(mcsA[soundID]);
mcsA[soundID].mySound = soundsA[soundID];
soundsA[soundID].attachSound(soundID);
}
trace((soundsA[soundID] + ":") + soundID);
}
static function playSound(soundID, startP, reps) {
delete mcsA[soundID].onEnterFrame;
soundsA[soundID].start(startP, reps);
}
static function stopSound(soundID) {
soundsA[soundID].stop();
}
static function setMasterVol(vol) {
masterSound.setVolume(vol);
}
static function setSoundVol(soundID, vol) {
delete mcsA[soundID].onEnterFrame;
soundsA[soundID].setVolume(vol);
}
static function fadeSoundOut(soundID, fadeSpeed) {
mcsA[soundID].fadeSpeed = fadeSpeed;
mcsA[soundID].onEnterFrame = function () {
var _local2 = this.mySound.getVolume();
_local2 = _local2 + this.fadeSpeed;
if (_local2 < 0) {
delete this.onEnterFrame;
this.mySound.stop();
} else {
this.mySound.setVolume(_local2);
}
};
}
static function fadeSoundIn(soundID, targetV, fadeSpeed, startP, reps) {
soundsA[soundID].setVolume(0);
soundsA[soundID].start(startP, reps);
mcsA[soundID].fadeSpeed = fadeSpeed;
mcsA[soundID].targetV = targetV;
mcsA[soundID].onEnterFrame = function () {
var _local2 = this.mySound.getVolume();
_local2 = _local2 + this.fadeSpeed;
if (_local2 >= this.targetV) {
delete this.onEnterFrame;
_local2 = this.targetV;
}
this.mySound.setVolume(_local2);
};
}
static function fadeSound(soundID, targetV, fadeSpeed, startP, reps) {
mcsA[soundID].fadeSpeed = fadeSpeed;
mcsA[soundID].targetV = targetV;
mcsA[soundID].onEnterFrame = function () {
var _local2 = this.mySound.getVolume();
_local2 = _local2 + this.fadeSpeed;
if (((_local2 >= this.targetV) && (this.fadeSpeed > 0)) || ((_local2 <= this.targetV) && (this.fadeSpeed < 0))) {
delete this.onEnterFrame;
_local2 = this.targetV;
}
this.mySound.setVolume(_local2);
};
}
}
Symbol 358 MovieClip [__Packages.InstructionsPresentMC] Frame 0
class InstructionsPresentMC extends MovieClip
{
var height, width, bg, ribbons, outLines;
function InstructionsPresentMC () {
super();
height = (width = 1);
}
function setRealColor(n) {
var _local2 = new Color(bg);
_local2.setRGB(colorsA[n]);
_local2 = new Color(ribbons);
_local2.setRGB(ribbonColorsA[n]);
}
function doSize(w, h) {
width = w;
height = h;
var _local2 = width * bSize;
var _local3 = height * bSize;
setBits(bg);
setBits(outLines);
ribbons.vRibbon._x = (_local2 / 2) - 2;
ribbons.vRibbon._height = _local3;
ribbons.hRibbon._y = (_local3 / 2) - 2;
ribbons.hRibbon._width = _local2;
ribbons.bow._x = _local2 / 2;
}
function setBits(mc) {
var _local4 = width * bSize;
var _local3 = height * bSize;
mc.l._height = (mc.r._height = (mc.c._height = _local3 - 8));
mc.t._width = (mc.c._width = (mc.b._width = _local4 - 8));
mc.bl._y = (mc.b._y = (mc.br._y = _local3 - 4));
mc.tr._x = (mc.r._x = (mc.br._x = _local4 - 4));
}
var colorsA = [3355443, 65280, 16711680, 255, 16776960, 16711935, 6710988];
var ribbonColorsA = [16776960, 16711884, 16777215, 16737792, 16711680, 16777215, 15658547];
var bSize = 21;
}
Symbol 359 MovieClip [__Packages.HighScoreTable] Frame 0
class HighScoreTable
{
var gameName, myTable, canGet, canRankUp;
function HighScoreTable (mc, gName) {
gameName = gName;
myTable = mc;
mc.scoreTable = this;
canGet = (canRankUp = true);
}
function tableIn() {
getScores();
}
function getScores() {
if (canGet) {
canGet = false;
var _local3 = "http://www.utterlysuperb.com/php/getScores.php";
var _local2 = new LoadVars();
_local2.game = gameName;
_local2.sRank = rank;
var _local4 = new LoadVars2(this, receiveScores);
_local2.sendAndLoad(_local3, _local4);
}
}
function receiveScores(lv) {
var _local2 = 0;
while (_local2 < 10) {
var _local3 = myTable.lBoard["score" + _local2];
_local3.rank.text = lv["rank" + _local2];
_local3.name.text = lv["name" + _local2];
_local3.score.text = lv["score" + _local2];
_local2++;
}
if ((rank == 1) && (myTable.lBoard.score0.score.text == "undefined")) {
myTable.warning.gotoAndPlay("in");
} else {
canRankUp = myTable.lBoard.score9.name.text != "";
canGet = true;
doNextBtn();
doPrevBtn();
}
}
function rankUp() {
if (canGet && (canRankUp)) {
rank = rank + 10;
getScores();
}
}
function rankDown() {
if (canGet) {
rank = rank - 10;
if (rank < 1) {
rank = 1;
}
getScores();
}
}
function doPrevBtn() {
if (rank > 10) {
myTable.lBoard.previous.onRelease = function () {
this._parent._parent.scoreTable.rankDown();
};
myTable.lBoard.previous._alpha = 100;
} else {
delete myTable.lBoard.previous.onRelease;
myTable.lBoard.previous._alpha = 60;
}
}
function doNextBtn() {
if (canRankUp) {
myTable.lBoard.next.onRelease = function () {
this._parent._parent.scoreTable.rankUp();
};
myTable.lBoard.next._alpha = 100;
} else {
delete myTable.lBoard.next.onRelease;
myTable.lBoard.next._alpha = 60;
}
}
var rank = 1;
}
Symbol 360 MovieClip [__Packages.LoadVars2] Frame 0
class LoadVars2 extends LoadVars
{
var callOb, callFunc, onLoad;
function LoadVars2 (cOb, cFunc) {
super();
callOb = cOb;
callFunc = cFunc;
onLoad = getInfo;
}
function getInfo(success) {
callFunc.apply(callOb, [this]);
}
}
Symbol 75 MovieClip [Game] Frame 1
#initclip 16
Object.registerClass("Game", Game);
#endinitclip
Symbol 115 MovieClip [InstructionsPresentMC] Frame 1
#initclip 17
Object.registerClass("InstructionsPresentMC", InstructionsPresentMC);
#endinitclip
Symbol 141 MovieClip Frame 30
stop();
_parent.snowFin();
Symbol 159 MovieClip Frame 30
stop();
Symbol 177 MovieClip Frame 1
stop();
Symbol 177 MovieClip Frame 2
function snowFin() {
play();
_parent._parent.removeMCs();
}
stop();
Symbol 177 MovieClip Frame 18
function trySubmitScore() {
if ((canSubmit && (userName.text != "")) && (userName.text.toLowerCase() != "enter name")) {
canSubmit = false;
delete submit.onRelease;
var _local2 = new LoadVars();
_local2.uname = userName.text;
_local2.score = _parent.tScore.text;
_local2.game = "presents_panic";
for (var _local3 in _local2) {
trace((_local3 + ":") + _local2[_local3]);
}
var _local4 = new LoadVars();
_local4.onLoad = function (success) {
trace(success);
gotoScores();
};
_local2.sendAndLoad("http://www.utterlysuperb.com/php/justAddScore.php", _local4);
}
}
function gotoScores() {
trace("_parent._parent:" + _parent._parent);
_parent._parent._parent.gotoScreen("scores", _parent._parent);
}
stop();
canDo = true;
playAgain.onRelease = function () {
if (canDo) {
_parent._parent._parent.gotoScreen("start", _parent._parent);
}
};
canSubmit = true;
submit.onRelease = trySubmitScore;
Symbol 190 Button
on (release) {
_parent._parent.pauseToggle();
}
Symbol 195 Button
on (release) {
_parent._parent.pauseToggle();
}
Symbol 196 MovieClip Frame 1
stop();
Symbol 205 MovieClip Frame 1
if (count == undefined) {
count = 0;
}
Symbol 205 MovieClip Frame 10
if ((count++) > 6) {
stop();
}
Symbol 208 Button
on (release) {
_parent._parent.setUpBomb();
}
Symbol 213 MovieClip Frame 1
stop();
Symbol 218 Button
on (release) {
_parent._parent.soundToggle();
}
Symbol 222 Button
on (release) {
_parent._parent.soundToggle();
}
Symbol 223 MovieClip Frame 1
stop();
Symbol 230 MovieClip Frame 1
stop();
Symbol 235 MovieClip Frame 1
stop();
Symbol 235 MovieClip Frame 2
play();
Symbol 236 MovieClip [interface] Frame 1
bombButton.onRelease = function () {
this._parent._parent.setUpBomb();
};
sq.onRelease = function () {
this._parent._parent.pauseToggle();
};
Symbol 273 MovieClip Frame 1
stop();
Symbol 273 MovieClip Frame 2
stop();
Symbol 273 MovieClip Frame 3
stop();
Symbol 276 MovieClip Frame 1
stop();
Symbol 276 MovieClip Frame 2
stop();
Symbol 276 MovieClip Frame 3
stop();
Symbol 283 MovieClip Frame 1
var i = 0;
while (i < 4) {
this["p" + i].setRealColor(i);
i++;
}
stop();
Symbol 295 MovieClip Frame 1
stop();
p0.setRealColor(1);
p1.setRealColor(3);
Symbol 295 MovieClip Frame 2
play();
p1.doSize(1, 1);
shape0.gotoAndStop(1);
Symbol 295 MovieClip Frame 32
shape0.gotoAndStop(2);
Symbol 295 MovieClip Frame 43
shape0.gotoAndStop(3);
Symbol 295 MovieClip Frame 69
shape0.gotoAndStop(4);
p1.doSize(2, 1);
Symbol 295 MovieClip Frame 83
gotoAndPlay (2);
Symbol 300 MovieClip Frame 1
function setPres() {
p0.setRealColor(2);
p0.doSize(2, 1);
p1.setRealColor(3);
p2.setRealColor(0);
p2.doSize(1, 1);
p3.setRealColor(5);
p3.doSize(2, 2);
p4.setRealColor(5);
p5.setRealColor(1);
p6.setRealColor(4);
p7.setRealColor(6);
p7.doSize(2, 1);
p8.setRealColor(3);
p9.setRealColor(0);
}
stop();
setPres();
Symbol 300 MovieClip Frame 2
play();
setPres();
Symbol 300 MovieClip Frame 42
_parent.makeWhite(p3);
_parent.makeWhite(p4);
Symbol 300 MovieClip Frame 54
p2.doSize(2, 1);
Symbol 300 MovieClip Frame 79
gotoAndPlay (2);
Symbol 303 MovieClip Frame 1
function setPres() {
p0.setRealColor(2);
p0.doSize(2, 1);
p1.setRealColor(3);
p2.setRealColor(0);
p2.doSize(1, 1);
p3.setRealColor(5);
p3.doSize(1, 2);
p4.setRealColor(5);
p5.setRealColor(5);
p6.setRealColor(4);
p7.setRealColor(6);
p7.doSize(2, 1);
p8.setRealColor(3);
p9.setRealColor(0);
p2.doSize(1, 1);
p5.doSize(1, 1);
}
stop();
setPres();
Symbol 303 MovieClip Frame 2
play();
setPres();
Symbol 303 MovieClip Frame 39
p9._alpha = 50;
Symbol 303 MovieClip Frame 55
p2.doSize(2, 1);
p5.doSize(2, 1);
p9._alpha = 100;
Symbol 303 MovieClip Frame 80
gotoAndPlay (2);
Symbol 308 MovieClip Frame 1
var i = 0;
while (i < 4) {
this["p" + i].setRealColor(i);
i++;
}
stop();
Symbol 311 MovieClip Frame 1
function setPres() {
p0.setRealColor(2);
p0.doSize(2, 1);
p1.setRealColor(3);
p2.setRealColor(0);
p2.doSize(1, 1);
p3.setRealColor(5);
p3.doSize(2, 1);
p4.setRealColor(5);
p5.setRealColor(1);
p6.setRealColor(4);
p7.setRealColor(6);
p8.setRealColor(3);
p9.setRealColor(0);
}
function setPower() {
thermometer.pGauge.bar._height = thermometer.pGauge.bg._height - ((thermometer.pGauge.bg._height / 100) * pow);
}
stop();
setPres();
pow = 70;
setPower(pow);
Symbol 311 MovieClip Frame 2
play();
setPres();
pow = 70;
setPower();
bomb.gotoAndStop(2);
Symbol 311 MovieClip Frame 19
space.onEnterFrame = function () {
this._parent.pow--;
this._parent.setPower();
};
Symbol 311 MovieClip Frame 73
bomb.gotoAndStop(3);
Symbol 311 MovieClip Frame 89
_parent.makeWhite(p0);
_parent.makeWhite(p1);
_parent.makeWhite(p2);
_parent.makeWhite(p3);
_parent.makeWhite(p4);
_parent.makeWhite(p9);
pow = pow - 30;
setPower();
Symbol 311 MovieClip Frame 122
gotoAndPlay (2);
Symbol 312 MovieClip Frame 1
function doneIn() {
this.instructionsMC.gotoAndPlay(2);
trace("gfgdd:" + instructionsMC);
}
function makeWhite(mc) {
var _local1 = new Color(mc);
_local1.setRGB(16777215);
}
nextBtn.onRelease = function () {
this._parent._parent.changePage(1);
};
playBtn.onRelease = function () {
if (this._parent._parent.canMove) {
_global.hasPlayed = true;
this._parent._parent.changePage(10);
}
};
if (_global.hasPlayed != true) {
playBtn._visible = false;
}
stop();
Symbol 312 MovieClip Frame 2
stop();
Symbol 312 MovieClip Frame 4
stop();
playBtn._visible = true;
Symbol 313 MovieClip Frame 1
function showMe() {
if (myPage <= numPages) {
gotoAndPlay ("in");
instructions.gotoAndStop(myPage);
}
}
function changePage(val) {
if (canMove) {
canMove = false;
myPage = myPage + val;
gotoAndPlay ("out");
}
}
numPages = 5;
myPage = 1;
canMove = false;
stop();
Symbol 313 MovieClip Frame 19
stop();
canMove = true;
this.instructions.doneIn();
Symbol 313 MovieClip Frame 30
showMe();
Symbol 313 MovieClip Frame 40
_parent._parent.gotoScreen("game", this._parent);
Symbol 314 MovieClip [startScreen] Frame 1
startBtn.onRelease = function () {
instructions.showMe();
delete startBtn.onRelease;
delete meBtn.onRelease;
delete highScoreBtn.onRelease;
};
meBtn.onRelease = function () {
getURL ("http://www.utterlysuperb.com", "_blank");
};
highScoreBtn.onRelease = function () {
_parent.gotoScreen("scores", this._parent);
};
Symbol 326 MovieClip Frame 1
stop();