Frame 1
function initializeVariables() {
if ((initialized == null) || (initialized == false)) {
_global.isZoneAPI = false;
_global.isGameReady = false;
_global.soundVolume = 100;
_global.score_broadcast = 0;
_global.broadcast_time = 0;
_global.tick_frequency = 750;
_global.timePaused = 0;
_global.timePausedStart = 0;
_global.timePausedEnd = 0;
_global.paused = false;
_global.soundOn = true;
_global.lastLevelWon;
_global.isFirstTimeGameStarted = true;
_global.gameOverInitialized = false;
_global.gameBreakInitialized = false;
_global.showPlayAgain = true;
_global.playAgainDownload = true;
_global.showContinue = true;
_global.continueDownload = true;
_global.externalConfig = false;
_global.versionNumber = "1.01";
_global.versionDate = "25/10/04";
_global.newGame = false;
_global.imports = 0;
_global.importedUpsellImages = new Array();
_global.upSellShift = new Array(0, 0);
_global.logic;
_global.gTeeth = 0;
_global.gRound = 0;
_global.gameOn = false;
_global.importingData = false;
_global.gameBoards = new Array();
_global.upsellLink;
_global.upsellWindow;
_global.hintTime;
_global.points_start;
_global.pointsIncrease;
_global.pointsLimit;
_global.pointsGold;
_global.pointsBonusStart;
_global.pointsTimerBonus;
_global.pointsBonusMax;
_global.hintSpd = 45;
_global.numHintCycles = 4;
_global.dropShift;
_global.symbolsInPosition = 0;
_global.lastScore = 0;
_global.veryFirstRound = true;
_global.boardRepeats = new Array();
_global.lastBoard = 0;
_global.repeats = 0;
_global.buriedRulesExplained = false;
_global.goldenIdol = false;
_global.internalConfigXML = new XML("<game name=\"Jewel Quest\" upsell_link=\"http://download.iwin.com/jewelquest/index.html\" upsell_window=\"_blank\" hint_time=\"10\" points_start=\"1\" points_increase=\"1\" points_limit=\"10\" points_gold=\"50\" points_bonus_start=\"250\" points_timer_bonus=\"100\" points_bonus_max=\"3000\"><timing><event name=\"fade_in_board\" speed=\"50\"/><event name=\"fade_out_board\" speed=\"50\"/><event name=\"jewel_removal\" time=\"1500\" call_rate=\"1\" time_between_rows=\"200\"/><event name=\"reveal_buried\" speed=\"75\"/><event name=\"jewels_drop\" time=\"1350\" call_rate=\"1\" time_between_rows=\"150\"/><event name=\"swap_symbols\" call_rate=\"1\" time=\"200\"/><event name=\"remove_matches\" speed=\"30\"/><event name=\"show_score\" call_rate=\"1\" distance=\"15\" opacity=\"50\" time=\"750\"/><event name=\"new_jewels\" time=\"200\" call_rate=\"1\"/><event name=\"tooth_blink\" speed=\"100\"/><event name=\"tooth_smile\" speed=\"25\"/><event name=\"flash_tiles\" speed=\"50\"/><event name=\"shrink_tiles\" speed=\"75\"/><event name=\"play_rnd_sound\" speed=\"1000\"/></timing><setting><event name=\"show_score\" value=\"false\"/></setting><board level=\"1\" overlay_image=\"flash_layout1a.jpg\" tiles_position=\"155,13\" overlay_position=\"145,3\" number_items=\"5\" timer=\"240\" show_upsell=\"Y\" lose_repeat=\"3\"><row number=\"7\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"6\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"5\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"4\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"3\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"2\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"1\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"0\" layout=\"1,1,1,1,1,1,1,1\"/></board><board level=\"2\" overlay_image=\"flash_layout4a.jpg\" tiles_position=\"155,13\" overlay_position=\"145,3\" number_items=\"5\" timer=\"240\" show_upsell=\"Y\" lose_repeat=\"3\"><row number=\"7\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"6\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"5\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"4\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"3\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"2\" layout=\"1,1,1,1,1,1,0,0\"/><row number=\"1\" layout=\"1,1,1,1,0,0,0,0\"/><row number=\"0\" layout=\"1,1,0,0,0,0,0,0\"/></board><board level=\"3\" overlay_image=\"flash_layout2a.jpg\" tiles_position=\"155,13\" overlay_position=\"145,3\" number_items=\"5\" timer=\"300\" show_upsell=\"Y\" lose_repeat=\"3\"><row number=\"7\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"6\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"5\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"4\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"3\" layout=\"2,1,1,1,1,1,1,2\"/><row number=\"2\" layout=\"0,2,1,1,1,1,2,0\"/><row number=\"1\" layout=\"0,0,1,1,1,1,0,0\"/><row number=\"0\" layout=\"0,0,0,1,1,0,0,0\"/></board><board level=\"4\" overlay_image=\"flash_layout3a.jpg\" tiles_position=\"155,13\" overlay_position=\"145,5\" number_items=\"5\" timer=\"300\" show_upsell=\"Y\" lose_repeat=\"3\"><row number=\"7\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"6\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"5\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"4\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"3\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"2\" layout=\"1,1,1,1,1,1,1,1\"/><row number=\"1\" layout=\"2,1,2,1,2,1,2,1\"/><row number=\"0\" layout=\"1,0,1,0,1,0,1,0\"/></board></game>");
_global.internalConfigXML.ignoreWhite;
setUpAudio();
extractConfigData(_global.internalConfigXML.firstChild);
importConfigData();
usePresetJewelConfig = false;
_global.cheats = false;
coLogo.loadMovie("CoLogo.jpg", "GET");
}
}
function importConfigData() {
_global.configXML = new XML();
_global.configXML.ignoreWhite = true;
_global.configXML.onLoad = configLoad;
path = "config.xml";
configXML.load(path);
}
function configLoad(success) {
if (success) {
_global.externalConfig = true;
xmlDoc = this.firstChild;
i = 0;
while (i < xmlDoc.childNodes.length) {
if (xmlDoc.childNodes[i].nodeName == "board") {
_global.gameBoards.length = 0;
_global.boardRepeats.length = 0;
break;
}
i++;
}
} else {
_global.initialized = true;
}
extractConfigData(xmlDoc);
}
function extractConfigData(xmlDoc) {
if (xmlDoc.nodeName == "game") {
_global.gameConfig = xmlDoc;
if (xmlDoc.attributes.upsell_link != null) {
_global.upsellLink = xmlDoc.attributes.upsell_link;
}
if (xmlDoc.attributes.upsell_window != null) {
_global.upsellWindow = xmlDoc.attributes.upsell_window;
}
if (xmlDoc.attributes.hint_time != null) {
_global.hintTime = Number(xmlDoc.attributes.hint_time);
}
_global.points_start = "1";
if (xmlDoc.attributes.points_increase != null) {
_global.pointsIncrease = Number(xmlDoc.attributes.points_increase);
}
if (xmlDoc.attributes.points_limit != null) {
_global.pointsLimit = Number(xmlDoc.attributes.points_limit);
}
if (xmlDoc.attributes.points_gold != null) {
_global.pointsGold = Number(xmlDoc.attributes.points_gold);
}
if (xmlDoc.attributes.points_bonus_start != null) {
_global.pointsBonusStart = Number(xmlDoc.attributes.points_bonus_start);
}
if (xmlDoc.attributes.points_timer_bonus != null) {
_global.pointsTimerBonus = Number(xmlDoc.attributes.points_timer_bonus);
}
if (xmlDoc.attributes.points_bonus_max != null) {
_global.pointsBonusMax = Number(xmlDoc.attributes.points_bonus_max);
}
i = 0;
while (i < xmlDoc.childNodes.length) {
if (xmlDoc.childNodes[i].nodeName == "board") {
gameBoard = xmlDoc.childNodes[i];
_global.boardRepeats.push(Number(gameBoard.attributes.lose_repeat));
_global.gameBoards.push(new Array(Number(gameBoard.attributes.level), gameBoard.attributes.overlay_image, gameBoard.attributes.overlay_position, gameBoard.attributes.tiles_position, Number(gameBoard.attributes.number_items), Number(gameBoard.attributes.timer), gameBoard.attributes.show_upsell));
tmpRowNum = gameBoard.childNodes.length;
tmpColumnNum = gameBoard.childNodes[0].attributes.layout.split(",").length;
_global.gameBoards[_global.gameBoards.length - 1].push(tmpColumnNum, tmpRowNum);
boardLayout = new Array(tmpColumnNum);
x = 0;
while (x < boardLayout.length) {
boardLayout[x] = new Array(tmpRowNum);
x++;
}
j = 0;
while (j < gameBoard.childNodes.length) {
if (gameBoard.childNodes[j].nodeName == "row") {
tmpRow = gameBoard.childNodes[j].attributes.number;
tmpRows = gameBoard.childNodes[j].attributes.layout.split(",");
y = 0;
while (y < tmpRows.length) {
boardLayout[y][tmpRow] = tmpRows[y];
y++;
}
}
j++;
}
_global.gameBoards[_global.gameBoards.length - 1].push(boardLayout);
} else if (xmlDoc.childNodes[i].nodeName == "timing") {
cycleTiming = 0;
while (cycleTiming < xmlDoc.childNodes[i].childNodes.length) {
switch (xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.name) {
case "fade_in_board" :
_global.fade_in_board_spd = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.speed);
break;
case "fade_out_board" :
_global.fade_out_board_spd = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.speed);
break;
case "jewel_removal" :
_global.jewels_remove_btwRows = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.time_between_rows);
_global.jewels_remove_rate = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.call_rate);
_global.jewels_remove_time = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.time);
break;
case "reveal_buried" :
_global.reveal_buried_spd = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.speed);
break;
case "jewels_drop" :
_global.jewels_drop_btwRows = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.time_between_rows);
_global.jewels_drop_rate = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.call_rate);
_global.jewels_drop_time = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.time);
break;
case "swap_symbols" :
_global.swap_symbols_rate = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.call_rate);
_global.swap_symbols_time = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.time);
break;
case "remove_matches" :
_global.remove_matches_spd = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.speed);
break;
case "show_score" :
_global.show_score_rate = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.call_rate);
_global.show_score_time = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.time);
_global.show_score_dist = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.distance);
_global.show_score_alpha = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.opacity);
break;
case "new_jewels" :
_global.new_jewels_rate = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.call_rate);
_global.new_jewels_time = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.time);
break;
case "tooth_blink" :
_global.tooth_blink_spd = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.speed);
break;
case "tooth_smile" :
_global.tooth_smile_spd = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.speed);
break;
case "flash_tiles" :
_global.flash_tiles_spd = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.speed);
break;
case "shrink_tiles" :
_global.shrink_tiles_spd = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.speed);
break;
case "play_rnd_sound" :
_global.play_rnd_sound_spd = Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.speed);
}
cycleTiming++;
}
} else if (xmlDoc.childNodes[i].nodeName == "setting") {
cycleTiming = 0;
while (cycleTiming < xmlDoc.childNodes[i].childNodes.length) {
switch (xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.name) {
case "show_score" :
if (xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.value == "true") {
_global.showScore = true;
} else {
_global.showScore = false;
}
break;
case "import_additional_upsell" :
if (xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.value == "true") {
_global.importingData = true;
_global.upSellShift[0] = _global.upSellShift[0] + Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.upsell_shift.split(",")[0]);
_global.upSellShift[1] = _global.upSellShift[1] + Number(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.upsell_shift.split(",")[1]);
m = 0;
while (m < xmlDoc.childNodes[i].childNodes[cycleTiming].childNodes.length) {
if (xmlDoc.childNodes[i].childNodes[cycleTiming].childNodes[m].nodeName == "import") {
tmpImportNode = xmlDoc.childNodes[i].childNodes[cycleTiming].childNodes[m];
importPath = tmpImportNode.attributes.import_url;
_root.createEmptyMovieClip("import_bmp_" + _global.imports, 900 + _global.imports);
myMC = eval ("import_bmp_" + _global.imports);
myMC.loadMovie(importPath);
while (myMC.getBytesLoaded() < myMC.getBytesTotal()) {
}
_global.importedUpsellImages.push(myMC);
myMC._x = tmpImportNode.attributes.import_location.split(",")[0];
myMC._y = tmpImportNode.attributes.import_location.split(",")[1];
myMC._alpha = 0;
_global.imports++;
}
m++;
}
_global.importingData = false;
}
break;
case "upsell_playagain" :
tmpImportNode = xmlDoc.childNodes[i].childNodes[cycleTiming];
_global.showPlayAgain = Boolean(tmpImportNode.attributes.value);
_global.playAgainDownload = Boolean(tmpImportNode.attributes.upsell_playagain_download);
break;
case "upsell_continue" :
tmpImportNode = xmlDoc.childNodes[i].childNodes[cycleTiming];
_global.showContinue = Boolean(tmpImportNode.attributes.value);
_global.continueDownload = Boolean(tmpImportNode.attributes.upsell_continue_download);
break;
case "zone_api" :
_global.isZoneAPI = Boolean(xmlDoc.childNodes[i].childNodes[cycleTiming].attributes.value);
}
cycleTiming++;
}
}
i++;
}
}
if (_global.externalConfig) {
_global.initialized = true;
_global.externalConfig = false;
}
}
function toggleScoreDisplay() {
if (_global.showScore == true) {
_global.showScore = false;
} else {
_global.showScore = true;
}
}
function Symbol() {
this.symbolType = 0;
this.inPlay = true;
this.moveDist = 0;
this.moved = 0;
this.origX;
this.origY;
}
function Tile() {
}
function ScoreTile() {
this.moveDist = 0;
this.fadeTo = 100;
this._score = 0;
}
function findReleaseTile() {
rr = 0;
while (rr < _global.logic.NUM_ROWS) {
cc = 0;
while (cc < _global.logic.NUM_COLUMNS) {
tmpTile = eval (((("tileContainer.tile_" + cc) + "_") + rr) + ".tile");
if (tmpTile.hitTest(_root._xmouse, _root._ymouse, true)) {
if (_global.logic.testAdjacentSpaces(_global.pick1._col, _global.pick1._row, tmpTile._col, tmpTile._row)) {
tmpTile.onPress();
}
}
cc++;
}
rr++;
}
}
function message(txt) {
_global.gameOn = false;
cancelHintAnimation();
attachMovie("Msg", "dialog", 100, {_msg:txt});
}
function setUpAudio() {
_global.snd_silence = new Sound();
_global.snd_addbonus = new Sound();
_global.snd_ambient = new Sound();
_global.snd_blink = new Sound();
_global.snd_bonus = new Sound();
_global.snd_click = new Sound();
_global.snd_dialog = new Sound();
_global.snd_efx1 = new Sound();
_global.snd_efx2 = new Sound();
_global.snd_efx3 = new Sound();
_global.snd_efx4 = new Sound();
_global.snd_efx5 = new Sound();
_global.snd_efx6 = new Sound();
_global.snd_efx7 = new Sound();
_global.snd_efx8 = new Sound();
_global.snd_endgame = new Sound();
_global.snd_fall = new Sound();
_global.snd_gameover = new Sound();
_global.snd_gemclick = new Sound();
_global.snd_gemland = new Sound();
_global.snd_go = new Sound();
_global.snd_hint = new Sound();
_global.snd_match = new Sound();
_global.snd_match2 = new Sound();
_global.snd_mismatch = new Sound();
_global.snd_ready = new Sound();
_global.snd_statue = new Sound();
_global.snd_timesup = new Sound();
_global.snd_ting = new Sound();
_global.snd_tock = new Sound();
_global.snd_buriedappear = new Sound();
_global.snd_buriedmatched = new Sound();
_global.snd_iwin = new Sound();
_global.snd_efx1.setVolume(50);
_global.snd_efx2.setVolume(50);
_global.snd_efx3.setVolume(50);
_global.snd_efx4.setVolume(50);
_global.snd_efx5.setVolume(50);
_global.snd_efx6.setVolume(50);
_global.snd_efx7.setVolume(50);
_global.snd_efx8.setVolume(50);
_global.snd_silence.attachSound("silence");
_global.snd_addbonus.attachSound("spjewel_addbonus");
_global.snd_ambient.attachSound("spjewel_amb");
_global.snd_blink.attachSound("spjewel_blink");
_global.snd_bonus.attachSound("spjewel_bonus");
_global.snd_click.attachSound("spjewel_click");
_global.snd_dialog.attachSound("spjewel_dialog");
_global.snd_efx1.attachSound("spjewel_efx1");
_global.snd_efx2.attachSound("spjewel_efx2");
_global.snd_efx3.attachSound("spjewel_efx3");
_global.snd_efx4.attachSound("spjewel_efx4");
_global.snd_efx5.attachSound("spjewel_efx5");
_global.snd_efx6.attachSound("spjewel_efx6");
_global.snd_efx7.attachSound("spjewel_efx7");
_global.snd_efx8.attachSound("spjewel_efx8");
_global.snd_endgame.attachSound("spjewel_endgame");
_global.snd_fall.attachSound("spjewel_fall");
_global.snd_gameover.attachSound("spjewel_gameover");
_global.snd_gemclick.attachSound("spjewel_gemclick");
_global.snd_gemland.attachSound("spjewel_gemland");
_global.snd_go.attachSound("spjewel_go");
_global.snd_hint.attachSound("spjewel_hint");
_global.snd_match.attachSound("spjewel_match");
_global.snd_match2.attachSound("spjewel_match2");
_global.snd_mismatch.attachSound("spjewel_mismatch");
_global.snd_ready.attachSound("spjewel_ready");
_global.snd_statue.attachSound("spjewel_statue");
_global.snd_timesup.attachSound("spjewel_timesup");
_global.snd_ting.attachSound("spjewel_ting");
_global.snd_tock.attachSound("spjewel_tock");
_global.snd_buriedappear.attachSound("buriedappear");
_global.snd_buriedmatched.attachSound("buriedmatched");
_global.snd_iwin.attachSound("iwinshort");
}
importBoard._visible = false;
initializeVariables();
if (usePresetJewelConfig) {
_global.boardStartConfig = new Array(8);
_global.boardStartConfig[7] = new Array(1, 2, 2, 5, 1, 1, 1, 1);
_global.boardStartConfig[6] = new Array(2, 3, 3, 6, 1, 1, 1, 1);
_global.boardStartConfig[5] = new Array(3, 1, 6, 5, 1, 1, 1, 1);
_global.boardStartConfig[4] = new Array(1, 3, 3, 6, 1, 1, 1, 1);
_global.boardStartConfig[3] = new Array(3, 2, 6, 5, 1, 1, 1, 1);
_global.boardStartConfig[2] = new Array(1, 2, 5, 6, 1, 1, 1, 1);
_global.boardStartConfig[1] = new Array(1, 2, 5, 4, 1, 1, 1, 1);
_global.boardStartConfig[0] = new Array(1, 4, 4, 1, 1, 1, 1, 1);
}
stop();
Logic = function (numColumns, numRows, numSymbols) {
this.LAST_OPTION_NUM = 2;
this.NUM_DIFF_ITEMS = numSymbols;
if (this.NUM_DIFF_ITEMS < 3) {
tmpMsg = "Error: Config file must specify a minimum of 3 symbols for each board.";
message(tmpMsg);
} else if (this.NUM_DIFF_ITEMS > 6) {
tmpMsg = "Error: Config file must specify a maximum of 6 symbols for each board.";
message(tmpMsg);
}
this.NORMAL_SPACE = 0;
this.GOLD_SPACE = 1;
this.SPACE_OUT_OF_PLAY = -99;
this.BURIED_ITEM = -1;
this.UNBURIED_SPACE = -98;
this.EMPTY_SPACE = 0;
this.NUM_COLUMNS = numColumns;
this.NUM_ROWS = numRows;
this.NUM_BOARD_SPACES = this.NUM_COLUMNS * this.NUM_ROWS;
this.NUM_QUEUE = 200;
this.NUM_ITEMS = this.NUM_COLUMNS * this.NUM_QUEUE;
this.SPACE_WIDTH = 40;
this.SPACE_HEIGHT = 40;
this.SPACE_ITEM_OFFSET = 2;
this.ITEM_MOVED = 1;
this.ITEM_MATCHED = 1;
this.MAX_BOARD_FILL_RETRYS = 1;
this.MIN_NUM_IN_SEQUENCE = 3;
this._movedQueued = new Array(this.NUM_COLUMNS);
this._shuffle = new Array();
this._initializing;
this._score;
this._prevScores;
this._board = new Array(this.NUM_COLUMNS);
this._tiles = new Array(this.NUM_COLUMNS);
this._matches = new Array(this.NUM_COLUMNS);
this._moved = new Array(this.NUM_COLUMNS);
this._queues = new Array(this.NUM_COLUMNS);
this._colPointers = new Array(this.NUM_COLUMNS);
this._movesFrom = new Array();
this._movesTo = new Array();
this._matchNum;
this._multiplier;
this._badges;
this._playingOption2;
this._pointsStart = _global.pointsStart;
this._pointsIncrease = _global.pointsIncrease;
this._pointsLimit = _global.pointsLimit;
this._pointsGold = _global.pointsGold;
this._pointsTimerBonus = _global.pointsTimerBonus;
this._pointsBonusMax = _global.pointsBonusMax;
this._pointsBonusStart = _global.pointsBonusStart;
i = 0;
while (i < this._board.length) {
this._board[i] = new Array(this.NUM_ROWS);
i++;
}
i = 0;
while (i < this._tiles.length) {
this._tiles[i] = new Array(this.NUM_ROWS);
i++;
}
i = 0;
while (i < this._matches.length) {
this._matches[i] = new Array(this.NUM_ROWS);
i++;
}
i = 0;
while (i < this._moved.length) {
this._moved[i] = new Array(this.NUM_ROWS);
i++;
}
i = 0;
while (i < this._queues.length) {
this._queues[i] = new Array(this.NUM_QUEUE);
i++;
}
i = 0;
while (i < this._movedQueued.length) {
this._movedQueued[i] = new Array(this.NUM_ROWS);
i++;
}
this.matchedSymbols = new Array();
this.activeScores = new Array();
this.jewelsToMove = new Array();
this.possibleMoves = new Array();
this.matchesBelow = new Array(this.NUM_COLUMNS);
mb = 0;
while (mb < this.matchesBelow.length) {
this.matchesBelow[mb] = new Array(this.NUM_ROWS);
mb++;
}
this.colMatches = new Array(this.NUM_COLUMNS);
this.colMatches2 = new Array(this.NUM_COLUMNS);
this.outOfPlayTiles = new Array(this.NUM_COLUMNS);
this.snapShot = new Array(this.NUM_COLUMNS);
ss = 0;
while (ss < this.snapShot.length) {
this.snapShot[ss] = new Array(this.NUM_ROWS);
ss++;
}
this.tilesArray = new Array(this.NUM_COLUMNS);
ta = 0;
while (ta < this.tilesArray.length) {
this.tilesArray[ta] = new Array(this.NUM_ROWS);
ta++;
}
this.scoreArray = new Array(this.NUM_COLUMNS);
sa = 0;
while (sa < this.scoreArray.length) {
this.scoreArray[sa] = new Array(this.NUM_ROWS);
sa++;
}
};
Logic.prototype = new Object();
Logic.prototype.getPointsStart = function () {
return(this._pointsStart);
};
Logic.prototype.getPointsIncrease = function () {
return(this._pointsIncrease);
};
Logic.prototype.getPointsLimit = function () {
return(this._pointsLimit);
};
Logic.prototype.getPointsGold = function () {
return(this._pointsGold);
};
Logic.prototype.getPointsTimerBonus = function () {
return(this._pointsTimerBonus);
};
Logic.prototype.getPointsBonusStart = function () {
return(this._pointsBonusStart);
};
Logic.prototype.getPointsBonusMax = function () {
return(_pointsBonusMax);
};
Logic.prototype.newGame = function () {
this._movesFrom = new Array();
this._movesTo = new Array();
this.setScore(_global.lastScore);
this._playingOption2 = true;
var _local3 = 0;
while (_local3 < this.NUM_COLUMNS) {
this._colPointers[_local3] = 0;
var _local4 = 0;
while (_local4 < this.NUM_ROWS) {
this._board[_local3][_local4] = 0;
this._tiles[_local3][_local4] = this.NORMAL_SPACE;
this._matches[_local3][_local4] = 0;
this._moved[_local3][_local4] = 0;
_local4++;
}
_local4 = 0;
while (_local4 < this.NUM_QUEUE) {
this._queues[_local3][_local4] = 0;
_local4++;
}
_local3++;
}
};
Logic.prototype.getSnapShot = function () {
ro = 0;
while (ro < this.NUM_ROWS) {
cm = 0;
while (cm < this.NUM_COLUMNS) {
eval (((("symbolContainer.symbol_" + cm) + "_") + ro) + ".symbol").updateArrayLoc();
cm++;
}
ro++;
}
};
Logic.prototype.syncSymbolToTileStatus = function () {
ro = 0;
while (ro < this.NUM_ROWS) {
cm = 0;
while (cm < this.NUM_COLUMNS) {
this.snapShot[cm][ro]._status = this.tilesArray[cm][ro]._status;
cm++;
}
ro++;
}
};
Logic.prototype.initTilesArray = function () {
ro = 0;
while (ro < this.NUM_ROWS) {
cm = 0;
while (cm < this.NUM_COLUMNS) {
tmpTile = eval (((("tileContainer.tile_" + cm) + "_") + ro) + ".tile");
this.tilesArray[cm][ro] = tmpTile;
cm++;
}
ro++;
}
};
Logic.prototype.initScoreArray = function () {
ro = 0;
while (ro < this.NUM_ROWS) {
cm = 0;
while (cm < this.NUM_COLUMNS) {
scrTile = eval (((("scoreContainer.scoreTile_" + cm) + "_") + ro) + ".scoreTile");
this.scoreArray[cm][ro] = scrTile;
cm++;
}
ro++;
}
};
Logic.prototype.setScore = function (value) {
this._score = value;
this._prevScore = _score;
_root.score.score.text = this._score;
return(this._score);
};
Logic.prototype.initTiles = function (configArray) {
var _local3 = 0;
while (_local3 < this.NUM_COLUMNS) {
var _local2 = 0;
while (_local2 < this.NUM_ROWS) {
if (configArray[_local3][_local2] == "0") {
this._tiles[_local3][_local2] = this.SPACE_OUT_OF_PLAY;
} else if (configArray[_local3][_local2] == "1") {
this._tiles[_local3][_local2] = this.NORMAL_SPACE;
} else if (configArray[_local3][_local2] == "2") {
this._tiles[_local3][_local2] = this.BURIED_ITEM;
}
_local2++;
}
_local3++;
}
};
Logic.prototype.markBoardOOP = function (configArray) {
var _local3 = 0;
while (_local3 < this.NUM_COLUMNS) {
var _local2 = 0;
while (_local2 < this.NUM_ROWS) {
if (configArray[_local3][_local2] == "0") {
this._board[_local3][_local2] = this.SPACE_OUT_OF_PLAY;
}
_local2++;
}
_local3++;
}
};
Logic.prototype.fillQueue = function (items) {
var _local5 = items.length;
var _local3 = 0;
var _local2 = 0;
var _local4 = 0;
while (_local3 < _local5) {
this._queues[_local2][_local4] = items[_local3];
_local3++;
_local2++;
if (_local2 == this.NUM_COLUMNS) {
_local4++;
_local2 = 0;
}
}
return((_local2 == this.NUM_COLUMNS) && (_local4 == this.NUM_ROWS));
};
Logic.prototype.resetMatches = function () {
var _local3 = 0;
while (_local3 < this.NUM_ROWS) {
var _local2 = 0;
while (_local2 < this.NUM_COLUMNS) {
this._matches[_local2][_local3] = 0;
_local2++;
}
_local3++;
}
};
Logic.prototype.resetMoved = function () {
var _local3 = 0;
while (_local3 < this.NUM_ROWS) {
var _local2 = 0;
while (_local2 < this.NUM_COLUMNS) {
this._moved[_local2][_local3] = 0;
_local2++;
}
_local3++;
}
};
Logic.prototype.getItemFromQueue = function (col) {
if (this._colPointers[col] < this.NUM_QUEUE) {
var _local3 = this._queues[col][this._colPointers[col]];
this._colPointers[col]++;
return(_local3);
}
return(0);
};
Logic.prototype.initBoard = function () {
this._initializing = true;
while (true) {
this.fillBoard();
var _local4 = 0;
while (_local4 < this.NUM_ROWS) {
var _local3 = 0;
while (_local3 < this.NUM_COLUMNS) {
this._moved[_local3][_local4] = this.ITEM_MOVED;
_local3++;
}
_local4++;
}
while (this.testMovedTableForMatches() > 0) {
this.removeMatches();
this.fillBoard();
}
if (this.findNumMovesLeft(true)) {
break;
}
_local4 = 0;
while (_local4 < this.NUM_ROWS) {
var _local3 = 0;
while (_local3 < this.NUM_COLUMNS) {
this._board[_local3][_local4] = 0;
_local3++;
}
_local4++;
}
}
if (usePresetJewelConfig) {
var _local4 = 0;
while (_local4 < this.NUM_ROWS) {
var _local3 = 0;
while (_local3 < this.NUM_COLUMNS) {
this._board[_local3][_local4] = _global.boardStartConfig[_local4][_local3];
_local3++;
}
_local4++;
}
}
this._initializing = false;
};
Logic.prototype.calcMoveInfo = function () {
this.jewelsToMove.length = 0;
cm = 0;
while (cm < this.colMatches.length) {
this.colMatches[cm] = 0;
cm++;
}
cm2 = 0;
while (cm2 < this.colMatches.length) {
this.colMatches2[cm2] = 0;
cm2++;
}
oopt = 0;
while (oopt < this.outOfPlayTiles.length) {
this.outOfPlayTiles[oopt] = 0;
oopt++;
}
ssRow = 0;
while (ssRow < this.NUM_ROWS) {
ssCol = 0;
while (ssCol < this.NUM_COLUMNS) {
if ((this._matches[ssCol][ssRow] == 1) && (this._tiles[ssCol][ssRow] != this.UNBURIED_SPACE)) {
if (ssRow == 0) {
this.matchesBelow[ssCol][ssRow] = 1;
} else {
this.matchesBelow[ssCol][ssRow] = this.matchesBelow[ssCol][ssRow - 1] + 1;
}
this.colMatches[ssCol]++;
this.colMatches2[ssCol]++;
} else if (ssRow == 0) {
this.matchesBelow[ssCol][ssRow] = 0;
} else {
this.matchesBelow[ssCol][ssRow] = this.matchesBelow[ssCol][ssRow - 1] + 0;
}
if (this._tiles[ssCol][ssRow] == this.BURIED_ITEM) {
this.matchesBelow[ssCol][ssRow] = 0;
}
if (this._board[ssCol][ssRow] == 0) {
this.outOfPlayTiles[ssCol]++;
this.colMatches[ssCol]--;
}
ssCol++;
}
ssRow++;
}
this.getSnapShot();
};
Logic.prototype.fillBoard = function () {
this.resetMoved();
var _local2 = false;
var _local3 = true;
while (_local2 || (_local3)) {
_local3 = false;
_local2 = false;
r = 0;
while (r < this.NUM_ROWS) {
c = 0;
while (c < this.NUM_COLUMNS) {
if (this._board[c][r] == this.EMPTY_SPACE) {
if (r < (this.NUM_ROWS - 1)) {
this.SlideDownItem(c, r);
}
if (this._board[c][r] > this.EMPTY_SPACE) {
this._moved[c][r] = this.ITEM_MOVED;
_local2 = true;
}
}
c++;
}
r++;
}
}
count = 0;
_local3 = true;
while (count < this.MAX_BOARD_FILL_RETRYS) {
while (_local2 || (_local3)) {
_local3 = false;
_local2 = false;
r = 0;
while (r < this.NUM_ROWS) {
c = 0;
while (c < this.NUM_COLUMNS) {
if (this._board[c][r] == this.EMPTY_SPACE) {
if (r < (this.NUM_ROWS - 1)) {
this.SlideDownItem(c, r);
} else {
this._board[c][r] = this.getItemFromQueue(c);
}
if (this._board[c][r] > this.EMPTY_SPACE) {
this._moved[c][r] = this.ITEM_MOVED;
_local2 = true;
}
}
c++;
}
r++;
}
}
if (this._initializing || (this.findNumMovesLeft(false))) {
break;
}
count++;
_local3 = true;
rr = 0;
while (rr < this.NUM_ROWS) {
cc = 0;
while (cc < this.NUM_COLUMNS) {
if (this._movedQueued[cc][rr] == 1) {
this._board[cc][rr] = this.EMPTY_SPACE;
}
cc++;
}
rr++;
}
}
this.calcMoveInfo();
};
Logic.prototype.swap = function (fromCol, fromRow, toCol, toRow) {
_firstMatchOfSwap = true;
if (this.TestAdjacentSpaces(fromCol, fromRow, toCol, toRow)) {
if ((this._board[fromCol][fromRow] == this.EMPTY_SPACE) || (this._board[toCol][toRow] == this.EMPTY_SPACE)) {
return(-1);
}
if ((this._tiles[fromCol][fromRow] <= this.BURIED_ITEM) || (this._tiles[toCol][toRow] <= this.BURIED_ITEM)) {
return(-2);
}
swapItem = this._board[fromCol][fromRow];
this._board[fromCol][fromRow] = this._board[toCol][toRow];
this._board[toCol][toRow] = swapItem;
numMatched = this.TestForSwapMatch(fromCol, fromRow, toCol, toRow);
if (numMatched == 0) {
swapItem = this._board[fromCol][fromRow];
this._board[fromCol][fromRow] = this._board[toCol][toRow];
this._board[toCol][toRow] = swapItem;
return(0);
}
return(numMatched);
}
return(-3);
};
Logic.prototype.testForSwapMatch = function (fromCol, fromRow, toCol, toRow) {
this.resetMatches();
this.doMatch(fromCol, fromRow);
this.doMatch(toCol, toRow);
var _local2 = this.countMatches();
this._multiplier = 0;
this._matchNum = 0;
this.scoreMatches(_local2);
return(_local2);
};
Logic.prototype.testMovedTableForMatches = function () {
this.resetMatches();
r = 0;
while (r < this.NUM_ROWS) {
c = 0;
while (c < this.NUM_COLUMNS) {
if (this._moved[c][r] == this.ITEM_MOVED) {
this.doMatch(c, r);
}
c++;
}
r++;
}
var _local2 = this.countMatches();
this.scoreMatches(_local2);
return(_local2);
};
Logic.prototype.scoreMatches = function (numMatches) {
if (this._initializing) {
return(undefined);
}
if (numMatches >= 3) {
this._matchNum++;
this._multiplier = this._multiplier + (numMatches - 2);
if (this._multiplier > this.getPointsLimit()) {
this._multiplier = this.getPointsLimit();
}
var r = 0;
while (r < this.NUM_ROWS) {
var c = 0;
while (c < this.NUM_COLUMNS) {
if (this._matches[c][r] == this.ITEM_MATCHED) {
if (this._tiles[c][r] > this.BURIED_ITEM) {
this.addScore(this._multiplier);
tmpTle = eval (((("scoreContainer.scoreTile_" + c) + "_") + r) + ".scoreTile");
tmpTle._score = tmpTle._score + this._multiplier;
}
}
c++;
}
r++;
}
}
};
Logic.prototype.doMatch = function (col, row) {
var _local2 = 1;
var _local7 = this._board[col][row];
if ((_local7 == 0) || (_local7 == -99)) {
return(undefined);
}
var _local10 = this.rightmost(_local7, col, row);
var _local9 = _local10 - 1;
while (_local9 >= 0) {
if (this._board[_local9][row] != _local7) {
break;
}
_local2++;
_local9--;
}
if (_local2 >= 3) {
var _local5 = _local2 - 1;
while (_local5 >= 0) {
this._matches[_local10 - _local5][row] = 1;
this.setGoal(_local10 - _local5, row);
_local5--;
}
}
_local2 = 1;
var _local11 = this.leftmost(_local7, col, row);
_local9 = _local11 + 1;
while (_local9 < this.NUM_COLUMNS) {
if (this._board[_local9][row] != _local7) {
break;
}
_local2++;
_local9++;
}
if (_local2 >= 3) {
var _local5 = _local2 - 1;
while (_local5 >= 0) {
this._matches[_local11 + _local5][row] = 1;
this.setGoal(_local11 + _local5, row);
_local5--;
}
}
_local2 = 1;
var _local12 = this.topmost(_local7, col, row);
var _local8 = _local12 - 1;
while (_local8 >= 0) {
if (this._board[col][_local8] != _local7) {
break;
}
_local2++;
_local8--;
}
if (_local2 >= 3) {
var _local6 = _local2 - 1;
while (_local6 >= 0) {
this._matches[col][_local12 - _local6] = 1;
this.setGoal(col, _local12 - _local6);
_local6--;
}
}
_local2 = 1;
var _local13 = this.bottommost(_local7, col, row);
_local8 = _local13 + 1;
while (_local8 < this.NUM_ROWS) {
if (this._board[col][_local8] != _local7) {
break;
}
_local2++;
_local8++;
}
if (_local2 >= 3) {
var _local6 = _local2 - 1;
while (_local6 >= 0) {
this._matches[col][_local13 + _local6] = 1;
this.setGoal(col, _local13 + _local6);
_local6--;
}
}
};
Logic.prototype.leftmost = function (testItem, col, row) {
var _local3 = col;
var _local2 = col - 1;
while (_local2 >= 0) {
if (this._board[_local2][row] != testItem) {
return(_local3);
}
_local3 = _local2;
_local2--;
}
return(_local3);
};
Logic.prototype.rightmost = function (testItem, col, row) {
var _local3 = col;
var _local2 = col + 1;
while (_local2 < this.NUM_COLUMNS) {
if (this._board[_local2][row] != testItem) {
return(_local3);
}
_local3 = _local2;
_local2++;
}
return(_local3);
};
Logic.prototype.bottommost = function (testItem, col, row) {
var _local3 = row;
var _local2 = row - 1;
while (_local2 >= 0) {
if (this._board[col][_local2] != testItem) {
return(_local3);
}
_local3 = _local2;
_local2--;
}
return(_local3);
};
Logic.prototype.topmost = function (testItem, col, row) {
var _local3 = row;
var _local2 = row + 1;
while (_local2 < this.NUM_ROWS) {
if (this._board[col][_local2] != testItem) {
return(_local3);
}
_local3 = _local2;
_local2++;
}
return(_local3);
};
Logic.prototype.setGoal = function (c, r) {
if (this._initializing) {
return(undefined);
}
if (this._playingOption2) {
if (this._tiles[c][r] == this.NORMAL_SPACE) {
this._tiles[c][r] = this.GOLD_SPACE;
this.addScore(this.getPointsGold());
tmpTle = eval (((("scoreContainer.scoreTile_" + c) + "_") + r) + ".scoreTile");
tmpTle._score = tmpTle._score + this.getPointsGold();
}
}
};
Logic.prototype.numGoalsLeft = function () {
var _local4 = 0;
var _local3 = 0;
while (_local3 < this.NUM_ROWS) {
var _local2 = 0;
while (_local2 < this.NUM_COLUMNS) {
if (this._playingOption2) {
if ((this._tiles[_local2][_local3] == 0) || (this._tiles[_local2][_local3] == this.BURIED_ITEM)) {
_local4++;
}
} else {
_local4 = 1;
}
_local2++;
}
_local3++;
}
return(_local4);
};
Logic.prototype.countMatches = function () {
var _local4 = 0;
var _local3 = 0;
while (_local3 < this.NUM_ROWS) {
var _local2 = 0;
while (_local2 < this.NUM_COLUMNS) {
if (this._matches[_local2][_local3] != 0) {
_local4++;
}
_local2++;
}
_local3++;
}
return(_local4);
};
Logic.prototype.removeMatches = function () {
r = 0;
while (r < this.NUM_ROWS) {
c = 0;
while (c < this.NUM_COLUMNS) {
if (this._board[c][r] != this.SPACE_OUT_OF_PLAY) {
if ((this._matches[c][r] == this.ITEM_MATCHED) && (this._initializing || (this._tiles[c][r] > this.BURIED_ITEM))) {
this._board[c][r] = this.EMPTY_SPACE;
}
}
c++;
}
r++;
}
};
Logic.prototype.testAdjacentSpaces = function (col1, row1, col2, row2) {
if (col1 == col2) {
return((row1 == (row2 - 1)) || (row1 == (row2 + 1)));
}
if (row1 == row2) {
return((col1 == (col2 - 1)) || (col1 == (col2 + 1)));
}
return(false);
};
Logic.prototype.findNumMovesLeft = function (firstFoundReturn) {
this._movesFrom = new Array();
this._movesTo = new Array();
r = this.NUM_ROWS - 1;
while (r >= 0) {
c = 0;
while (c < (this.NUM_COLUMNS - 1)) {
if ((((((this._board[c][r] != 0) && (this._board[c + 1][r] != 0)) && (this._board[c][r] != this.SPACE_OUT_OF_PLAY)) && (this._board[c + 1][r] != this.SPACE_OUT_OF_PLAY)) && (this._tiles[c][r] != this.BURIED_ITEM)) && (this._tiles[c + 1][r] != this.BURIED_ITEM)) {
leftPiece = this._board[c][r];
rightPiece = this._board[c + 1][r];
if ((((((((((c <= (this.NUM_COLUMNS - 4)) && (leftPiece == this._board[c + 2][r])) && (leftPiece == this._board[c + 3][r])) || (((r >= 2) && (leftPiece == this._board[c + 1][r - 1])) && (leftPiece == this._board[c + 1][r - 2]))) || ((((r >= 1) && (r <= (this.NUM_ROWS - 2))) && (leftPiece == this._board[c + 1][r - 1])) && (leftPiece == this._board[c + 1][r + 1]))) || (((r <= (this.NUM_ROWS - 3)) && (leftPiece == this._board[c + 1][r + 1])) && (leftPiece == this._board[c + 1][r + 2]))) || (((c >= 2) && (rightPiece == this._board[c - 1][r])) && (rightPiece == this._board[c - 2][r]))) || (((r >= 2) && (rightPiece == this._board[c][r - 1])) && (rightPiece == this._board[c][r - 2]))) || ((((r >= 1) && (r <= (this.NUM_ROWS - 2))) && (rightPiece == this._board[c][r - 1])) && (rightPiece == this._board[c][r + 1]))) || (((r <= (this.NUM_ROWS - 3)) && (rightPiece == this._board[c][r + 1])) && (rightPiece == this._board[c][r + 2]))) {
this._movesFrom.push(new Array(c, r));
this._movesTo.push(new Array(c + 1, r));
if (firstFoundReturn) {
return(true);
}
}
}
c++;
}
r--;
}
var r = (this.NUM_ROWS - 1);
while (r >= 1) {
var c = 0;
while (c < this.NUM_COLUMNS) {
if ((((((this._board[c][r] != 0) && (this._board[c][r - 1] != 0)) && (this._board[c][r] != this.SPACE_OUT_OF_PLAY)) && (this._board[c][r - 1] != this.SPACE_OUT_OF_PLAY)) && (this._tiles[c][r] != this.BURIED_ITEM)) && (this._tiles[c][r - 1] != this.BURIED_ITEM)) {
var _local3 = this._board[c][r];
var _local2 = this._board[c][r - 1];
if ((((((((((r >= 3) && (_local3 == this._board[c][r - 2])) && (_local3 == this._board[c][r - 3])) || (((c >= 2) && (_local3 == this._board[c - 1][r - 1])) && (_local3 == this._board[c - 2][r - 1]))) || ((((c >= 1) && (c <= (this.NUM_COLUMNS - 2))) && (_local3 == this._board[c - 1][r - 1])) && (_local3 == this._board[c + 1][r - 1]))) || (((c <= (this.NUM_COLUMNS - 3)) && (_local3 == this._board[c + 1][r - 1])) && (_local3 == this._board[c + 2][r - 1]))) || (((r <= (this.NUM_ROWS - 3)) && (_local2 == this._board[c][r + 1])) && (_local2 == this._board[c][r + 2]))) || (((c >= 2) && (_local2 == this._board[c - 1][r])) && (_local2 == this._board[c - 2][r]))) || ((((c >= 1) && (c <= (this.NUM_COLUMNS - 2))) && (_local2 == this._board[c - 1][r])) && (_local2 == this._board[c + 1][r]))) || (((c <= (this.NUM_COLUMNS - 3)) && (_local2 == this._board[c + 1][r])) && (_local2 == this._board[c + 2][r]))) {
this._movesFrom.push(new Array(c, r));
this._movesTo.push(new Array(c, r - 1));
if (firstFoundReturn) {
return(true);
}
}
}
c++;
}
r--;
}
return(this._movesFrom.length > 0);
};
Logic.prototype.shuffle = function () {
if (this._shuffle == null) {
this._shuffle = new Array(this.NUM_ITEMS);
}
var _local2 = 0;
while (_local2 < this.NUM_ITEMS) {
this._shuffle[_local2] = random(this.NUM_DIFF_ITEMS) + 1;
_local2++;
}
this.fillQueue(this._shuffle);
this.initBoard();
};
Logic.prototype.addScore = function (value) {
this._score = this._score + value;
this._prevScores = this._score;
_root.score.score.text = this._score;
return(this._score);
};
Logic.prototype.SlideDownItem = function (c, r) {
if (this._initializing) {
if (this._board[c][r + 1] == this.SPACE_OUT_OF_PLAY) {
addtor = 2;
while ((r + addtor) < this.NUM_ROWS) {
if (this._board[c][r + addtor] != this.SPACE_OUT_OF_PLAY) {
this._board[c][r] = this._board[c][r + addtor];
this._board[c][r + addtor] = this.EMPTY_SPACE;
break;
}
addtor++;
}
} else {
this._board[c][r] = this._board[c][r + 1];
this._board[c][r + 1] = this.EMPTY_SPACE;
}
} else if ((this._board[c][r + 1] >= this.EMPTY_SPACE) && ((this._tiles[c][r + 1] > this.BURIED_ITEM) || (this._tiles[c][r + 1] == this.UNBURIED_SPACE))) {
this._board[c][r] = this._board[c][r + 1];
this._board[c][r + 1] = this.EMPTY_SPACE;
this._moved[c][r + 1] = this.ITEM_MOVED;
}
};
Logic.prototype.clearUnburied = function () {
didAnyClear = false;
r = 0;
while (r < this.NUM_ROWS) {
c = 0;
while (c < this.NUM_COLUMNS) {
if (this._tiles[c][r] == this.UNBURIED_SPACE) {
this._tiles[c][r] = this.NORMAL_SPACE;
tt = eval (((("_root.tileContainer.tile_" + c) + "_") + r) + ".tile");
tt._status = 0;
ts = _root.getSymbol(tt, ((("logic.clearUnburied @ [" + c) + "][") + r) + "]");
ts._status = 0;
didAnyClear = true;
}
c++;
}
r++;
}
return(didAnyClear);
};
Symbol.prototype = new MovieClip();
Symbol.prototype.setSymbolType = function (num) {
this.symbolType = num;
this.gotoAndStop("_" + num);
};
Symbol.prototype.updateArrayLoc = function () {
_global.logic.snapShot[Number(this._x / 40)][Number(7 - (this._y / 40))] = this;
};
Symbol.prototype.bury = function (bool) {
if (bool) {
this.symbol.gotoAndStop("buried");
} else if (this.symbol._currentframe == 8) {
this.symbol.gotoAndPlay(9);
} else {
this.symbol.gotoAndStop(1);
}
};
Symbol.prototype.showHint = function () {
if (this.symbol._currentframe == 1) {
this.symbol.gotoAndPlay(2);
}
};
Symbol.prototype.remove = function () {
if (this.symbol._currentframe == 1) {
this.symbol.gotoAndPlay(5);
}
};
Symbol.prototype.setLoc = function (x, y) {
this._x = x;
this._y = y;
};
Symbol.prototype.setMove = function (xdist) {
this.moveDist = xdist;
};
Tile.prototype = new MovieClip();
Tile.prototype.setLoc = function (x, y) {
this._x = x;
this._y = y;
};
Tile.prototype.onPress = function () {
cancelHintAnimation();
if ((_global.gameOn && (this._status >= 0)) && (getSymbol(this).symbolType > 0)) {
if (_global.pick1 != null) {
if (_global.logic.testAdjacentSpaces(_global.pick1._col, _global.pick1._row, this._col, this._row)) {
_global.pick2 = this;
_global.symbol2 = getSymbol(pick2);
_global.pick1.hilt._visible = false;
_global.gameOn = false;
_root.swapSymbols(_global.symbol1, _global.symbol2);
return(undefined);
}
_global.snd_gemclick.setVolume(_global.soundVolume);
_global.snd_gemclick.start();
_global.pick1.hilt._visible = false;
startHintAnimation();
}
if (_global.pick1 != this) {
_global.pick1 = this;
_global.symbol1 = getSymbol(pick1, "press tile");
_global.snd_gemclick.setVolume(_global.soundVolume);
_global.snd_gemclick.start();
this.hilt._visible = true;
} else {
delete _global.pick1;
delete _global.symbol1;
}
}
};
Tile.prototype.onReleaseOutside = function () {
_root.findReleaseTile();
};
ScoreTile.prototype = new MovieClip();
ScoreTile.prototype.setLoc = function (x, y) {
this._x = x;
this._y = y;
this.origX = this.score._x;
this.origY = this.score._y;
};
Object.registerClass("Symbol", Symbol);
Object.registerClass("Tile", Tile);
Object.registerClass("ScoreTile", ScoreTile);
base.onRollOut = function () {
cursor.hide();
};
base.onRollOver = function () {
cursor.show();
};
_global.infoListener = new Object();
_global.infoListener.onKeyDown = function () {
if ((Key.isDown(17) && (Key.isDown(16))) && (Key.isDown(86))) {
_root.message(((("Jewel Quest\rRelease: " + _global.versionNumber) + newline) + "Dated: ") + _global.versionDate);
}
if (((Key.isDown(17) && (Key.isDown(16))) && (Key.isDown(87))) && (_global.cheats == true)) {
forceWin();
}
if ((Key.isDown(17) && (Key.isDown(16))) && (Key.isDown(83))) {
toggleScoreDisplay();
}
};
Key.addListener(infoListener);
Array.prototype.trace = function () {
for (ob in this) {
this.trace_eval(this[ob], ob, 1);
}
};
Array.prototype.trace_eval = function (val, object, level) {
s = " ";
space = "";
i = 0;
while (level > i) {
space = space + s;
i++;
}
val_type = typeof(val);
switch (val_type) {
case "string" :
break;
case "object" :
for (ob in val) {
this.trace_eval(val[ob], ob, level + 1);
}
break;
case "function" :
}
};
Frame 2
function getTilesSnapShot() {
_global.lastC = _global.logic.NUM_COLUMNS;
_global.lastR = _global.logic.NUM_ROWS;
_global.boardSnapShot = getBoardSnapShot();
_global.lastGamesTiles = new Array(_global.logic.NUM_COLUMNS);
lgt = 0;
while (lgt < lastGamesTiles.length) {
lastGamesTiles[lgt] = new Array(_global.logic.NUM_ROWS);
lgt++;
}
lgtr = 0;
while (lgtr < _global.logic.NUM_ROWS) {
lgtc = 0;
while (lgtc < _global.logic.NUM_COLUMNS) {
lastGamesTiles[lgtc][lgtr] = _global.logic._tiles[lgtc][lgtr];
lgtc++;
}
lgtr++;
}
}
function loadBoard(path, loc) {
locArray = loc.split(",");
importBoard._x = -1000;
importBoard._y = -1000;
_global.xloc = locArray[0];
_global.yloc = locArray[1];
importBoard._alpha = 0;
importBoard.loadMovie(path);
}
function removeOldSymbols() {
r1 = 0;
while (r1 < _global.lastR) {
c1 = 0;
while (c1 < _global.lastC) {
symbolContainer.removeMovieClip(eval ((("symbolContainer.symbol_" + c1) + "_") + r1));
c1++;
}
r1++;
}
}
function removeOldTiles() {
r2 = 0;
while (r2 < _global.lastR) {
c2 = 0;
while (c2 < _global.lastC) {
tileContainer.removeMovieClip(eval ((("tileContainer.tile_" + c2) + "_") + r2));
c2++;
}
r2++;
}
}
function removeOldScoreTiles() {
r3 = 0;
while (r3 < _global.lastR) {
c3 = 0;
while (c3 < _global.lastC) {
scoreContainer.removeMovieClip(eval ((("scoreContainer.tile_" + c3) + "_") + r3));
c3++;
}
r3++;
}
}
function positionSymbols() {
qq = 100;
r4 = 0;
while (r4 < _global.logic.NUM_ROWS) {
c4 = 0;
while (c4 < _global.logic.NUM_COLUMNS) {
tmpSymbol = _global.logic._board[c4][r4];
tmpStatus = _global.logic._tiles[c4][r4];
symbolContainer.createEmptyMovieClip((("symbol_" + c4) + "_") + r4, qq--);
mc = eval ((("symbolContainer.symbol_" + c4) + "_") + r4);
mc.attachMovie("Symbol", "symbol", 0, {_type:tmpSymbol, _col:c4, _row:r4, _status:tmpStatus});
c4++;
}
r4++;
}
}
function positionTiles() {
qqq = 0;
r5 = 0;
while (r5 < _global.logic.NUM_ROWS) {
c5 = 0;
while (c5 < _global.logic.NUM_COLUMNS) {
tileContainer.createEmptyMovieClip((("tile_" + c5) + "_") + r5, qqq++);
mc = eval ((("tileContainer.tile_" + c5) + "_") + r5);
mc.attachMovie("Tile", "tile", 0, {_col:c5, _row:r5, _status:_global.logic._tiles[c5][r5]});
c5++;
}
r5++;
}
}
function positionScoreTiles() {
qqqq = 0;
r6 = 0;
while (r6 < _global.logic.NUM_ROWS) {
c6 = 0;
while (c6 < _global.logic.NUM_COLUMNS) {
scoreContainer.createEmptyMovieClip((("scoreTile_" + c6) + "_") + r6, qqqq++);
mc = eval ((("scoreContainer.scoreTile_" + c6) + "_") + r6);
mc.attachMovie("ScoreTile", "scoreTile", 0, {_col:c6, _row:r6});
c6++;
}
r6++;
}
}
function showImports() {
im = 0;
while (im < _global.importedUpsellImages.length) {
_global.importedUpsellImages[im]._visible = true;
_global.importedUpsellImages[im]._alpha = 100;
im++;
}
}
function hideImports() {
im = 0;
while (im < _global.importedUpsellImages.length) {
_global.importedUpsellImages[im]._visible = false;
im++;
}
}
function showOrHideSymbols(showStatus) {
r4 = 0;
while (r4 < _global.logic.NUM_ROWS) {
c4 = 0;
while (c4 < _global.logic.NUM_COLUMNS) {
mc = eval ((("symbolContainer.symbol_" + c4) + "_") + r4);
mc.symbol._visible = showStatus;
c4++;
}
r4++;
}
r5 = 0;
while (r5 < _global.logic.NUM_ROWS) {
c5 = 0;
while (c5 < _global.logic.NUM_COLUMNS) {
mc = eval ((("tileContainer.tile_" + c5) + "_") + r5);
mc.tile._visible = showStatus;
c5++;
}
r5++;
}
}
function pause() {
if (_global.gameOn) {
if (!_global.paused) {
_global.paused = true;
pauseScreen._visible = true;
_global.soundVolume = 0;
_global.timePausedStart = getTimer();
showOrHideSymbols(false);
}
}
}
function resume() {
if (_global.paused) {
_global.paused = false;
pauseScreen._visible = false;
if (_global.soundOn) {
_global.soundVolume = 100;
} else {
_global.soundVolume = 0;
}
_global.timePausedEnd = getTimer();
_global.timePaused = _global.timePaused + (_global.timePausedEnd - _global.timePausedStart);
showOrHideSymbols(true);
}
}
function muteOn() {
_global.soundOn = false;
_global.soundVolume = 0;
}
function muteOff() {
_global.soundOn = true;
_global.soundVolume = 100;
}
_global.isGameReady = true;
_global.initFrame3 = false;
rules._x = rules._x + Number(_global.upSellShift[0]);
rules._y = rules._y + Number(_global.upSellShift[1]);
score._x = 35 + Number(_global.upSellShift[0]);
score._y = 252 + Number(_global.upSellShift[1]);
score_title._x = score_title._x + Number(_global.upSellShift[0]);
score_title._y = score_title._y + Number(_global.upSellShift[1]);
showImports();
score.score.text = _global.logic._score;
symbolContainer._visible = false;
tileContainer._visible = false;
importBoard._visible = false;
_global.board = (gRound + gameBoards.length) % gameBoards.length;
if (_global.board != _global.lastBoard) {
_global.lastLevelWon = true;
if (_global.logic._score != null) {
_global.lastScore = _global.logic._score;
}
_global.repeats = 0;
_global.lastBoard = _global.board;
} else {
_global.lastLevelWon = false;
if (_global.logic._score != null) {
_global.lastScore = 0;
}
_global.repeats++;
if (_global.repeats > _global.boardRepeats[_global.board]) {
_global.gRound++;
_global.board = (gRound + gameBoards.length) % gameBoards.length;
_global.repeats = 0;
_global.lastBoard = _global.board;
}
}
if (_global.veryFirstRound) {
_global.veryFirstRound = false;
rules.gotoAndStop("intro");
} else if (gameBoards[board][6] == "N") {
rules.gotoAndStop("intro");
} else if (_global.lastLevelWon) {
if (_global.showContinue) {
rules.gotoAndStop("continue");
} else {
hideImports();
gotoAndPlay ("Game");
}
} else if (_global.showPlayAgain) {
rules.gotoAndStop("playAgain");
} else {
hideImports();
gotoAndPlay ("Game");
}
tilesArray = gameBoards[board][3].split(",");
_global.xtiles = tilesArray[0];
_global.ytiles = tilesArray[1];
getTilesSnapShot();
_global.logic = new Logic(gameBoards[board][7], gameBoards[board][8], gameBoards[board][4]);
if (!_global.newGame) {
_global.logic.newGame();
_global.logic.initTiles(gameBoards[board][gameBoards[board].length - 1]);
_global.logic.shuffle();
_global.logic.markBoardOOP(gameBoards[board][gameBoards[board].length - 1]);
_global.boardTimer = gameBoards[board][5] * 1000;
symbolContainer._visible = false;
symbolContainer._x = _global.xtiles;
symbolContainer._y = _global.ytiles;
tileContainer._visible = false;
tileContainer._x = _global.xtiles;
tileContainer._y = _global.ytiles;
_global.dropShift = _global.ytiles;
scoreContainer._x = _global.xtiles;
scoreContainer._y = _global.ytiles;
positionSymbols();
positionTiles();
positionScoreTiles();
}
stop();
Frame 3
function loadGameBoard() {
loadBoard(gameBoards[board][1], gameBoards[board][2]);
_global.fib = setInterval(fadeInBoard, _global.fade_in_board_spd);
}
function clearGameBoard() {
_global.fob = setInterval(fadeOutBoard, _global.fade_out_board_spd);
}
function fadeOutBoard() {
if (importBoard._alpha > 0) {
importBoard._alpha = importBoard._alpha - 10;
} else {
if (_global.lastScore == 0) {
score.score.text = _global.lastScore;
_global.gteeth = 0;
teeth.gotoAndStop("teeth_" + _global.gTeeth);
if (_global.goldenIdol) {
_global.goldenIdol = false;
golden_idol.gotoAndStop(1);
}
}
importBoard._x = -1000;
importBoard._y = -1000;
clearInterval(_global.fob);
delete _global.fob;
loadGameBoard();
}
}
function fadeInBoard() {
amtBoardLoaded = importBoard.getBytesLoaded();
boardTotal = importBoard.getBytesTotal();
if (amtBoardLoaded >= boardTotal) {
importBoard._x = _global.xloc;
importBoard._y = _global.yloc;
importBoard._visible = true;
if (importBoard._alpha < 100) {
importBoard._alpha = importBoard._alpha + 10;
} else {
clearInterval(_global.fib);
delete _global.fib;
setUpGame();
}
}
}
function setDrop() {
rdrp = 0;
while (rdrp < _global.logic.NUM_ROWS) {
cdrp = 0;
while (cdrp < _global.logic.NUM_COLUMNS) {
if (_global.logic._tiles[cdrp][rdrp] != _global.logic.BURIED_ITEM) {
_global.setupDrop = eval (((("tileContainer.tile_" + cdrp) + "_") + rdrp) + ".tile._y") - eval (((("symbolContainer.symbol_" + cdrp) + "_") + rdrp) + ".symbol._y");
break;
}
cdrp++;
}
rdrp++;
}
if (_global.setupDrop == 0) {
_global.setupDrop = (_global.logic.NUM_ROWS * 40) + _global.ytiles;
}
}
function clearOldGame() {
snapShot = _global.boardSnapShot;
cogr = 0;
while (cogr < _global.lastR) {
cogc = 0;
while (cogc < _global.lastC) {
snapShot[cogc][cogr].moveDist = clearDrop;
snapShot[cogc][cogr].origY = snapShot[cogc][cogr]._y;
snapShot[cogc][cogr].origX = snapShot[cogc][cogr]._x;
cogc++;
}
cogr++;
}
dropSymbolsOutOfPlace(_global.jewels_remove_time, _global.jewels_remove_btwRows);
}
function getBoardSnapShot() {
ss = new Array(_global.lastC);
q = 0;
while (q < ss.length) {
ss[q] = new Array(_global.lastR);
q++;
}
ro = 0;
while (ro < _global.lastR) {
cm = 0;
while (cm < _global.lastC) {
tmpSymb = getSymbol(eval (((("tileContainer.tile_" + cm) + "_") + ro) + ".tile"), "getBoardSnapShot");
ss[cm][ro] = tmpSymb;
cm++;
}
ro++;
}
return(ss);
}
function animateRemoval(as2row, timeToTake) {
if (_global.moving == false) {
_global.moving = true;
percentComplete = ((getTimer() - _global.aniRemovalStart) - (as2row * _global.jewels_remove_btwRows)) / timeToTake;
if (percentComplete > 1) {
percentComplete = 1;
}
if (percentComplete == 1) {
c = 0;
while (c < _global.logic.NUM_COLUMNS) {
mc = _global.boardSnapShot[c][as2row];
mc._y = mc.origY + mc.moveDist;
mc.moveDist = 0;
c++;
}
aniInterval = eval ("_global.aniRemove" + as2row);
clearInterval(aniInterval);
delete aniInterval;
if (as2row == 7) {
animateTiles(true);
}
} else {
c = 0;
while (c < _global.logic.NUM_COLUMNS) {
mc = _global.boardSnapShot[c][as2row];
mc._y = mc.origY + (mc.moveDist * percentComplete);
c++;
}
}
_global.moving = false;
updateAfterEvent();
}
}
function resetGame() {
if (_global.newGame) {
scoreContainer._visible = false;
symbolContainer._visible = false;
tileContainer._visible = false;
_global.logic.newGame();
_global.logic.initTiles(gameBoards[board][gameBoards[board].length - 1]);
_global.logic.shuffle();
_global.logic.markBoardOOP(gameBoards[board][gameBoards[board].length - 1]);
_global.boardTimer = gameBoards[board][5] * 1000;
darkGrid._x = _global.xtiles;
darkGrid._y = _global.ytiles - 1;
symbolContainer._x = _global.xtiles;
symbolContainer._y = _global.ytiles;
tileContainer._x = _global.xtiles;
tileContainer._y = _global.ytiles;
_global.dropShift = _global.ytiles;
scoreContainer._x = _global.xtiles;
scoreContainer._y = _global.ytiles;
removeOldSymbols();
removeOldTiles();
removeOldScoreTiles();
positionSymbols();
positionTiles();
positionScoreTiles();
if (_global.newGame) {
clearGameBoard();
}
}
}
function setUpGameReady() {
if (buriedSymbols()) {
_global.aniBuried = setInterval(animateBuriedSymbols, _global.reveal_buried_spd);
_global.snd_buriedappear.setVolume(_global.soundVolume);
_global.snd_buriedappear.start();
} else {
timer.timer_head.gotoAndPlay(9);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
dropSymbolsIntoPlace(_global.jewels_drop_time, _global.jewels_drop_btwRows);
}
}
function dropSymbolsIntoPlace(time, perRow) {
_global.aniSetupStart = getTimer();
_global.aniSetup0 = setInterval(animateSetup2, _global.jewels_drop_rate, 0, time - (perRow * 7));
_global.aniSetup1 = setInterval(animateSetup2, _global.jewels_drop_rate, 1, time - (perRow * 6));
_global.aniSetup2 = setInterval(animateSetup2, _global.jewels_drop_rate, 2, time - (perRow * 5));
_global.aniSetup3 = setInterval(animateSetup2, _global.jewels_drop_rate, 3, time - (perRow * 4));
_global.aniSetup4 = setInterval(animateSetup2, _global.jewels_drop_rate, 4, time - (perRow * 3));
_global.aniSetup5 = setInterval(animateSetup2, _global.jewels_drop_rate, 5, time - (perRow * 2));
_global.aniSetup6 = setInterval(animateSetup2, _global.jewels_drop_rate, 6, time - (perRow * 1));
_global.aniSetup7 = setInterval(animateSetup2, _global.jewels_drop_rate, 7, time);
}
function dropSymbolsOutOfPlace(time, perRow) {
_global.dropsCalled = 1;
_global.aniRemovalStart = getTimer();
_global.aniRemove0 = setInterval(animateRemoval, _global.jewels_remove_rate, 0, time);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
_global.callDrops = setInterval(staggerRemoveAnimations, perRow, time);
}
function staggerRemoveAnimations(time) {
if (_global.dropsCalled < _global.logic.NUM_ROWS) {
switch (_global.dropsCalled) {
case 0 :
_global.aniRemove0 = setInterval(animateRemoval, _global.jewels_remove_rate, 0, time);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
break;
case 1 :
_global.aniRemove1 = setInterval(animateRemoval, _global.jewels_remove_rate, 1, time);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
break;
case 2 :
_global.aniRemove2 = setInterval(animateRemoval, _global.jewels_remove_rate, 2, time);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
break;
case 3 :
_global.aniRemove3 = setInterval(animateRemoval, _global.jewels_remove_rate, 3, time);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
break;
case 4 :
_global.aniRemove4 = setInterval(animateRemoval, _global.jewels_remove_rate, 4, time);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
break;
case 5 :
_global.aniRemove5 = setInterval(animateRemoval, _global.jewels_remove_rate, 5, time);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
break;
case 6 :
_global.aniRemove6 = setInterval(animateRemoval, _global.jewels_remove_rate, 6, time);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
break;
case 7 :
_global.aniRemove7 = setInterval(animateRemoval, _global.jewels_remove_rate, 7, time);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
}
_global.dropsCalled++;
} else {
clearInterval(_global.callDrops);
delete _global.callDrops;
}
}
function setUpGame() {
_global.waitForSymbolPositioning = setInterval(waitForPosition, 200);
}
function waitForPosition() {
totalSymbols = _global.logic.NUM_COLUMNS * _global.logic.NUM_ROWS;
if (_global.symbolsInPosition == totalSymbols) {
clearInterval(_global.waitForSymbolPositioning);
delete _global.waitForSymbolPositioning;
_global.newGame = false;
_global.logic.initTilesArray();
_global.logic.initScoreArray();
symbolContainer._visible = true;
tileContainer._visible = true;
scoreContainer._visible = true;
setDrop();
setUpGameReady();
}
}
function removeBuriedDialog() {
_global.buriedDialogVisible = false;
removeMovieClip(bd);
timer.timer_head.gotoAndPlay(9);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
dropSymbolsIntoPlace(_global.jewels_drop_time, _global.jewels_drop_btwRows);
_global.buriedRulesExplained = true;
}
function buriedSymbols() {
r = 0;
while (r < _global.logic.NUM_ROWS) {
c = 0;
while (c < _global.logic.NUM_COLUMNS) {
if (_global.logic._tiles[c][r] == _global.logic.BURIED_ITEM) {
return(true);
}
c++;
}
r++;
}
return(false);
}
function animateBuriedSymbols() {
numMod = 0;
r = 0;
while (r < _global.logic.NUM_ROWS) {
c = 0;
while (c < _global.logic.NUM_COLUMNS) {
tmpSymbol = eval (((("symbolContainer.symbol_" + c) + "_") + r) + ".symbol.symbol");
if (tmpSymbol != null) {
if (tmpSymbol._alpha < 100) {
tmpSymbol._alpha = tmpSymbol._alpha + 20;
numMod++;
}
}
c++;
}
r++;
}
if (numMod == 0) {
clearInterval(_global.aniBuried);
delete _global.aniBuried;
var dlgX;
var dlgY;
rbd = _global.logic.NUM_ROWS - 1;
while (rbd >= 0) {
cbd = 0;
while (cbd < _global.logic.NUM_COLUMNS) {
if (_global.logic._tiles[cbd][rbd] == _global.logic.BURIED_ITEM) {
dlgX = (Number(_global.xtiles) + Number(40 * cbd)) + 34;
dlgY = (Number(_global.ytiles) + Number(40 * (7 - rbd))) + 6;
break;
}
cbd++;
}
rbd--;
}
if (!_global.buriedRulesExplained) {
attachMovie("buriedDialog", "bd", 99);
_global.buriedDialogVisible = true;
bd._x = dlgX;
bd._y = dlgY;
bd._alpha = 100;
} else {
timer.timer_head.gotoAndPlay(9);
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
dropSymbolsIntoPlace(_global.jewels_drop_time, _global.jewels_drop_btwRows);
}
}
}
function hintFxn() {
_global.snd_hint.setVolume(_global.soundVolume);
_global.snd_hint.start();
hintNum = random(_global.logic._movesFrom.length);
_global.hs1 = getSymbol(eval (((("tileContainer.tile_" + _global.logic._movesFrom[hintNum][0]) + "_") + _global.logic._movesFrom[hintNum][1]) + ".tile"), "hintFxn1");
_global.hs2 = getSymbol(eval (((("tileContainer.tile_" + _global.logic._movesTo[hintNum][0]) + "_") + _global.logic._movesTo[hintNum][1]) + ".tile"), "hintFxn2");
clearInterval(_global.hintInterval);
delete _global.hintInterval;
_global.animateHint = setInterval(aniHint, _global.hintSpd);
}
function aniHint() {
if (_global.hs1.symbol._currentframe == 1) {
_global.hs1.symbol.gotoAndStop(2);
_global.hs2.symbol.gotoAndStop(2);
} else if (_global.hs1.symbol._currentframe == 2) {
_global.hs1.symbol.gotoAndStop(3);
_global.hs2.symbol.gotoAndStop(3);
} else if (_global.hs1.symbol._currentframe == 3) {
_global.hs1.symbol.gotoAndStop(4);
_global.hs2.symbol.gotoAndStop(4);
} else if (_global.hs1.symbol._currentframe == 4) {
_global.hs1.symbol.gotoAndStop(1);
_global.hs2.symbol.gotoAndStop(1);
hintCycle++;
if (hintCycle == _global.numHintCycles) {
clearInterval(_global.animateHint);
delete _global.animateHint;
_global.hintInterval = setInterval(hintFxn, _global.hintTime * 1000);
hintCycle = 0;
}
}
}
function resetHintAnimation() {
hintCycle = 0;
clearInterval(_global.hintInterval);
clearInterval(_global.animateHint);
delete _global.hintInterval;
delete _global.animateHint;
_global.hintInterval = setInterval(hintFxn, _global.hintTime * 1000);
if (_global.hs1.symbol._currentframe < 8) {
_global.hs1.symbol.gotoAndStop(1);
}
if (_global.hs2.symbol._currentframe < 8) {
_global.hs2.symbol.gotoAndStop(1);
}
}
function cancelHintAnimation() {
hintCycle = 0;
clearInterval(_global.hintInterval);
clearInterval(_global.animateHint);
delete _global.hintInterval;
delete _global.animateHint;
if (_global.hs1.symbol._currentframe < 8) {
_global.hs1.symbol.gotoAndStop(1);
}
if (_global.hs2.symbol._currentframe < 8) {
_global.hs2.symbol.gotoAndStop(1);
}
}
function startHintAnimation() {
resetHintAnimation();
}
function animateSetup2(as2row, timeToTake) {
percentComplete = (getTimer() - _global.aniSetupStart) / timeToTake;
if (percentComplete >= 1) {
c = 0;
while (c < _global.logic.NUM_COLUMNS) {
mc = eval (((("symbolContainer.symbol_" + c) + "_") + as2row) + ".symbol");
mc.moveDist = 0;
mc._y = eval (((("tileContainer.tile_" + c) + "_") + as2row) + ".tile._y");
c++;
}
_global.snd_fall.setVolume(_global.soundVolume);
_global.snd_fall.start();
aniInterval = eval ("_global.aniSetup" + as2row);
clearInterval(aniInterval);
delete aniInterval;
if (as2row == 7) {
showReadyMsg();
_global.logic.getSnapShot();
}
} else {
c = 0;
while (c < _global.logic.NUM_COLUMNS) {
if (_global.logic._tiles[c][as2row] != _global.logic.BURIED_ITEM) {
mc = eval (((("symbolContainer.symbol_" + c) + "_") + as2row) + ".symbol");
amtToMove = (setupDrop * percentComplete) - mc.moveDist;
mc.moveDist = mc.moveDist + amtToMove;
mc._y = mc._y + amtToMove;
}
c++;
}
}
_global.moving = false;
updateAfterEvent();
}
function startTimer() {
_global.hintInterval = setInterval(hintFxn, _global.hintTime * 1000);
_global.timerStarted = getTimer();
_global.animateTimer = setInterval(tick, _global.tick_frequency);
}
function tick() {
if (!_global.paused) {
timePassed = (getTimer() - _global.timerStarted) - _global.timePaused;
timeLeft = _global.boardTimer - timePassed;
percentLeft = timeLeft / _global.boardTimer;
timerXPos = percentLeft * 148;
timer.timer._x = timerXPos;
if (timeLeft <= 15000) {
timer.eye._visible = true;
_global.snd_tock.setVolume(_global.soundVolume);
_global.snd_tock.start();
}
if ((timeLeft <= 60000) && (tilesFlashed == false)) {
tilesFlashed = true;
animateTiles(false);
}
if (timePassed >= _global.boardTimer) {
timesUp();
}
if (_global.isZoneAPI && (_global.score_broadcast > 0)) {
_global.broadcast_time = _global.broadcast_time + _global.tick_frequency;
if (_global.broadcast_time >= _global.score_broadcast) {
_global.broadcast_time = 0;
var _local2 = ((("<game><score>" + score.score.text) + "</score><time>") + Math.round(timePassed / 1000)) + "</time></game>";
fscommand ("ScoreBroadcast", _local2);
}
}
}
}
function timesUp() {
initTimesUp();
if (gameOn) {
clearInterval(_global.animateTimer);
delete _global.animateTimer;
timer.eye._visible = false;
timer.timer_head.closeMouth(true);
}
}
function initTimesUp() {
if (gameOn) {
hintCycle = 0;
clearInterval(_global.hintInterval);
clearInterval(_global.animateHint);
delete _global.hintInterval;
delete _global.animateHint;
if (_global.hs1.symbol._currentframe < 8) {
_global.hs1.symbol.gotoAndStop(1);
}
if (_global.hs2.symbol._currentframe < 8) {
_global.hs2.symbol.gotoAndStop(1);
}
}
}
function gameOver(isGameOver) {
initGameOver();
_global.snd_gameover.setVolume(_global.soundVolume);
_global.snd_gameover.start();
if (_global.isZoneAPI && (isGameOver)) {
fscommand ("ScoreSubmit", ("<game><score>" + score.score.text) + "</score><time></time></game>");
fscommand ("GameEnd", "<gamedata></gamedata>");
} else if (_global.isZoneAPI) {
_global.gameBreakInitialized = true;
fscommand ("GameBreak", ("<data><breakpoint>" + _global.gRound) + "</breakpoint></data>");
} else {
gotoAndStop ("Text");
}
}
function initGameOver() {
_global.gameOverInitialized = true;
_global.timePaused = 0;
_global.broadcast_time = 0;
_global.timePausedStart = 0;
_global.timePausedEnd = 0;
clearInterval(_global.animateTimer);
delete _global.animateTimer;
_global.gameOn = false;
_global.newGame = true;
_global.snd_ambient.stop();
clearInterval(_global.randomSound);
clearInterval(_global.randomTileFlash);
delete _global.randomSound;
delete _global.randomTileFlash;
_global.symbolsInPosition = 0;
symbolContainer._visible = false;
tileContainer._visible = false;
importBoard._visible = false;
}
function showReadyMsg() {
ready._visible = true;
ready.play();
}
function showTimeUpMsg() {
_global.gameOn = false;
timeup._visible = true;
timeup.play();
}
function showNoMatchesMsg() {
timer.eye._visible = false;
clearInterval(_global.animateTimer);
delete _global.animateTimer;
_global.gameOn = false;
nomatches._visible = true;
nomatches.play();
}
function showCompleteMsg() {
timer.eye._visible = false;
clearInterval(_global.animateTimer);
delete _global.animateTimer;
_global.gameOn = false;
timePassed = getTimer() - _global.timerStarted;
complete.setPoints(_global.pointsBonusStart);
_global.bonusTime = _global.boardTimer - timePassed;
hintCycle = 0;
clearInterval(_global.hintInterval);
clearInterval(_global.animateHint);
delete _global.hintInterval;
delete _global.animateHint;
if (_global.hs1.symbol._currentframe < 8) {
_global.hs1.symbol.gotoAndStop(1);
}
if (_global.hs2.symbol._currentframe < 8) {
_global.hs2.symbol.gotoAndStop(1);
}
complete._visible = true;
complete.play();
}
function swapSymbols(s1, s2) {
if (s1._x == s2._x) {
direction = "vertical";
if (s1._y < s2._y) {
sym1 = s1;
sym2 = s2;
} else {
sym1 = s2;
sym2 = s1;
}
} else {
direction = "horizontal";
if (s1._x < s2._x) {
sym1 = s1;
sym2 = s2;
} else {
sym1 = s2;
sym2 = s1;
}
}
_global.swapFromLoc = new Array(sym1._x, sym1._y);
_global.swapToLoc = new Array(sym2._x, sym2._y);
_global.swapFrom = sym1;
_global.swapTo = sym2;
sym1.origY = sym1._y;
sym1.origX = sym1._x;
sym2.origY = sym2._y;
sym2.origX = sym2._x;
_global.startAniSwap = getTimer();
_global.aniSwap = setInterval(animateSwap, _global.swap_symbols_rate, direction, _global.swap_symbols_time);
}
function animateSwap(direction, time) {
var _local2 = 0;
if (_global.moving == false) {
_global.moving = true;
_local2 = (getTimer() - _global.startAniSwap) / time;
if (_local2 > 1) {
_local2 = 1;
}
shiftAmt = 40 * _local2;
if (direction == "vertical") {
if (swapFrom._y == _global.swapToLoc[1]) {
swapComplete();
_global.moving = false;
return(undefined);
}
if ((swapFrom.origY + shiftAmt) >= _global.swapToLoc[1]) {
swapFrom._y = _global.swapToLoc[1];
swapTo._y = _global.swapFromLoc[1];
} else {
swapFrom._y = swapFrom.origY + shiftAmt;
swapTo._y = swapTo.origY - shiftAmt;
}
} else {
if (swapFrom._x == _global.swapToLoc[0]) {
swapComplete();
_global.moving = false;
return(undefined);
}
if ((swapFrom.origX + shiftAmt) >= _global.swapToLoc[0]) {
swapFrom._x = _global.swapToLoc[0];
swapTo._x = _global.swapFromLoc[0];
} else {
swapFrom._x = swapFrom.origX + shiftAmt;
swapTo._x = swapTo.origX - shiftAmt;
}
}
updateAfterEvent();
_global.moving = false;
}
}
function swapComplete() {
if (!_global.swapback) {
if (_global.logic.swap(_global.pick1._col, _global.pick1._row, _global.pick2._col, _global.pick2._row) > 0) {
clearMatches();
// unexpected jump
}
_global.snd_mismatch.setVolume(_global.soundVolume);
_global.snd_mismatch.start();
clearInterval(_global.aniSwap);
delete _global.aniSwap;
_global.swapBack = true;
_global.symbol1 = getSymbol(_global.pick2, "swapComplete1");
_global.symbol2 = getSymbol(_global.pick1, "swapComplete2");
swapSymbols(_global.symbol1, _global.symbol2);
return(undefined);
} else {
_global.gameOn = true;
startHintAnimation();
}
_global.swapBack = false;
clearPicks();
clearInterval(_global.aniSwap);
delete _global.aniSwap;
}
function clearPicks() {
_global.pick1.hilt._visible = false;
delete _global.pick1;
delete _global.symbol1;
_global.pick2.hilt._visible = false;
delete _global.pick2;
delete _global.symbol2;
}
function getSymbol(tile, callerId) {
tmpx = tile._x;
tmpy = tile._y;
r = 0;
while (r < _global.logic.NUM_ROWS) {
c = 0;
while (c < _global.logic.NUM_COLUMNS) {
tmpSymbol = symbolContainer[(("symbol_" + c) + "_") + r].symbol;
if ((tmpSymbol._x == tmpx) && (tmpSymbol._y == tmpy)) {
return(tmpSymbol);
}
c++;
}
r++;
}
return(null);
}
function getSymbolByLoc(x, y) {
tmpx = x;
tmpy = y;
r = 0;
while (r < _global.logic.NUM_ROWS) {
c = 0;
while (c < _global.logic.NUM_COLUMNS) {
tmpSymbol = symbolContainer[(("symbol_" + c) + "_") + r].symbol;
if ((tmpSymbol._x == tmpx) && (tmpSymbol._y == tmpy)) {
return(tmpSymbol);
}
c++;
}
r++;
}
return(null);
}
function setOutOfPlayBelowAsMatch(clm, rrw) {
rww = rrw;
while (rww >= 0) {
if ((((_global.logic._board[clm][rww] == _global.logic.SPACE_OUT_OF_PLAY) || (_global.logic._tiles[clm][rww] == _global.logic.SPACE_OUT_OF_PLAY)) || (_global.logic._board[clm][rww] == 0)) && (_global.gameBoards[_global.board][_global.gameBoards[_global.board].length - 1][clm][rww] != 0)) {
tmpTle = _global.logic.tilesArray[clm][rww];
tmpTle._status = 0;
getSymbol(tmpTle, "setOutOfPlayBelowAsMatch")._status = 0;
_global.logic._matches[clm][rww] = 1;
if (tmpTle._currentframe == 1) {
_global.logic._tiles[clm][rww] = 0;
} else {
_global.logic._tiles[clm][rww] = 1;
}
_global.logic._board[clm][rww] = 0;
} else {
if (_global.logic._tiles[clm][rww] == _global.logic.BURIED_ITEM) {
return(undefined);
}
if (_global.gameBoards[_global.board][_global.gameBoards[_global.board].length - 1][clm][rww] == 0) {
return(undefined);
}
}
rww--;
}
}
function animateShowScore(timeToTake) {
if (_global._scoring == false) {
_global._scoring = true;
sspc = (getTimer() - _global.scoresStart) / timeToTake;
if (sspc > 1) {
sspc = 1;
}
sd = 0;
while (sd < _global.logic.activeScores.length) {
tmpScore = _global.logic.activeScores[sd];
if (tmpScore.score._visible == false) {
tmpScore.score.score.score.text = "+" + tmpTile._score;
tmpScore.score.score.score_shadow.text = "+" + tmpTile._score;
tmpScore.score._visible = true;
}
tmpScore.score._y = tmpScore.origY - (tmpScore.moveDist * sspc);
tmpScore.score._alpha = parseInt(100 - ((100 - tmpScore.fadeTo) * sspc));
if (sspc == 1) {
tmpScore.score._visible = false;
tmpScore.score._y = origY;
tmpScore.score._alpha = 100;
}
sd++;
}
updateAfterEvent();
if (sspc == 1) {
clearInterval(_global.aniShowScore);
delete _global.aniShowScore;
}
_global._scoring = false;
}
}
function clearMatches() {
_global.logic.matchedSymbols.length = 0;
if (_global.showScore) {
if (_global.logic.activeScores.length > 0) {
sd = 0;
while (sd < _global.logic.activeScores.length) {
_global.logic.activeScores[sd].moveDist = 0;
_global.logic.activeScores[sd].fadeTo = 100;
_global.logic.activeScores[sd].score._visible = false;
sd++;
}
}
_global.logic.activeScores.length = 0;
}
traceArray(_global.logic._matches, "MATCHES");
traceArray(_global.logic._moved, "MOVED");
traceArray(_global.logic.matchesBelow, "MATCHBELOW");
traceArray(_global.logic._board, "BOARD");
traceArray(_global.logic._tiles, "TILES");
rr = 0;
while (rr < _global.logic.NUM_ROWS) {
cc = 0;
while (cc < _global.logic.NUM_COLUMNS) {
if (_global.logic._matches[cc][rr] == 1) {
tmpTile = _global.logic.tilesArray[cc][rr];
if ((tmpTile._status == 0) || (tmpTile._status == _global.logic.SPACE_OUT_OF_PLAY)) {
_global.logic.snapShot[cc][rr]._status = 0;
tmpTile.gotoAndStop("gold");
_global.logic._tiles[cc][rr] = _global.logic.GOLD_SPACE;
} else {
tmpTile._status++;
_global.logic._tiles[cc][rr] = _global.logic.UNBURIED_SPACE;
setOutOfPlayBelowAsMatch(tmpTile._col, tmpTile._row);
}
_global.logic.matchedSymbols.push(getSymbol(tmpTile, "clearMatches1"));
if (_global.showScore) {
_global.logic.activeScores.push(_global.logic.scoreArray[cc][rr]);
}
}
cc++;
}
rr++;
}
_global.logic.removeMatches();
_global.logic.fillBoard();
_global.aniRmvSym = setInterval(animateRemoveSymbols, _global.remove_matches_spd);
if (_global.showScore) {
sd = 0;
while (sd < _global.logic.activeScores.length) {
_global.logic.activeScores[sd].moveDist = _global.show_score_dist;
_global.logic.activeScores[sd].fadeTo = _global.show_score_alpha;
sd++;
}
_global.scoresStart = getTimer();
_global.aniShowScore = setInterval(animateShowScore, _global.show_score_rate, _global.show_score_time);
}
_global.snd_match.setVolume(_global.soundVolume);
_global.snd_match.start();
}
function animateRemoveSymbols() {
if (_global.removingSymbols == false) {
_global.removingSymbols = true;
clearFinished = false;
j = 0;
while (j < _global.logic.matchedSymbols.length) {
tmpSymbol = _global.logic.matchedSymbols[j];
if ((tmpSymbol._status == 0) || (tmpSymbol._status == _global.logic.SPACE_OUT_OF_PLAY)) {
if (tmpSymbol._currentframe > 1) {
if (tmpSymbol.symbol._currentframe == 1) {
tmpSymbol.symbol.gotoAndStop("move");
} else if (tmpSymbol.symbol._currentframe == 7) {
tmpSymbol.gotoAndStop(1);
} else {
tmpSymbol.symbol.gotoAndStop(tmpSymbol.symbol._currentframe + 1);
}
} else {
clearFinished = true;
}
} else if (tmpSymbol._status == _global.logic.BURIED_ITEM) {
if (tmpSymbol.symbol._currentframe == 1) {
tmpSymbol.symbol.gotoAndStop(1);
} else if (tmpSymbol.symbol._currentframe < 11) {
if (tmpSymbol.symbol._currentframe == 8) {
_global.snd_buriedmatched.setVolume(_global.soundVolume);
_global.snd_buriedmatched.start();
}
tmpSymbol.symbol.gotoAndStop(tmpSymbol.symbol._currentframe + 1);
} else {
tmpSymbol.symbol.gotoAndStop(1);
}
}
j++;
}
if (clearFinished) {
clearInterval(_global.aniRmvSym);
delete _global.aniRmvSym;
_global.jewelsAnimating = 0;
repositionSymbols();
}
updateAfterEvent();
_global.removingSymbols = false;
}
}
function repositionSymbols() {
rpsRow = _global.logic.NUM_ROWS - 1;
while (rpsRow >= 0) {
rpsCol = 0;
while (rpsCol < _global.logic.NUM_COLUMNS) {
tmpSymbol = _global.logic.snapShot[rpsCol][rpsRow];
if ((_global.logic._moved[rpsCol][rpsRow] == 1) && (_global.logic._tiles[rpsCol][rpsRow] != _global.logic.UNBURIED_SPACE)) {
tmpSymbol.moveDist = 40 * _global.logic.matchesBelow[rpsCol][rpsRow];
tmpSymbol.origX = tmpSymbol._x;
tmpSymbol.origY = tmpSymbol._y;
}
if ((_global.logic._matches[rpsCol][rpsRow] == 1) && (_global.logic._tiles[rpsCol][rpsRow] != _global.logic.UNBURIED_SPACE)) {
if ((rpsCol == 0) && (rpsRow == 3)) {
traceArray(_global.logic._matches, "MATCHES");
traceArray(_global.logic._moved, "MOVED");
traceArray(_global.logic.matchesBelow, "MATCHBELOW");
traceArray(_global.logic._board, "BOARD");
traceArray(_global.logic._tiles, "TILES");
}
if (_global.logic.outOfPlayTiles[rpsCol] == 0) {
tmpSymbol.setLoc(tmpSymbol._x, (-(40 * _global.logic.colMatches[rpsCol])) - Number(dropShift));
tmpSymbol.origX = tmpSymbol._x;
tmpSymbol.origY = tmpSymbol._y;
if (_global.logic._board[rpsCol][rpsRow] != -99) {
_global.logic.colMatches[rpsCol]--;
tmpSymbol.moveDist = (40 * _global.logic.colMatches2[rpsCol]) + Number(dropShift);
} else {
tmpSymbol.moveDist = (40 * _global.logic.matchesBelow[rpsCol][rpsRow]) + Number(dropShift);
_global.logic._matches[rpsCol][rpsRow] = 0;
_global.logic._moved[rpsCol][rpsRow] = 0;
if ((rpsCol == 0) && (rpsRow == 3)) {
}
}
tmpSymbol.setSymbolType(_global.logic._board[rpsCol][8 - (_global.logic.colMatches2[rpsCol] - _global.logic.colMatches[rpsCol])]);
} else {
es = _global.logic.NUM_ROWS - 1;
while (es >= 0) {
if (_global.logic._board[rpsCol][es] == 0) {
_global.logic._board[rpsCol][es] = _global.logic.SPACE_OUT_OF_PLAY;
_global.logic._tiles[rpsCol][es] = _global.logic.SPACE_OUT_OF_PLAY;
_global.logic.outOfPlayTiles[rpsCol]--;
newx = 40 * rpsCol;
newy = 40 * (7 - es);
tmpSymbol.setLoc(newx, newy);
tmpSymbol.moveDist = 0;
tmpSymbol._status = _global.logic.SPACE_OUT_OF_PLAY;
eval (((("tileContainer.tile_" + rpsCol) + "_") + es) + ".tile")._status = _global.logic.SPACE_OUT_OF_PLAY;
break;
}
es--;
}
}
}
if (_global.logic._tiles[rpsCol][rpsRow] == _global.logic.UNBURIED_SPACE) {
tmpSymbol.origX = tmpSymbol._x;
tmpSymbol.origY = tmpSymbol._y;
tmpSymbol.moveDist = 40 * _global.logic.matchesBelow[rpsCol][rpsRow];
}
if (tmpSymbol.moveDist > 0) {
_global.logic.jewelsToMove.push(tmpSymbol);
_global.jewelsAnimating++;
}
tmpSymbol.force = false;
rpsCol++;
}
rpsRow--;
}
_global.dropDone = setInterval(jewelDropDone, 1);
_global.aniDropStart = getTimer();
_global.aniSymbolDrop = setInterval(animateSymbolDrop2, _global.new_jewels_rate, _global.new_jewels_time);
}
function animateDrop4() {
_global.dropStartTime = getTimer();
jdAniStart = getTimer();
ad4 = 0;
while (ad4 < _global.logic.jewelsToMove.length) {
_global.logic.jewelsToMove[ad4].animateSelfDrop(jdAniStart);
ad4++;
}
_global.dropDone = setInterval(jewelDropDone, 10);
}
function jewelDropDone() {
if (_global.jewelsAnimating == 0) {
clearInterval(_global.dropDone);
delete _global.dropDone;
_global.snd_gemland.setVolume(_global.soundVolume);
_global.snd_gemland.start();
_global.logic.clearUnburied();
_global.logic.resetMatches();
_global.logic.syncSymbolToTileStatus();
if (_global.logic.testMovedTableForMatches() > 0) {
clearMatches();
} else if (!_global.logic.findNumMovesLeft(true)) {
showNoMatchesMsg();
} else {
_global.gameOn = true;
startHintAnimation();
if (_global.logic.numGoalsLeft() == 0) {
showCompleteMsg();
}
}
updateAfterEvent();
}
}
function animateSymbolDrop2(ttt) {
var _local2;
if (_global.moving == false) {
_global.moving = true;
_local2 = (getTimer() - _global.aniDropStart) / ttt;
if (_local2 > 1) {
_local2 = 1;
}
jtm = 0;
while (jtm < _global.logic.jewelsToMove.length) {
tmpSymbol = _global.logic.jewelsToMove[jtm];
tmpSymbol._y = tmpSymbol.origY + (_local2 * tmpSymbol.moveDist);
if (_local2 == 1) {
tmpSymbol.moveDist = 0;
tmpSymbol.moved = 0;
tmpSymbol.origX = tmpSymbol._x;
tmpSymbol.origY = tmpSymbol._y;
}
jtm++;
}
if (_local2 == 1) {
clearInterval(_global.aniSymbolDrop);
delete _global.aniSymbolDrop;
_global.jewelsAnimating = 0;
}
_global.moving = false;
updateAfterEvent();
}
}
function countBonusPoints() {
_global.aniBonus = setInterval(animateBonusPoints, _global.bonusSpeed);
}
function animateBonusPoints() {
_global.snd_bonus.setVolume(_global.soundVolume);
_global.snd_bonus.start();
if ((complete.getPoints() + _global.pointsTimerBonus) < _global.pointsBonusMax) {
complete.setPoints(complete.getPoints() + _global.pointsTimerBonus);
} else {
complete.setPoints(_global.pointsBonusMax);
clearInterval(_global.aniBonus);
delete _global.aniBonus;
complete.gotoAndPlay(complete._currentframe + 1);
timer.timer._x = 0;
timer.timer_head.closeMouth(false);
return(undefined);
}
timeLeft = _global.bonusTime;
percentLeft = timeLeft / _global.boardTimer;
timerXPos = percentLeft * 148;
timer.timer._x = timerXPos;
_global.bonusTime = _global.bonusTime - 10000;
if (_global.bonusTime <= 0) {
clearInterval(_global.aniBonus);
delete _global.aniBonus;
complete.gotoAndPlay(complete._currentframe + 1);
timer.timer._x = 0;
timer.timer_head.closeMouth(false);
}
}
function showTooth() {
_global.toothBlinks = 5;
_global.smileBlinks = 3;
_global.smileAniDirection = "back";
if (_global.gTeeth < 5) {
_global.gTeeth = _global.gTeeth + 1;
_global.aniTooth = setInterval(animateTooth, _global.tooth_blink_spd, _global.toothBlinks);
} else if (!_global.goldenIdol) {
_global.goldenIdol = true;
golden_idol.gotoAndPlay(2);
} else {
_global.aniTooth = setInterval(flashSmile, _global.tooth_smile_spd, _global.smileBlinks);
}
}
function flashSmile(blinks) {
if (_global.smileBlinks > 0) {
if (_global.smileAniDirection == "back") {
if (teeth._currentframe > 1) {
teeth.gotoAndStop(teeth._currentframe - 1);
} else {
_global.smileAniDirection = "forward";
_global.snd_ting.setVolume(_global.soundVolume);
_global.snd_ting.start();
}
} else if (_global.smileAniDirection == "forward") {
if (teeth._currentframe < 6) {
teeth.gotoAndStop(teeth._currentframe + 1);
} else {
_global.smileAniDirection = "back";
_global.smileBlinks = _global.smileBlinks - 1;
_global.snd_ting.setVolume(_global.soundVolume);
_global.snd_ting.start();
}
}
} else if (_global.smileBlinks == -15) {
clearInterval(_global.aniTooth);
delete _global.aniTooth;
_global.gRound++;
gameOver();
} else {
_global.smileBlinks = _global.smileBlinks - 1;
}
}
function animateTooth(blinks) {
if (_global.toothBlinks > 0) {
if (teeth._currentFrame == _global.gTeeth) {
teeth.gotoAndStop("teeth_" + _global.gTeeth);
_global.toothBlinks = _global.toothBlinks - 1;
_global.snd_ting.setVolume(_global.soundVolume);
_global.snd_ting.start();
} else {
teeth.gotoAndStop(teeth._currentframe - 1);
}
} else if (_global.toothBlinks == -15) {
clearInterval(_global.aniTooth);
delete _global.aniTooth;
_global.gRound++;
gameOver();
} else {
_global.toothBlinks = _global.toothBlinks - 1;
}
}
function animateTiles(doShrink) {
if ((_global.newGame == null) || (_global.newGame == false)) {
getTilesSnapShot();
}
_global.goldCol = 0;
_global.aniTiles = setInterval(goldTiles, _global.flash_tiles_spd, doShrink);
}
function shrinkGold() {
allDoneShrink = 0;
_global.aniTiles2 = setInterval(shrinkTiles, _global.shrink_tiles_spd);
}
function goldTiles(doShrink) {
gtr = 0;
while (gtr < _global.lastR) {
gtc = 0;
while (gtc < _global.lastC) {
gtTmpTile = eval (((("tileContainer.tile_" + gtc) + "_") + gtr) + ".tile");
if ((_global.lastGamesTiles[gtc][gtr] == 1) || ((_global.lastGamesTiles[gtc][gtr] == _global.logic.SPACE_OUT_OF_PLAY) && (gtTmpTile._currentframe != 1))) {
if (gtc == _global.goldCol) {
gtTmpTile.gotoAndStop(5);
} else if (gtc == (_global.goldCol - 1)) {
gtTmpTile.gotoAndStop(4);
} else if (gtc == (_global.goldCol - 2)) {
gtTmpTile.gotoAndStop(3);
} else if (gtc == (_global.goldCol - 3)) {
gtTmpTile.gotoAndStop(3);
} else {
gtTmpTile.gotoAndStop(2);
}
}
gtc++;
}
gtr++;
}
if (_global.goldCol < 12) {
_global.goldCol++;
} else {
clearInterval(_global.aniTiles);
delete _global.aniTiles;
if (doShrink) {
shrinkGold();
}
}
}
function shrinkTiles() {
numGoldTiles = 0;
gtr2 = 0;
while (gtr2 < _global.lastR) {
gtc2 = 0;
while (gtc2 < _global.lastC) {
gtTmpTile = eval (((("tileContainer.tile_" + gtc2) + "_") + gtr2) + ".tile");
if ((gtTmpTile._currentframe > 1) && (_global.lastGamesTiles[gtc2][gtr2] == 0)) {
}
if ((_global.lastGamesTiles[gtc2][gtr2] == 1) || (_global.lastGamesTiles[gtc2][gtr2] == _global.logic.SPACE_OUT_OF_PLAY)) {
if (gtTmpTile._currentframe == 2) {
gtTmpTile.gotoAndStop(6);
} else if ((gtTmpTile._currentframe >= 6) && (gtTmpTile._currentframe < 8)) {
gtTmpTile.gotoAndStop(gtTmpTile._currentframe + 1);
} else if (gtTmpTile._currentframe == 8) {
gtTmpTile.gotoAndStop(1);
} else if (gtTmpTile._currentframe == 1) {
doneRound = true;
}
numGoldTiles++;
}
gtc2++;
}
gtr2++;
}
if (doneRound == true) {
doneRound = false;
allDoneShrink++;
}
if ((allDoneShrink == 10) || (numGoldTiles == 0)) {
clearInterval(_global.aniTiles2);
delete _global.aniTiles2;
resetGame();
}
}
function playrandomTileFlash() {
if (gameOn) {
tmpRTF = random(20);
if (tmpRTF == 0) {
animateTiles(false);
}
}
}
function playRandomSoundEffect() {
if (gameOn) {
rnum = random(16);
if (rnum < 8) {
switch (rnum) {
case 0 :
_global.snd_efx1.setVolume(_global.soundVolume);
_global.snd_efx1.start();
break;
case 1 :
_global.snd_efx2.setVolume(_global.soundVolume);
_global.snd_efx2.start();
break;
case 2 :
_global.snd_efx3.setVolume(_global.soundVolume);
_global.snd_efx3.start();
break;
case 3 :
_global.snd_efx4.setVolume(_global.soundVolume);
_global.snd_efx4.start();
break;
case 4 :
_global.snd_efx5.setVolume(_global.soundVolume);
_global.snd_efx5.start();
break;
case 5 :
_global.snd_efx6.setVolume(_global.soundVolume);
_global.snd_efx6.start();
break;
case 6 :
_global.snd_efx7.setVolume(_global.soundVolume);
_global.snd_efx7.start();
break;
case 7 :
if (_global.soundVolume > 0) {
_global.snd_efx8.setVolume(50);
}
_global.snd_efx8.start();
}
}
}
}
function forceWin() {
if (gameOn) {
fwr = 0;
while (fwr < _global.logic.NUM_ROWS) {
fwc = 0;
while (fwc < _global.logic.NUM_COLUMNS) {
if (_global.logic._tiles[fwc][fwr] == 0) {
_global.logic._tiles[fwc][fwr] = 1;
}
fwc++;
}
fwr++;
}
_global.bonusSpeed = 5;
animateTiles(false);
showCompleteMsg();
}
}
function traceArray(array, title) {
tar = _global.logic.NUM_ROWS - 1;
while (tar >= 0) {
tmpRowString = "";
tac = 0;
while (tac < _global.logic.NUM_COLUMNS) {
infoStr = String(array[tac][tar]);
limNum = Number(3 - infoStr.length);
trs = 0;
while (trs < limNum) {
tmpRowString = tmpRowString + " ";
trs++;
}
tmpRowString = (tmpRowString + infoStr) + " ";
tac++;
}
tar--;
}
}
function traceArrayValue(array, title, attrib) {
tar = _global.logic.NUM_ROWS - 1;
while (tar >= 0) {
tmpRowString = "";
tac = 0;
while (tac < _global.logic.NUM_COLUMNS) {
arrayVal = eval ((array[tac][tar] + ".") + attrib);
infoStr = String(arrayVal);
limNum = Number(3 - infoStr.length);
trs = 0;
while (trs < limNum) {
tmpRowString = tmpRowString + " ";
trs++;
}
tmpRowString = (tmpRowString + infoStr) + " ";
tac++;
}
tar--;
}
}
function updateBoard() {
_global.logic.getSnapShot();
ubr = 0;
while (ubr < _global.logic.NUM_ROWS) {
ubc = 0;
while (ubc < _global.logic.NUM_COLUMNS) {
_global.logic.snapShot[ubc][ubr].setSymbolType(_global.logic._board[ubc][ubr]);
ubc++;
}
ubr++;
}
}
if (_global.initFrame3 == false) {
pauseScreen._visible = false;
score._x = 24;
score._y = 281;
_global.paused = false;
_global.timePaused = 0;
_global.broadcast_time = 0;
_global.timePausedStart = 0;
_global.timePausedEnd = 0;
_global.gameOverInitialized = false;
_global._scoring = false;
_global.initFrame3 = true;
_global.moving = false;
_global.removingSymbols = false;
ready._visible = false;
complete._visible = false;
if (_global.lastScore != 0) {
score.score.text = _global.lastScore;
}
symbolContainer._visible = true;
tileContainer._visible = true;
importBoard._visible = true;
teeth.gotoAndStop("teeth_" + _global.gTeeth);
if (_global.goldenIdol) {
golden_idol.gotoAndStop(2);
}
setDrop();
setupProgress = 0;
clearProgress = 0;
clearDrop = 425;
animDist = 30;
hintCycle = 0;
tilesFlashed = false;
_global.bonusSpeed = 75;
var snapShot;
timer.eye._visible = false;
timer.timer_head.gotoAndStop(8);
if (_global.newGame) {
clearOldGame();
} else {
loadGameBoard();
}
}
_global.snd_ambient.setVolume(_global.soundVolume);
_global.snd_ambient.start(0, 9999);
_global.randomSound = setInterval(playRandomSoundEffect, _global.play_rnd_sound_spd);
testTileAni.onRelease = function () {
animateTiles(false);
};
stop();
Instance of Symbol 44 MovieClip in Frame 3
onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse, false) && (_global.buriedDialogVisible == true)) {
_root.removeBuriedDialog();
}
}
Frame 4
gotoAndStop ("Text");
Frame 11
if (_global.isGameReady) {
if (_global.isFirstTimeGameStarted) {
_global.isFirstTimeGameStarted = false;
gotoAndStop ("Game");
} else if ((!_global.paused) && (gameOn)) {
initTimesUp();
initGameOver();
gotoAndStop ("Text");
} else if (_global.gameOverInitialized) {
_global.gameOverInitialized = false;
gotoAndStop ("Text");
}
}
Frame 18
if (_global.gameBreakInitialized) {
_global.gameBreakInitialized = false;
gotoAndStop ("Text");
}
Frame 25
muteOn();
Frame 32
muteOff();
Frame 39
pause();
Frame 46
resume();
Symbol 37 MovieClip Frame 1
stop();
Symbol 38 MovieClip [ScoreTile] Frame 1
score._visible = false;
setLoc(_parent._x + (_col * 40), ((_parent._y + (_global.logic.NUM_ROWS * 40)) - 40) - (40 * _row));
stop();
Symbol 42 MovieClip [tileGlow] Frame 8
gotoAndPlay (1);
Symbol 60 MovieClip [Tile] Frame 1
hilt._visible = false;
setLoc(_parent._x + (_col * 40), ((_parent._y + (_global.logic.NUM_ROWS * 40)) - 40) - (40 * _row));
stop();
Symbol 60 MovieClip [Tile] Frame 5
Symbol 60 MovieClip [Tile] Frame 8
Symbol 61 MovieClip [gameBoardStagingArea] Frame 1
stop();
Symbol 84 MovieClip [Symbol 6] Frame 1
stop();
Symbol 84 MovieClip [Symbol 6] Frame 7
stop();
Symbol 84 MovieClip [Symbol 6] Frame 8
stop();
Symbol 84 MovieClip [Symbol 6] Frame 11
gotoAndStop (1);
Symbol 107 MovieClip [Symbol 5] Frame 1
stop();
Symbol 107 MovieClip [Symbol 5] Frame 7
stop();
Symbol 107 MovieClip [Symbol 5] Frame 8
stop();
Symbol 107 MovieClip [Symbol 5] Frame 11
gotoAndStop (1);
Symbol 130 MovieClip [Symbol 4] Frame 1
stop();
Symbol 130 MovieClip [Symbol 4] Frame 7
stop();
Symbol 130 MovieClip [Symbol 4] Frame 8
stop();
Symbol 130 MovieClip [Symbol 4] Frame 11
gotoAndStop (1);
Symbol 153 MovieClip [Symbol 3] Frame 1
stop();
Symbol 153 MovieClip [Symbol 3] Frame 7
stop();
Symbol 153 MovieClip [Symbol 3] Frame 8
stop();
Symbol 153 MovieClip [Symbol 3] Frame 11
gotoAndStop (1);
Symbol 176 MovieClip [Symbol 2] Frame 1
stop();
Symbol 176 MovieClip [Symbol 2] Frame 7
stop();
Symbol 176 MovieClip [Symbol 2] Frame 8
stop();
Symbol 176 MovieClip [Symbol 2] Frame 11
gotoAndStop (1);
Symbol 199 MovieClip [Symbol 1] Frame 1
stop();
Symbol 199 MovieClip [Symbol 1] Frame 7
stop();
Symbol 199 MovieClip [Symbol 1] Frame 8
stop();
Symbol 199 MovieClip [Symbol 1] Frame 11
gotoAndStop (1);
Symbol 200 MovieClip [Symbol] Frame 1
if ((_global.gameOn == false) && (_global.aniRmvSym == null)) {
if (_status == -1) {
setSymbolType(_type);
symbol.gotoAndStop("buried");
setLoc(_parent._x + (_col * 40), _parent._y + (Math.abs(_row - 7) * 40));
symbol._alpha = 0;
} else if (_status == -99) {
setSymbolType(0);
setLoc(_parent._x + (_col * 40), ((-(_row * 40)) - 40) - _global.ytiles);
} else {
setSymbolType(_type);
tx = _parent._x + (_col * 40);
ty = ((-(_row * 40)) - 40) - _global.ytiles;
setLoc(_parent._x + (_col * 40), ((-(_row * 40)) - 40) - _global.ytiles);
}
_global.symbolsInPosition++;
}
stop();
Symbol 200 MovieClip [Symbol] Frame 2
stop();
Symbol 200 MovieClip [Symbol] Frame 3
stop();
Symbol 200 MovieClip [Symbol] Frame 4
stop();
Symbol 200 MovieClip [Symbol] Frame 5
stop();
Symbol 200 MovieClip [Symbol] Frame 6
stop();
Symbol 200 MovieClip [Symbol] Frame 7
stop();
Symbol 207 MovieClip [buriedDialog] Frame 1
done.onRelease = function () {
_root.removeBuriedDialog();
};
Symbol 216 MovieClip [Msg] Frame 1
this._x = 136;
this._y = 150;
msg.text = _msg;
shadow.text = _msg;
ok_btn.onRelease = function () {
tellTarget (_root) {
_global.gameOn = true;
startHintAnimation();
removeMovieClip(dialog);
};
};
_global.snd_dialog.start();
stop();
Symbol 223 MovieClip Frame 1
var count = 0;
var introSoundPlayed = false;
Symbol 223 MovieClip Frame 2
if ((((_root._framesloaded == _root._totalframes) && (initialized == true)) && (getTimer() > 5)) && (_global.importingData == false)) {
if ((_global.soundVolume > 0) && (!introSoundPlayed)) {
introSoundPlayed = true;
_global.snd_iwin.start();
}
if (count > 30) {
tellTarget (_parent) {
if (_global.isZoneAPI) {
fscommand ("SessionReady", "<data></data>");
} else {
gotoAndStop ("Text");
}
};
} else {
count++;
}
} else {
amtLoaded = Math.round(_root.getBytesLoaded() / 1024);
total = Math.round(_root.getBytesTotal() / 1024);
percent = Math.round((amtLoaded / total) * 100);
bytesLoadedOutput = (amtLoaded + " / ") + total;
bar.loadBar._xscale = percent;
}
Symbol 223 MovieClip Frame 3
gotoAndPlay (2);
Symbol 230 MovieClip Frame 1
stop();
Symbol 234 MovieClip Frame 1
stop();
Symbol 279 MovieClip Frame 1
stop();
Symbol 279 MovieClip Frame 2
play_again._visible = false;
click_to_play.onRelease = function () {
tellTarget (_parent) {
hideImports();
if (_global.isZoneAPI) {
fscommand ("GameReady", "<data><mode></mode><difficulty></difficulty><startlevel></startlevel></data>");
} else {
gotoAndPlay ("Game");
}
};
};
stop();
Symbol 279 MovieClip Frame 3
play_again._visible = true;
if (!_global.playAgainDownload) {
play_again._x = 260;
download._visible = false;
}
play_again.onRelease = function () {
tellTarget (_parent) {
hideImports();
gotoAndPlay ("Game");
};
};
download.onRelease = function () {
if (_global.isZoneAPI) {
fscommand ("CustomEvent", "<gamedata>DeluxeUpsell</gamedata>");
} else {
getURL (_global.upsellLink, _global.upsellWindow);
}
};
stop();
Symbol 279 MovieClip Frame 4
continue_game._visible = true;
if (!_global.continueDownload) {
continue_game._x = 260;
download._visible = false;
}
continue_game.onRelease = function () {
tellTarget (_parent) {
hideImports();
gotoAndPlay ("Game");
};
};
download.onRelease = function () {
if (_global.isZoneAPI) {
fscommand ("CustomEvent", "<gamedata>DeluxeUpsell</gamedata>");
} else {
getURL (_global.upsellLink, _global.upsellWindow);
}
};
stop();
Symbol 289 MovieClip Frame 1
resume.onRelease = function () {
tellTarget (_parent) {
resume();
};
};
Symbol 293 MovieClip Frame 1
stop();
Symbol 293 MovieClip Frame 8
_global.snd_timesup.start();
Symbol 293 MovieClip Frame 43
_root.gameOver(true);
gotoAndStop (1);
Symbol 318 MovieClip Frame 1
stop();
Symbol 319 MovieClip Frame 1
function setPoints(value) {
_bonusPoints = value;
bonusString = new String("" + value);
numPos = 1;
s = bonusString.length - 1;
while (s >= 0) {
tmpNum = Number(bonusString.charAt(s));
switch (numPos) {
case 1 :
d5.gotoAndStop("num_" + tmpNum);
break;
case 2 :
d4.gotoAndStop("num_" + tmpNum);
break;
case 3 :
d3.gotoAndStop("num_" + tmpNum);
break;
case 4 :
d2.gotoAndStop("num_" + tmpNum);
break;
case 5 :
d1.gotoAndStop("num_" + tmpNum);
}
numPos++;
s--;
}
}
function getPoints() {
return(_bonusPoints);
}
var _bonusPoints = 0;
stop();
Symbol 319 MovieClip Frame 2
_global.snd_endgame.start();
Symbol 319 MovieClip Frame 28
_root.eyes.gotoAndPlay("open");
Symbol 319 MovieClip Frame 46
_root.countBonusPoints();
stop();
Symbol 319 MovieClip Frame 58
_global.snd_addbonus.start();
Symbol 319 MovieClip Frame 66
_global.logic.addScore(getPoints());
Symbol 319 MovieClip Frame 91
_root.eyes.gotoAndPlay("close");
_root.showTooth();
_global.snd_statue.start();
gotoAndStop (1);
Symbol 322 MovieClip Frame 1
stop();
Symbol 322 MovieClip Frame 50
_root.gameOver(true);
gotoAndStop (1);
Symbol 327 MovieClip Frame 1
stop();
Symbol 327 MovieClip Frame 2
_global.snd_ready.start();
Symbol 327 MovieClip Frame 25
_global.snd_go.start();
Symbol 327 MovieClip Frame 38
this._visible = false;
_global.gameOn = true;
_root.startTimer();
gotoAndStop (1);
Symbol 338 MovieClip Frame 1
stop();
Symbol 338 MovieClip Frame 2
stop();
Symbol 338 MovieClip Frame 3
stop();
Symbol 338 MovieClip Frame 4
stop();
Symbol 338 MovieClip Frame 5
stop();
Symbol 338 MovieClip Frame 6
stop();
Symbol 342 MovieClip Frame 1
stop();
Symbol 342 MovieClip Frame 2
_global.snd_statue.start();
Symbol 342 MovieClip Frame 12
_global.snd_statue.start();
Symbol 342 MovieClip Frame 20
_global.snd_statue.start();
Symbol 342 MovieClip Frame 26
_global.snd_statue.start();
Symbol 342 MovieClip Frame 30
_global.snd_statue.start();
Symbol 342 MovieClip Frame 34
_global.snd_statue.start();
Symbol 342 MovieClip Frame 38
_global.snd_statue.start();
Symbol 342 MovieClip Frame 40
_global.snd_statue.start();
Symbol 342 MovieClip Frame 42
_global.snd_statue.start();
Symbol 342 MovieClip Frame 51
_global.snd_statue.start();
Symbol 342 MovieClip Frame 70
_global.gRound++;
_root.gameOver();
stop();
Symbol 349 MovieClip Frame 1
stop();
Symbol 349 MovieClip Frame 3
_global.snd_blink.start();
Symbol 349 MovieClip Frame 5
_global.snd_blink.start();
Symbol 349 MovieClip Frame 7
_global.snd_blink.start();
Symbol 349 MovieClip Frame 9
_global.snd_blink.start();
Symbol 349 MovieClip Frame 11
_global.snd_blink.start();
Symbol 349 MovieClip Frame 13
_global.snd_blink.start();
Symbol 349 MovieClip Frame 15
_global.snd_blink.start();
Symbol 349 MovieClip Frame 17
stop();
Symbol 349 MovieClip Frame 24
gotoAndStop (1);
Symbol 356 MovieClip Frame 1
function closeMouth(tu) {
timeUp = tu;
gotoAndPlay (2);
}
var timeUp;
stop();
Symbol 356 MovieClip Frame 8
if (timeUp) {
_root.showTimeUpMsg();
}
stop();
Symbol 356 MovieClip Frame 9
play();
Symbol 356 MovieClip Frame 12
_root.timer.gotoAndPlay("setup_timer");
gotoAndStop ("open");
Symbol 361 MovieClip Frame 1
stop();
Symbol 361 MovieClip Frame 2
stop();
Symbol 367 MovieClip Frame 10
gotoAndPlay (1);
Symbol 368 MovieClip Frame 1
stop();
Symbol 368 MovieClip Frame 2
play();
Symbol 368 MovieClip Frame 10
eye._visible = false;
stop();