Frame 1
function cls() {
var c;
for (c in _root) {
_root[c].removeMovieClip();
}
}
function initsfx() {
var i;
i = 0;
while (i < _root.sfx.length) {
_root.sfx[i].object = new Sound();
_root.sfx[i].object.attachSound(_root.sfx[i].linkage);
i++;
}
}
function startsfx(idx) {
if (_root.soundmuted) {
return(undefined);
}
if ((_root.sfx[idx].laststart == undefined) || ((_root.currframe - _root.sfx[idx].laststart) >= _root.sfx[idx].len)) {
if (_root.sfx[idx].loop) {
_root.sfx[idx].object.start(0, 100000);
} else {
_root.sfx[idx].object.start();
}
if (_root.sfx[idx].vol != undefined) {
_root.sfx[idx].object.setVolume(_root.sfx[idx].vol);
}
_root.sfx[idx].laststart = _root.currframe;
}
}
function isplayingsfx(idx) {
if ((_root.sfx[idx].object.position == 0) || (_root.sfx[idx].object.position == undefined)) {
return(false);
}
return(true);
}
function stopsfx(idx) {
_root.sfx[idx].object.stop();
_root.sfx[idx].object.position = undefined;
_root.sfx[idx].laststart = 0;
}
function stopallsfx() {
var i;
i = 0;
while (i < _root.sfx.length) {
_root.sfx[i].object.stop();
_root.sfx[i].object.position = undefined;
_root.sfx[i].laststart = 0;
i++;
}
}
function resetallsfx() {
var i;
i = 0;
while (i < _root.sfx.length) {
_root.sfx[i].laststart = undefined;
i++;
}
}
function sitelock(urls_allowed) {
lock = true;
domain_parts = _url.split("://");
if (domain_parts[0] == "file") {
lock = false;
}
real_domain = domain_parts[1].split("/");
for (x in urls_allowed) {
if (_url.indexOf(urls_allowed[x]) != -1) {
lock = false;
}
}
if (lock) {
_root._visible = false;
}
}
var myMenu_cm = new ContextMenu();
myMenu_cm.hideBuiltInItems();
_root.menu = myMenu_cm;
_root.attachMovie("dummy", "dummy", _root.getNextHighestDepth(), {_x:-100, _y:-100});
_root.dummy.onEnterFrame = function () {
var i;
var perc;
if (_root.preloadplay == undefined) {
var p;
p = Math.ceil((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
_root.loaderpot.perc = ("" + p) + "%";
_root.loaderpot.potmask._y = (200 * (100 - p)) / 100;
}
if ((_root._framesloaded == _root._totalframes) && (_root.preloadplay == undefined)) {
_root.loadermachine._visible = false;
_root.loadpercent = "";
_root.attachMovie("genericbtn", "preloadplay", _root.getNextHighestDepth(), {_x:217, _y:519});
_root.preloadplay.txt = "CONTINUE";
_root.preloadplay.onPress = function () {
cls();
_root.gotoAndPlay("splash");
};
}
};
var sfx = [{linkage:"gamemainmusic", len:0, loop:true, vol:20}, {linkage:"click", len:0, loop:false}, {linkage:"gamemenumusic", len:0, loop:true, vol:40}, {linkage:"opentap", len:0, loop:false}, {linkage:"closetap", len:0, loop:false}, {linkage:"potfill", len:0, loop:false}, {linkage:"success", len:0, loop:false}, {linkage:"fail", len:0, loop:false}, {linkage:"dropdrop", len:0, loop:false}];
urls_allowed = ["smartcode.hu", "www.smartcode.hu", "www.flashgamelicense.com", "flashgamelicense.com", "armorgames.com"];
stop();
Frame 3
function startwater() {
potb_prep();
potblock_prep();
_root.outlinecursor.removeMovieClip();
hand = E_EMPTY;
handmoved = false;
cellioff = 0;
celljoff = 0;
_root.hintdlg.removeMovieClip();
startsfx(3);
_root.dummy.onEnterFrame = inclevel;
}
function stopwater() {
startsfx(4);
_root.dummy.onEnterFrame = updatelevel;
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var k = 0;
while (k < MAXLAYERS) {
var m = ((("w" + i) + j) + k);
var e = eprops[_root[m].element];
_root[m].wfrom = 0;
_root[m].wto = 0;
_root[m].ownedby = "";
_root[m].overflown = undefined;
_root[m].wtotalamount = 0;
if (e.type == E_SPLIT) {
if (e.dirs.indexOf("2") == -1) {
_root[m].lever._xscale = 100;
} else {
_root[m].lever._xscale = -100;
}
_root[m].dirs = e.dirs;
}
if (e.type == E_TANK) {
_root[m].wamount = e.capacity;
} else {
_root[m].wamount = 0;
if (_root[m].element == 0) {
_root[m].gotoAndStop(1 + _root[m].element);
}
}
k++;
}
j++;
}
i++;
}
}
function quit() {
stopallsfx();
startsfx(2);
for (c in _root) {
removeMovieClip(_root[c]);
}
_root.gotoAndPlay("mainmenu");
}
function resetlevel() {
initlevel(currlevel);
}
function initlevel(level) {
var map = _root["map" + level];
_root.levelbg.removeMovieClip();
if ((level < FIRSTDEMOLEVEL) && (((level - 1) % 5) != 0)) {
_root.attachMovie("levelbg" + ((level - 1) % 5), "levelbg", _root.getNextHighestDepth(), {_x:GRIDX, _y:GRIDY});
}
_root.leveltxt_d1 = "0";
_root.leveltxt_d2 = "" + Math.floor(level / 10);
_root.leveltxt_d3 = "" + (level % 10);
if ((((((((level == 1) || (level == 2)) || (level == 3)) || (level == 5)) || (level == 6)) || (level == 7)) || (level == 8)) && ((_root.customlevel == undefined) || (_root.customlevel == ""))) {
var my_fmt = new TextFormat();
my_fmt.leading = -5;
_root.attachMovie("hintdlg", "hintdlg", _root.getNextHighestDepth());
_root.hintdlg.btn.txt = "CONTINUE";
_root.hintdlg.btn.onPress = function () {
_root.hintdlg.removeMovieClip();
};
_root.hintdlg.btn.onRollOver = function () {
this.filters = [gl];
};
_root.hintdlg.btn.onRollOut = function () {
this.filters = undefined;
};
switch (level) {
case 1 :
_root.hintdlg._x = 297;
_root.hintdlg._y = 550;
_root.hintdlg.txt.htmlText = "<b>POTS & TANKS</b><br>Drag this pot to have it under the water tank. Then click START or press SPACE.";
_root.hintdlg.txt.setTextFormat(my_fmt);
break;
case 2 :
_root.hintdlg._x = 325;
_root.hintdlg._y = 500;
_root.hintdlg.txt.htmlText = "<b>ADDING</b><br>You can pour different streams together, where the amount of water will be added up.";
_root.hintdlg.txt.setTextFormat(my_fmt);
break;
case 3 :
_root.hintdlg._x = 325;
_root.hintdlg._y = 560;
_root.hintdlg.txt.htmlText = "<b>PIPES</b><br>With pipes water can be controlled. Once water leaves a pipe, it won't enter another one. Pipes cannot be rotated.";
_root.hintdlg.txt.setTextFormat(my_fmt);
break;
case 5 :
_root.hintdlg._x = 325;
_root.hintdlg._y = 300;
_root.hintdlg.arr._x = -55;
_root.hintdlg.txt.htmlText = "<b>OVERFLOW POTS</b><br>Once this kind of pot is full, the spare water will stream on through the white overflow valve.";
_root.hintdlg.txt.setTextFormat(my_fmt);
break;
case 6 :
_root.hintdlg._x = 343;
_root.hintdlg._y = 567;
_root.hintdlg.arr._x = -10;
_root.hintdlg.arr._y = -179;
_root.hintdlg.arr._rotation = 270;
_root.hintdlg.txt.htmlText = "<b>BLOCKS</b><br>These red blocks exclude both water and movable items.";
_root.hintdlg.txt.setTextFormat(my_fmt);
break;
case 7 :
_root.hintdlg._x = 178;
_root.hintdlg._y = 370;
_root.hintdlg.arr._x = 65;
_root.hintdlg.arr._rotation = 45;
_root.hintdlg.txt.htmlText = "<b>WATER SPLITTER</b><br>This element splits water into two different streams equally.";
_root.hintdlg.txt.setTextFormat(my_fmt);
break;
case 8 :
_root.hintdlg._x = 247;
_root.hintdlg._y = 255;
_root.hintdlg.arr._x = 65;
_root.hintdlg.arr._visible = false;
_root.hintdlg.txt.htmlText = "<b>SPLITTER DIRECTIONS</b><br>The initial direction is displayed on the splitter. Check out the difference!";
_root.hintdlg.txt.setTextFormat(my_fmt);
}
}
if ((_root.customlevel != undefined) && (_root.customlevel != "")) {
var cl = _root.customlevel.split("|");
_root.tiptext = cl.length;
var j = 0;
while (j < GRIDH) {
var i = 0;
while (i < GRIDW) {
trace(_root.map1[j][i]);
_root.map1[j][i] = Math.floor(cl[(1 + (j * GRIDW)) + i]);
trace(_root.map1[j][i]);
trace("====");
i++;
}
j++;
}
}
var i = 0;
while (i < GRIDW) {
currmap[i] = Array();
var j = 0;
while (j < GRIDH) {
_root.currmap[i][j] = map[j][i];
if (map[j][i] > 100) {
_root.currmap[i][j] = _root.currmap[i][j] - 100;
}
j++;
}
i++;
}
_root.attachMovie("outlinecursor", "outlinecursor", _root.getNextHighestDepth());
outlinedepth = _root.outlinecursor.getDepth();
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var k = 0;
while (k < MAXLAYERS) {
if (k == 0) {
setcell(i, j, k, ((map[j][i] > 100) ? (map[j][i] - 100) : (map[j][i])), ((map[j][i] > 100) ? true : false));
} else {
setcell(i, j, k, 0, false);
}
k++;
}
j++;
}
i++;
}
var i = 1;
while (i <= 6) {
elementtofront(i);
i++;
}
elementtofront(8);
elementtofront(7);
var i = 0;
while (i < _root.potarr.length) {
elementtofront(_root.potarr[i]);
i++;
}
_root.outlinecursor.removeMovieClip();
_root.attachMovie("fpsometer", "fpsometer", _root.getNextHighestDepth(), {_x:100, _y:0, cacheAsBitmap:true});
}
function inrect(cx, cy, rx, ry, rw, rh) {
if ((((cx > rx) && (cx < (rx + rw))) && (cy > ry)) && (cy < (ry + rh))) {
return(true);
}
return(false);
}
function elementtofront(element) {
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var m = ((("w" + i) + j) + "0");
if (_root[m].element == element) {
_root[m].swapDepths(_root.getNextHighestDepth());
}
j++;
}
i++;
}
}
function ispot(i, j) {
if ((i < 0) || (j < 0)) {
return(false);
}
if (_root.currmap[i][j] >= 10) {
return(true);
}
return(false);
}
function potb_prep() {
var i;
var j;
potb = Array();
i = 0;
while (i < GRIDW) {
_root.potb[i] = Array();
j = 0;
while (j < GRIDH) {
_root.potb[i][j] = undefined;
if (isanypot(i, j)) {
var ee = 0;
while (ee < _root.potarr.length) {
var potprop = eprops[_root.potarr[ee]];
var ii = 0;
while (ii < potprop.width) {
if (_root.currmap[i - ii][j - (potprop.height - 1)] == _root.potarr[ee]) {
_root.potb[i][j] = {potmc:(("w" + (i - ii)) + (j - (potprop.height - 1))) + "0", prop:potprop, x:i - ii, y:j - (potprop.height - 1)};
}
ii++;
}
ee++;
}
}
j++;
}
i++;
}
}
function potblock_prep() {
var i;
var j;
var ii;
var jj;
potblock = Array();
i = 0;
while (i < GRIDW) {
_root.potblock[i] = Array();
j = 0;
while (j < GRIDH) {
_root.potblock[i][j] = Array();
_root.potblock[i][j][1] = 0;
_root.potblock[i][j][2] = 0;
_root.potblock[i][j][3] = 0;
_root.potblock[i][j][4] = 0;
j++;
}
i++;
}
i = 0;
while (i < GRIDW) {
j = 0;
while (j < GRIDH) {
var e = eprops[_root.currmap[i][j]];
if ((((e.type == E_TANK) || (e.type == E_POT)) || (e.type == E_BLOCK)) || (e.type == E_SPLIT)) {
ii = 0;
while (ii < e.width) {
if ((e.type != E_POT) && (e.type != E_SPLIT)) {
_root.potblock[i + ii][j][3] = 1;
}
_root.potblock[i + ii][(j + e.height) - 1][1] = 1;
ii++;
}
jj = 0;
while (jj < e.height) {
_root.potblock[i][j + jj][2] = 1;
_root.potblock[(i + e.width) - 1][j + jj][4] = 1;
jj++;
}
}
j++;
}
i++;
}
}
function isanypot(i, j) {
if ((((((((((((ispot(i, j) || (ispot(i - 1, j))) || (ispot(i - 2, j))) || (ispot(i - 3, j))) || (ispot(i, j - 1))) || (ispot(i - 1, j - 1))) || (ispot(i - 2, j - 1))) || (ispot(i, j - 2))) || (ispot(i, j - 3))) || (ispot(i - 1, j - 2))) || (ispot(i - 1, j - 3))) || (ispot(i - 4, j))) || (ispot(i - 5, j))) {
return(true);
}
return(false);
}
function findpot(i, j) {
if (isanypot(i, j)) {
var ee = 0;
while (ee < _root.potarr.length) {
var potprop = eprops[_root.potarr[ee]];
var ii = 0;
while (ii < potprop.width) {
var jj = 0;
while (jj < potprop.height) {
if (_root.currmap[i - ii][j - jj] == _root.potarr[ee]) {
return({poti:i - ii, potj:j - jj});
}
jj++;
}
ii++;
}
ee++;
}
}
return(false);
}
function dbgcell(i, j, layer) {
m = (("w" + i) + j) + layer;
trace((((((((((m + ": ") + _root[m].element) + "|") + _root[m].wfrom) + "|") + _root[m].wto) + "|") + _root[m].wamount) + " own:") + _root[m].ownedby);
}
function dbgcurrmap() {
var j = 0;
while (j < GRIDH) {
var line = "";
var i = 0;
while (i < GRIDW) {
line = line + currmap[i][j];
i++;
}
trace(line);
j++;
}
trace("-------");
}
function dbgcurrmap2() {
var j = 0;
while (j < GRIDH) {
var line = "";
var i = 0;
while (i < GRIDW) {
line = line + (((((_root[(("w" + i) + j) + "0"].wamount + ",") + _root[(("w" + i) + j) + "1"].wamount) + "_") + _root[(("w" + i) + j) + "2"].wamount) + "|");
i++;
}
trace(line);
j++;
}
trace("-------");
}
function getmatchingelement_prep() {
var i;
var j;
var l;
var dir;
var f;
var o;
gme = Array();
i = 0;
while (i < GRIDW) {
_root.gme[i] = Array();
j = 0;
while (j < GRIDH) {
_root.gme[i][j] = Array();
l = 0;
while (l < MAXLAYERS) {
_root.gme[i][j][l] = Array();
dir = 1;
while (dir <= 4) {
_root.gme[i][j][l][dir] = Array();
f = 0;
while (f <= 1) {
_root.gme[i][j][l][dir][f] = undefined;
f++;
}
dir++;
}
l++;
}
j++;
}
i++;
}
}
function getm(i, j, l, todir, forcetubestart) {
var o;
o = _root.gme[i][j][l][todir][((forcetubestart == undefined) ? 0 : 1)];
if (o == undefined) {
_root.gme[i][j][l][todir][((forcetubestart == undefined) ? 0 : 1)] = getmatchingelement(i, j, l, todir, forcetubestart);
o = _root.gme[i][j][l][todir][((forcetubestart == undefined) ? 0 : 1)];
}
return(o);
}
function getmatchingelement(i, j, l, todir, forcetubestart) {
var m;
var retm = "";
var retlayer;
var owner = ((("" + i) + j) + l);
var origelement = _root[(("w" + i) + j) + l].element;
if (forcetubestart != undefined) {
origelement = 1;
}
switch (todir) {
case 1 :
j--;
break;
case 2 :
i++;
break;
case 3 :
j++;
break;
case 4 :
i--;
}
if (((((j < 0) || (j >= GRIDWATERLIMIT)) || (i < 0)) || (i >= GRIDW)) || (j >= GRIDH)) {
return({out:true, i:i, j:j, todir:todir});
}
if (potblock[i][j][todir]) {
return({todir:todir, i:i, j:j, blocked:true});
}
layer = 0;
while (layer < MAXLAYERS) {
m = (("w" + i) + j) + layer;
if (((_root[m].element == 0) && (_root[m].wfrom == 0)) && (retm == "")) {
retm = m;
retlayer = layer;
}
if ((_root[m].element == 0) && (_root[m].ownedby == owner)) {
return({todir:3, m:m, i:i, j:j, layer:layer, out:false});
}
if (_root[m].element != 0) {
var e = eprops[_root[m].element];
var dirs;
if (e.type == E_SPLIT) {
dirs = _root[m].dirs;
} else {
dirs = e.dirs;
}
if (origelement != 0) {
if (int(dirs.charAt(0)) == oppdir(todir)) {
return({todir:int(dirs.charAt(1)), m:m, i:i, j:j, layer:layer, out:false});
}
if (int(dirs.charAt(2)) == oppdir(todir)) {
return({todir:int(dirs.charAt(3)), m:m, i:i, j:j, layer:layer, out:false});
}
}
}
layer++;
}
_root[retm].ownedby = owner;
return({todir:3, m:retm, i:i, j:j, layer:retlayer, out:false});
}
function oppdir(dir) {
switch (dir) {
case 1 :
return(3);
case 2 :
return(4);
case 3 :
return(1);
case 4 :
return(2);
}
}
function setcell(i, j, layer, element, movable) {
var m = ((("w" + i) + j) + layer);
var e = eprops[element];
_root[m].removeMovieClip();
if (j == GRIDH) {
return(undefined);
}
switch (element) {
case 7 :
_root.attachMovie("balloon1", m, _root.getNextHighestDepth());
break;
case 8 :
_root.attachMovie("balloon2", m, _root.getNextHighestDepth());
break;
case 9 :
_root.attachMovie("balloon4", m, _root.getNextHighestDepth());
break;
case 10 :
_root.attachMovie("pot1", m, _root.getNextHighestDepth());
break;
case 11 :
_root.attachMovie("pot2", m, _root.getNextHighestDepth());
break;
case 12 :
_root.attachMovie("pot2b", m, _root.getNextHighestDepth());
break;
case 13 :
_root.attachMovie("pot3", m, _root.getNextHighestDepth());
break;
case 14 :
_root.attachMovie("pot3b", m, _root.getNextHighestDepth());
break;
case 15 :
_root.attachMovie("pot4", m, _root.getNextHighestDepth());
break;
case 16 :
_root.attachMovie("pot4b", m, _root.getNextHighestDepth());
break;
case 17 :
_root.attachMovie("pot6", m, _root.getNextHighestDepth());
break;
case 20 :
_root.attachMovie("pot6b", m, _root.getNextHighestDepth());
break;
case 21 :
_root.attachMovie("pot8", m, _root.getNextHighestDepth());
break;
case 22 :
_root.attachMovie("pot5", m, _root.getNextHighestDepth());
break;
case 23 :
_root.attachMovie("pot6c", m, _root.getNextHighestDepth());
break;
case 24 :
_root.attachMovie("pot4c", m, _root.getNextHighestDepth());
break;
case 25 :
_root.attachMovie("balloon3", m, _root.getNextHighestDepth());
break;
case 26 :
_root.attachMovie("opot1", m, _root.getNextHighestDepth());
break;
case 27 :
_root.attachMovie("opot2", m, _root.getNextHighestDepth());
break;
case 28 :
_root.attachMovie("opot3b", m, _root.getNextHighestDepth());
break;
case 29 :
_root.attachMovie("opot4c", m, _root.getNextHighestDepth());
break;
case 30 :
_root.attachMovie("opot4", m, _root.getNextHighestDepth());
break;
case 31 :
_root.attachMovie("opot6b", m, _root.getNextHighestDepth());
break;
case 32 :
_root.attachMovie("opot8", m, _root.getNextHighestDepth());
break;
case 33 :
_root.attachMovie("opot2b", m, _root.getNextHighestDepth());
break;
case 34 :
_root.attachMovie("opotl1", m, _root.getNextHighestDepth());
break;
case 35 :
_root.attachMovie("opotl2", m, _root.getNextHighestDepth());
break;
case 36 :
_root.attachMovie("opotl3b", m, _root.getNextHighestDepth());
break;
case 37 :
_root.attachMovie("opotl4c", m, _root.getNextHighestDepth());
break;
case 38 :
_root.attachMovie("opotl4", m, _root.getNextHighestDepth());
break;
case 39 :
_root.attachMovie("opotl6b", m, _root.getNextHighestDepth());
break;
case 40 :
_root.attachMovie("opotl8", m, _root.getNextHighestDepth());
break;
case 41 :
_root.attachMovie("opotl2b", m, _root.getNextHighestDepth());
break;
default :
_root.attachMovie("water", m, _root.getNextHighestDepth());
}
_root[m]._x = GRIDX + (i * CELLW);
_root[m]._y = GRIDY + (j * CELLH);
_root[m]._xscale = 100;
_root[m]._yscale = 100;
_root[m].cacheAsBitmap = true;
_root[m].element = element;
if (e.type == E_TANK) {
_root[m].wamount = e.capacity;
} else {
_root[m].wamount = 0;
}
_root[m].wfrom = 0;
_root[m].wto = 0;
_root[m].wlast = 1;
_root[m].wtotalamount = 0;
_root[m].ownedby = "";
if (e.type != E_SPLIT) {
_root[m].lever._visible = false;
} else {
_root[m].dirs = e.dirs;
if (e.dirs.indexOf("2") == -1) {
_root[m].lever._xscale = 100;
} else {
_root[m].lever._xscale = -100;
}
}
if ((element < 7) || (element >= 18)) {
_root[m].gotoAndStop(1 + element);
}
if (e.type == E_SPLIT) {
_root[m].gotoAndStop(element - 34);
}
if (movable && (element != 0)) {
_root[m].filters = [gl];
_root[m].movable = true;
} else {
_root[m].filters = undefined;
_root[m].movable = false;
}
if (layer == 0) {
currmap[i][j] = element;
}
}
function mousemove() {
var celli = (Math.floor((_root._xmouse - GRIDX) / CELLW) + cellioff);
var cellj = (Math.floor((_root._ymouse - GRIDY) / CELLH) + celljoff);
var e = eprops[hand];
var ii;
var jj;
if ((cellj + e.height) > GRIDH) {
cellj = GRIDH - e.height;
}
if ((celli + e.width) > GRIDW) {
celli = GRIDW - e.width;
}
if (celli < 0) {
celli = 0;
}
if (cellj < 0) {
cellj = 0;
}
var collision = false;
var tmpmap = Array();
var i = 0;
while (i < GRIDW) {
tmpmap[i] = Array();
i++;
}
var tmp = currmap[lasthandi][lasthandj];
currmap[lasthandi][lasthandj] = 0;
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
if (currmap[i][j]) {
var ee = eprops[currmap[i][j]];
ii = 0;
while (ii < ee.width) {
jj = 0;
while (jj < ee.height) {
tmpmap[i + ii][j + jj] = 1;
jj++;
}
ii++;
}
}
j++;
}
i++;
}
ii = 0;
while (ii < e.width) {
jj = 0;
while (jj < e.height) {
if (tmpmap[celli + ii][cellj + jj]) {
collision = true;
}
jj++;
}
ii++;
}
currmap[lasthandi][lasthandj] = tmp;
if (hand != E_EMPTY) {
_root.outlinecursor._x = _root._xmouse + cellioffpx;
_root.outlinecursor._y = _root._ymouse + celljoffpx;
}
if (((((((hand != E_EMPTY) && (celli >= 0)) && (cellj >= 0)) && ((celli + e.width) <= GRIDW)) && ((cellj + e.height) <= GRIDH)) && (!collision)) && ((lasthandi != celli) || (lasthandj != cellj))) {
setcell(lasthandi, lasthandj, 0, 0, true);
setcell(celli, cellj, 0, hand, true);
lasthandi = celli;
lasthandj = cellj;
handmoved = true;
}
}
function keydown(code) {
if ((code == 32) && (_root.genericdialog != undefined)) {
_root.genericdialog.ok.onPress.apply();
return(undefined);
}
if ((code == 32) && (_root.genericdialog == undefined)) {
if (_root.dummy.onEnterFrame == inclevel) {
stopwater();
} else {
startwater();
}
}
if ((code == 82) && (_root.genericdialog == undefined)) {
stopwater();
resetlevel();
}
if (code == 27) {
quit();
}
}
function mousedown() {
var celli = (Math.floor((_root._xmouse - GRIDX) / CELLW) + cellioff);
var cellj = (Math.floor((_root._ymouse - GRIDY) / CELLH) + celljoff);
if (_root.dummy.onEnterFrame == inclevel) {
return(undefined);
}
if (_root.genericdialog != undefined) {
return(undefined);
}
if ((((celli >= 0) && (cellj >= 0)) && (celli < GRIDW)) && (cellj < GRIDH)) {
if (hand == E_EMPTY) {
_root.hintdlg.removeMovieClip();
if (_root[(("w" + celli) + cellj) + "0"].movable) {
hand = currmap[celli][cellj];
origi = celli;
origj = cellj;
lasthandi = celli;
lasthandj = cellj;
cellioff = 0;
celljoff = 0;
cellioffpx = (GRIDX + (celli * CELLW)) - _root._xmouse;
celljoffpx = (GRIDY + (cellj * CELLH)) - _root._ymouse;
_root.attachMovie("outlinecursor", "outlinecursor", outlinedepth, {_alpha:20, _width:_root.eprops[hand].width * CELLW, _height:_root.eprops[hand].height * CELLH, _x:_root._xmouse + cellioffpx, _y:_root._ymouse + celljoffpx});
}
var fp = findpot(celli, cellj);
if (fp && (_root[(("w" + fp.poti) + fp.potj) + "0"].movable)) {
hand = currmap[fp.poti][fp.potj];
origi = fp.poti;
origj = fp.potj;
lasthandi = fp.poti;
lasthandj = fp.potj;
cellioff = fp.poti - celli;
celljoff = fp.potj - cellj;
cellioffpx = (GRIDX + (fp.poti * CELLW)) - _root._xmouse;
celljoffpx = (GRIDY + (fp.potj * CELLH)) - _root._ymouse;
_root.attachMovie("outlinecursor", "outlinecursor", outlinedepth, {_alpha:20, _width:_root.eprops[hand].width * CELLW, _height:_root.eprops[hand].height * CELLH, _x:_root._xmouse + cellioffpx, _y:_root._ymouse + celljoffpx});
}
} else {
_root.outlinecursor.removeMovieClip();
hand = E_EMPTY;
handmoved = false;
cellioff = 0;
celljoff = 0;
}
}
}
function mouseup() {
var celli = (Math.floor((_root._xmouse - GRIDX) / CELLW) + cellioff);
var cellj = (Math.floor((_root._ymouse - GRIDY) / CELLH) + celljoff);
if (hand != E_EMPTY) {
if (!handmoved) {
return(undefined);
}
_root.outlinecursor.removeMovieClip();
hand = E_EMPTY;
handmoved = false;
cellioff = 0;
celljoff = 0;
}
}
function dropdrop(speed, curri, currj, dir) {
if ((_root.currframe % speed) == 0) {
var nn = ("drop" + Math.random());
_root.attachMovie("drop", nn, _root.getNextHighestDepth());
if ((dir == 3) || (dir == 1)) {
_root[nn]._x = (GRIDX + (curri * CELLW)) + (Math.random() * CELLW);
_root[nn]._y = GRIDY + (currj * CELLH);
}
if (dir == 4) {
_root[nn]._x = (((GRIDX + (curri * CELLW)) + CELLW) + (Math.random() * 6)) - 3;
_root[nn]._y = ((GRIDY + (currj * CELLH)) + 10) + (Math.random() * 20);
}
if (dir == 2) {
_root[nn]._x = ((GRIDX + (curri * CELLW)) + (Math.random() * 6)) - 3;
_root[nn]._y = ((GRIDY + (currj * CELLH)) + 10) + (Math.random() * 20);
}
_root[nn].cacheAsBitmap = true;
}
}
function incstream(stream, i, j, layer, dir, forcetubestart) {
var curri = i;
var currj = j;
var currlayer = layer;
var currdir = dir;
var count33 = 0;
var retstream = stream;
while (true) {
var nexte = getmatchingelement(curri, currj, currlayer, currdir, forcetubestart);
forcetubestart = undefined;
_root.infinitycount++;
if (_root.infinitycount > (GRIDW * GRIDH)) {
return(undefined);
}
if (((nexte.todir == 3) && (currdir == 1)) && (stream)) {
var nn = ("drop" + Math.random());
_root.attachMovie("drop", nn, _root.getNextHighestDepth());
_root[nn]._x = (GRIDX + (curri * CELLW)) + (Math.random() * CELLW);
_root[nn]._y = GRIDY + (currj * CELLH);
_root[nn].cacheAsBitmap = true;
break;
}
if (currdir == 3) {
count33++;
} else {
count33 = 0;
}
var nextprop = eprops[_root[nexte.m].element];
_root[nexte.m].wfrom = oppdir(currdir);
_root[nexte.m].wto = nexte.todir;
curri = nexte.i;
currj = nexte.j;
currdir = nexte.todir;
currlayer = nexte.layer;
var pb = _root.potb[curri][currj - 1];
if (pb != undefined) {
var n = pb.potmc;
var potprop = pb.prop;
if (count33 > potprop.height) {
if (((i == 6) && (j == 7)) && (_root[n].wamount == 57)) {
n = n;
}
if ((n == "w580") && (_root[n].wamount == 57)) {
n = n;
}
if (stream) {
if ((n == "w580") && (_root[n].wamount == 56)) {
n = n;
}
_root[n].wlast = _root[n].wamount;
_root[n].wamount++;
if (_root[n].wamount == 1) {
startsfx(5);
}
}
if (_root[n].wamount > potprop.capacity) {
if (potprop.of == undefined) {
if ((_root.currframe % 3) == 1) {
if (_root[n].wamount > (potprop.capacity + 5)) {
var nn = ("drop" + Math.random());
_root.attachMovie("drop", nn, _root.getNextHighestDepth());
_root[nn]._x = (GRIDX + (pb.x * CELLW)) + ((Math.random() * CELLW) * potprop.width);
_root[nn]._y = GRIDY + (pb.y * CELLH);
_root[nn].cacheAsBitmap = true;
}
}
} else {
var ofx;
var ofy;
var ofdir;
if (potprop.of == 1) {
ofx = pb.x;
ofy = pb.y;
ofdir = 4;
} else {
ofx = (pb.x + potprop.width) - 1;
ofy = pb.y;
ofdir = 2;
}
if (!_root[n].ofhandled) {
if (_root[n].overflown > (_root[n].wamount - potprop.capacity)) {
if (incstream(false, ofx, ofy, 0, ofdir, true)) {
totalstream++;
}
_root[n].ofhandled = true;
} else {
if (_root[n].overflown == undefined) {
_root[n].overflown = 0;
}
_root[n].overflown++;
if (incstream(true, ofx, ofy, 0, ofdir, true)) {
totalstream++;
}
_root[n].ofhandled = true;
}
}
}
}
break;
}
}
if (eprops[_root[nexte.m].element].type == E_SPLIT) {
if (_root[nexte.m].dirs == "1441") {
if (incstream(false, curri, currj, currlayer, 2)) {
totalstream++;
}
}
if (_root[nexte.m].dirs == "1221") {
if (incstream(false, curri, currj, currlayer, 4)) {
totalstream++;
}
}
}
if (nexte.out) {
if (stream) {
dropdrop(2, nexte.i, nexte.j, nexte.todir);
}
break;
}
if (stream && (nexte.blocked)) {
dropdrop(2, curri, currj, nexte.todir);
break;
}
_root[nexte.m].wlast = _root[nexte.m].wamount;
if (stream) {
_root[nexte.m].wamount++;
_root[nexte.m].wtotalamount++;
var m = nexte.m;
var e = eprops[_root[m].element];
if (e.type == E_SPLIT) {
if (_root[m].wtotalamount >= e.capacity) {
if ((((_root[m].wtotalamount - e.capacity) % 56) == 28) || (((_root[m].wtotalamount - e.capacity) % 56) == 0)) {
if (_root[m].dirs == "1221") {
_root[m].dirs = "1441";
_root[m].lever._xscale = -100;
} else {
_root[m].dirs = "1221";
_root[m].lever._xscale = 100;
}
}
}
}
if (_root[nexte.m].wamount <= nextprop.capacity) {
stream = false;
} else {
_root[nexte.m].wamount = nextprop.capacity;
}
} else if (_root[nexte.m].wamount > 0) {
stream = true;
retstream = true;
_root[nexte.m].wamount--;
if (_root[nexte.m].wamount == 0) {
_root[nexte.m].wfrom = 0;
_root[nexte.m].wto = 0;
_root[nexte.m].ownedby = "";
_root[nexte.m].gotoAndStop(1);
}
}
}
return(retstream);
}
function inclevel() {
var layer = 0;
var totaltanks = 0;
var totalinpot = 0;
totalstream = 0;
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var m = ((("w" + i) + j) + layer);
var e = eprops[_root[m].element];
if (e.type == E_POT) {
_root[m].ofhandled = false;
}
j++;
}
i++;
}
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var m = ((("w" + i) + j) + layer);
var e = eprops[_root[m].element];
if (e.type == E_SPLIT) {
}
if (e.type == E_POT) {
totalinpot = totalinpot + Math.min(e.capacity, _root[m].wamount);
}
if (e.type == E_TANK) {
var stream;
totaltanks = totaltanks + e.capacity;
if (_root[m].wamount > 0) {
_root[m].wamount--;
stream = true;
} else {
stream = false;
}
_root.infinitycount = 0;
stream = incstream(stream, i, (j + e.height) - 1, layer, 3, true);
if (_root.infinitycount > (GRIDW * GRIDH)) {
_root.dummy.onEnterFrame = undefined;
showdialog("\nThe level contains an infinite loop. Please try another setup!", true, function () {
stopwater();
hidedialog();
startsfx(0);
});
return(undefined);
}
if (stream) {
totalstream++;
}
}
j++;
}
i++;
}
if (totaltanks == totalinpot) {
if (currlevel < FIRSTDEMOLEVEL) {
if (_root.genericdialog == undefined) {
stopsfx(0);
startsfx(6);
}
_root.levelstatus[currlevel] = 1;
_root.savestatus();
if (currlevel == NUMLEVELS) {
showdialog("Congratulations!\n\nAll levels solved, game completed.", true, function () {
quit();
});
} else {
showdialog("\nSUCCESS!\nClick to continue!", true, function () {
stopwater();
currlevel++;
initlevel(currlevel);
hidedialog();
startsfx(0);
});
}
} else {
_root.attachMovie("dummy", "fader", _root.getNextHighestDepth(), {_x:-100, _y:-100, cf:0});
_root.dummy.onEnterFrame = undefined;
_root.fader.onEnterFrame = function () {
var over = false;
this.cf++;
if (this.cf > 30) {
var layer = 0;
while (layer < MAXLAYERS) {
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var mname = ((("w" + i) + j) + layer);
_root[mname]._alpha = _root[mname]._alpha - 3;
if (_root[mname]._alpha <= 0) {
over = 1;
}
j++;
}
i++;
}
layer++;
}
}
if (over) {
stopwater();
this.removeMovieClip();
_root.currlevel++;
if (_root.currlevel > LASTDEMOLEVEL) {
_root.currlevel = FIRSTDEMOLEVEL;
}
initlevel(_root.currlevel);
startwater();
}
};
}
} else if (totalstream == 0) {
stopsfx(0);
stopsfx(8);
startsfx(7);
_root.dummy.onEnterFrame = undefined;
showdialog("\nWHAT A WASTE!\nLevel failed.", true, function () {
stopwater();
hidedialog();
startsfx(0);
}, true);
}
var newtimer = getTimer();
lasttimer = newtimer;
updatelevel();
}
function updatelevel() {
_root.currframe++;
var layer = 0;
while (layer < MAXLAYERS) {
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var mname = ((("w" + i) + j) + layer);
var e = eprops[_root[mname].element];
if ((e.type == E_EMPTY) && (_root[mname].wamount == 0)) {
} else {
if (_root[mname].movable) {
if (_root.dummy.onEnterFrame == updatelevel) {
if ((_root.currframe % 20) < 10) {
_root[mname].filters = [gl];
} else {
_root[mname].filters = [gl2];
}
} else {
_root[mname].filters = undefined;
}
}
if ((_root[mname].wamount > 0) && (j >= (GRIDWATERLIMIT - 1))) {
} else if (((_root[mname].wamount == 0) || (e.type == E_TANK)) || (e.type == E_POT)) {
_root[mname]._xscale = 100;
_root[mname]._yscale = 100;
_root[mname]._rotation = 0;
_root[mname]._x = GRIDX + (i * CELLW);
_root[mname]._y = GRIDY + (j * CELLH);
switch (e.type) {
case E_TANK :
_root[mname].balloonmask._y = e.pixh - ((e.pixh * _root[mname].wamount) / e.capacity);
break;
case E_POT :
if (_root[mname].wamount <= e.capacity) {
_root[mname].potmask._y = (e.height * CELLH) * (1 - (_root[mname].wamount / e.capacity));
}
break;
default :
if (e.type == E_SPLIT) {
_root[mname].gotoAndStop(_root[mname].element - 34);
} else {
_root[mname].gotoAndStop(_root[mname].element + 1);
}
}
} else {
var dir = ((10 * _root[mname].wfrom) + _root[mname].wto);
switch (dir) {
case 12 :
sf = 30;
xs = 100;
ys = -100;
ro = 90;
xo = 0;
yo = 0;
break;
case 21 :
sf = 30;
xs = 100;
ys = 100;
ro = 180;
xo = CELLW;
yo = CELLH;
break;
case 23 :
sf = 30;
xs = 100;
ys = -100;
ro = 180;
xo = CELLW;
yo = 0;
break;
case 32 :
sf = 30;
xs = 100;
ys = 100;
ro = 270;
xo = 0;
yo = CELLH;
break;
case 34 :
sf = 30;
xs = 100;
ys = -100;
ro = 270;
xo = CELLW;
yo = CELLH;
break;
case 43 :
sf = 30;
xs = 100;
ys = 100;
ro = 0;
xo = 0;
yo = 0;
break;
case 41 :
sf = 30;
xs = 100;
ys = -100;
ro = 0;
xo = 0;
yo = CELLH;
break;
case 14 :
sf = 30;
xs = 100;
ys = 100;
ro = 90;
xo = CELLW;
yo = 0;
break;
case 13 :
sf = 80;
xs = 100;
ys = 100;
ro = 0;
xo = 0;
yo = 0;
break;
case 31 :
sf = 80;
xs = 100;
ys = -100;
ro = 0;
xo = 0;
yo = CELLH;
break;
case 42 :
sf = 80;
xs = 100;
ys = 100;
ro = 270;
xo = 0;
yo = CELLH;
break;
case 24 :
sf = 80;
xs = 100;
ys = 100;
ro = 90;
xo = CELLW;
yo = 0;
}
if (_root[mname].element == 0) {
sf = sf + 100;
}
if (e.type == E_SPLIT) {
sf = 230;
xs = 100;
ys = 100;
ro = 0;
xo = 0;
yo = 0;
}
if (_root[mname].wamount < _root[mname].wlast) {
_root[mname].gotoAndStop(((sf + 20) + e.capacity) - _root[mname].wamount);
} else if (_root[mname].wamount == _root[mname].wlast) {
if ((_root[mname]._currentFrame < (sf + 40)) || (_root[mname]._currentFrame >= (sf + 50))) {
_root[mname].gotoAndPlay(sf + 40);
}
} else {
_root[mname].gotoAndStop(sf + _root[mname].wamount);
}
_root[mname]._xscale = xs;
_root[mname]._yscale = ys;
_root[mname]._rotation = ro;
_root[mname]._x = (GRIDX + (i * CELLW)) + xo;
_root[mname]._y = (GRIDY + (j * CELLH)) + yo;
}
}
j++;
}
i++;
}
layer++;
}
}
function showdialog(txt, button, okcallback, wtbtn) {
if (_root.genericdialog == undefined) {
_root.attachMovie("genericdialog", "genericdialog", _root.getNextHighestDepth(), {_x:48, _y:67, cacheAsBitmap:true, _alpha:0});
_root.btn_start.enabled = false;
_root.btn_stop.enabled = false;
_root.btn_reset.enabled = false;
_root.genericdialog.ok.txt = "CONTINUE";
_root.genericdialog.ok.onPress = okcallback;
_root.genericdialog.dlgtxt = txt;
_root.genericdialog.onEnterFrame = function () {
if (this._alpha < 100) {
this._alpha = this._alpha + 4;
} else {
this._alpha = 100;
}
};
if (wtbtn != undefined) {
_root.genericdialog.walkthrough.txt = "NEED A HINT?";
_root.genericdialog.walkthrough.onPress = function () {
startsfx(1);
_root.getURL("http://armorgames.com/guide/liquid-measure-2-vide-guide-and-walkthrough", "_blank");
};
} else {
_root.genericdialog.walkthrough._visible = false;
}
_root.dialogvisible = true;
if (button) {
_root.genericdialog.ok.enabled = true;
_root.genericdialog.ok._visible = true;
} else {
_root.genericdialog.ok.enabled = false;
_root.genericdialog.ok._visible = false;
}
}
}
function hidedialog() {
_root.btn_start.enabled = true;
_root.btn_stop.enabled = true;
_root.btn_reset.enabled = true;
_root.genericdialog.removeMovieClip();
_root.dialogvisible = false;
}
map1 = [[0, 9, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 103, 0, 0, 0], [0, 0, 0, 0, 104, 0, 0, 0], [0, 133, 0, 0, 101, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map1 = [[0, 0, 9, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 116, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map2 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 25, 0, 0, 0, 0], [0, 0, 8, 0, 0, 0, 0, 0], [0, 7, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 117, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map3 = [[0, 0, 0, 0, 0, 0, 9, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 2, 4, 0], [0, 15, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 102, 102, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map4 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 25, 0, 0, 0, 25, 0, 0], [0, 0, 0, 8, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [121, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 102, 0, 103, 0, 104], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map5 = [[0, 9, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 2, 0, 0, 0, 0, 0], [0, 0, 0, 33, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 112, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map6 = [[0, 25, 0, 0, 0, 0, 25, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 3, 0, 0, 0, 0, 0, 0], [19, 19, 0, 0, 19, 19, 19, 19], [0, 0, 0, 0, 0, 0, 0, 0], [0, 102, 0, 0, 0, 0, 0, 0], [0, 102, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 130, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 112, 0, 0, 104], [0, 0, 0, 0, 0, 0, 0, 0]];
map7 = [[0, 0, 0, 0, 0, 0, 9, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 4, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 42, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 112, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 112, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map8 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 25, 0, 0, 25, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 42, 0, 0, 43, 0, 0], [0, 11, 0, 0, 0, 0, 11, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 110, 0, 0, 0, 0, 110, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map9 = [[7, 8, 25, 9, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 103, 0, 103, 0], [0, 0, 0, 0, 16, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 114, 0, 114, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map10 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 25, 0, 0, 0, 0], [0, 0, 8, 0, 0, 8, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 114, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 116, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map11 = [[0, 0, 9, 0, 0, 25, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0], [0, 5, 0, 0, 0, 0, 6, 0], [0, 3, 6, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1, 0], [0, 0, 3, 0, 0, 0, 4, 0], [0, 18, 18, 0, 0, 0, 18, 18], [0, 18, 18, 18, 0, 142, 115, 0], [113, 0, 0, 0, 0, 143, 0, 0]];
map12 = [[9, 9, 9, 9, 9, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 18, 18, 0], [0, 0, 0, 0, 0, 0, 18, 0], [1, 1, 1, 1, 3, 2, 0, 0], [1, 1, 1, 3, 2, 2, 0, 0], [1, 1, 3, 2, 2, 2, 0, 0], [1, 3, 2, 2, 2, 2, 0, 0], [3, 2, 2, 2, 140, 0, 0, 0], [0, 0, 139, 0, 0, 0, 112, 0], [0, 0, 0, 0, 0, 0, 138, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map13 = [[0, 0, 0, 9, 7, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 0], [0, 0, 6, 3, 0, 1, 0, 6], [0, 0, 3, 6, 0, 4, 0, 1], [0, 0, 0, 3, 2, 2, 2, 4], [0, 5, 2, 2, 2, 2, 2, 6], [0, 1, 5, 2, 2, 2, 2, 4], [0, 4, 3, 2, 2, 2, 2, 0], [0, 0, 0, 0, 0, 0, 0, 0], [126, 110, 126, 134, 126, 0, 0, 0]];
map14 = [[0, 0, 9, 9, 8, 25, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [138, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [131, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 18, 0, 0, 5, 0], [0, 0, 0, 0, 0, 0, 1, 10], [18, 102, 0, 0, 0, 0, 1, 18], [18, 104, 0, 0, 18, 18, 1, 18], [18, 18, 18, 33, 0, 0, 4, 18], [0, 0, 18, 18, 18, 18, 18, 18], [0, 0, 0, 0, 0, 0, 0, 0]];
map15 = [[18, 18, 18, 18, 18, 18, 18, 18], [0, 25, 8, 7, 7, 8, 25, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 123, 0, 0, 0, 0, 0], [0, 0, 0, 0, 116, 0, 0, 0], [0, 0, 0, 0, 0, 0, 112, 0]];
map16 = [[25, 0, 0, 25, 0, 25, 0, 110], [0, 0, 0, 0, 0, 0, 0, 134], [0, 0, 0, 0, 0, 0, 0, 134], [0, 0, 0, 0, 0, 0, 0, 102], [33, 0, 0, 0, 0, 0, 0, 103], [19, 19, 19, 33, 0, 0, 0, 0], [0, 6, 19, 19, 19, 0, 41, 0], [0, 3, 6, 0, 6, 0, 19, 19], [19, 0, 3, 0, 1, 0, 0, 0], [19, 0, 0, 19, 3, 0, 0, 0], [19, 19, 19, 19, 19, 19, 19, 19], [0, 0, 0, 0, 0, 0, 0, 0]];
map17 = [[8, 0, 8, 7, 19, 25, 0, 9], [0, 0, 0, 1, 19, 0, 0, 0], [3, 0, 1, 1, 19, 0, 0, 0], [0, 0, 4, 1, 19, 0, 0, 0], [0, 0, 2, 4, 19, 1, 0, 0], [0, 0, 0, 0, 0, 3, 2, 0], [0, 0, 102, 101, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 104, 0], [0, 114, 0, 102, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 114, 0], [0, 0, 0, 0, 0, 0, 0, 0], [123, 0, 0, 0, 0, 0, 0, 0]];
map18 = [[9, 0, 0, 0, 0, 8, 25, 9], [0, 0, 136, 136, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0], [3, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 2, 2, 0, 0, 0], [0, 0, 10, 0, 0, 0, 0, 0], [18, 18, 18, 0, 18, 18, 18, 18], [111, 0, 0, 0, 0, 0, 0, 135], [0, 0, 0, 0, 133, 0, 0, 0]];
map19 = [[0, 9, 0, 9, 0, 9, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 19, 0, 0, 0], [19, 19, 0, 0, 0, 0, 0, 0], [103, 101, 0, 19, 0, 0, 138, 0], [106, 103, 19, 0, 0, 0, 0, 0], [101, 103, 0, 0, 0, 0, 0, 0], [104, 102, 0, 34, 0, 0, 0, 0], [0, 105, 0, 0, 0, 0, 0, 0], [16, 0, 0, 0, 13, 0, 0, 0]];
map20 = [[102, 0, 8, 7, 8, 9, 0, 25], [102, 0, 0, 0, 0, 0, 0, 0], [102, 0, 0, 0, 0, 0, 0, 0], [104, 0, 0, 0, 18, 0, 0, 0], [104, 126, 0, 0, 0, 0, 0, 18], [104, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 18], [33, 0, 0, 0, 0, 0, 0, 0], [0, 33, 0, 0, 0, 0, 0, 34], [0, 0, 33, 0, 0, 0, 0, 0], [0, 0, 0, 41, 0, 0, 0, 0], [0, 0, 10, 0, 0, 0, 10, 0]];
map21 = [[7, 0, 8, 7, 0, 0, 0, 8], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 14, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 5, 0, 0], [0, 0, 0, 2, 0, 0, 0, 0], [0, 0, 0, 0, 12, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 101, 0, 0, 0, 0, 0, 0], [103, 0, 106, 104, 106, 0, 0, 0], [103, 101, 103, 103, 101, 134, 0, 0]];
map22 = [[7, 19, 7, 19, 7, 19, 7, 19], [0, 7, 1, 7, 0, 7, 0, 7], [0, 0, 4, 0, 0, 4, 0, 4], [0, 0, 19, 0, 0, 19, 0, 19], [0, 0, 0, 0, 0, 19, 0, 0], [0, 0, 0, 19, 5, 0, 0, 0], [19, 19, 0, 0, 4, 19, 19, 0], [0, 0, 19, 19, 19, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 111, 0], [0, 0, 0, 0, 0, 0, 0, 110], [141, 0, 126, 102, 102, 102, 133, 0]];
map23 = [[8, 25, 25, 8, 0, 25, 25, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [30, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 33, 0, 0, 0, 0], [0, 0, 0, 0, 0, 36, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [105, 101, 101, 0, 0, 0, 0, 0], [0, 102, 103, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 10, 0, 0], [0, 0, 23, 0, 0, 0, 0, 0]];
map24 = [[0, 9, 0, 0, 0, 0, 0, 9], [25, 0, 0, 0, 25, 0, 0, 0], [0, 0, 0, 8, 0, 0, 0, 0], [0, 0, 7, 0, 0, 7, 7, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 103, 0, 0, 0, 113, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 114, 0, 0, 116, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 116, 0, 0, 0], [0, 0, 0, 0, 0, 18, 18, 0], [0, 0, 0, 122, 0, 0, 0, 0]];
map25 = [[0, 25, 0, 0, 0, 9, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [19, 19, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 18, 18, 0, 0], [0, 2, 0, 2, 2, 2, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [14, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 102, 142, 135, 101, 11], [0, 103, 102, 102, 104, 0, 105, 0]];
map26 = [[9, 9, 9, 7, 0, 8, 25, 9], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 4, 0], [0, 0, 0, 0, 0, 0, 0, 4], [0, 0, 0, 0, 0, 18, 18, 18], [128, 0, 0, 0, 0, 18, 0, 0], [0, 0, 26, 0, 0, 18, 115, 0], [0, 0, 0, 32, 0, 0, 0, 0], [133, 0, 0, 0, 0, 0, 103, 102], [138, 0, 0, 0, 0, 18, 104, 104], [0, 0, 0, 0, 0, 18, 102, 102]];
map27 = [[102, 103, 0, 9, 9, 0, 7, 0], [102, 103, 0, 0, 0, 0, 0, 0], [102, 103, 0, 0, 0, 0, 0, 0], [106, 104, 0, 0, 0, 0, 0, 0], [106, 105, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 35, 0, 34, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 28, 0, 0, 0, 0, 43, 0], [0, 0, 0, 0, 0, 0, 0, 11], [0, 0, 0, 0, 0, 10, 0, 0]];
map28 = [[0, 0, 8, 5, 6, 8, 8, 0], [0, 0, 0, 1, 1, 0, 0, 0], [18, 5, 0, 1, 1, 0, 0, 0], [18, 1, 0, 4, 3, 0, 18, 18], [5, 4, 6, 0, 5, 0, 18, 8], [3, 0, 1, 0, 1, 0, 0, 0], [18, 18, 1, 0, 1, 18, 0, 0], [25, 5, 4, 0, 3, 0, 0, 18], [0, 1, 18, 0, 0, 0, 0, 0], [0, 1, 18, 0, 135, 127, 126, 0], [0, 1, 18, 104, 0, 0, 126, 134], [0, 4, 18, 104, 116, 0, 0, 0]];
map29 = [[8, 0, 7, 0, 25, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [3, 0, 18, 0, 0, 0, 0, 0], [0, 0, 18, 0, 4, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 5, 42, 0, 0, 126], [0, 0, 0, 3, 0, 0, 0, 104], [0, 0, 0, 2, 0, 0, 101, 101], [0, 0, 14, 0, 0, 0, 106, 102], [0, 0, 0, 0, 12, 0, 106, 103], [0, 0, 0, 0, 0, 0, 106, 103]];
map30 = [[25, 0, 8, 8, 8, 0, 9, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0, 0, 0], [1, 0, 4, 0, 3, 6, 0, 0], [3, 2, 0, 0, 0, 4, 0, 0], [0, 5, 0, 0, 0, 2, 4, 0], [0, 3, 0, 0, 2, 2, 0, 0], [0, 0, 0, 0, 0, 0, 0, 6], [0, 0, 0, 0, 0, 2, 2, 4], [20, 0, 0, 134, 102, 102, 0, 0], [0, 0, 0, 110, 141, 0, 101, 0], [0, 0, 0, 141, 0, 126, 0, 0]];
map31 = [[0, 8, 8, 0, 0, 8, 8, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 3, 2, 0, 4, 1, 0], [0, 3, 2, 2, 0, 2, 4, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 19, 0, 0, 0, 0, 0, 0], [0, 110, 110, 0, 19, 0, 0, 0], [0, 19, 19, 0, 0, 0, 0, 0], [0, 110, 0, 0, 0, 19, 0, 19], [0, 19, 134, 19, 0, 0, 0, 0], [133, 0, 105, 143, 106, 142, 133, 0]];
map100 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 8, 0, 0, 8, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 16, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map101 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 8, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 3, 2, 0, 0, 0, 0], [0, 0, 18, 18, 12, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map102 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 8, 8, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 33, 0, 0, 0, 0, 0], [0, 0, 0, 0, 12, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map103 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 25, 0, 0, 25, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 33, 0, 0, 0, 41, 0, 0], [0, 0, 0, 12, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map104 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 25, 0, 0], [0, 0, 8, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 35, 0, 0], [0, 0, 13, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map105 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 8, 0, 0, 8, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 3, 0, 0, 4, 0, 0], [0, 19, 19, 0, 0, 19, 19, 0], [0, 0, 16, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map106 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 7, 0, 0, 0, 0, 0], [0, 0, 3, 2, 2, 6, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 2, 4, 0, 0], [0, 0, 0, 10, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map107 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 25, 0, 0], [0, 0, 0, 8, 0, 0, 0, 0], [0, 0, 7, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 23, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map108 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 8, 8, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 33, 0, 0, 0, 0, 0], [0, 0, 0, 0, 26, 0, 0, 0], [0, 0, 0, 0, 0, 10, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map109 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 8, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 42, 2, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 10, 0, 0, 10, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
map110 = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 25, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 33, 0, 2, 6, 0, 0], [0, 0, 0, 0, 0, 4, 0, 0], [0, 0, 0, 0, 10, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]];
var ds = (new flash.filters.DropShadowFilter(0, 45, 0, 50, 10, 10, 2, 1, false, false, false));
var gl = (new flash.filters.GlowFilter(52224, 0.5, 10, 10, 2, 1, false, false));
var gl2 = (new flash.filters.GlowFilter(34816, 0.5, 10, 10, 2, 1, false, false));
var currmap = Array();
var currframe = 0;
var lasttimer;
var NUMLEVELS = 31;
var FIRSTDEMOLEVEL = 100;
var LASTDEMOLEVEL = 110;
GRIDX = 48;
GRIDY = 67;
GRIDW = 8;
GRIDH = 12;
GRIDWATERLIMIT = 13;
MAXLAYERS = 5;
CELLW = 50;
CELLH = 50;
E_EMPTY = 0;
E_PIPE = 1;
E_TANK = 2;
E_POT = 3;
E_BLOCK = 4;
E_SPLIT = 5;
START_X = 519;
START_Y = 70;
RESET_X = 521;
RESET_Y = 200;
EXIT_X = 501;
EXIT_Y = 614;
var hand = E_EMPTY;
var lasthandi;
var lasthandj;
var handmoved = false;
var origi;
var origj;
var cellioff = 0;
var celljoff = 0;
var cellioffpx = 0;
var celljoffpx = 0;
var outlinedepth;
var soundmuted = false;
var oldvolume;
var dbg = 0;
var infinitycount;
var gme;
var potb;
var potblock;
eprops = Array();
eprops[0] = {type:E_EMPTY, dirs:"", width:1, height:1, capacity:10};
eprops[1] = {type:E_PIPE, dirs:"1331", width:1, height:1, capacity:9};
eprops[2] = {type:E_PIPE, dirs:"2442", width:1, height:1, capacity:9};
eprops[3] = {type:E_PIPE, dirs:"1221", width:1, height:1, capacity:10};
eprops[4] = {type:E_PIPE, dirs:"1441", width:1, height:1, capacity:10};
eprops[5] = {type:E_PIPE, dirs:"2332", width:1, height:1, capacity:10};
eprops[6] = {type:E_PIPE, dirs:"3443", width:1, height:1, capacity:10};
eprops[7] = {type:E_TANK, dirs:"", width:1, height:1, capacity:28, pixh:50};
eprops[8] = {type:E_TANK, dirs:"", width:1, height:2, capacity:56, pixh:100};
eprops[9] = {type:E_TANK, dirs:"", width:1, height:4, capacity:112, pixh:200};
eprops[10] = {type:E_POT, dirs:"", width:1, height:1, capacity:28};
eprops[11] = {type:E_POT, dirs:"", width:1, height:2, capacity:56};
eprops[12] = {type:E_POT, dirs:"", width:2, height:1, capacity:56};
eprops[13] = {type:E_POT, dirs:"", width:3, height:1, capacity:84};
eprops[14] = {type:E_POT, dirs:"", width:1, height:3, capacity:84};
eprops[15] = {type:E_POT, dirs:"", width:2, height:2, capacity:112};
eprops[16] = {type:E_POT, dirs:"", width:4, height:1, capacity:112};
eprops[17] = {type:E_POT, dirs:"", width:3, height:2, capacity:168};
eprops[18] = {type:E_BLOCK, dirs:"", width:1, height:1, capacity:10};
eprops[19] = {type:E_BLOCK, dirs:"", width:1, height:1, capacity:10};
eprops[20] = {type:E_POT, dirs:"", width:2, height:3, capacity:168};
eprops[21] = {type:E_POT, dirs:"", width:2, height:4, capacity:224};
eprops[22] = {type:E_POT, dirs:"", width:5, height:1, capacity:140};
eprops[23] = {type:E_POT, dirs:"", width:6, height:1, capacity:168};
eprops[24] = {type:E_POT, dirs:"", width:1, height:4, capacity:112};
eprops[25] = {type:E_TANK, dirs:"", width:1, height:3, capacity:84, pixh:150};
eprops[26] = {type:E_POT, dirs:"", width:1, height:1, capacity:28, of:2};
eprops[27] = {type:E_POT, dirs:"", width:1, height:2, capacity:56, of:2};
eprops[28] = {type:E_POT, dirs:"", width:1, height:3, capacity:84, of:2};
eprops[29] = {type:E_POT, dirs:"", width:1, height:4, capacity:112, of:2};
eprops[30] = {type:E_POT, dirs:"", width:2, height:2, capacity:112, of:2};
eprops[31] = {type:E_POT, dirs:"", width:2, height:3, capacity:168, of:2};
eprops[32] = {type:E_POT, dirs:"", width:2, height:4, capacity:224, of:2};
eprops[33] = {type:E_POT, dirs:"", width:2, height:1, capacity:56, of:2};
eprops[34] = {type:E_POT, dirs:"", width:1, height:1, capacity:28, of:1};
eprops[35] = {type:E_POT, dirs:"", width:1, height:2, capacity:56, of:1};
eprops[36] = {type:E_POT, dirs:"", width:1, height:3, capacity:84, of:1};
eprops[37] = {type:E_POT, dirs:"", width:1, height:4, capacity:112, of:1};
eprops[38] = {type:E_POT, dirs:"", width:2, height:2, capacity:112, of:1};
eprops[39] = {type:E_POT, dirs:"", width:2, height:3, capacity:168, of:1};
eprops[40] = {type:E_POT, dirs:"", width:2, height:4, capacity:224, of:1};
eprops[41] = {type:E_POT, dirs:"", width:2, height:1, capacity:56, of:1};
eprops[42] = {type:E_SPLIT, dirs:"1221", width:1, height:1, capacity:10};
eprops[43] = {type:E_SPLIT, dirs:"1441", width:1, height:1, capacity:10};
var potarr = [10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41];
_root.about.txt = "ABOUT";
_root.about.onPress = function () {
stopwater();
cls();
startsfx(1);
_root.gotoAndPlay("about");
};
_root.startgame.txt = "START";
_root.startgame.onPress = function () {
stopwater();
cls();
startsfx(1);
_root.gotoAndPlay("selectlevel");
};
_root.oldversion.txt = "PLAY LM1";
_root.oldversion.onPress = function () {
startsfx(1);
_root.getURL("http://armorgames.com/play/3799/liquid-measure", "_blank");
};
_root.walkthrough.txt = "GET A HINT";
_root.walkthrough.onPress = function () {
startsfx(1);
_root.getURL("http://armorgames.com/guide/liquid-measure-2-vide-guide-and-walkthrough", "_blank");
};
_root.attachMovie("moregames", "moregames", _root.getNextHighestDepth(), {_x:504, _y:399});
_root.moregames.onPress = function () {
startsfx(1);
_root.getURL("http://armorgames.com", "_blank");
};
_root.attachMovie("twitter", "twitter", _root.getNextHighestDepth(), {_x:504, _y:247});
_root.twitter.onPress = function () {
startsfx(1);
_root.getURL("http://twitter.com/armorgames", "_blank");
};
_root.attachMovie("facebook", "facebook", _root.getNextHighestDepth(), {_x:504, _y:323});
_root.facebook.onPress = function () {
startsfx(1);
_root.getURL("http://www.facebook.com/pages/Armor-Games/19522089061", "_blank");
};
_root.attachMovie("sclogo", "sclogo", _root.getNextHighestDepth(), {_x:501, _y:610});
_root.sclogo.onPress = function () {
startsfx(1);
_root.getURL("http://smartcode.hu", "_blank");
};
if ((_root.customlevel != undefined) && (_root.customlevel != "")) {
_root.onLoad = function () {
_root.currlevel = 1;
for (c in _root) {
removeMovieClip(_root[c]);
}
_root.gotoAndPlay("startgame");
};
}
if (!isplayingsfx(2)) {
initsfx();
stopallsfx();
startsfx(2);
}
_root.dummy.onEnterFrame = updatelevel;
_root.currlevel = FIRSTDEMOLEVEL;
_root.initlevel(_root.currlevel);
startwater();
stop();
var totalstream = 0;
Instance of Symbol 10 MovieClip [dummy] "dummy" in Frame 3
onClipEvent (keyDown) {
_root.keydown(Key.getCode());
}
Frame 4
function loadstatus() {
var i = 0;
while (i < NUMLEVELS) {
levelstatus[i] = _root.local_data.data["lvl" + i];
if ((levelstatus[i] == undefined) || (levelstatus[i] == "")) {
if (i == 0) {
levelstatus[i] = 1;
} else {
levelstatus[i] = 0;
}
}
i++;
}
statusloaded = 1;
}
function savestatus() {
var i = 0;
while (i < NUMLEVELS) {
_root.local_data.data["lvl" + i] = levelstatus[i];
i++;
}
}
var local_data = SharedObject.getLocal("liquidmeasure2_gamestate");
var currlevel;
var levelstatus;
if (statusloaded != 1) {
levelstatus = Array(NUMLEVELS);
loadstatus();
}
var i = 0;
while (i < NUMLEVELS) {
var m = ("btn_lvl" + (i + 1));
_root[m].txt = "LEVEL " + (i + 1);
_root[m].gotoAndStop(1);
_root[m].onPress = function () {
stopallsfx();
startsfx(1);
_root.currlevel = this.tolevel;
for (c in _root) {
removeMovieClip(_root[c]);
}
_root.gotoAndPlay("startgame");
};
_root[m].tolevel = i + 1;
if (levelstatus[i] == 0) {
_root[m].enabled = false;
_root[m].gotoAndStop(2);
}
i++;
}
stop();
Frame 5
_root.dummy.onEnterFrame = updatelevel;
_root.dummy.onMouseMove = mousemove;
_root.dummy.onMouseDown = mousedown;
_root.dummy.onMouseUp = mouseup;
_root.attachMovie("btn_exit", "btn_exit", _root.getNextHighestDepth());
_root.btn_exit.onPress = quit;
_root.btn_exit._x = EXIT_X;
_root.btn_exit._y = EXIT_Y;
_root.attachMovie("lever", "lever", _root.getNextHighestDepth());
_root.lever.onEnterFrame = function () {
if (_root.genericdialog != undefined) {
this.gotoAndStop(2);
return(undefined);
}
if (inrect(_root._xmouse, _root._ymouse, this._x, this._y, 125, 150)) {
if ((_root._xmouse - this._x) < 45) {
this.gotoAndStop(2);
}
if (((_root._xmouse - this._x) >= 45) && ((_root._xmouse - this._x) < 80)) {
this.gotoAndStop(1);
}
if ((_root._xmouse - this._x) >= 80) {
this.gotoAndStop(3);
}
} else if (_root.dummy.onEnterFrame == inclevel) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
};
_root.lever.onPress = function () {
if (_root.genericdialog != undefined) {
return(undefined);
}
if ((_root._xmouse - this._x) < 45) {
stopwater();
}
if (((_root._xmouse - this._x) >= 45) && ((_root._xmouse - this._x) < 80)) {
startwater();
}
if ((_root._xmouse - this._x) >= 80) {
stopwater();
resetlevel();
}
};
_root.lever._x = 473;
_root.lever._y = 439;
_root.lever.gotoAndStop(2);
_root.soundswitch.onPress = function () {
var s = new Sound();
if (_root.soundmuted == false) {
_root.oldvolume = s.getVolume();
s.setVolume(0);
_root.soundmuted = true;
_root.soundswitch.gotoAndStop(2);
} else {
s.setVolume(_root.oldvolume);
_root.soundmuted = false;
_root.soundswitch.gotoAndStop(1);
}
};
_root.soundswitch.gotoAndStop(1);
initlevel(currlevel);
stopallsfx();
startsfx(0);
stop();
Instance of Symbol 10 MovieClip [dummy] "dummy" in Frame 5
onClipEvent (keyDown) {
_root.keydown(Key.getCode());
}
Frame 6
_root.backbtn.txt = "BACK";
_root.backbtn.onPress = function () {
startsfx(1);
_root.gotoAndPlay("mainmenu");
};
stop();
Symbol 428 MovieClip [water] Frame 70
stop();
Symbol 428 MovieClip [water] Frame 120
stop();
Symbol 428 MovieClip [water] Frame 170
stop();
Symbol 428 MovieClip [water] Frame 220
stop();
Symbol 428 MovieClip [water] Frame 250
stop();
Symbol 432 MovieClip [drop] Frame 20
this.removeMovieClip();
Symbol 490 Button
on (press) {
getURL ("http://www.armorgames.com", "_blank");
}
Symbol 493 MovieClip Frame 1
_root.stop();
gotoAndPlay (2);
Symbol 493 MovieClip Frame 218
_root.gotoAndPlay("mainmenu");