Frame 1
function randn(n) {
return(Math.floor(Math.random() * n));
}
function tick() {
_root.set.Tick();
}
function randomindex(arr) {
return(arr[Math.floor(Math.random() * arr.length)]);
}
function array_search(arr, search) {
for (var _local3 in arr) {
if (arr[_local3] == search) {
return(_local3);
}
}
return(undefined);
}
function str_lpad(n, cnt, char) {
var _local1 = String(n);
if (cnt == undefined) {
cnt = 2;
}
if (char == undefined) {
char = "0";
}
while ((cnt - _local1.length) > 0) {
_local1 = char + _local1;
}
return(_local1);
}
function preload() {
var _local5 = _root.preloadbar;
var _local4 = _root;
var _local6 = 170;
var _local2 = _local4.getBytesTotal();
var _local3 = _local4.getBytesLoaded();
_local5._width = _local6 * (_local3 / _local2);
if (_local3 == _local2) {
_root.onEnterFrame = undefined;
_root.gotoAndStop(2);
}
}
System.security.allowDomain("endgameradio.com", "www.endgameradio.com");
_root.set = new JigSet();
_root.onEnterFrame = preload;
stop();
Frame 4
_root.set.IntroSound();
_root.set.StatusReport();
stop();
Frame 5
stop();
Frame 10
_root.set.Init();
stop();
Symbol 10 MovieClip [sec-tri-out] Frame 1
stop();
Symbol 17 MovieClip [sec-tri-in] Frame 1
stop();
Symbol 24 MovieClip [sec-flat] Frame 1
stop();
Symbol 35 Button
on (press) {
_root.set.ViewScores();
}
Symbol 41 Button
on (press) {
_root.set.username = _parent.entry.name.text;
var x;
if ((x = _root.set.SubmitScore())) {
this.submitlabel.text.text = "Sent!";
_parent.entry._visible = false;
}
}
Symbol 45 Button
on (press) {
_root.gotoAndStop(4);
_root.set.Clean();
this.removeMovieClip();
}
Symbol 47 MovieClip [Dialog] Frame 1
stop();
Symbol 65 Button
on (press) {
var a;
a = this.mark;
a._alpha = ((a._alpha > 0) ? 0 : 100);
if (a._alpha == 100) {
_root.set.mainvol.setVolume(100);
} else {
_root.set.mainvol.setVolume(0);
}
}
Symbol 162 MovieClip [__Packages.JigSet] Frame 0
class JigSet
{
var clip, pointsclip, pieces, mark, order, pointsclist, compliments, opposites, callback, bgm, mainvol, sound, soundmode, soundfx, sitemode, scoresent, userid, usertype, ground, stack, freecols, timemode, clawdir, clawqueue, lastmod, pointsi, holdmeter, mutexpiece, turn, tickcount, tickbase, countleveler, countsculptor, countdrill, countflaws, score, combo, flawpiece, flawpieceinv, active, nextpiece, clawclip, holdclip, difficulty, speedbase, playmode, backclip, starttime, keylistener;
function JigSet () {
clip = _root.pieces;
pointsclip = _root.createEmptyMovieClip("points", 1);
pieces = new Array();
mark = new Array();
order = new Array();
pointsclist = new Array();
compliments = new Array(0, 2, 1);
opposites = new Array(2, 3, 0, 1);
callback = new Array();
bgm = new Array();
bgm[0] = new SoundChannel(true);
bgm[0].SetPlaylist(new Array(new SoundPhrase("BGM_Jig")));
mainvol = new Sound();
var _local3 = _root.createEmptyMovieClip("sidesound", 4094);
sound = new Sound(_local3);
soundmode = 0;
var _local4 = _root.createEmptyMovieClip("sidesoundfx", 4093);
soundfx = new Sound(_local4);
IntroSound();
_root.createEmptyMovieClip("timertick", 5000);
_root.timertick.onEnterFrame = _root.tick;
_root.timertick.gotoAndPlay(1);
}
function IntroSound() {
if (soundmode != 9999) {
sound.attachSound("Intro");
sound.setVolume(100);
sound.start();
soundmode = 9999;
sound.onSoundComplete = function () {
this.start();
};
}
}
function AddPiece() {
var _local4 = new JigPiece();
pieces.push(_local4);
var _local3 = 3;
var _local5 = _root.randn(_local3);
var _local6 = _root.randn(_local3);
var _local7 = _root.randn(_local3);
var _local8 = _root.randn(_local3);
_local4.Create(this, pieces.length - 1, _local5, _local7, _local6, _local8);
return(_local4);
}
function StatusReport() {
}
function Init() {
StatusReport();
SoundEffect("Menu");
if (_root._url.indexOf("endgameradio.com") != -1) {
sitemode = 1;
} else {
sitemode = 0;
}
scoresent = 0;
if (_root.username) {
username = _root.username;
userid = _root.userid;
usertype = 1;
}
ground = new Array(12, 12, 12, 12, 12, 12, 12, 12);
stack = new Array();
freecols = new Array(0, 1, 2, 3, 4, 5, 6, 7);
var _local7 = 0;
while (_local7 < 8) {
stack[_local7] = new Array();
_local7++;
}
sound.stop();
soundmode = 0;
timemode = 0;
clawdir = 0;
clawqueue = 0;
lastmod = 0;
pointsi = 0;
usertype = 0;
holdmeter = holdmax;
mutexpiece = false;
turn = 0;
timemode = 0;
tickcount = 0;
tickbase = 0;
countleveler = 0;
countsculptor = 0;
countdrill = 0;
countflaws = 0;
score = 0;
combo = 0;
flawpiece = new JigPiece();
flawpiece.Create(this, 9999, 0, 0, 0, 0);
flawpieceinv = new JigPiece();
flawpieceinv.Create(this, 9998, 0, 0, 0, 0);
clip.loadVariables("http://endgameradio.com/smack.php");
var _local8 = AddPiece();
active = _local8;
nextpiece = AddPiece();
nextpiece.NextPiece();
_local8.Begin();
clawclip = _root.claw;
holdclip = _root.holdbar;
switch (difficulty) {
case 1 :
speedbase = Math.floor(tickdiv * 2);
allowedflaws = 40;
break;
case 2 :
speedbase = tickdiv;
allowedflaws = 20;
break;
case 3 :
speedbase = Math.floor(tickdiv * 0.66);
allowedflaws = 10;
}
switch (playmode) {
case "basic" :
break;
case "sudden" :
break;
case "speed" :
timelimit = 120 * (4 - difficulty);
break;
case "leveler" :
break;
case "sculptor" :
break;
case "driller" :
break;
case "bare" :
clawclip._alpha = 0;
holdclip._alpha = 0;
}
_root.textflaws.text = allowedflaws;
var _local5;
var _local6;
backclip = _root.backblocks;
backclip._alpha = 100;
var _local4 = 0;
while (_local4 < height) {
var _local3 = 0;
while (_local3 < width) {
_local5 = (_local4 * width) + _local3;
_local6 = backclip.attachMovie("JigBlock", "b" + _local5, _local5);
_local6._x = ((psizex * _local3) + offx) - (psizex * 0.5);
_local6._y = ((psizey * _local4) + offy) - (psizex * 0.5);
_local3++;
}
_local4++;
}
var _local9 = new Date();
starttime = Math.floor(_local9.getTime() / 1000);
keylistener = new Object();
keylistener.ref = this;
keylistener.onKeyDown = function () {
switch (Key.getCode()) {
case 37 :
case 65 :
this.ref.KeyLeft();
break;
case 39 :
case 68 :
this.ref.KeyRight();
break;
case 38 :
case 87 :
this.ref.KeyUp();
break;
case 40 :
case 83 :
this.ref.KeyDown();
break;
case 32 :
this.ref.KeyHold();
break;
case 70 :
this.ref.KeyDrop();
break;
case 86 :
this.ref.KeyAccel();
break;
case 90 :
this.ref.KeySculptor();
break;
case 88 :
this.ref.KeyLeveler();
break;
case 67 :
this.ref.KeyDrill();
}
};
keylistener.onKeyUp = function () {
switch (Key.getCode()) {
case 32 :
this.ref.KeyUnHold();
break;
case 86 :
this.ref.KeyUnAccel();
}
};
Key.addListener(keylistener);
_local7 = 0;
while (_local7 < bgm.length) {
bgm[_local7].Play();
_local7++;
}
callback.timer = TickTimer;
callback.frame = TickFrame;
callback.fall = TickJumpFall;
}
function ViewScores() {
var _local2;
switch (difficulty) {
case 1 :
_local2 = "easy";
break;
case 2 :
_local2 = "normal";
break;
case 3 :
_local2 = "hard";
}
getURL ((("http://endgameradio.com/score.php?game=1&mode=" + playmode) + "-") + _local2, "_blank");
}
function SubmitScore() {
var _local4 = GetFinalScore();
var _local2;
switch (difficulty) {
case 1 :
_local2 = "easy";
break;
case 2 :
_local2 = "normal";
break;
case 3 :
_local2 = "hard";
}
if (((!username) || (scoresent == 1)) || (_local4 < 0)) {
return(false);
}
var _local3 = ((((((((("http://endgameradio.com/sendscore.php?username=" + username) + "&game=1&mode=") + playmode) + "-") + _local2) + "&score=") + _local4) + "&user=") + userid) + "&scoretype=";
clip.loadVariables(_local3);
scoresent = 1;
return(true);
}
function GetFinalScore() {
var _local2;
_local2 = score;
return(_local2);
}
function End(result) {
timemode = 3;
Key.removeListener(keylistener);
for (var _local5 in callback) {
if (_local5 != "pointfade") {
delete callback[_local5];
}
}
var _local4;
switch (result) {
case "win" :
_local4 = "*Ding* Grats! ^_^\nYou get 150% of your\nscore for completing";
var _local6 = score;
score = Math.floor(score * 1.5);
Score(score - _local6);
break;
case "time" :
_local4 = "OH NOES!\nYou ran out of time O.o";
break;
case "quit" :
_local4 = ":(";
break;
case "fail" :
_local4 = "OH NOES!\nInstant Death mode means you lose. T.T";
break;
case "flaw" :
_local4 = "OH NOES!\nToo many flaws.\nThe Gods are not pleased...";
}
_root.backblocks._alpha = 0;
var _local3 = _root.attachMovie("Dialog", "dialog", 10000);
if (sitemode == 0) {
_local3.submit._visible = false;
_local3.entry._visible = false;
} else {
_local3.msg.text = "";
_local3.msg._visible = false;
}
_local3._x = 270;
_local3._y = 300;
_local3.text.text = _local4;
_local3.score.text = GetFinalScore();
_local3.entry.name.text = username;
}
function Clean() {
var _local2 = 0;
while (_local2 < pieces.length) {
pieces[_local2].Destroy();
delete pieces[_local2];
_local2++;
}
flawpiece.Destroy();
flawpieceinv.Destroy();
_local2 = 0;
while (_local2 < bgm.length) {
bgm[_local2].Stop();
_local2++;
}
}
function GetTimeLeft() {
var _local2 = GetTimeUsed();
_local2 = timelimit - _local2;
return(_local2);
}
function GetTimeUsed() {
var _local2 = new Date();
var _local4 = Math.floor(_local2.getTime() / 1000);
var _local3 = _local4 - starttime;
return(_local3);
}
function Tick() {
var _local2 = "--tick:";
for (var _local3 in callback) {
callback[_local3].call(this);
_local2 = _local2 + (_local3 + ",");
}
}
function Turn() {
while (mutexpiece == true) {
}
mutexpiece = true;
if ((active.y + 1) == ground[active.x]) {
Land();
} else {
active.AddPosition(0, 1);
}
mutexpiece = false;
_root.whiteout._alpha = 0;
turn++;
}
function Land() {
if (timemode >= 2) {
return(undefined);
}
active.SetPosition(-1, ground[active.x] - 1);
ground[active.x] = active.y;
var _local4 = 0;
if (active.y < 1) {
var _local6 = _root.array_search(freecols, active.x);
freecols.splice(_local6, 1);
if (freecols.length == 0) {
_local4 = 1;
}
}
stack[active.x].push(active);
order.push(active);
var _local3 = landscore;
Score(_local3);
if (active.y < 4) {
Score((_local3 * ((((4 - active.y) - 1) * 0.5) + 1)) - _local3, "combo");
}
if (combo > 0) {
Score((_local3 * (((combo - 1) * 0.5) + 1)) - _local3, "combo");
}
combo++;
_root.textcombo.text = combo;
var _local5 = Match();
if (!_local5.match) {
Fix(_local5);
SoundEffect("PieceFlaw");
} else {
SoundEffect("PiecePlace");
}
if (_local4) {
return(End("win"));
}
active = nextpiece;
nextpiece = AddPiece();
nextpiece.NextPiece();
active.Begin();
}
function Fix(con) {
var _local4;
var _local5;
var _local7 = 0;
if (playmode == "sudden") {
return(End("fail"));
}
var _local8 = active.GetLocalSec(0);
var _local3 = 0;
while (_local3 < 4) {
_local4 = active.GetLocalSec(_local3);
if (con.res[_local3] == false) {
if (con.adj[_local3] == 0) {
_local5 = 0;
} else {
_local5 = compliments[con.adj[_local3].GetLocalValue(opposites[_local3])];
}
flawpiece.LoadSec(_local4, _local5);
flawpieceinv.LoadSec(_local4, active.GetLocalValue(_local3));
active.LoadSec(_local4, _local5);
countflaws++;
_root.textflaws.text = allowedflaws - countflaws;
_local7 = _local7 + flawscore;
if (allowedflaws == countflaws) {
return(End("flaw"));
}
} else {
flawpiece.LoadSec(_local4, -1);
flawpieceinv.LoadSec(_local4, -1);
}
_local3++;
}
if (_local7) {
flawpiece.SetPosition(active.x, active.y);
flawpiece.SetRotation(-_local8);
flawpiece.Flaw();
flawpiece.Show();
flawpieceinv.SetPosition(active.x, active.y);
flawpieceinv.SetRotation(-_local8);
flawpieceinv.Flaw();
flawpieceinv.Show();
callback.flawflash = TickFlawFlash;
Score(_local7, "flaw");
combo = 0;
_root.textcombo.text = combo;
}
}
function Match() {
var _local3 = new JigConnection();
_local3.adj = active.GetAdjacent();
_local3.res = new Array();
_local3.match = true;
var _local2 = 0;
while (_local2 < 4) {
var _local5 = ("testing " + active.OrientName(_local2)) + ": ";
var _local6 = active.GetLocalValue(_local2);
if (_local3.adj[_local2] == undefined) {
var _local4;
switch (_local2) {
case 0 :
_local4 = active.y == 0;
break;
case 1 :
_local4 = active.x == (width - 1);
break;
case 3 :
_local4 = active.x == 0;
break;
case 2 :
_local4 = active.y == (height - 1);
}
if (_local4) {
_local3.res[_local2] = _local6 == 0;
_local3.adj[_local2] = 0;
_local5 = _local5 + (("wall (" + _local6) + "==0)");
} else {
_local3.res[_local2] = true;
_local5 = _local5 + "nothing";
}
} else {
_local3.res[_local2] = compliments[_local6] == _local3.adj[_local2].GetLocalValue(opposites[_local2]);
_local5 = _local5 + (((("piece (" + _local6) + "<=>") + _local3.adj[_local2].GetLocalValue(opposites[_local2])) + ")");
}
if (_local3.res[_local2] == false) {
_local3.match = false;
}
_local2++;
}
return(_local3);
}
function Mark(arr) {
var _local2 = 0;
while (_local2 < mark.length) {
pieces[mark[_local2]].Unmark();
_local2++;
}
mark = new Array();
_local2 = 0;
while (_local2 < arr.length) {
pieces[arr[_local2]].Mark();
mark.push(arr[_local2]);
_local2++;
}
}
function Score(n, type) {
n = Math.floor(n);
if (n == 0) {
return(undefined);
}
score = score + n;
_root.textscore.text = score;
var _local3 = pointsclip.attachMovie("points", pointsi, pointsi);
_local3._x = active.clip._x;
_local3._y = active.clip._y;
if (n > 0) {
_local3.text.text = "+" + n;
} else {
_local3.text.text = n;
}
switch (type) {
case "flaw" :
_local3.text.textColor = 16751001 /* 0xFF9999 */;
_local3._y = _local3._y + 20;
break;
case "combo" :
_local3.text.textColor = 10066431 /* 0x9999FF */;
_local3._y = _local3._y - 20;
break;
}
pointsclist[pointsi] = _local3;
pointsi++;
callback.pointfade = TickPointFade;
}
function SoundEffect(v) {
soundfx.stop();
soundfx.attachSound(v);
soundfx.setVolume(100);
soundfx.start();
}
function UseClaw(v) {
if (active.GetLocalValue(3) == v) {
return(undefined);
}
callback.claw = TickClawOut;
clawqueue = v;
switch (v) {
case 0 :
countleveler++;
_root.textleveler.text = countleveler;
Score(levelerscore);
SoundEffect("ToolLeveler");
break;
case 1 :
countsculptor++;
_root.textsculptor.text = countsculptor;
Score(sculptorscore);
SoundEffect("ToolSculptor");
break;
case 2 :
countdrill++;
_root.textdrill.text = countdrill;
Score(drillscore);
SoundEffect("ToolDrill");
}
}
function KeyRight() {
while (mutexpiece == true) {
}
mutexpiece = true;
if (active.x < 7) {
var _local2 = active.GetAdjacentRight();
if (_local2 == undefined) {
active.AddPosition(1, 0);
}
}
mutexpiece = false;
}
function KeyLeft() {
while (mutexpiece == true) {
}
mutexpiece = true;
if (active.x > 0) {
var _local2 = active.GetAdjacentLeft();
if (_local2 == undefined) {
active.AddPosition(-1, 0);
}
}
mutexpiece = false;
}
function KeyUp() {
active.AddRotation(-1);
}
function KeyDown() {
active.AddRotation(1);
}
function KeyDrop() {
Land();
}
function KeyAccel() {
if (timemode != 3) {
timemode = 1;
}
}
function KeyUnAccel() {
accel = 0;
if (timemode != 3) {
timemode = 0;
}
}
function KeyHold() {
if (timemode != 3) {
timemode = 2;
if (soundmode == 0) {
var _local2 = 0;
while (_local2 < bgm.length) {
bgm[_local2].SetVolume(15);
_local2++;
}
soundmode = 1;
callback.whiteout = TickWhiteOut;
sound.attachSound("HoldStart");
sound.setVolume(100);
sound.start();
sound.onSoundComplete = function () {
if (this.GetTimeLeft() < 60) {
this.attachSound("HoldLoopAlt");
} else {
this.attachSound("HoldLoop");
}
this.start();
this.onSoundComplete = function () {
this.start();
};
};
}
}
}
function KeyUnHold() {
if (timemode == 3) {
return(undefined);
}
timemode = 0;
_root.whiteout._alpha = 0;
if (soundmode == 1) {
soundmode = 0;
callback.mixout = TickMixOut;
}
}
function KeyDrill() {
if (((playmode != "bare") && (playmode != "sculptor")) && (playmode != "leveler")) {
UseClaw(2);
}
}
function KeySculptor() {
if (((playmode != "bare") && (playmode != "driller")) && (playmode != "leveler")) {
UseClaw(1);
}
}
function KeyLeveler() {
if (((playmode != "bare") && (playmode != "sculptor")) && (playmode != "driller")) {
UseClaw(0);
}
}
function TickClawOut() {
var _local2;
var _local4 = -20;
_local2 = clawclip._x + ((clawspeed * (active.x + 1)) * 0.5);
var _local3 = active.GlobalX(active.x);
if (_local2 >= (_local3 + _local4)) {
_local2 = _local3 + _local4;
callback.claw = TickClawIn;
active.LoadSec(active.GetLocalSec(3), clawqueue);
}
clawclip._x = _local2;
}
function TickClawIn() {
var _local2;
_local2 = clawclip._x - ((clawspeed * (active.x + 1)) * 0.5);
if (_local2 <= 66) {
_local2 = 66;
delete callback.claw;
}
clawclip._x = _local2;
}
function TickTimer() {
var _local3;
if (playmode == "speed") {
_local3 = GetTimeLeft();
if (_local3 <= 0) {
End("time");
}
} else {
_local3 = GetTimeUsed();
}
var _local4 = (Math.floor(_local3 / 60) + ":") + _root.str_lpad(_local3 % 60);
_root.texttime.text = _local4;
}
function TickMixOut() {
var _local3 = 3;
var _local4 = sound.getVolume() - _local3;
if (_local4 < 0) {
_local4 = 0;
}
sound.setVolume(_local4);
var _local5 = "mixout: ";
var _local2 = 0;
while (_local2 <= 100) {
if (_local2 <= _local4) {
_local5 = _local5 + "*";
}
_local2 = _local2 + _local3;
}
if (_local4 == 0) {
delete callback.mixout;
sound.stop();
}
_local2 = 0;
while (_local2 < bgm.length) {
bgm[_local2].AddVolume(_local3);
_local2++;
}
}
function TickPointFade() {
var _local2 = 0;
for (var _local3 in pointsclist) {
pointsclist[_local3].text._y = pointsclist[_local3].text._y - 5;
if (pointsclist[_local3].text._y < -20) {
pointsclist[_local3].text._alpha = pointsclist[_local3].text._alpha - 5;
}
if (pointsclist[_local3].text._y < -120) {
pointsclist[_local3].removeMovieClip();
delete pointsclist[_local3];
}
_local2++;
}
if (_local2 == 0) {
delete callback.pointfade;
}
}
function TickFrame() {
switch (timemode) {
case 0 :
holdmeter = holdmeter + holdregen;
if (holdmeter > holdmax) {
holdmeter = holdmax;
}
holdclip._width = (holdmeter / holdmax) * 171;
break;
case 1 :
accel = accel + accelrate;
if (accel > accelmax) {
accel = accelmax;
}
break;
case 2 :
holdmeter = holdmeter - 1;
if (holdmeter <= 0) {
holdmeter = 0;
KeyUnHold();
}
holdclip._width = (holdmeter / holdmax) * 171;
}
}
function TickSmoothFall() {
if (timemode < 2) {
tickcount = tickcount + (1 + accel);
var _local2 = tickcount % speedbase;
if (_local2 < lastmod) {
Turn();
} else {
var _local3 = active.GlobalY(active.y) + Math.floor((_local2 / speedbase) * psizey);
active.clip._y = _local3;
clawclip._y = _local3;
}
lastmod = _local2;
}
}
function TickFlawFlash() {
flawtimetick++;
if (flawtimetick >= flawtime) {
flawtimetick = 0;
flawcount++;
flawpiece.Toggle();
flawpieceinv.Toggle();
if (flawcount >= flawlimit) {
flawpiece.Hide();
flawpieceinv.Hide();
flawcount = 0;
delete callback.flawflash;
}
}
}
function TickWhiteOut() {
if (soundmode == 0) {
_root.whiteout._alpha = 0;
delete callback.whiteout;
}
var _local3 = _root.whiteout._alpha;
_local3 = _local3 + 9;
if (_local3 > 100) {
_local3 = 30;
delete callback.whiteout;
}
_root.whiteout._alpha = _local3;
}
function TickJumpFall() {
if (timemode < 2) {
tickcount = tickcount + 1;
var _local2 = tickcount % speedbase;
if (_local2 < lastmod) {
Turn();
var _local3 = active.GlobalY(active.y) + Math.floor((_local2 / speedbase) * psizey);
active.clip._y = _local3;
clawclip._y = _local3;
}
lastmod = _local2;
}
}
var bgmchannels = 2;
var height = 12;
var width = 8;
var psizex = 40;
var psizey = 40;
var offx = 120;
var offy = 120;
var clawspeed = 50;
var flawscore = -100;
var drillscore = -20;
var sculptorscore = -20;
var levelerscore = -20;
var landscore = 100;
var allowedflaws = 40;
var accel = 0;
var accelmax = 10;
var accelrate = 0.4;
var holdmax = 400;
var holdregen = 0.15;
var flawtimetick = 0;
var flawtime = 5;
var flawcount = 0;
var flawlimit = 6;
var timelimit = 360;
var tickdiv = 15;
var username = "";
}
Symbol 163 MovieClip [__Packages.SoundChannel] Frame 0
class SoundChannel
{
var channelid, sound, index, volume, mode, playlist;
function SoundChannel (sync) {
if (typeof(_root.soundchannels) != "object") {
_root.soundchannels = new Array();
_root.createEmptyMovieClip("soundchannelclips", 4095);
}
channelid = _root.soundchannels.length;
_root.soundchannels.push(this);
var _local3 = _root.soundchannelclips.createEmptyMovieClip("channel" + channelid, channelid);
sound = new Sound(_local3);
index = 0;
volume = 100;
mode = 0;
if (sync != undefined) {
this.sync = sync;
}
if (this.sync) {
sound.onSoundComplete = NextAll;
}
}
function SetPlaylist(arr) {
playlist = arr;
var _local3 = 0;
var _local2 = 0;
while (_local2 < playlist.length) {
_local3 = _local3 + playlist[_local2].length;
_local2++;
}
}
function GetCurrentTrack() {
return(playlist[index]);
}
function FarQueue(s) {
playlist.push(s);
}
function NearQueue(s) {
playlist.splice(index + 1, 0, s);
}
function SetVolume(v) {
if (v != undefined) {
volume = v;
}
v = Math.floor((volume * GetCurrentTrack().volume) / 100);
sound.setVolume(v);
}
function AddVolume(v) {
var _local2 = volume + v;
if (_local2 < 0) {
_local2 = 0;
}
if (_local2 > 100) {
_local2 = 100;
}
SetVolume(_local2);
}
function Pause() {
sound.stop();
}
function Stop() {
Pause();
index = 0;
mode = 0;
}
function Play() {
mode = 1;
var _local2 = GetCurrentTrack();
if (!_local2) {
return(undefined);
}
sound.attachSound(_local2.file);
SetVolume();
sound.start();
}
function Next() {
if (mode == 0) {
return(undefined);
}
var _local2 = GetCurrentTrack();
if (!_local2.Next()) {
return(undefined);
}
index++;
if (index >= playlist.length) {
index = 0;
}
Play();
}
function NextAll() {
var _local2 = 0;
while (_local2 < _root.soundchannels.length) {
_root.soundchannels[_local2].Next();
var _local3 = _root.soundchannels[_local2];
_local2++;
}
}
var sync = false;
var threshold = 500;
}
Symbol 164 MovieClip [__Packages.SoundPhrase] Frame 0
class SoundPhrase
{
var file, length, volume, index;
function SoundPhrase (file, length, volume) {
this.file = file;
if (length == undefined) {
length = 1;
}
if (volume == undefined) {
volume = 100;
}
this.length = length;
this.volume = volume;
index = 0;
}
function Next() {
index++;
if (index == length) {
index = 0;
return(true);
}
return(false);
}
}
Symbol 165 MovieClip [__Packages.JigPiece] Frame 0
class JigPiece
{
var set, id, clip, sec, rot, y, x, dot;
function JigPiece () {
}
function Create(set, id, top, right, bottom, left) {
this.set = set;
this.id = id;
clip = set.clip.attachMovie("Piece", "piece" + id, id);
sec = new Array(-1, -1, -1, -1);
LoadSec(0, top);
LoadSec(1, right);
LoadSec(2, bottom);
LoadSec(3, left);
rot = 0;
clip._alpha = 0;
}
function Destroy() {
clip.removeMovieClip();
sec = new Array();
set = undefined;
}
function Toggle() {
if (clip._alpha > 0) {
clip._alpha = 0;
} else {
clip._alpha = 100;
}
}
function Show() {
clip._alpha = 100;
}
function ShowLabel() {
clip.top.seclabel._alpha = 100;
clip.right.seclabel._alpha = 100;
clip.bottom.seclabel._alpha = 100;
clip.left.seclabel._alpha = 100;
}
function Begin() {
SetPosition(_root.randomindex(set.freecols), -2);
Show();
}
function NextPiece() {
clip._x = 481;
clip._y = 39.7;
Show();
}
function GetLocalSec(orient) {
var _local2 = orient - rot;
if (_local2 < 0) {
_local2 = 4 + _local2;
}
return(_local2 % 4);
}
function GetLocalValue(orient) {
return(sec[GetLocalSec(orient)]);
}
function GetNormal(orient) {
switch (orient) {
case 0 :
return(new Array(0, -1));
case 1 :
return(new Array(1, 0));
case 2 :
return(new Array(0, 1));
case 3 :
return(new Array(-1, 0));
}
}
function GetAdjacent() {
var _local2 = new Array();
_local2[3] = GetAdjacentLeft();
_local2[1] = GetAdjacentRight();
if (y != (set.height - 1)) {
_local2[2] = set.stack[x][(set.height - y) - 2];
}
if (set.stack[x].length >= (set.height - y)) {
_local2[0] = set.stack[x][set.height - y];
}
return(_local2);
}
function GetAdjacentLeft() {
if (x > 0) {
return(set.stack[x - 1][(set.height - y) - 1]);
}
return(undefined);
}
function GetAdjacentRight() {
if (x < (set.width - 1)) {
return(set.stack[x + 1][(set.height - y) - 1]);
}
return(undefined);
}
function OrientName(orient) {
var _local1 = new Array("top", "right", "bottom", "left");
return(_local1[orient]);
}
function LoadSec(orient, val) {
var _local3;
var _local4;
_local4 = OrientName(orient);
_local3 = orient * 90;
sec[orient] = val;
var _local6 = new Array("flat", "tri-out", "tri-in");
if (val < 0) {
clip[_local4].removeMovieClip();
return(undefined);
}
var _local2 = clip.attachMovie("sec-" + _local6[val], _local4, _local3);
_local2._rotation = _local3;
_local2.seclabel.text.text = orient;
}
function Hide() {
clip._alpha = 0;
}
function Window() {
clip.top.gotoAndStop(2);
clip.right.gotoAndStop(2);
clip.bottom.gotoAndStop(2);
clip.left.gotoAndStop(2);
}
function Flaw() {
clip.top.gotoAndStop(3);
clip.right.gotoAndStop(3);
clip.bottom.gotoAndStop(3);
clip.left.gotoAndStop(3);
}
function Dot(orient) {
if (dot != undefined) {
dot.removeMovieClip();
}
dot = clip[OrientName(orient)].attachMovie("Dot", "dot", 0);
dot._y = -10;
}
function Mark() {
clip.attachMovie("Dot", "mark", 100);
}
function Unmark() {
if (clip.mark) {
clip.mark.removeMovieClip();
}
}
function GlobalY(y) {
return(set.offy + (set.psizey * y));
}
function GlobalX(x) {
return(set.offx + (set.psizex * x));
}
function SetY(y) {
this.y = y;
clip._y = GlobalY(y);
}
function SetX(x) {
this.x = x;
clip._x = GlobalX(x);
}
function SetPosition(x, y) {
if (x != -1) {
SetX(x);
}
if (y != -1) {
SetY(y);
}
}
function AddPosition(x, y) {
if (x) {
SetX(this.x + x);
}
if (y) {
SetY(this.y + y);
}
}
function SetRotation(r) {
if (r < 0) {
r = 4 + r;
}
rot = r % 4;
clip._rotation = rot * 90;
}
function AddRotation(r) {
if (r < 0) {
r = 4 + r;
}
rot = (rot + r) % 4;
clip._rotation = rot * 90;
}
}
Symbol 166 MovieClip [__Packages.JigConnection] Frame 0
class JigConnection
{
function JigConnection () {
}
}
Symbol 71 Button
on (press) {
_root.set.SoundEffect("Menu");
gotoAndStop (4);
}
Symbol 83 Button
on (press) {
_root.set.SoundEffect("Menu");
gotoAndStop (5);
}
Symbol 91 Button
on (press) {
_root.set.SoundEffect("Menu");
gotoAndStop (6);
}
Symbol 96 Button
on (press) {
_root.set.playmode = "basic";
_root.set.difficulty = 1;
gotoAndPlay (10);
}
Symbol 97 Button
on (press) {
_root.set.playmode = "basic";
_root.set.difficulty = 2;
gotoAndPlay (10);
}
Symbol 98 Button
on (press) {
_root.set.playmode = "basic";
_root.set.difficulty = 3;
gotoAndPlay (10);
}
Symbol 100 Button
on (press) {
_root.set.playmode = "sudden";
_root.set.difficulty = 1;
gotoAndPlay (10);
}
Symbol 101 Button
on (press) {
_root.set.playmode = "sudden";
_root.set.difficulty = 2;
gotoAndPlay (10);
}
Symbol 102 Button
on (press) {
_root.set.playmode = "sudden";
_root.set.difficulty = 3;
gotoAndPlay (10);
}
Symbol 103 Button
on (press) {
_root.set.playmode = "speed";
_root.set.difficulty = 1;
gotoAndPlay (10);
}
Symbol 104 Button
on (press) {
_root.set.playmode = "speed";
_root.set.difficulty = 2;
gotoAndPlay (10);
}
Symbol 105 Button
on (press) {
_root.set.playmode = "speed";
_root.set.difficulty = 3;
gotoAndPlay (10);
}
Symbol 107 Button
on (press) {
_root.set.playmode = "leveler";
_root.set.difficulty = 1;
gotoAndPlay (10);
}
Symbol 108 Button
on (press) {
_root.set.playmode = "leveler";
_root.set.difficulty = 2;
gotoAndPlay (10);
}
Symbol 109 Button
on (press) {
_root.set.playmode = "leveler";
_root.set.difficulty = 3;
gotoAndPlay (10);
}
Symbol 110 Button
on (press) {
_root.set.playmode = "sculptor";
_root.set.difficulty = 1;
gotoAndPlay (10);
}
Symbol 111 Button
on (press) {
_root.set.playmode = "sculptor";
_root.set.difficulty = 2;
gotoAndPlay (10);
}
Symbol 112 Button
on (press) {
_root.set.playmode = "sculptor";
_root.set.difficulty = 3;
gotoAndPlay (10);
}
Symbol 113 Button
on (press) {
_root.set.playmode = "driller";
_root.set.difficulty = 1;
gotoAndPlay (10);
}
Symbol 114 Button
on (press) {
_root.set.playmode = "driller";
_root.set.difficulty = 2;
gotoAndPlay (10);
}
Symbol 115 Button
on (press) {
_root.set.playmode = "driller";
_root.set.difficulty = 3;
gotoAndPlay (10);
}
Symbol 116 Button
on (press) {
_root.set.playmode = "bare";
_root.set.difficulty = 1;
gotoAndPlay (10);
}
Symbol 117 Button
on (press) {
_root.set.playmode = "bare";
_root.set.difficulty = 2;
gotoAndPlay (10);
}
Symbol 118 Button
on (press) {
_root.set.playmode = "bare";
_root.set.difficulty = 3;
gotoAndPlay (10);
}
Symbol 145 Button
on (press) {
getURL ("http://endgameradio.com/", "_blank");
}
Symbol 146 Button
on (press) {
_root.set.End("quit");
}