Combined Code
movieClip 8 cursor2 {
}
movieClip 10 l8 {
frame 1 {
if (!delay) {
_root.f_AddWall(this, z_wall);
}
gotoAndStop(2);
}
}
movieClip 11 l2 {
frame 1 {
if (!z_platform.removed) {
_root.f_AddPlatform(this, z_platform);
z_platform.slope = 0;
}
gotoAndStop(2);
}
}
movieClip 29 {
}
movieClip 46 {
}
movieClip 47 {
}
movieClip 64 {
}
movieClip 81 {
}
movieClip 90 {
}
movieClip 91 {
instance body of movieClip 47 {
onClipEvent (load) {
timer = 2;
}
onClipEvent (enterFrame) {
if (timer % 3 == 0) {
var u = _root.f_FX(_parent._parent._x, _parent._parent._y - 20 + random(40), _parent._parent._y, 'ember', 100, 100);
u.body._rotation = _parent._parent.trajectory;
}
++timer;
}
}
}
movieClip 92 selectbitmap {
}
movieClip 94 Rect {
}
movieClip 95 blank {
}
movieClip 98 {
}
movieClip 99 {
}
movieClip 101 {
}
movieClip 103 {
frame 1 {
stop();
}
}
movieClip 106 {
}
movieClip 107 {
}
movieClip 110 {
}
movieClip 113 {
frame 1 {
stop();
}
}
movieClip 114 Preloader {
frame 1 {
function enterFrameHandler() {
var v2 = 0;
v2 = _root.getBytesLoaded() / _root.getBytesTotal();
if (loadingBar) {
loadingBar.gotoAndStop(int(v2 * (loadingBar._totalframes - 1)) + 1);
}
if (v2 >= 1 && haltComplete != true) {
onEnterFrame = null;
gotoAndStop('loaded');
}
}
stop();
var autoPlay;
var className;
var haltComplete;
onEnterFrame = enterFrameHandler;
}
frame 10 {
function _onPlayClick() {
_root.nextFrame();
_root.play();
_parent._onLoaded();
}
if (playButton) {
playButton.onRelease = _onPlayClick;
playButton.stop();
}
if (autoPlay) {
_onPlayClick(null);
}
}
}
movieClip 116 Newgrounds API Classes {
#initclip
Object.registerClass('Newgrounds API Classes', com.newgrounds.shims.APIShim);
#endinitclip
}
movieClip 156 {
}
movieClip 159 {
}
movieClip 164 {
}
movieClip 168 {
}
movieClip 169 {
}
movieClip 170 {
}
movieClip 171 FlashAd {
#initclip
Object.registerClass('FlashAd', com.newgrounds.components.FlashAdBase);
#endinitclip
frame 1 {
function initPlayButton() {
if (this.playButton) {
this.playButton.onRelease = onPlayClick;
if (!this.showPlayButton) {
this.playButton._visible = false;
}
}
}
function onPlayClick() {
removeAd();
_visible = false;
}
stop();
}
frame 2 {
initPlayButton();
}
frame 10 {
initPlayButton();
}
frame 20 {
initPlayButton();
}
}
movieClip 172 APIConnector {
frame 1 {
function _onLoaded() {
gotoAndStop('invisible');
if (_redirect) {
com.newgrounds.API.loadOfficialVersion();
return undefined;
}
}
function _apiConnect() {
var v2 = com.newgrounds.API;
if (v2 && !v2.connected) {
if (!apiId) {
com.newgrounds.Logger.logError('No API ID entered in the API Connector component.', 'You can create an API ID for this submission at http://newgrounds.com/account/flashapi', 'Enter your API ID into the API Connector using the Component Inspector (Window -> Component Inspector).');
return undefined;
}
switch (debugMode) {
case 'Off':
default:
v2.debugMode = v2.RELEASE_MODE;
goto 1319;
case 'Simulate Logged-in User':
//Invalid switch }
v2.debugMode = v2.DEBUG_MODE_LOGGED_IN;
goto 1319;
case 'Off':
v2.debugMode = v2.DEBUG_MODE_LOGGED_OUT;
goto 1319;
case 'Simulate Logged-in User':
v2.debugMode = v2.DEBUG_MODE_NEW_VERSION;
goto 1319;
case 'Simulate Logged-out User':
v2.debugMode = v2.DEBUG_MODE_HOST_BLOCKED;
label 1319:
if (loader) {
loader.haltComplete = true;
}
v2.addEventListener(com.newgrounds.APIEvent.API_CONNECTED, _onConnected);
v2.connect(_root, apiId, encryptionKey, movieVersion);
}
}
function _onConnected(event) {
if (loader) {
loader.haltComplete = false;
}
if (redirectOnNewVersion && event.__get__success() && (event.__get__data()).newVersion) {
_redirect = true;
}
if (redirectOnHostBlocked && !event.__get__success() && event.__get__error() == com.newgrounds.APIEvent.ERROR_HOST_BLOCKED) {
_redirect = true;
}
if (_redirect) {
gotoAndStop('adPreloader');
forceAlwaysOnTop();
}
}
function forceAlwaysOnTop() {
var v2 = getNextHighestDepth();
swapDepths(v2);
if (Stage) {
_x = (Stage.width - _width) / 2;
_y = (Stage.height - _height) / 2;
_visible = true;
}
if (_root && _root instanceof MovieClip) {
(MovieClip(_root)).stop();
}
}
stop();
if (_root && _root instanceof MovieClip) {
(MovieClip(_root)).stop();
}
var apiId;
var encryptionKey;
var movieVersion;
var debugMode;
var connectorType;
var redirectOnHostBlocked;
var redirectOnNewVersion;
var adType;
var className;
var _redirect;
_x = int(_x);
_y = int(_y);
if (!debugMode) {
debugMode = 'Simulate Logged-in User';
}
if (!connectorType) {
connectorType = 'Flash Ad + Preloader';
}
if (!adType) {
adType = 'Video';
}
if (ad) {
ad.adType = adType;
}
switch (connectorType) {
case 'Flash Ad + Preloader':
gotoAndStop('adPreloader');
break;
case 'Flash Ad Only':
gotoAndStop('ad');
break;
case 'Invisible':
gotoAndStop('invisible');
}
_apiConnect();
}
instance ad of movieClip 171 FlashAd {
onClipEvent (construct) {
apiId = '';
showBorder = true;
adType = 'Video';
}
}
instance loader of movieClip 114 Preloader {
onClipEvent (construct) {
autoPlay = false;
mainClass = '';
}
}
}
frame 1 {
function f_StartRecord() {
if (Key.isDown(37) || Key.isDown(38) || Key.isDown(39) || Key.isDown(83) || Key.isDown(88) || Key.isDown(90) || Key.isDown(65) || Key.isDown(68) || Key.isDown(40) || Key.isDown(87) || Key.isDown(82) || Key.isDown(recordKey)) {
if (Key.isDown(recordKey) || Key.isDown(82)) {
pressed_r = true;
}
game.exit.gotoAndStop('waiting');
return true;
}
}
function f_CreateExit() {
if (phase == 1) {
return undefined;
}
if (!exit) {
if (gameclock < 300) {
exit = true;
game.exit.gotoAndStop('on');
f_RecordPt = f_CheckExit;
} else {
if (Key.isDown(recordKey) || Key.isDown(82)) {
if (!pressed_r) {
exit = true;
game.exit.gotoAndStop('on');
f_RecordPt = f_CheckExit;
}
} else {
pressed_r = false;
}
}
}
}
function f_CheckExit() {
var v1 = false;
if (Key.isDown(81)) {
v1 = true;
}
if (gameclock <= 0) {
gameclock = 0;
v1 = true;
}
if (Math.abs(b1.x - game.exit._x) < 10 or v1) {
if (Math.abs(b1.y - game.exit._y) < 1 or v1) {
phase = 100;
b1.gotoAndStop('blank');
phase = -1;
exit = false;
f_ClearFX();
game.exit.gotoAndStop('off');
f_RecordPt = undefined;
hud.gotoAndStop('off');
tips.gotoAndStop('off');
if (v1) {
b1.m = 0;
bm = new Array(0);
b1.moves = bm;
if (gameclock == 0) {
menu.gotoAndStop('dataloss');
} else {
menu.gotoAndStop('raybots');
}
} else {
menu.gotoAndStop('raybots');
}
}
}
}
function f_ClickOn() {
clicked = true;
}
function f_ClickOff() {
clicked = false;
}
function f_ListScroll(z, c, s) {
z = menu.humanbrowse.listbox;
c = menu.humanbrowse.channels;
s = menu.humanbrowse.scrollbar;
if (clicked) {
var v6 = int(s._xmouse);
var v4 = int(s._ymouse);
if (!inscrollbar) {
if (v6 >= 0 && v4 >= 0 && v6 < s._width & v4 < s._height) {
inscrollbar = true;
}
}
if (inscrollbar) {
s.bar._y = v4 - s.bar._height / 2;
if (s.bar._y < 0) {
s.bar._y = 0;
} else {
if (s.bar._y + s.bar._height > s.bg._height) {
s.bar._y = s.bg._height - s.bar._height;
}
}
if (v4 <= 0) {
var v7 = 0;
} else {
if (v4 > s.bg._height) {
var v7 = 1;
} else {
var v7 = v4 / s.bg._height;
}
}
v7 = s.bar._y / (s.bg._height - s.bar._height);
var v5 = c._y;
if (campaignselect) {
var v8 = c._y + c._height - (bossChannel.length * 50 + 20);
} else {
var v8 = c._y + c._height - (bosslog.length * 50 + 20);
}
if (z._height < c._height) {
z.destin = z._y;
} else {
z.destin = v5 + (v8 - v5) * v7;
}
}
} else {
inscrollbar = false;
}
if (z.destin && Math.abs(z._y - z.destin) > 0.5) {
z._y += (z.destin - z._y) / 10;
}
}
function onMouseWheel(delta) {
if (!menu.humanbrowse.listbox) {
return undefined;
}
var v3 = menu.humanbrowse.listbox;
var v2 = menu.humanbrowse.channels;
var v1 = menu.humanbrowse.scrollbar;
trace(delta);
v1.bar._y -= delta * 10;
var v4 = v1.bar._y;
if (v1.bar._y < 0) {
v1.bar._y = 0;
} else {
if (v1.bar._y + v1.bar._height > v1.bg._height) {
v1.bar._y = v1.bg._height - v1.bar._height;
}
}
if (v4 <= 0) {
var v6 = 0;
} else {
if (v4 > v1.bg._height) {
var v6 = 1;
} else {
var v6 = v4 / v1.bg._height;
}
}
v6 = v1.bar._y / (v1.bg._height - v1.bar._height);
var v5 = v2._y;
if (campaignselect) {
var v7 = v2._y + v2._height - (bossChannel.length * 50 + 20);
} else {
var v7 = v2._y + v2._height - (bosslog.length * 50 + 20);
}
if (v3._height < v2._height) {
v3.destin = v3._y;
} else {
v3.destin = v5 + (v7 - v5) * v6;
}
}
function f_CheckPause() {
if (Key.isDown(80)) {
if (!pressedPause) {
pressedPause = true;
if (paused) {
paused = false;
pauseScreen.gotoAndStop('off');
} else {
paused = true;
pauseScreen.gotoAndStop('on');
}
}
} else {
pressedPause = false;
}
}
function f_Controls(z) {
if (wait_timer > 0) {
return undefined;
}
if (z.teleport_timer > 0) {
return undefined;
}
++z.rtimer;
if (z.rtimer > 1000) {
z.rtimer = 1;
}
if (z.rtimer % 2 == 0) {
++z.m;
z.moves[z.m] = new Array(0);
if (Key.isDown(37)) {
z.moves[z.m][0] = true;
}
if (Key.isDown(39)) {
z.moves[z.m][1] = true;
}
if (Key.isDown(38)) {
z.moves[z.m][2] = true;
}
if (Key.isDown(65) || Key.isDown(90)) {
z.moves[z.m][3] = true;
}
if (Key.isDown(83) || Key.isDown(88)) {
z.moves[z.m][4] = true;
}
if (Key.isDown(40)) {
z.moves[z.m][5] = true;
}
}
}
function f_Process(z) {
if (z.teleport_timer > 0 || !z.alive) {
return undefined;
}
f_Timers(z);
if (wait_timer > 0) {
if (!z.animatic) {
f_GoFrame(z, 'stand');
}
return undefined;
}
if (z.recoil_timer > 0) {
--z.recoil_timer;
z.gotoAndStop('hit');
if (z._xscale > 0) {
f_MoveH(z, -3);
} else {
f_MoveH(z, 3);
}
return undefined;
}
f_Jumping(z);
if (z == p1) {
if (bossrushmode) {
if (deathclock > 0 && deathclock < 60) {
if (z.platform) {
fireloop.s_fireloop.stop();
_root['s_winline' + (random(10) + 1)].start(0, 0);
z.animatic = true;
z.gotoAndStop('win');
wait_timer = 180;
return undefined;
}
}
}
}
f_CheckJump(z);
f_LeftRightTimers(z);
z.walking = false;
if (z.left_timer > 0 and z.left_timer > z.right_timer) {
if (z._xscale > 0) {
z._xscale *= -1;
}
z.walking = true;
f_MoveH(z, -z.speed_x);
}
if (z.right_timer > 0 and z.right_timer > z.left_timer) {
if (z._xscale < 0) {
z._xscale *= -1;
}
z.walking = true;
f_MoveH(z, z.speed_x);
}
f_Attack1(z);
f_Attack2(z);
if (z.teleport_timer > 0) {
return undefined;
}
if (z.platform) {
if (z.walking) {
f_GoFrame(z, 'walk');
if (z.shooting) {
z.body.gun.gotoAndPlay('shoot');
z.shooting = false;
}
if (z._xscale > 0) {
if (z.right_timer % 15 == 0 || z.right_timer == 1) {
f_FX(z.x, z.y - 2, z.y + 2, z.runfx, z._xscale, 100);
}
} else {
if (z.left_timer % 15 == 0 || z.left_timer == 1) {
f_FX(z.x, z.y - 2, z.y + 2, z.runfx, z._xscale, 100);
}
}
} else {
f_GoFrame(z, 'stand');
if (z.shooting) {
z.body.gun.gotoAndPlay('shoot');
z.shooting = false;
}
}
} else {
if (z.shooting) {
z.body.gun.gotoAndPlay('shoot');
z.shooting = false;
}
f_GoFrame(z, 'jump');
if (z.newjump) {
z.newjump = false;
z.body.gotoAndPlay(1);
}
if (z.doublejumped) {
z.doublejumped = false;
s_robotDouble.start(0, 0);
z.body.gotoAndPlay('jump2');
}
}
}
function f_DeathTimer() {
--deathclock;
if (deathclock == 120 && !bossrushmode) {
if (winner) {
var v2 = p1.health / p1.health_max;
if (v2 > 0.7) {
_root['s_testWinEasy' + random(3)].start(0, 0);
} else {
if (v2 > 0.25) {
_root['s_testWinMedium' + random(4)].start(0, 0);
} else {
_root['s_testWinHard' + random(5)].start(0, 0);
}
}
} else {
_root['s_testLoss' + random(6)].start(0, 0);
}
}
if (deathclock <= 0) {
hud.gotoAndStop('off');
f_EndSwording(b1);
if (bossrushmode) {
bosslog[rushlevel].grade = (p1.health / p1.health_start) * 100;
bosslog[rushlevel].time = (gameclock / b1.gameclock * 60) * 100;
trace('GRADE: ' + bosslog[rushlevel].grade);
trace('TIME SCORE: ' + bosslog[rushlevel].time);
if (winner) {
phase = 9;
f_NextBoss();
} else {
phase = -1;
f_SaveUser();
_root.logdelay = 41;
menu.gotoAndStop('bosslogwait');
}
} else {
phase = -1;
f_ClearFX();
fireloop.s_fireloop.stop();
f_EndSwording(b1);
menu.gotoAndStop('raybots');
}
}
}
function f_GameTimers() {
if (wait_timer > 0) {
--wait_timer;
if (wait_timer == 0) {
hud.gotoAndStop('on');
f_UpdateHud(p1);
}
} else {
if (gameclock > 0) {
--gameclock;
f_RenderClock();
if (gameclock == 0) {
if (phase == 3) {
s_timeOver.start(0, 0);
tips.gotoAndStop('timeup');
deathclock = 120;
phase = 10;
} else {
f_Damage(p1, 999999);
}
}
}
}
}
function f_RenderClock() {
var v1 = Math.floor(gameclock / 60);
var v2 = Math.floor(v1 / 60);
v1 -= v2 * 60;
milliseconds = gameclock - v1 * 60 - v2 * 60 * 60;
if (v2 < 10) {
v2 = '0' + v2;
}
if (v1 < 10) {
v1 = '0' + v1;
}
if (milliseconds < 10) {
milliseconds = '0' + milliseconds;
}
hud.timer.seconds.text = v2 + ':' + v1 + ':' + milliseconds;
}
function f_ShowTimer(h, za) {
h.gotoAndStop(int(101 - ((za.recovery - za.charge_current) / za.recovery) * 100));
}
function f_Timers(z) {
if (z.a1.charge_current > 0) {
--z.a1.charge_current;
}
if (z.a2.charge_current > 0) {
--z.a2.charge_current;
}
if (z == p1) {
if (wait_timer <= 0) {
++z.chargeshot;
if (z.chargeshot == 200) {
p1.flare.gotoAndPlay(2);
s_charged.start(0, 0);
}
if (z.chargeshot > maxCharge + 5) {
z.chargeshot = maxCharge + 5;
}
}
}
if (z.invincible_timer > 0) {
--z.invincible_timer;
}
}
function f_MenuBulletVars() {
var v1 = weapon;
menu.speed.text = v1.speed;
menu.damage.text = v1.damage;
menu.recovery.text = v1.bulletrecovery;
menu.bounces.text = v1.bounces;
menu.trajectory.text = v1.trajectory;
menu.gravity.text = v1.gravity;
menu.bulletsize.text = v1.bulletsize;
}
function f_MenuBombVars() {
var v1 = weapon;
menu.bombdamage.text = v1.bombdamage;
menu.bombtimer.text = v1.bombtimer;
menu.bombgravity.text = v1.bombgravity;
}
function f_ChangeBombType(v) {
var v1 = weapon;
v1.bombtype += v;
if (v1.bombtype > 2) {
v1.bombtype = 1;
} else {
if (v1.bombtype < 1) {
v1.bombtype = 2;
}
}
menu.bombtype.text = v1.bombtype;
menu.atype.bombs.gotoAndStop(v1.bombtype);
}
function f_WeaponDefaults(u) {
u.atype = 1;
u.num = 4;
u.bounces = 0;
u.trajectory = 0;
u.gravity = 0;
u.speed = 10;
u.damage = 3;
u.bulletrecovery = 12;
u.charge_current = 0;
u.bulletsize = 50;
u.bombdamage = 5;
u.bombrecovery = u.bombdamage * 6;
u.bombtimer = 90;
u.blast = 1;
u.bombgravity = 1;
u.bombtype = 1;
u.beamdamage = 15;
u.beamrecovery = 60;
u.teleportrecovery = 120;
}
function f_BossWeapons(z) {
f_WeaponDefaults(z.a1);
f_WeaponDefaults(z.a2);
z.a1.atype = 1;
z.a2.atype = 2;
z.doublejump = 1;
}
function f_SetBullet(u, num) {
u.atype = 1;
if (!num) {
u.num = 2;
} else {
u.num = num;
}
if (!u.damage) {
u.damage = 2;
}
if (!u.speed) {
u.speed = 20;
}
if (!u.trajectory) {
u.trajectory = 0;
}
if (!u.bulletrecovery) {
u.bulletrecovery = u.damage * 8;
}
if (!u.bounces) {
u.bounces = 0;
}
if (!u.gravity) {
u.gravity = 0;
}
u.charge_current = 0;
if (num == 1) {
u.damage = 2;
u.bulletrecovery = 0;
u.weaponSound = s_shoot10;
u.h = 15;
u.w = 20;
} else {
if (num == 2) {
u.h = 15;
u.w = 20;
} else {
if (num == 3) {
u.weaponSound = s_shoot9;
u.h = 15;
u.w = 20;
} else {
if (num == 4) {
u.weaponSound = s_shoot9;
u.h = 15;
u.w = 20;
} else {
if (num == 5) {
u.weaponSound = s_shoot9;
u.h = 15;
u.w = 20;
}
}
}
}
}
}
function f_Shoot(z, za) {
z.shooting = true;
if (z._xscale > 0) {
var v4 = za.trajectory;
} else {
var v4 = 180 - za.trajectory;
}
if (z == p1) {
var v5 = 1;
} else {
var v5 = 0;
}
if (z._xscale > 0) {
var v3 = 25;
} else {
var v3 = -25;
}
if (z == p1 && z.chargeshot >= maxCharge) {
s_chargeshot.start(0, 0);
za.charge_current = 20;
f_NewBullet(z.x + v3, z.y - 25, za, 2, za.speed * 0.75, v4, za.damage * 7, v5, za.bounces, za.gravity);
f_FX(z.x + v3, z.y - 25, z.y + 1, 'gunflare', z._xscale, 100);
} else {
f_NewBullet(z.x + v3, z.y - 25, za, za.num, za.speed, v4, za.damage, v5, za.bounces, za.gravity);
}
z.chargeshot = 0;
}
function f_FlameThrower(z, za) {
if (gameclock % 4 == 0) {
var v3 = 80 + random(20);
if (z._xscale > 0) {
var v7 = 25;
var v5 = 4;
var v4 = v3;
} else {
var v7 = -25;
var v5 = -4;
var v4 = -v3;
}
if (gameclock % 24 == 0) {
var v6 = 14;
} else {
if (gameclock % 20 == 0) {
var v6 = 17;
} else {
if (gameclock % 16 == 0) {
var v6 = 20;
} else {
if (gameclock % 12 == 0) {
var v6 = 23;
} else {
if (gameclock % 8 == 0) {
var v6 = 20;
} else {
var v6 = 17;
}
}
}
}
}
z.body.gun.flame.gotoAndPlay('go');
z.body.gun.flame._yscale = 40 + random(30);
var v1 = f_FX(z.x + v7, z.y - v6, z.y + 1, 'flamethrower', v4, v3);
v1.speed_x = v5;
v1.speed_y = 0;
v1.x = v1._x;
v1.y = v1._y;
v1.damage = 1;
v1.w = 20;
v1.h = 13;
}
if (firetimer == 0) {
fireloop.s_fireloop.start(0, 9999);
s_fireblast.start(0, 0);
}
++firetimer;
z.pressed_attack2 = false;
z.a1.charge_current = 5;
}
function f_AttackPress(z) {
if (!z.moves[z.m][3]) {
z.pressed_attack1 = false;
}
if (!z.moves[z.m][4]) {
z.pressed_attack2 = false;
}
}
function f_ProcessAttack(z, za) {
if (za.atype == 1) {
za.weaponSound.start(0, 0);
za.recovery = za.bulletrecovery;
za.charge_current = za.recovery;
f_Shoot(z, za);
} else {
if (za.atype == 2) {
za.weaponSound.start(0, 0);
za.recovery = za.bombrecovery;
za.charge_current = za.bombrecovery;
f_DropBomb(z, za);
} else {
if (za.atype == 3) {
f_Beam(z, za);
} else {
if (za.atype == 4) {
za.weaponSound.start(0, 0);
za.recovery = za.teleportrecovery;
za.charge_current = za.teleportrecovery;
f_Teleport(z, za);
} else {
if (za.atype == 6) {
if (!z.swording) {
z.swording = true;
sword.s_sword.start(0, 9999);
z.body.gun.sword.gotoAndPlay(2);
}
} else {
if (za.atype == 7) {
f_FlameThrower(z, za);
}
}
}
}
}
}
}
function f_EndSwording(z) {
z.swording = false;
if (swordwallsound) {
swordwallsound = false;
swordwall.s_swordwall.stop();
}
sword.s_sword.stop();
z.body.gun.sword.gotoAndStop('off');
}
function f_Attack1(z) {
if (z.moves[z.m][3]) {
if (!z.pressed_attack1 || z.a1.atype == 3) {
if (z.a1.charge_current <= 0) {
z.pressed_attack1 = true;
f_ProcessAttack(z, z.a1);
}
}
} else {
z.pressed_attack1 = false;
if (z.a1.atype == 6) {
f_EndSwording(z);
}
}
}
function f_Attack2(z) {
if (z.moves[z.m][4]) {
if (!z.pressed_attack2 || z.a2.atype == 3) {
if (z.a2.charge_current <= 0) {
z.pressed_attack2 = true;
f_ProcessAttack(z, z.a2);
}
}
} else {
z.pressed_attack2 = false;
if (z.a2.atype == 6) {
f_EndSwording(z);
}
if (z.a2.atype == 7) {
fireloop.s_fireloop.stop();
firetimer = 0;
}
}
}
function f_Teleport(z, za) {
if (phase == 4 || phase == 6 || phase == 7) {
var v2 = z.moves[z.m][7];
var v3 = z.moves[z.m][8];
if (!v2) {
v2 = z.x;
}
if (!v3) {
v3 = z.y;
}
if (columns > columns_default) {
v2 += (columns / columns_default - 1) * (columns_default * tilesize);
}
f_FX(z.x, z.y, z.y - 1, 'warpout', 100, 100);
f_NewSparkle(z.x, z.y, v2, v3);
f_SetXY(z, v2, v3);
z._xscale = z.moves[z.m][9];
z.teleport_timer = teleportdelay;
z.gotoAndStop('blank');
} else {
z.teleported = true;
phase = 1;
}
}
function f_GoFrame(zone, u_frame) {
if (!zone.punching) {
zone.gotoAndStop(u_frame);
}
}
function f_LeftRightTimers(z) {
if (z.moves[z.m][0]) {
if (z.left_timer <= 0) {
z.left_last2 = z.left_timer;
z.left_timer = 1;
} else {
++z.left_timer;
}
} else {
if (z.left_timer > 0) {
z.left_last = z.left_timer;
z.left_timer = 0;
} else {
--z.left_timer;
}
}
if (z.moves[z.m][1]) {
if (z.right_timer <= 0) {
z.right_last2 = z.right_timer;
z.right_timer = 1;
} else {
++z.right_timer;
}
} else {
if (z.right_timer > 0) {
z.right_last = z.right_timer;
z.right_timer = 0;
} else {
--z.right_timer;
}
}
}
function f_Jumping(zone) {
if (zone.platform == undefined or zone.jumping) {
if (zone.float_timer > 0) {
--zone.float_timer;
} else {
if (zone.speed_y >= 0) {
if (f_PY(zone, zone.speed_y) == false) {
f_MoveV(zone, zone.speed_y);
zone.speed_y += gravity;
zone.jumping = false;
}
} else {
f_MoveV(zone, f_WA(zone, zone.speed_y));
zone.speed_y += gravity;
}
if (zone.speed_y > zone.speed_y_max) {
zone.speed_y = zone.speed_y_max;
}
}
}
}
function f_CheckJump(zone) {
if (zone.moves[zone.m][5]) {
if (!zone.pressed_down) {
if (zone.platform.dropthru) {
zone.pressed_down = true;
zone.thruster_current = zone.thruster_max;
zone.speed_y = 1;
zone.y += 5;
zone._y = zone.y;
f_Depth(zone, zone.y);
zone.platform = undefined;
return undefined;
}
}
} else {
zone.pressed_down = false;
}
if (zone.moves[zone.m][2]) {
if (!zone.pressed_jump) {
var v2 = 0;
if (zone.doublejump > 0) {
if (!zone.platform && zone.thruster_current >= zone.thruster_max) {
v2 = -3;
--zone.jumps;
} else {
zone.jumps = zone.doublejump + 1;
}
} else {
zone.jumps = 0;
}
if (zone.platform != undefined or zone.jumps > 0 or zone.thruster_current < zone.thruster_max) {
zone.pressed_jump = true;
zone.jumping = true;
if (zone.platform) {
zone.jumpsound.start(0, 0);
zone.thruster_current = 0;
zone.newjump = true;
if (!(zone.moves[zone.m][5] && zone.platform.dropthru)) {
f_FX(zone.x, zone.y - 2, zone.y - 1, zone.jumpfx, 100, 100);
}
} else {
zone.doublejumped = true;
}
if (zone.speed_y > zone.launch) {
zone.speed_y = zone.launch + v2;
}
zone.platform = undefined;
}
} else {
++zone.thruster_current;
zone.thruster_boost += 0.11;
if (zone.thruster_current < zone.thruster_max) {
zone.speed_y = zone.launch - zone.thruster_boost;
}
}
} else {
zone.thruster_boost = 0;
zone.thruster_current = zone.thruster_max;
zone.pressed_jump = false;
}
}
function f_MoveH(zone, speed) {
zone.hitwall = false;
if (!zone.autowalk) {
speed = f_W(zone, speed);
}
zone.x += speed;
zone._x = zone.x;
f_PH(zone);
return speed;
}
function f_MoveV(zone, speed) {
zone.y += speed;
zone._y = zone.y;
f_Depth(zone, zone.y);
}
function f_AssignPlatform(zone, u_p) {
zone.jumps = zone.doublejump + 1;
zone.platform = u_p;
}
function f_PY(zone, speed, u_pass) {
if (speed > 0) {
i = int(((zone.y + speed) / grid_height) * rows);
j = int((zone.x / grid_width) * columns);
tile = grid[i][j];
if (tile.num) {
if (zone.x >= tile.x) {
if (zone.x <= tile.x + tilesize) {
if (zone.y <= tile.y and zone.y + speed >= tile.y) {
f_MoveV(zone, tile.y - zone.y);
zone.speed_y = 0;
zone.prevplatformx = zone.x;
zone.prevplatformy = zone.y;
f_AssignPlatform(zone, tile);
zone.s_land.start(0, 0);
f_FX(zone.x, zone.y - 2, zone.y + 10, zone.landfx, 100, 100);
return true;
}
}
}
}
}
return false;
}
function f_PH(z) {
if (z.platform) {
tile = f_GetTile(z.x, z.y);
if (tile != z.platform) {
if (tile.solid) {
f_AssignPlatform(z, tile);
} else {
z.platform = undefined;
z.speed_y = 1;
}
}
}
}
function f_W(zone, speed) {
if (speed > 0) {
var v4 = zone.w;
var v5 = 0;
} else {
var v4 = -zone.w;
var v5 = tilesize;
}
i = int(((zone.y - 1) / grid_height) * rows);
j = int(((zone.x + v4 + speed) / grid_width) * columns);
tile = grid[i][j];
if (!tile.num) {
i = int(((zone.y - zone.h) / grid_height) * rows);
j = int(((zone.x + v4 + speed) / grid_width) * columns);
tile = grid[i][j];
}
if (!tile.dropthru) {
if (zone.y <= tile.y + Math.abs(zone.speed_y)) {
var v3 = f_GetTile(tile.x, tile.y - 1);
var v6 = f_GetTile(v3.x, v3.y - 1);
if (v3.dropthru and !v6.dropthru) {
f_SetXY(zone, tile.x + v5, tile.y);
return speed;
}
}
if (speed > 0) {
if (zone.x + zone.w + speed > tile.x) {
zone.wall_pt = tile;
zone.wall_dir = 2;
return tile.x - (zone.x + zone.w);
}
return speed;
}
if (zone.x - zone.w + speed < tile.x + tilesize) {
zone.wall_pt = tile;
zone.wall_dir = 4;
return tile.x + tilesize - (zone.x - zone.w);
}
}
return speed;
}
function f_WA(zone, speed) {
i = int(((zone.y - zone.h + speed) / grid_height) * rows);
j = int((zone.x / grid_width) * columns);
tile = grid[i][j];
if (!tile.dropthru) {
if (zone.y - zone.h + speed < tile.y + tilesize) {
if (!zone.moves[zone.m][2]) {
zone.speed_y = 0;
}
zone.wall_pt = tile;
zone.wall_dir = 1;
return tile.y + tilesize - (zone.y - zone.h);
}
}
return speed;
}
function f_WB(zone, speed) {
i = int(((zone.y + speed) / grid_height) * rows);
j = int((zone.x / grid_width) * columns);
tile = grid[i][j];
if (!tile.dropthru) {
if (zone.y + speed > tile.y) {
zone.wall_pt = tile;
zone.wall_dir = 3;
return tile.y - zone.y;
}
}
return speed;
}
function f_Depth(u_char, u_depth) {
var v2 = 200 * ((u_depth - abs_top) / abs_bottom);
u_char.current_depth = int(v2 * 200 + u_char.depth_mod);
u_char.swapDepths(u_char.current_depth);
}
function f_SetDepthMod() {
++current_depth_mod;
return current_depth_mod;
}
function f_AddNeutral(zone) {
zone.depth_mod = f_SetDepthMod();
f_Depth(zone, zone._y);
}
function f_rad2deg(radian) {
return 57.29577951308232 * radian;
}
function f_ObjectPush(zone, a_Array) {
a_Array.push(zone);
}
function f_ObjectPop(zone, a_Array) {
for (n in a_Array) {
if (a_Array[n] == zone) {
a_Array.splice(n, 1);
return undefined;
}
}
}
function f_SetXY(z, x, y) {
z._x = x;
z._y = y;
z.x = x;
z.y = y;
f_Depth(z, z.y);
}
function f_ClickChar(z) {
if (phase == 0) {
z.alive = false;
f_Depth(z, bgdepth + 1);
z.gotoAndStop('ghost');
menu.gotoAndStop('bossspawn');
phase = 1;
} else {
if (!z.teleported) {
game.exit._x = z.x;
game.exit._y = z.y;
}
phase = 2;
menu.gotoAndStop('off');
tips.gotoAndStop('recording');
z.gotoAndStop('stand');
}
}
function f_GetTile(x, y) {
return grid[int((y / grid_height) * rows)][int((x / grid_width) * columns)];
}
function f_DragChar(z) {
var v4 = int(((_ymouse - game._y) / grid_height) * rows);
var v3 = int(((_xmouse - game._x) / grid_width) * columns);
tile = grid[v4][v3];
if (tile.dropthru) {
if (!z.teleported) {
var v2 = 0;
do {
++v2;
} while (!grid[v4 + v2][v3].num > 0 and v2 < rows);
if (v2 >= rows) {
return undefined;
}
tile = grid[v4 + v2 - 1][v3];
}
f_SetXY(z, tile.x + tilesize / 2, tile.y + tilesize);
f_AssignPlatform(z, tile);
} else {
return undefined;
}
if (_xmouse < z.x + game._x) {
if (z._xscale > 0) {
z._xscale *= -1;
}
} else {
if (_xmouse > z.x + game._x) {
if (z._xscale < 0) {
z._xscale *= -1;
}
}
}
if (z.teleported) {
z.moves[b1.m][7] = z.x;
z.moves[b1.m][8] = z.y;
z.moves[b1.m][9] = z._xscale;
f_AssignPlatform(z, f_GetTile(z.x, z.y));
if (z.speed_y < 0 or !b1.platform.solid) {
z.platform = undefined;
}
} else {
z.xscale = z._xscale;
z.default_x = z.x;
z.default_y = z.y;
}
z.gotoAndStop('drag');
}
function f_RefreshChar(z, loop) {
z.thruster_boost = 0;
z.thruster_current = zone.thruster_max;
z.pressed_jump = false;
z.speed_y = 0;
z.jumping = false;
z.alive = true;
z.chargeshot = 0;
f_AssignPlatform(z, f_GetTile(z.x, z.y));
if (z == p1 && bossrushmode && rushlevel > 0) {
z.health += z.health_max * 0.4;
if (z.health > z.health_max) {
z.health = z.health_max;
}
} else {
if (!loop) {
z.health = z.health_max;
}
}
z.recoil_timer = 0;
z.invincible_timer = 0;
z.teleport_timer = 0;
z.a1.charge_current = 0;
z.a2.charge_current = 0;
z.pressed_attack1 = false;
z.pressed_attack2 = false;
z.pressed_jump = false;
z.shooting = false;
z.m = 0;
z.teleported = false;
f_EndSwording(b1);
if (z.a1.atype == 5 || z.a2.atype == 5) {
z.hasShield = true;
} else {
z.hasShield = false;
z.shield.gotoAndStop('off');
}
}
function f_InitChar(z, moves) {
z.m = 0;
z.moves = moves;
z.x = z._x;
z.y = z._y;
z.speed_x = 5;
z.speed_y = 0;
z.speed_y_max = 25;
z.launch = -9;
z.invincible_timer = 0;
z.left_timer = 0;
z.right_timer = 0;
z.health_max = 100;
z.health = z.health_max;
z.chargeshot = 0;
z.w2 = 2;
z.w = 15;
z.h = 46;
z.rtimer = 1;
z.thruster_boost = 0;
z.thruster_max = 13;
z.thruster_current = zone.thruster_max;
z._xscale = 100;
z._yscale = 100;
z.active = true;
z.alive = true;
z.a1 = new Object();
z.a2 = new Object();
if (!z.depth_mod) {
z.depth_mod = f_SetDepthMod();
}
f_Depth(z, z._y);
}
function f_Clear() {
a_Platforms = new Array(0);
a_Walls = new Array(0);
total_platforms = 0;
total_walls = 0;
}
function f_TileClick() {
clicked = true;
firstclick = true;
}
function f_TileRelease() {
clicked = false;
i = 0;
while (i < rows) {
j = 0;
while (j < columns) {
var v1 = grid[i][j];
v1.clicked = false;
++j;
}
++i;
}
}
function f_SetTile(z) {
if (z.num == 2 || z.num == 0) {
z.dropthru = true;
} else {
z.dropthru = false;
}
if (z.num == 0) {
z.solid = false;
} else {
z.solid = true;
}
}
function f_DragTile(z) {
var v2 = int(((_ymouse - game._y) / grid_height) * rows);
var v1 = int(((_xmouse - game._x) / grid_width) * columns);
tile = grid[v2][v1];
z._x = tile.x;
z._y = tile.y;
if (v2 == rows - 1) {
z._y = tile.y + 100;
}
if (v2 == rows - 1 or v1 == 0 or v1 == columns - 1) {
return undefined;
}
if (clicked) {
if (Key.isDown(90) || Key.isDown(88)) {
tile.num = 0;
} else {
tile.num = tileselect;
}
grid_level[v2][v1].num = tile.num;
if (tile.num) {
if (tile.mc._currentframe != tile.num) {
tile.mc.gotoAndStop(tile.num);
if (tile.num == 1) {
tile.mc.body.gotoAndStop(random(totalArtPanel) + 1);
} else {
if (tile.num == 2) {
tile.mc.body.gotoAndStop(random(totalArtHalf) + 1);
}
}
}
} else {
tile.mc.gotoAndStop('blank');
}
f_SetTile(tile);
}
}
function f_UpgradeMenu() {
menu.gotoAndStop('upgrade');
}
function f_UpgradeHelmet(z) {
if (p1.helmet < 5) {
++p1.helmet;
z.nextFrame();
}
}
function f_ExitEditRoom() {
phase = -1;
f_ClearFX();
tc.gotoAndStop('off');
f_TileRelease();
tips.gotoAndStop('off');
menu.gotoAndStop('raybots');
}
function f_EditWeapons() {
weapon = b1.a1.atype;
if (weapon == 1) {
menu.gotoAndStop('editbullet');
} else {
if (weapon == 2) {
menu.gotoAndStop('editbomb');
} else {
if (weapon == 3) {
menu.gotoAndStop('editbeam');
} else {
if (weapon == 4) {
menu.gotoAndStop('editteleport');
} else {
if (weapon == 5) {
menu.gotoAndStop('editshield');
} else {
if (weapon == 6) {
menu.gotoAndStop('editsword');
}
}
}
}
}
}
}
function f_SetTheme(newtheme) {
theme = newtheme;
f_DrawGrid(grid_level);
bg.gotoAndStop(theme);
}
function f_SetTileSelect(newtile) {
tileselect = newtile;
tc.gotoAndStop('on');
if (newtile > 0) {
tc.body.gotoAndStop(tileselect);
} else {
tc.body.gotoAndStop('blank');
}
}
function f_SetClock(u) {
b1.gameclock = u;
gameclockdefault = u * 60;
}
function f_SetWeaponSound(w) {
if (w.atype == 1) {
f_SetBullet(w, w.num);
} else {
if (w.atype == 2) {
w.weaponSound = undefined;
} else {
if (w.atype == 3) {
w.weaponSound = s_beam;
} else {
if (w.atype == 4) {
w.weaponSound = s_teleport;
}
}
}
}
}
function f_EditBullet() {
weapon.atype = 1;
f_SetBullet(weapon, weapon.num);
menu.gotoAndStop('editbullet');
f_ClearFX();
f_DrawGrid(grid_bd);
f_SetXY(b1, grid[6][11].x + tilesize / 2, grid[6][11].y);
b1._xscale = 100;
b1.swording = false;
b1.hasShield = false;
b1.shield.gotoAndStop('off');
b1.gotoAndStop('stand');
bd_timer = 0;
f_MenuBulletVars();
menu.atype.bullets.gotoAndStop(weapon.num);
menu.dragspeed.percent = (weapon.speed - minBulletSpeed) / (maxBulletSpeed - minBulletSpeed);
menu.dragspeed.bar._x = menu.dragspeed.clicker._width * menu.dragspeed.percent;
menu.dragspeed.mode = 1;
menu.dragdamage.percent = (weapon.damage - minBulletDamage) / (maxBulletDamage - minBulletDamage);
menu.dragdamage.bar._x = menu.dragdamage.clicker._width * menu.dragdamage.percent;
menu.dragdamage.mode = 2;
menu.dragbounces.percent = (weapon.bounces - minBulletBounces) / (maxBulletBounces - minBulletBounces);
menu.dragbounces.bar._x = menu.dragbounces.clicker._width * menu.dragbounces.percent;
menu.dragbounces.mode = 3;
menu.draggravity.percent = (weapon.gravity + (maxBulletGravity - minBulletGravity) / 2) / (maxBulletGravity - minBulletGravity);
menu.draggravity.bar._x = menu.draggravity.clicker._width * menu.draggravity.percent;
menu.draggravity.mode = 4;
var v1 = weapon.trajectory + 30;
if (v1 >= 360) {
v1 -= 360;
menu.dragtrajectory.percent = 1 - v1 / 60;
} else {
menu.dragtrajectory.percent = (30 - weapon.trajectory) / 60;
}
menu.dragtrajectory.bar._x = menu.dragtrajectory.clicker._width * menu.dragtrajectory.percent;
menu.dragtrajectory.mode = 5;
}
function f_EditBomb() {
weapon.atype = 2;
weapon.weaponSound = undefined;
menu.gotoAndStop('editbomb');
menu.atype.bombs.gotoAndStop(weapon.bombtype);
f_ClearFX();
f_DrawGrid(grid_bd);
var v1 = grid[6][10];
v1.num = 2;
v1.mc.gotoAndStop(2);
f_SetTile(v1);
v1 = grid[6][9];
v1.num = 2;
v1.mc.gotoAndStop(2);
f_SetTile(v1);
v1 = grid[6][8];
v1.num = 2;
v1.mc.gotoAndStop(2);
f_SetTile(v1);
v1 = grid[6][12];
v1.num = 2;
v1.mc.gotoAndStop(2);
f_SetTile(v1);
v1 = grid[6][13];
v1.num = 2;
v1.mc.gotoAndStop(2);
f_SetTile(v1);
v1 = grid[6][14];
v1.num = 2;
v1.mc.gotoAndStop(2);
f_SetTile(v1);
v1 = grid[6][15];
v1.num = 2;
v1.mc.gotoAndStop(2);
f_SetTile(v1);
f_SetXY(b1, grid[6][11].x + tilesize / 2, grid[6][11].y);
b1._xscale = 100;
b1.swording = false;
b1.hasShield = false;
b1.shield.gotoAndStop('off');
b1.gotoAndStop('walk');
bd_timer = 0;
f_MenuBombVars();
menu.dragtimer.percent = (weapon.bombtimer - minBombTimer) / (maxBombTimer - minBombTimer);
menu.dragtimer.bar._x = menu.dragtimer.clicker._width * menu.dragtimer.percent;
menu.dragtimer.mode = 6;
menu.dragdamage.percent = (weapon.bombdamage - minBombDamage) / (maxBombDamage - minBombDamage);
menu.dragdamage.bar._x = menu.dragdamage.clicker._width * menu.dragdamage.percent;
menu.dragdamage.mode = 7;
menu.draggravity.percent = (weapon.bombgravity + (maxBombGravity - minBombGravity) / 2) / (maxBombGravity - minBombGravity);
menu.draggravity.bar._x = menu.draggravity.clicker._width * menu.draggravity.percent;
menu.draggravity.mode = 8;
}
function f_EditBeam() {
weapon.atype = 3;
weapon.weaponSound = s_beam;
menu.gotoAndStop('editbeam');
f_ClearFX();
f_DrawGrid(grid_bd);
f_SetXY(b1, grid[6][11].x + tilesize / 2, grid[6][11].y);
b1._xscale = 100;
b1.swording = false;
b1.hasShield = false;
b1.shield.gotoAndStop('off');
b1.gotoAndStop('stand');
bd_timer = 0;
}
function f_EditTeleport() {
weapon.atype = 4;
weapon.weaponSound = s_teleport;
menu.gotoAndStop('editteleport');
f_ClearFX();
f_DrawGrid(grid_bd);
var v1 = grid[6][11];
v1.num = 0;
v1.mc.gotoAndStop('blank');
v1 = grid[6][10];
v1.num = 2;
v1.mc.gotoAndStop(2);
v1 = grid[6][13];
v1.num = 2;
v1.mc.gotoAndStop(2);
f_SetXY(b1, grid[6][10].x + tilesize / 2, grid[6][10].y);
b1._xscale = 100;
b1.swording = false;
b1.hasShield = false;
b1.shield.gotoAndStop('off');
b1.gotoAndStop('stand');
bd_timer = 0;
}
function f_EditShield() {
weapon.atype = 5;
weapon.weaponSound = undefined;
menu.gotoAndStop('editshield');
f_ClearFX();
f_DrawGrid(grid_bd);
f_SetXY(b1, grid[6][11].x + tilesize / 2, grid[6][11].y);
b1._xscale = 100;
b1.swording = false;
b1.hasShield = true;
b1.shield.gotoAndStop('on');
b1.gotoAndStop('stand');
bd_timer = 0;
}
function f_EditSword() {
weapon.atype = 6;
weapon.weaponSound = undefined;
menu.gotoAndStop('editsword');
f_ClearFX();
f_DrawGrid(grid_bd);
f_SetXY(b1, grid[6][11].x + tilesize / 2, grid[6][11].y);
b1._xscale = 100;
b1.hasShield = false;
b1.shield.gotoAndStop('off');
b1.gotoAndStop('stand');
b1.swording = true;
b1.body.gun.sword.gotoAndPlay(2);
bd_timer = 0;
}
function f_EditDraw(num) {
if (num) {
editimage = num;
} else {
editimage = 1;
}
menu.gotoAndStop('editdraw');
}
function f_SetHead(z) {
if (z._parent._parent._parent._parent.logbox) {
return undefined;
}
z.attachBitmap(b1.head, 0, true, true);
}
function f_SetHat(z) {
if (z._parent._parent.logbox) {
z.stop();
return undefined;
}
var v1 = b1.bdata.hat;
if (v1 && v1 != 9999) {
z.gotoAndStop(v1);
} else {
z.gotoAndStop('blank');
}
}
function f_UpdateHat(num) {
s_tuneUp.start(0, 0);
b1.bdata.hat = num;
b1.gotoAndStop('blank');
b1.gotoAndStop('stand');
}
function f_SetHand(z) {
if (z._parent._parent._parent.logbox) {
z.stop();
return undefined;
}
hand = b1.bdata.hand;
if (hand) {
z.gotoAndStop(hand);
}
}
function f_UpdateHand(num) {
s_tuneUp.start(0, 0);
b1.bdata.hand = num;
b1.gotoAndStop('blank');
b1.gotoAndStop('stand');
}
function f_PopulateItems(z, itemname, total) {
var v3 = 0;
var v5 = 0;
if (itemname == 'hats' && pdata.uniques.length % 2 != 0) {
var v7 = 16 + int((pdata.uniques.length + 1) / 2);
} else {
var v7 = 16 + int(pdata.uniques.length / 2);
}
if (v7 > total) {
v7 = total;
}
var v1 = 0;
while (v1 < total) {
var v2 = itemname + v1;
z.attachMovie(itemname, v2, v1);
v2 = z[itemname + v1];
v2.num = v1 + 1;
v2.gotoAndStop(v2.num);
if (v1 >= v7) {
v2.b.gotoAndStop(2);
}
v2._x = v3 * 60;
v2._y = v5 * 60;
++v3;
if (v3 > 7) {
v3 = 0;
++v5;
}
++v1;
}
}
function f_ChangeBulletArt(i) {
weapon.num += i;
if (weapon.num > 5) {
weapon.num = 3;
} else {
if (weapon.num < 3) {
weapon.num = 5;
}
}
f_SetBullet(weapon, weapon.num);
menu.atype.bullets.gotoAndStop(weapon.num);
}
function f_DragBar(z) {
if (z.active) {
if (z.clicker._xmouse < 0) {
var v2 = 0;
} else {
if (z.clicker._xmouse > z.clicker._width) {
var v2 = z.clicker._width;
} else {
var v2 = z.clicker._xmouse;
}
}
z.bar._x = v2;
z.percent = v2 / z.clicker._width;
if (z.mode == 1) {
weapon.speed = int((maxBulletSpeed - minBulletSpeed) * z.percent + minBulletSpeed);
menu.speed.text = weapon.speed;
} else {
if (z.mode == 2) {
weapon.damage = int((maxBulletDamage - minBulletDamage) * z.percent + minBulletDamage);
weapon.bulletrecovery = weapon.damage * 8;
menu.damage.text = weapon.damage;
} else {
if (z.mode == 3) {
weapon.bounces = int((maxBulletBounces - minBulletBounces) * z.percent + minBulletBounces);
menu.bounces.text = weapon.bounces;
} else {
if (z.mode == 4) {
weapon.gravity = (maxBulletGravity - minBulletGravity) * z.percent + minBulletGravity;
weapon.gravity = Math.round(weapon.gravity * 100) / 100;
menu.gravity.text = weapon.gravity;
} else {
if (z.mode == 5) {
weapon.trajectory = 30 - int(60 * z.percent);
if (weapon.trajectory < 0) {
weapon.trajectory += 360;
}
menu.trajectory.text = weapon.trajectory;
} else {
if (z.mode == 6) {
weapon.bombtimer = int((maxBombTimer - minBombTimer) * z.percent + minBombTimer);
menu.bombtimer.text = weapon.bombtimer;
} else {
if (z.mode == 7) {
weapon.bombdamage = int((maxBombDamage - minBombDamage) * z.percent + minBombDamage);
weapon.bombrecovery = weapon.bombdamage * 6;
menu.bombdamage.text = weapon.bombdamage;
} else {
if (z.mode == 8) {
weapon.bombgravity = (maxBombGravity - minBombGravity) * z.percent + minBombGravity;
weapon.bombgravity = Math.round(weapon.bombgravity * 100) / 100;
menu.bombgravity.text = weapon.bombgravity;
}
}
}
}
}
}
}
}
}
}
function f_ExitEditBullet() {
f_ClearFX();
menu.gotoAndStop('raybots');
f_DrawGrid(grid_level);
b1.gotoAndStop('blank');
}
function f_CreateGrids() {
grid = new Array(rows);
var v2 = 0;
while (v2 < rows) {
grid[v2] = new Array(maxColumns);
var v1 = 0;
while (v1 < maxColumns) {
grid[v2][v1] = new Object();
grid[v2][v1].num = 0;
++v1;
}
++v2;
}
grid_level = new Array(rows);
v2 = 0;
while (v2 < rows) {
grid_level[v2] = new Array(columns);
v1 = 0;
while (v1 < columns) {
grid_level[v2][v1] = new Object();
grid_level[v2][v1].num = 0;
++v1;
}
++v2;
}
grid_default = new Array(rows);
v2 = 0;
while (v2 < rows) {
grid_default[v2] = new Array(columns);
v1 = 0;
while (v1 < columns) {
grid_default[v2][v1] = new Object();
grid_default[v2][v1].num = 0;
++v1;
}
++v2;
}
v1 = 0;
while (v1 < rows) {
grid_default[v1][0].num = 3;
grid_default[v1][columns_default - 1].num = 3;
++v1;
}
v2 = 0;
while (v2 < columns_default) {
grid_default[rows - 1][v2].num = 1;
++v2;
}
v2 = 0;
while (v2 < columns_default) {
grid_default[0][v2].num = 1;
++v2;
}
grid_bd = new Array(rows);
v2 = 0;
while (v2 < rows) {
grid_bd[v2] = new Array(columns);
v1 = 0;
while (v1 < columns) {
grid_bd[v2][v1] = new Object();
grid_bd[v2][v1].num = 0;
++v1;
}
++v2;
}
f_BulletDemoGrid();
grid_pixeltool = new Array(rows);
v2 = 0;
while (v2 < rows) {
grid_pixeltool[v2] = new Array(columns);
v1 = 0;
while (v1 < columns) {
grid_pixeltool[v2][v1] = new Object();
grid_pixeltool[v2][v1].num = 0;
++v1;
}
++v2;
}
f_PixelToolGrid();
}
function f_Rasterize(sourceClip, newClipName, parentClip, depth) {
var v1 = sourceClip.getBounds(sourceClip);
var v4 = new flash.display.BitmapData(v1.xMax - v1.xMin, v1.yMax - v1.yMin, true, 0);
var v3 = new flash.geom.Matrix();
v3.translate(-v1.xMin, -v1.yMin);
v4.draw(sourceClip, v3);
var v2 = parentClip.createEmptyMovieClip(newClipName, depth);
v2.attachBitmap(v4, 0);
return v2;
}
function f_DrawGrid(grid_pt, offset) {
if (!offset) {
offset = 0;
var v7 = 0;
var v6 = columns;
} else {
var v7 = columns;
var v6 = columns + columns_default;
}
var v9 = v6 / columns_default;
if (game.tileset['screen' + v9]) {
game.tileset['screen' + v9].removeMovieClip();
}
if (game.tileset['raster' + v9]) {
game.tileset['raster' + v9].removeMovieClip();
}
var v5 = game.tileset.attachMovie('blank', 'screen' + v9, v9);
var v4 = 0;
i = 0;
while (i < rows) {
var v3 = 0;
j = v7;
while (j < v6) {
var v1 = grid[i][j];
v1.num = grid_pt[i][v3].num;
v1.x = tilesize * j;
v1.y = tilesize * i;
v1.w = tilesize;
f_SetTile(v1);
if (v1.num > 0 && v1.num != 3 || !bossrushmode) {
++v4;
var v2 = v5.attachMovie('tile', 't' + i + '_' + j, v4);
if (v1.num) {
v2.gotoAndStop(v1.num);
if (v1.num == 1) {
v2.body.gotoAndStop(random(totalArtPanel) + 1);
} else {
if (v1.num == 2) {
v2.body.gotoAndStop(random(totalArtHalf) + 1);
}
}
} else {
v1.num = 0;
v2.gotoAndStop('blank');
}
v2._x = v1.x;
v2._y = v1.y;
v1.mc = v2;
}
++v3;
++j;
}
++i;
}
columns = v6;
grid_width = columns * tilesize;
if (bossrushmode) {
var v10 = f_Rasterize(v5, 'raster' + v9, game.tileset, v9 + 10000);
v10._x = 900 * v9 - 900 - 9;
v10._y -= 9;
trace('Removing: ' + v5);
v5.removeMovieClip();
}
}
function f_LoadGrid(grid_pt) {
j = 0;
while (j < rows) {
grid_pt[j][0].num = 3;
grid_pt[j][columns_default - 1].num = 3;
++j;
}
var v1 = 0;
while (v1 < columns_default) {
grid_pt[rows - 1][v1].num = 1;
++v1;
}
v1 = 0;
while (v1 < columns_default) {
grid_pt[0][v1].num = 1;
++v1;
}
}
function f_BulletDemoGrid() {
i = 0;
while (i < columns) {
grid_bd[rows - 1][i].num = 1;
++i;
}
i = 0;
while (i < columns) {
grid_bd[1][i].num = 1;
++i;
}
j = 0;
while (j < rows) {
i = 0;
while (i < 8) {
grid_bd[j][i].num = 1;
++i;
}
++j;
}
j = 0;
while (j < rows) {
grid_bd[j][16].num = 1;
++j;
}
grid_bd[6][11].num = 2;
}
function f_PixelToolGrid() {
i = 0;
while (i < columns) {
grid_pixeltool[rows - 1][i].num = 1;
++i;
}
i = 0;
while (i < columns) {
grid_pixeltool[1][i].num = 1;
++i;
}
j = 0;
while (j < rows) {
i = 0;
while (i < 13) {
grid_pixeltool[j][i].num = 1;
++i;
}
++j;
}
j = 0;
while (j < rows) {
grid_pixeltool[j][16].num = 1;
++j;
}
grid_pixeltool[6][14].num = 2;
}
function f_EditRoom() {
if (b1.moves.length > 0) {
menu.notices.gotoAndStop('erasepattern');
} else {
menu.notices.gotoAndStop(1);
passtest = false;
f_EndDemo();
tc.gotoAndStop('on');
phase = 5;
f_SetTileSelect(1);
menu.gotoAndStop('exiteditroom');
}
}
function f_RecordPattern() {
if (b1.gameclock > 60) {
gameclock = 3600;
} else {
gameclock = b1.gameclock * 60;
}
phase = 0;
wait_timer = 0;
bm = new Array(0);
b1.moves = bm;
f_RefreshChar(b1);
game.exit.gotoAndStop('off');
hud.gotoAndStop('recharge');
menu.gotoAndStop('playerspawn');
}
function f_DeliverPlayer() {
s_dropped.start(0, 0);
f_SetXY(p1, p1.default_x, p1.default_y);
tbot.body.body.gotoAndPlay('release');
p1.health_start = p1.health;
p1.chargeshot = 0;
p1.gotoAndStop('dropped');
}
function f_Test(botmodeflag) {
_quality = 'low';
botmode = botmodeflag;
phase = 4;
gameclock = gameclockdefault;
b1._xscale = b1.xscale;
f_SetXY(b1, b1.default_x, b1.default_y);
f_RefreshChar(b1);
pm = new Array(0);
f_SetXY(p1, p1.default_x, p1.default_y);
f_RefreshChar(p1);
p1._xscale = p1.xscale;
wait_timer = 160;
p1.animatic = true;
s_carryBot.start(0, 0);
tbot._x = p1.x;
tbot._y = p1.y - 50;
if (botmode) {
tbot.gotoAndStop('deliver2');
tbot.body.gotoAndPlay(1);
tbot.body._xscale = p1.xscale;
menu.gotoAndStop('exittest');
} else {
tbot.gotoAndStop('deliver');
tbot.body.gotoAndPlay(1);
tbot.body.body.gotoAndStop('hold');
f_SetXY(p1, p1.x, tbot._y + tbot.body._y + tbot.body.body._y);
p1.gotoAndStop('dangle');
menu.gotoAndStop('off');
}
}
function f_PrepBattle() {
_quality = 'low';
phase = 8;
panSpeed = 10;
prePanTimer = 60;
panTimer = 900 / panSpeed;
gameclock = gameclockdefault;
b1._xscale = b1.xscale;
f_SetXY(b1, b1.default_x, b1.default_y);
f_RefreshChar(b1);
b1.gotoAndStop('stand');
s_carryBot.start(0, 0);
tbot._x = p1.x;
tbot._y = p1.y - 30;
tbot.gotoAndStop('fetch');
tbot.body.gotoAndPlay(1);
pm = new Array();
p1.moves = pm;
p1.m = 0;
menu.gotoAndStop('off');
}
function f_RaybotsMenu() {
_quality = 'medium';
menumode = 2;
tips.gotoAndStop('off');
game.exit.gotoAndStop('off');
justSaved = false;
f_Demo();
if (b1.moves.length > 0) {
menu.testpattern.gotoAndStop(2);
}
if (passtest && !justSaved) {
menu.saveboss.gotoAndStop(2);
}
if (bossfile) {
f_GenerateLink();
menu.directurl.text = directurl;
}
}
function f_HumanMenu() {
_quality = 'medium';
bossrushmode = false;
doScores = -1;
menumode = 1;
if (fromSelect) {
fromSelect = false;
} else {
f_BossRushCleanup();
m_select.start(0, 9999);
}
}
function f_Demo() {
phase = 7;
p1.gotoAndStop('blank');
p1.alive = false;
if (b1.moves.length > 0) {
b1._xscale = b1.xscale;
f_SetXY(b1, b1.default_x, b1.default_y);
f_RefreshChar(b1);
} else {
b1.gotoAndStop('blank');
}
game._xscale = 50;
game._yscale = 50;
game._x = menu.demopt._x + menu._x - tilesize * 0.5 + 1;
game._y = menu.demopt._y + menu._y - tilesize * 0.5 + 1;
}
function f_EndDemo() {
f_ClearFX();
b1.gotoAndStop('blank');
game._xscale = 100;
game._yscale = 100;
game._x = -tilesize;
game._y = screen_height - grid_height;
phase = -1;
f_EndSwording(b1);
}
function f_ExitTest() {
f_ClearFX();
phase = -1;
p1.gotoAndStop('blank');
b1.gotoAndStop('blank');
hud.gotoAndStop('off');
tbot.gotoAndStop('blank');
fireloop.s_fireloop.stop();
f_EndSwording(b1);
if (bossrushmode) {
bossrushmode = false;
menu.gotoAndStop('humans');
} else {
menu.gotoAndStop('raybots');
}
}
function f_Replay(z) {
if (wait_timer > 0 || !z.alive) {
return undefined;
}
if (z.teleport_timer > 0) {
--z.teleport_timer;
if (z.teleport_timer == teleportFrames) {
f_FX(z.x, z.y, z.y + 1, 'warpin', z._xscale, 100);
}
if (z.teleport_timer <= 0) {
z.teleported = false;
f_AssignPlatform(z, f_GetTile(z.x, z.y));
if (z.speed_y < 0 or !z.platform.solid) {
z.platform = undefined;
}
z.gotoAndStop('stand');
} else {
return undefined;
}
}
++z.rtimer;
if (z.rtimer > 1000) {
z.rtimer = 1;
}
if (z.rtimer % 2 == 0) {
++z.m;
if (z.m > z.moves.length) {
z.m = 1;
z._xscale = z.xscale;
f_SetXY(b1, b1.default_x, b1.default_y);
f_RefreshChar(z, true);
}
}
}
function f_Recoil(z) {
z.recoil_timer = 15;
}
function f_UpdateHud(z) {
var v1 = 101 - (z.health / z.health_max) * 100;
if (z == p1) {
hud.health_p1.gotoAndStop(v1);
} else {
hud.health_b1.gotoAndStop(v1);
}
}
function f_Damage(z, damage) {
if (z.invincible_timer > 0) {
return undefined;
}
z.health -= damage;
if (z.health < 0) {
z.health = 0;
}
var v3 = 101 - (z.health / z.health_max) * 100;
if (z == p1) {
if (z.health > 0) {
if (bossrushmode) {
_root['s_oww' + (random(18) + 1)].start(0, 0);
} else {
_root['s_testHurt' + random(4)].start(0, 0);
}
f_Recoil(z);
z.invincible_timer = 30;
}
hud.health_p1.gotoAndStop(v3);
} else {
hud.health_b1.gotoAndStop(v3);
}
if (z.health == 0) {
z.alive = false;
deathclock = 180;
phase = 6;
if (z == b1) {
passtest = true;
winner = true;
++pdata.wins;
p1.invincible_timer = 200;
f_EndSwording(b1);
if (bossrushmode) {
s_explosion.start(0, 0);
bossfile.sendVote('Losses', 1);
bossfile.sendVote('Difficulty', 0);
z.gotoAndStop('die');
} else {
s_bossDemoDie.start(0, 0);
z.gotoAndStop('dietest');
}
} else {
winner = false;
if (bossrushmode) {
fireloop.s_fireloop.stop();
if (gameclock == 0) {
s_timeOver.start(0, 0);
b1.alive = false;
b1.gotoAndStop('timeup');
f_Depth(z, b1._y + 50);
z.gotoAndStop('timeup');
} else {
s_humandie.start(0, 0);
f_Depth(z, z._y + 50);
z.invincible_timer = 90;
z.gotoAndStop('die');
}
++pdata.losses;
bossfile.sendVote('Wins', 1);
bossfile.sendVote('Difficulty', 5);
} else {
if (gameclock == 0) {
s_timeOver.start(0, 0);
tips.gotoAndStop('timeup');
b1.alive = false;
b1.gotoAndStop('stand');
f_Depth(z, b1._y + 50);
z.gotoAndStop('stand');
} else {
s_monitorBreak.start(0, 0);
f_Depth(z, z._y + 50);
z.gotoAndStop('die');
}
}
}
}
}
function f_Invincible(z, t) {
if (z.invincible_timer <= 0) {
z.invincible_timer = t;
}
}
function f_BodyHit() {
if (p1.invincible_timer > 0 || wait_timer > 0) {
return undefined;
} else {
if (p1.alive) {
var v1 = false;
if (b1.hasShield) {
if (Math.sqrt(Math.pow(b1.x - p1.x, 2) + Math.pow(b1.y - p1.y, 2)) <= 100) {
v1 = true;
}
}
if (Math.abs(b1.x - p1.x) < 30) {
if (b1.y - b1.h / 2 < p1.y) {
if (b1.y > p1.y - p1.h / 2) {
v1 = true;
}
}
}
if (v1) {
if (b1.teleport_timer > 0) {
return false;
}
if (b1.x < p1.x and p1._xscale > 0) {
p1._xscale *= -1;
f_Damage(p1, 5);
return true;
}
if (b1.x > p1.x and p1._xscale < 0) {
p1._xscale *= -1;
}
f_Damage(p1, 5);
return true;
}
}
}
}
function f_PlayerHelmet(z) {
z.gotoAndStop(p1.helmet);
}
function f_HumanMode() {
p1.gotoAndStop('blank');
p1 = game.p1;
menu.gotoAndStop('humans');
}
function f_RaybotMode() {
passtest = false;
p1 = game.p2;
for (var v2 in game.tileset) {
game.tileset[v2].removeMovieClip();
}
game.tileset.attachMovie('blank', 'screen1', 1);
var v3 = 0;
v2 = 0;
while (v2 < rows) {
j = 0;
while (j < columns) {
++v3;
var v1 = grid[v2][j];
v1.num = 0;
v1.mc = game.tileset.screen1.attachMovie('tile', 't' + v2 + '_' + j, v3);
v1.mc._x = v1.x;
v1.mc._y = v1.y;
v1.mc.gotoAndStop('blank');
++j;
}
++v2;
}
f_BossDataRefresh();
m_makeraybot.start(0, 999);
f_CreateGrids();
grid_level = grid_default;
f_DrawGrid(grid_level);
menu.gotoAndStop('raybots');
}
function f_UnlockItem(id, authorName, z) {
var v3 = true;
if (authorName == com.newgrounds.API.__get__username()) {
trace('You Made this boss!');
v3 = false;
}
var v2 = 1;
while (v2 < bossChannel.length) {
var v1 = 0;
while (v1 < bossChannel[v2].bosses.length) {
if (bossChannel[v2].bosses[v1] == id) {
v3 = false;
break;
}
++v1;
}
++v2;
}
if (pdata.uniques.length > 0) {
v2 = 0;
while (v2 < pdata.uniques.length) {
if (pdata.uniques[v2] == id) {
v3 = false;
break;
}
++v2;
}
}
if (v3) {
com.newgrounds.Logger.logMessage('UPDATING PDATA UNIQUES: ' + pdata.uniques);
if (pdata.uniques.length > 0) {
pdata.uniques.push(id);
} else {
pdata.uniques[0] = id;
}
com.newgrounds.Logger.logMessage('PDATA UNIQUES: ' + pdata.uniques);
com.newgrounds.Logger.logMessage('ID: ' + id);
com.newgrounds.Logger.logMessage('LENGTH: ' + pdata.uniques.length);
if (pdata.uniques.length < hatsTotal + handsTotal - 32) {
if (pdata.uniques.length % 2 == 0) {
z.body.gotoAndStop(int(pdata.uniques.length / 2) + 116);
z.body.num = int(pdata.uniques.length / 2) + 16;
} else {
z.body.gotoAndStop(int(pdata.uniques.length / 2) + 1 + 16);
z.body.num = int(pdata.uniques.length / 2) + 17;
}
f_SaveUser();
} else {
z.body.gotoAndStop('thanks');
}
} else {
z.body.gotoAndStop('thanks');
}
}
function f_ClearBossLog() {
var v1 = 0;
while (v1 < bosslog.length) {
menu['boss' + v1].removeMovieClip();
++v1;
}
}
function f_BossLogOutput() {
if (channelNum > 0) {
doScores = channelNum;
}
f_BossRushCleanup();
s_bossLog.start(0, 9999);
finalGrade = 0;
finalTime = 0;
var v1 = 0;
while (v1 < bosslog.length) {
var v2 = menu.humanbrowse.listbox.attachMovie('BossLogBox', 'boss' + v1, v1);
v2._x = 0;
v2._y = 20 + v1 * 50;
v2.bossName.text = bosslog[v1].bossName;
v2.authorName.text = 'by ' + bosslog[v1].authorName;
v2.body.head.head.head.attachBitmap(bosslog[v1].bitmap, 0, true, false);
if (bosslog[v1].hat) {
v2.body.hat.gotoAndStop(bosslog[v1].hat);
} else {
v2.body.hat.gotoAndStop('blank');
}
if (bosslog[v1].hand) {
v2.body.arm.hand.gotoAndStop(bosslog[v1].hand);
} else {
v2.body.arm.hand.gotoAndStop('blank');
}
v2.authorLink = 'http://' + bosslog[v1].authorName + '.newgrounds.com';
v2.directurl = bosslog[v1].directurl;
v2.votebar.saveFile = bosslog[v1];
finalGrade += bosslog[v1].grade;
finalTime += bosslog[v1].time;
++v1;
}
finalGrade /= bosslog.length;
finalTime /= bosslog.length;
trace('FINAL GRADE: ' + finalGrade);
trace('FINAL TIME: ' + finalTime);
finalScore = int((finalGrade + finalTime) * 100);
trace('FINAL SCORE: ' + finalScore);
trace('WINNER?!?!?! ' + winner);
if (doScores > 0) {
if (winner) {
com.newgrounds.API.postScore(bossChannel[doScores].title, finalScore);
}
}
}
function f_BossRushCleanup() {
f_EndDemo();
bossArray = undefined;
channelNum = -1;
p1.gotoAndStop('blank');
for (var v1 in game.tileset) {
game.tileset[v1].removeMovieClip();
}
game._x = gameXDefault;
columns = columns_default;
grid_width = columns * tilesize;
f_BossDataRefresh();
}
function f_BossDataRefresh() {
m_campaign.stop();
bossfile = undefined;
b1.m = 0;
bm = new Array(0);
b1.moves = bm;
f_BossWeapons(b1);
headbitmap = flash.display.BitmapData.loadBitmap('head1');
b1.head = headbitmap;
b1.bdata = new Object();
b1.bdata.hat = undefined;
b1.bdata.hand = 1;
f_SetBullet(b1.a1, 3);
f_SetBullet(b1.a2, 3);
b1.hasShield = false;
b1.shield.gotoAndStop('off');
game.bg._x = 50;
game.bg.t1._x = 0;
game.bg.t2._x = 900;
game.bg.t3._x = 1800;
game.bg.t4._x = 2700;
game.bg2._x = 50;
}
function f_InitGame() {
PI = 0.0174532925199433;
screen_width = 800;
screen_height = 450;
_quality = 'medium';
moves_max = 99999999;
bm = new Array(0);
pm = new Array(0);
panOffset = 0;
wheelListener = {'onMouseWheel': onMouseWheel};
recordKey = 32;
abs_top = -100;
abs_bottom = 550;
bgdepth = game.depth_top._y;
gravity = 0.75;
teleportdelay = 34;
current_depth_mod = 0;
bd_timer = 0;
maxBulletSpeed = 20;
minBulletSpeed = 2;
maxBulletDamage = 6;
minBulletDamage = 1;
maxBulletBounces = 5;
minBulletBounces = 0;
maxBulletGravity = 1;
minBulletGravity = -1;
maxBulletTrajectory = 5;
minBulletTrajectory = 1;
maxBombTimer = 180;
minBombTimer = 30;
maxBombGravity = 1;
minBombGravity = -1;
maxBombDamage = 7;
minBombDamage = 1;
maxCharge = 200;
hatsTotal = 40;
handsTotal = 40;
headsize = 30;
s_jump1 = new Sound();
s_jump1.attachSound('sound_swinger1');
s_robotJump = new Sound();
s_robotJump.attachSound('sound_robotjump');
s_robotDouble = new Sound();
s_robotDouble.attachSound('sound_doublejump2');
s_shoot7 = new Sound();
s_shoot7.attachSound('sound_shoot7');
s_shoot9 = new Sound();
s_shoot9.attachSound('sound_shoot9');
s_shoot10 = new Sound();
s_shoot10.attachSound('sound_shoot10');
s_charged = new Sound();
s_charged.attachSound('sound_charged');
s_chargeshot = new Sound();
s_chargeshot.attachSound('sound_chargeshot');
s_teleport = new Sound();
s_teleport.attachSound('sound_teleport3');
s_bossDemoDie = new Sound();
s_bossDemoDie.attachSound('sound_explosion1');
s_explosion = new Sound();
s_explosion.attachSound('sound_explosion3');
s_explosion2 = new Sound();
s_explosion2.attachSound('sound_explosion4');
s_cling1 = new Sound();
s_cling1.attachSound('sound_cling5');
s_cling2 = new Sound();
s_cling2.attachSound('sound_cling6');
s_cling0 = new Sound();
s_cling0.attachSound('sound_cling7');
s_robotLand = new Sound();
s_robotLand.attachSound('sound_robotland4');
s_hitRobot = new Sound();
s_hitRobot.attachSound('sound_hitrobot');
s_carryBot = new Sound();
s_carryBot.attachSound('sound_carrybot1');
s_dropped = new Sound();
s_dropped.attachSound('sound_dropped');
s_hitBody1 = new Sound();
s_hitBody1.attachSound('sound_bullethitbody1');
s_hitBody2 = new Sound();
s_hitBody2.attachSound('sound_bullethitbody1');
s_monitorBreak = new Sound();
s_monitorBreak.attachSound('sound_monitorbreak');
s_undo = new Sound();
s_undo.attachSound('sound_undo');
s_click1 = new Sound();
s_click1.attachSound('sound_click1');
s_colorPick = new Sound();
s_colorPick.attachSound('sound_colorpick');
s_tuneUp = new Sound();
s_tuneUp.attachSound('sound_tuneup1');
s_beam = new Sound();
s_beam.attachSound('sound_beamzap');
s_humandie = new Sound();
s_humandie.attachSound('sound_guts');
s_bone = new Sound();
s_bone.attachSound('sound_bone');
m_campaign = new Sound();
m_campaign.attachSound('468900');
m_makeraybot = new Sound();
m_makeraybot.attachSound('477039');
m_humans = new Sound();
m_humans.attachSound('496127');
m_select = new Sound();
m_select.attachSound('themeloop');
s_fireblast = new Sound();
s_fireblast.attachSound('sound_fireblast');
fireloop.s_fireloop = new Sound(fireloop);
fireloop.s_fireloop.attachSound('sound_fireloop');
beamloop.s_beamloop = new Sound(beamloop);
beamloop.s_beamloop.attachSound('sound_beam2');
swordwall.s_swordwall = new Sound(swordwall);
swordwall.s_swordwall.attachSound('sound_swordwall');
sword.s_sword = new Sound(sword);
sword.s_sword.attachSound('sound_sword');
sword.s_selectHuman = new Sound(sword);
sword.s_selectHuman.attachSound('sound_selecthuman');
sword.s_selectRaybot = new Sound(sword);
sword.s_selectRaybot.attachSound('sound_selectraybot');
s_oww1 = new Sound();
s_oww1.attachSound('vox_oww1');
s_oww2 = new Sound();
s_oww2.attachSound('vox_oww2');
s_oww3 = new Sound();
s_oww3.attachSound('vox_oww3');
s_oww4 = new Sound();
s_oww4.attachSound('vox_oww4');
s_oww5 = new Sound();
s_oww5.attachSound('vox_oww5');
s_oww6 = new Sound();
s_oww6.attachSound('vox_oww6');
s_oww7 = new Sound();
s_oww7.attachSound('vox_oww7');
s_oww8 = new Sound();
s_oww8.attachSound('vox_oww8');
s_oww9 = new Sound();
s_oww9.attachSound('vox_oww9');
s_oww10 = new Sound();
s_oww10.attachSound('vox_oww10');
s_oww11 = new Sound();
s_oww11.attachSound('vox_oww11');
s_oww12 = new Sound();
s_oww12.attachSound('vox_oww12');
s_oww13 = new Sound();
s_oww13.attachSound('vox_oww13');
s_oww14 = new Sound();
s_oww14.attachSound('vox_oww14');
s_oww15 = new Sound();
s_oww15.attachSound('vox_oww15');
s_oww16 = new Sound();
s_oww16.attachSound('vox_oww16');
s_oww17 = new Sound();
s_oww17.attachSound('vox_oww17');
s_oww18 = new Sound();
s_oww18.attachSound('vox_oww18');
s_winline1 = new Sound();
s_winline1.attachSound('vox_winline1');
s_winline2 = new Sound();
s_winline2.attachSound('vox_winline2');
s_winline3 = new Sound();
s_winline3.attachSound('vox_winline3');
s_winline4 = new Sound();
s_winline4.attachSound('vox_winline4');
s_winline5 = new Sound();
s_winline5.attachSound('vox_winline5');
s_winline6 = new Sound();
s_winline6.attachSound('vox_winline6');
s_winline7 = new Sound();
s_winline7.attachSound('vox_winline10');
s_winline8 = new Sound();
s_winline8.attachSound('vox_winline8');
s_winline9 = new Sound();
s_winline9.attachSound('vox_winline9');
s_handUnlocked = new Sound();
s_handUnlocked.attachSound('vox_hand_unlocked');
s_hatUnlocked = new Sound();
s_hatUnlocked.attachSound('vox_hat_unlocked');
s_johnnyutah = new Sound();
s_johnnyutah.attachSound('vox_johnnyutah');
s_raybotSaved0 = new Sound();
s_raybotSaved0.attachSound('vox_raybot_saved');
s_raybotSaved1 = new Sound();
s_raybotSaved1.attachSound('vox_raybot_saved2');
s_raybotSaved2 = new Sound();
s_raybotSaved2.attachSound('vox_raybot_saved3');
s_testLoss0 = new Sound();
s_testLoss0.attachSound('vox_test_loss_6');
s_testLoss1 = new Sound();
s_testLoss1.attachSound('vox_test_loss_1');
s_testLoss2 = new Sound();
s_testLoss2.attachSound('vox_test_loss_2');
s_testLoss3 = new Sound();
s_testLoss3.attachSound('vox_test_loss_3');
s_testLoss4 = new Sound();
s_testLoss4.attachSound('vox_test_loss_4');
s_testLoss5 = new Sound();
s_testLoss5.attachSound('vox_test_loss_5');
s_testWinEasy0 = new Sound();
s_testWinEasy0.attachSound('vox_test_win_easydifficulty3');
s_testWinEasy1 = new Sound();
s_testWinEasy1.attachSound('vox_test_win_easydifficulty');
s_testWinEasy2 = new Sound();
s_testWinEasy2.attachSound('vox_test_win_easydifficulty2');
s_testWinMedium0 = new Sound();
s_testWinMedium0.attachSound('vox_test_win_mediumdifficulty4');
s_testWinMedium1 = new Sound();
s_testWinMedium1.attachSound('vox_test_win_mediumdifficulty');
s_testWinMedium2 = new Sound();
s_testWinMedium2.attachSound('vox_test_win_mediumdifficulty2');
s_testWinMedium3 = new Sound();
s_testWinMedium3.attachSound('vox_test_win_mediumdifficulty3');
s_testWinHard0 = new Sound();
s_testWinHard0.attachSound('vox_test_win_harddifficulty5');
s_testWinHard1 = new Sound();
s_testWinHard1.attachSound('vox_test_win_harddifficulty');
s_testWinHard2 = new Sound();
s_testWinHard2.attachSound('vox_test_win_harddifficulty2');
s_testWinHard3 = new Sound();
s_testWinHard3.attachSound('vox_test_win_harddifficulty3');
s_testWinHard4 = new Sound();
s_testWinHard4.attachSound('vox_test_win_harddifficulty4');
s_testHurt0 = new Sound();
s_testHurt0.attachSound('vox_testunit_hurt4');
s_testHurt1 = new Sound();
s_testHurt1.attachSound('vox_testunit_hurt1');
s_testHurt2 = new Sound();
s_testHurt2.attachSound('vox_testunit_hurt2');
s_testHurt3 = new Sound();
s_testHurt3.attachSound('vox_testunit_hurt3');
s_timeOver = new Sound();
s_timeOver.attachSound('vox_timeover');
s_bossLog = new Sound();
s_bossLog.attachSound('496127');
s_global = new Sound();
theme = 2;
rows = 10;
columns_default = 18;
columns = columns_default;
maxColumns = columns * 20;
tilesize = 50;
grid_height = rows * tilesize;
grid_width = columns * tilesize;
teleportFrames = 16;
totalArtPanel = 15;
totalArtHalf = 5;
game.attachMovie('blank', 'tileset', f_SetDepthMod());
game._x = -tilesize;
gameXDefault = game._x;
game._y = screen_height - grid_height;
f_CreateGrids();
bg = game.bg;
pdata = new Object();
pdata.wins = 0;
pdata.losses = 0;
pdata.rushes = 0;
pdata.coins = 0;
pdata.uniques = new Array();
tc = game.tilecursor;
tc.depth_mod = f_SetDepthMod();
f_Depth(tc, 500);
var v2 = f_SetDepthMod();
game.attachMovie('soldier', 'p1', v2);
p1 = game.p1;
p1.depth_mod = v2;
p1.platform = game.t11_1;
p1.default_x = p1.platform._x + tilesize / 2;
p1.default_y = p1.platform._y;
p1.helmet = 1;
p1.jumpsound = s_jump1;
p1.jumpfx = 'dustjump';
p1.landfx = 'dustland';
p1.runfx = 'dustrun';
f_InitChar(p1, pm);
f_SetBullet(p1.a1, 1);
f_SetBullet(p1.a2, 1);
p1.a2.atype = 7;
v2 = f_SetDepthMod();
game.attachMovie('robosoldier', 'p2', v2);
var v1 = game.p2;
v1.depth_mod = v2;
v1.platform = game.t11_1;
v1.default_x = v1.platform._x + tilesize / 2;
v1.default_y = v1.platform._y;
v1.helmet = 1;
v1.jumpsound = s_robotJump;
v1.jumpfx = 'sparkjump';
v1.landfx = 'sparkland';
v1.runfx = 'dustrun';
f_InitChar(v1, pm);
f_SetBullet(v1.a1, 1);
f_SetBullet(v1.a2, 1);
v1.a2.atype = 7;
v2 = f_SetDepthMod();
game.attachMovie('raybot', 'b1', v2);
b1 = game.b1;
b1.depth_mod = v2;
f_InitChar(b1, bm);
f_BossDataRefresh();
b1.s_land = s_robotLand;
b1.s_hit = s_hitRobot;
v2 = f_SetDepthMod();
game.attachMovie('transferbot', 'tbot', v2);
tbot = game.tbot;
tbot.depth_mod = v2;
f_InitFX();
f_LoadUser();
b1.jumpsound = s_robotJump;
b1.jumpfx = 'sparkjump';
b1.landfx = 'sparkland';
b1.runfx = 'dustrun';
f_SetClock(120);
if (directfile) {
directfile.addEventListener(com.newgrounds.APIEvent.FILE_LOADED, onBossLoaded);
directfile.load();
menu.gotoAndStop('loading');
} else {
menu.gotoAndStop('on');
}
}
function f_Mute() {
if (!textInput) {
if (Key.isDown(77)) {
if (!pressedMute) {
pressedMute = true;
if (muted) {
s_global.setVolume(100);
muted = false;
} else {
s_global.setVolume(0);
muted = true;
}
}
} else {
pressedMute = false;
}
}
}
function f_Game() {
f_Mute();
if (phase == 0) {
f_DragChar(p1);
} else {
if (phase == 1) {
f_DragChar(b1);
} else {
if (phase == 2) {
if (f_StartRecord()) {
phase = 3;
if (b1.teleported) {
b1.teleported = false;
if (b1.speed_y < 0 or !b1.platform.solid) {
b1.platform = undefined;
}
} else {
f_RecordPt = f_CreateExit;
b1.m = 0;
bm = new Array(0);
f_AssignPlatform(b1, f_GetTile(b1.x, b1.y));
}
f_Controls(b1);
f_Process(b1);
}
} else {
if (phase == 3) {
f_GameTimers();
f_ShowTimer(hud.a1, b1.a1);
f_ShowTimer(hud.a2, b1.a2);
f_Controls(b1);
f_Process(b1);
f_RecordPt();
} else {
if (phase == 4) {
f_GameTimers();
f_Replay(b1);
f_Process(b1);
f_Controls(p1);
f_Process(p1);
f_BodyHit();
} else {
if (phase == 5) {
f_DragTile(tc);
} else {
if (phase == 6) {
f_DeathTimer();
f_Replay(b1);
f_Process(b1);
f_Controls(p1);
f_Process(p1);
} else {
if (phase == 7) {
if (b1.moves.length > 0) {
f_Replay(b1);
f_Process(b1);
}
} else {
if (phase == 8) {
if (prePanTimer > 0) {
--prePanTimer;
var v7 = p1.x;
var v6 = p1.y;
f_Controls(p1);
f_Process(p1);
tbot._x += p1.x - v7;
tbot._y += p1.y - v6;
if (prePanTimer == 11) {
tbot.body.body.gotoAndPlay('bite');
} else {
if (prePanTimer == 0) {
tbot.speed_x = (p1.default_x - p1.x) / panTimer;
tbot.speed_y = (p1.default_y - 50 - p1.y) / panTimer;
p1.animatic = true;
p1.gotoAndStop('dangle');
p1._xscale = p1.xscale;
_root['s_oww' + (random(18) + 1)].start(0, 0);
}
}
} else {
game._x -= panSpeed;
game.bg._x += panSpeed * 0.5;
var v4 = game.bg._x + game._x;
var v2 = 1;
while (v2 <= 4) {
var v3 = game.bg['t' + v2];
if (v3._x + v4 <= -900) {
v3._x += 3600;
}
++v2;
}
game.bg2._x += panSpeed * 0.75;
if (game.bg2._x + game._x <= -game.bg2._width / 2) {
game.bg2._x += game.bg2._width / 2;
}
tbot._x += tbot.speed_x;
tbot._y += tbot.speed_y;
f_SetXY(p1, p1.x + tbot.speed_x, p1.y + tbot.speed_y);
--panTimer;
if (panTimer == 0) {
tbot.gotoAndStop('escape');
f_RefreshChar(p1);
f_DeliverPlayer();
wait_timer = 60;
hud.gotoAndStop('on');
f_UpdateHud(p1);
var v5 = game.tileset['raster' + (columns / columns_default - 1)];
trace('Removing the previous screen: ' + v5);
v5.removeMovieClip();
phase = 4;
}
}
} else {
if (phase == 9) {
f_Controls(p1);
f_Process(p1);
} else {
if (phase == 10) {
--deathclock;
if (deathclock <= 0) {
hud.gotoAndStop('off');
tips.gotoAndStop('off');
phase = -1;
bm = new Array(0);
b1.moves = bm;
f_ClearFX();
menu.gotoAndStop('raybots');
}
}
}
}
}
}
}
}
}
}
}
}
}
function f_LoadUser() {
trace('Loading user.');
var v1 = com.newgrounds.API.createSaveQuery('SaveData');
v1.addCondition(com.newgrounds.SaveQuery.AUTHOR_NAME, '=', com.newgrounds.API.__get__username());
v1.addEventListener(com.newgrounds.APIEvent.QUERY_COMPLETE, onUserQueryComplete);
v1.execute();
}
function onUserQueryComplete(event) {
com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.QUERY_COMPLETE, onUserQueryComplete);
if (event.success) {
var v1 = event.data;
userfile = v1.files[0];
if (userfile) {
userfile.addEventListener(com.newgrounds.APIEvent.FILE_LOADED, onUserLoaded);
userfile.load();
trace('User File Found.');
} else {
trace('No user file.');
}
} else {
trace('USER QUERY FAILED.');
}
}
function onUserLoaded(event) {
com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.FILE_LOADED, onUserLoaded);
if (event.success) {
userfile = event.data;
pdata = userfile.data.pdata;
if (!pdata.uniques[0]) {
pdata.uniques = new Array();
}
trace('User Loaded.');
}
}
function f_SaveUser() {
trace('SAVING USER!!');
if (!userfile) {
userfile = com.newgrounds.API.createSaveFile('SaveData');
}
userfile.name = com.newgrounds.API.username;
userfile.data = new Object();
userfile.data.pdata = pdata;
userfile.addEventListener(com.newgrounds.APIEvent.FILE_SAVED, onUserSaved);
userfile.save();
}
function f_SaveFace() {
if (!headfile) {
headfile = com.newgrounds.API.createSaveFile('Faces');
}
headfile.keys.personal = personal;
trace('Attempting Save.');
headfile.name = menu.notices.textfield.text;
headbitmap = new flash.display.BitmapData(headsize, headsize, true, 0);
headbitmap.copyPixels(bitmap, bitmap.rectangle, new flash.geom.Point());
headfile.data = bitmap;
headfile.createIcon(editor);
headfile.addEventListener(com.newgrounds.APIEvent.FILE_SAVED, onFileSaved);
headfile.save();
}
function f_SaveBoss() {
if (!bossfile) {
bossfile = com.newgrounds.API.createSaveFile('Bosses');
}
bossfile.keys.personal = personal;
trace('Saving Boss Battle.');
bossfile.name = menu.notices.textfield.text;
bossfile.data = new Object();
bossfile.data.level = grid_level;
bossfile.data.b1_x = b1.default_x;
bossfile.data.b1_y = b1.default_y;
bossfile.data.b1_xscale = b1.xscale;
bossfile.data.p1_x = p1.default_x;
bossfile.data.p1_y = p1.default_y;
bossfile.data.p1_xscale = p1.xscale;
bossfile.data.bosspattern = b1.moves;
bossfile.data.head = headbitmap;
bossfile.data.weapon1 = b1.a1;
bossfile.data.weapon2 = b1.a2;
bossfile.data.bdata = b1.bdata;
bossfile.data.gameclock = b1.gameclock;
b1.gotoAndStop('pose');
f_EndSwording(b1);
f_SetHat(b1.body.hat);
f_SetHand(b1.body.arm.hand);
b1.bg.gotoAndStop('on');
f_SetHead(b1.body.head.head.head);
bossfile.createIcon(b1);
b1.bg.gotoAndStop('off');
f_ClearFX();
b1._xscale = b1.xscale;
f_SetXY(b1, b1.default_x, b1.default_y);
f_RefreshChar(b1);
bossfile.addEventListener(com.newgrounds.APIEvent.FILE_SAVED, onFileSaved);
bossfile.save();
justSaved = true;
menu.saveboss.gotoAndStop(1);
}
function onFileSaved(event) {
com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.FILE_SAVED, onFileSaved);
if (event.success) {
_root['s_raybotSaved' + random(3)].start(0, 0);
f_GenerateLink();
menu.directurl.text = directurl;
trace('File saved');
} else {
trace('error');
}
}
function onUserSaved(event) {
com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.FILE_SAVED, onUserSaved);
if (event.success) {
trace('User Saved');
} else {
trace('User Save Error');
}
}
function f_BossListener() {
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_LOADED, onBossLoaded);
}
function onFileRequested(event) {
directfile = event.data;
if (directfile.group.name != 'Bosses') {
directfile = undefined;
}
}
function onBossLoaded(event) {
com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.FILE_LOADED, onBossLoaded);
if (event.success) {
if (bossrushmode && rushlevel > 0) {
panOffset += 900;
} else {
panOffset = 0;
}
bossfile = event.data;
grid_level = bossfile.data.level;
b1.moves = bossfile.data.bosspattern;
b1.default_x = bossfile.data.b1_x + panOffset;
b1.default_y = bossfile.data.b1_y;
b1.xscale = bossfile.data.b1_xscale;
b1.a1 = bossfile.data.weapon1;
b1.a2 = bossfile.data.weapon2;
b1.bdata = bossfile.data.bdata;
if (bossfile.data.gameclock) {
f_SetClock(bossfile.data.gameclock);
} else {
f_SetClock(120);
}
p1.default_x = bossfile.data.p1_x + panOffset;
p1.default_y = bossfile.data.p1_y;
p1.xscale = bossfile.data.p1_xscale;
f_SetWeaponSound(b1.a1);
f_SetWeaponSound(b1.a2);
headbitmap = bossfile.data.head;
b1.head = headbitmap;
b1.body.head.head.head.attachBitmap(headbitmap, 0, true, true);
editimage = 1;
if (grid_level[0][0].num == undefined) {
var v2 = 0;
while (v2 < rows) {
var v1 = 0;
while (v1 < columns_default) {
var v4 = int(grid_level[v2][v1]);
grid_level[v2][v1] = new Object();
var v3 = grid_level[v2][v1];
v3.num = v4;
++v1;
}
++v2;
}
}
f_LoadGrid(grid_level);
f_DrawGrid(grid_level, panOffset);
if (singlebossfight || directfile) {
singlebossfight = false;
directfile = undefined;
bossrushmode = true;
rushlevel = 0;
bosslog = new Array();
m_humans.stop();
m_campaign.start(0, 9999);
}
if (bossrushmode) {
hud.gotoAndStop('nextup');
var v5 = bossfile.name.substr(0, bossfile.name.length - 1);
hud.nextinfo.text = v5 + ' by ' + bossfile.authorName;
menu.gotoAndStop('off');
bosslog[rushlevel] = bossfile;
bosslog[rushlevel].directurl = 'http://www.newgrounds.com/portal/view/610807/show/usergenerated/group/522/play/' + bossfile.id;
bosslog[rushlevel].hat = bossfile.data.bdata.hat;
bosslog[rushlevel].hand = bossfile.data.bdata.hand;
bosslog[rushlevel].bossName = v5;
bosslog[rushlevel].bitmap = new flash.display.BitmapData(headsize, headsize, true, 0);
bosslog[rushlevel].bitmap.copyPixels(headbitmap, headbitmap.rectangle, new flash.geom.Point());
if (rushlevel == 0) {
f_Test(false);
} else {
f_PrepBattle();
}
} else {
f_ClearFX();
menu.gotoAndStop('raybots');
b1.gotoAndStop('blank');
}
trace('Boss Loaded.');
} else {
trace('Boss didn\'t load.');
menu.gotoAndStop('on');
b1.gotoAndStop('blank');
}
}
function f_GenerateLink() {
if (com.newgrounds.API.__get__username() == 'API-Debugger') {
directurl = 'http://www.newgrounds.com/projects/games/613619/preview/show/usergenerated/group/522/play/' + bossfile.id;
} else {
directurl = 'http://www.newgrounds.com/portal/view/610807/show/usergenerated/group/522/play/' + bossfile.id;
}
}
function f_FaceListener() {
headfile.data = undefined;
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_LOADED, onFaceLoaded);
}
function f_ExitBossLoad() {
com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.FILE_LOADED, onBossLoaded);
singlebossfight = false;
if (menumode == 1) {
menu.gotoAndStop('humans');
} else {
if (menumode == 2) {
menu.gotoAndStop('raybots');
}
}
}
function f_ExitFaceLoad() {
com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.FILE_LOADED, onFaceLoaded);
}
function onFaceLoaded(event) {
com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.FILE_LOADED, onFaceLoaded);
if (event.success) {
headfile = event.data;
headbitmap = headfile.data;
b1.head = headfile.data;
b1.body.head.head.head.attachBitmap(headfile.data, 0, true, true);
editimage = 1;
if (headfile.AUTHOR_NAME != com.newgrounds.API.__get__username()) {
headfile = undefined;
}
menu.gotoAndStop('editdraw');
trace('Face Loaded.');
} else {
trace('Face didn\'t load.');
menu.gotoAndStop('on');
b1.gotoAndStop('blank');
}
}
function f_BossRush(num) {
m_humans.stop();
m_campaign.start(0, 9999);
menu.gotoAndStop('loading');
bossrushmode = true;
rushlevel = -1;
channelNum = num;
bosslog = new Array();
trace('LOADED. BOSSRUSHMODE: ' + bossrushmode);
if (num == 0) {
bossrushtype = 0;
f_GetBosses();
} else {
bossrushtype = 1;
f_NextBoss();
}
}
function f_GetBosses() {
var v1 = com.newgrounds.API.createSaveQuery('Bosses');
v1.isRandomized = true;
v1.sortOn('Difficulty', false);
v1.resultsPerPage = 10;
v1.addEventListener(com.newgrounds.APIEvent.QUERY_COMPLETE, onBossQueryComplete);
v1.execute();
}
function onBossQueryComplete(event) {
com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.QUERY_COMPLETE, onBossQueryComplete);
if (event.success) {
bossArray = event.data;
f_NextBoss();
}
}
function f_NextBoss() {
++rushlevel;
var v2 = false;
if (bossrushtype == 0) {
if (rushlevel < bossArray.files.length) {
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_LOADED, onBossLoaded);
bossArray.files[rushlevel].load();
} else {
v2 = true;
}
} else {
if (rushlevel < bossChannel[channelNum].bosses.length) {
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_LOADED, onBossLoaded);
com.newgrounds.API.loadSaveFile(bossChannel[channelNum].bosses[rushlevel], true);
} else {
v2 = true;
}
}
if (v2) {
if (bossrushmode) {
if (channelNum >= 0) {
com.newgrounds.API.unlockMedal(bossChannel[channelNum].medal);
}
bossrushmode = false;
++pdata.rushes;
winner = true;
f_SaveUser();
_root.logdelay = 100;
menu.gotoAndStop('bosslogwait');
} else {
menu.gotoAndStop('on');
}
}
}
function f_Channels() {
var v1 = 0;
while (v1 < bossChannel.length) {
var v2 = menu.humanbrowse.listbox.attachMovie('ChannelBox', 'channel' + v1, v1);
v2._x = 0;
if (v1 == 0) {
v2._y = 5 + (bossChannel.length - 1) * 50;
} else {
v2._y = 5 + v1 * 50 - 50;
}
v2.num = v1;
if ((com.newgrounds.API.getMedal(bossChannel[v1].medal)).__get__unlocked()) {
v2.gotoAndStop(2);
}
v2.title.text = bossChannel[v1].title;
++v1;
}
}
function f_CreateFX() {
var v1 = 1;
while (v1 <= total_fx) {
var v3 = 'fx' + v1;
var v2 = f_SetDepthMod();
game.attachMovie('fx', v3, v2);
v3 = game['fx' + v1];
v3.depth_mod = v2;
++v1;
}
}
function f_ClearFX() {
var v1 = 1;
while (v1 <= total_fx) {
var v2 = game['fx' + v1];
v2.gotoAndStop('blank');
++v1;
}
game.beam.gotoAndStop('off');
}
function f_FX(fx_x, fx_y, fx_depth, fx_type, fx_xscale, fx_yscale) {
var v1 = game['fx' + current_fx];
v1._x = fx_x;
v1._y = fx_y;
if (fx_xscale != undefined) {
v1._xscale = fx_xscale;
} else {
v1._xscale = 100;
}
if (fx_yscale != undefined) {
v1._yscale = fx_yscale;
} else {
v1._yscale = 100;
}
v1.damage_val = 0;
v1.hitall = false;
v1.isbullet = false;
v1._rotation = 0;
v1.gotoAndStop('blank');
v1.gotoAndStop(fx_type);
f_Depth(v1, fx_depth);
++current_fx;
if (current_fx > total_fx) {
current_fx = 1;
}
return v1;
}
function f_InitFX() {
total_fx = 180;
current_fx = 1;
f_CreateFX();
}
function f_NewBullet(x, y, za, num, speed, trajectory, damage, nature, bounces, gravity) {
var v1 = f_FX(x, y, y, 'bullet', 100, 100);
v1.body.gotoAndStop(num);
v1.x = v1._x;
v1.y = v1._y;
v1.damage = damage;
v1.num = num;
v1.nature = nature;
v1.speed_x = speed * Math.cos(PI * trajectory);
v1.speed_y = speed * Math.sin(PI * trajectory);
if (v1.speed_y < 0.0001 and v1.speed_y > -0.0001) {
v1.speed_y = 0;
}
v1.trajectory = Math.atan2(v1.speed_y, v1.speed_x) / PI;
v1.body.body._rotation = v1.trajectory;
if (v1.trajectory > 90 or v1.trajectory < -90) {
v1.body.body._yscale *= -1;
}
v1.w = za.w / 2;
v1.h = za.h / 2;
if (v1.num == 2) {
v1.h = 20;
v1.w = 20;
}
if (v1.h < 20) {
v1.y += 6;
}
v1._y = v1.y;
v1.bounces = bounces;
v1.gravity = gravity;
return v1;
}
function f_BulletHit(z) {
z.gotoAndStop('bullethit');
z.body.gotoAndStop(z.num);
}
function f_BH(z, v) {
if (v.alive) {
if (z.y - z.h <= v.y) {
if (z.y + z.h >= v.y - v.h) {
if (z.x - z.w <= v.x + v.w) {
if (z.x + z.w >= v.x - v.w) {
if (v == p1) {
if (z.speed_x > 0 and v._xscale > 0) {
v._xscale *= -1;
} else {
if (z.speed_x < 0 and v._xscale < 0) {
v._xscale *= -1;
}
}
_root['s_hitBody' + (random(2) + 1)].start(0, 0);
f_Damage(v, z.damage);
f_Depth(z, v.y + 5);
f_BulletHit(z);
return true;
}
if (v.teleport_timer > 0) {
return false;
f_Damage(v, z.damage);
f_Depth(z, v.y + 5);
f_BulletHit(z);
return true;
}
v.s_hit.start(0, 0);
f_Damage(v, z.damage);
f_Depth(z, v.y + 5);
f_BulletHit(z);
return true;
}
}
}
}
}
}
function f_BulletHitWall(z) {
if (z.wall_dir == 1) {
z._y = z.wall_pt.y + tilesize;
if (z._x < z.wall_pt.x) {
z._x = z.wall_pt.x;
} else {
if (z._x > z.wall_pt.x + tilesize) {
z._x = z.wall_pt.x + tilesize;
}
}
} else {
if (z.wall_dir == 2) {
z._x = z.wall_pt.x;
if (z._y > z.wall_pt.y + tilesize) {
z._y = z.wall_pt.y + tilesize;
} else {
if (z._y < z.wall_pt.y) {
z._y = z.wall_pt.y;
}
}
} else {
if (z.wall_dir == 3) {
z._y = z.wall_pt.y;
if (z._x < z.wall_pt.x) {
z._x = z.wall_pt.x;
} else {
if (z._x > z.wall_pt.x + tilesize) {
z._x = z.wall_pt.x + tilesize;
}
}
} else {
if (z.wall_dir == 4) {
z._x = z.wall_pt.x + tilesize;
if (z._y > z.wall_pt.y + tilesize) {
z._y = z.wall_pt.y + tilesize;
} else {
if (z._y < z.wall_pt.y) {
z._y = z.wall_pt.y;
}
}
}
}
}
}
f_BulletHit(z);
}
function f_BBR(z) {
tile = f_GetTile(z.x + z.w, z.y + z.h);
if (!tile.dropthru && z.speed_y <= 0 || tile.solid && z.speed_y > 0) {
if (tile.y >= z.y + z.h - z.speed_y - 2 and tile.y <= z.y + z.h) {
var v2 = f_GetTile(tile.x, tile.y - 10);
if (v2.dropthru) {
z.wall_dir = 3;
} else {
z.wall_dir = 2;
}
z.wall_pt = tile;
return true;
}
z.wall_dir = 2;
z.wall_pt = tile;
return true;
}
}
function f_BBL(z) {
tile = f_GetTile(z.x - z.w, z.y + z.h);
if (!tile.dropthru && z.speed_y <= 0 || tile.solid && z.speed_y > 0) {
if (tile.y >= z.y + z.h - z.speed_y - 2 and tile.y <= z.y + z.h) {
var v2 = f_GetTile(tile.x, tile.y - 10);
if (v2.dropthru) {
z.wall_dir = 3;
} else {
z.wall_dir = 4;
}
z.wall_pt = tile;
return true;
}
z.wall_dir = 4;
z.wall_pt = tile;
return true;
}
}
function f_BTR(z) {
tile = f_GetTile(z.x + z.w, z.y - z.h);
if (!tile.dropthru) {
if (tile.y + tilesize <= z.y - z.h - z.speed_y + 2 and tile.y + tilesize >= z.y - z.h) {
var v2 = f_GetTile(tile.x, tile.y + 60);
if (v2.dropthru) {
z.wall_dir = 1;
} else {
z.wall_dir = 2;
}
z.wall_pt = tile;
return true;
}
z.wall_dir = 2;
z.wall_pt = tile;
return true;
}
}
function f_BTL(z) {
tile = f_GetTile(z.x - z.w, z.y - z.h);
if (!tile.dropthru) {
if (tile.y + tilesize <= z.y - z.h - z.speed_y + 2 and tile.y + tilesize >= z.y - z.h) {
var v2 = f_GetTile(tile.x, tile.y + 60);
if (v2.dropthru) {
z.wall_dir = 1;
} else {
z.wall_dir = 4;
}
z.wall_pt = tile;
return true;
}
z.wall_dir = 4;
z.wall_pt = tile;
return true;
}
}
function f_BC(z) {
tile = f_GetTile(z.x - z.w, z.y);
if (!tile.dropthru) {
z.wall_dir = 4;
z.wall_pt = tile;
return true;
}
tile = f_GetTile(z.x + z.w, z.y);
if (!tile.dropthru) {
z.wall_dir = 2;
z.wall_pt = tile;
return true;
}
tile = f_GetTile(z.x, z.y - z.h);
if (!tile.dropthru) {
z.wall_dir = 1;
z.wall_pt = tile;
return true;
}
tile = f_GetTile(z.x, z.y + z.h);
if (!tile.dropthru) {
z.wall_dir = 3;
z.wall_pt = tile;
return true;
}
return false;
}
function f_BW(z) {
if (z.speed_y > 0) {
if (z.speed_x > 0) {
if (f_BBR(z)) {
return true;
} else {
if (f_BTR(z)) {
return true;
} else {
if (f_BC(z)) {
return true;
}
}
}
} else {
if (f_BBL(z)) {
return true;
} else {
if (f_BTL(z)) {
return true;
} else {
if (f_BC(z)) {
return true;
}
}
}
}
} else {
if (z.speed_x > 0) {
if (f_BTR(z)) {
return true;
} else {
if (f_BBR(z)) {
return true;
} else {
if (f_BC(z)) {
return true;
}
}
}
} else {
if (f_BTL(z)) {
return true;
} else {
if (f_BBL(z)) {
return true;
} else {
if (f_BC(z)) {
return true;
}
}
}
}
}
}
function f_Bullet(z) {
z.wall_pt = undefined;
z.wall_dir = 0;
z.prev_x = z.x;
z.prev_y = z.y;
f_SetXY(z, z.x + z.speed_x, z.y + z.speed_y);
if (!f_BW(z)) {
z.speed_y += z.gravity;
if (z.speed_y > maxbulletspeed) {
z.speed_y = maxbulletspeed;
} else {
if (z.speed_y < -maxbulletspeed) {
z.speed_y = -maxbulletspeed;
}
}
if (z.nature == 0) {
f_BH(z, p1);
} else {
f_BH(z, b1);
}
z.trajectory = Math.atan2(z.speed_y, z.speed_x) / PI;
z.body.body._rotation = z.trajectory;
} else {
if (z.bounces > 0) {
--z.bounces;
if (z.wall_dir == 1) {
z.y = z.wall_pt.y + tilesize + z.h + 1;
z.speed_y *= -1;
} else {
if (z.wall_dir == 2) {
z.x = z.wall_pt.x - (z.w + 1);
z.speed_x *= -1;
} else {
if (z.wall_dir == 3) {
z.y = z.wall_pt.y - (z.h + 1);
z.speed_y *= -1;
} else {
if (z.wall_dir == 4) {
z.x = z.wall_pt.x + tilesize + z.w + 1;
z.speed_x *= -1;
}
}
}
}
z._x = z.x;
z._y = z.y;
} else {
f_BulletHitWall(z);
if (z.nature == 0) {
f_BH(z, p1);
} else {
f_BH(z, b1);
}
}
}
}
function f_Flame(z) {
z.wall_pt = undefined;
z.wall_dir = 0;
z.x += z.speed_x;
z._x = z.x;
if (!f_BW(z)) {
f_BH(z, b1);
} else {
z.speed_x = 0;
}
}
function f_JUNKBEEEM(z, za) {
var v3 = int((z.y / grid_height) * rows);
var v2 = int((z.x / grid_width) * columns);
var v1 = v3 - 1;
while (v1 > 0) {
tile = grid[v1][v2];
if (tile.dropthru) {
f_FX(tile.x, tile.y + tilesize, bgdepth, 'beam', 100, 100);
var v5 = tile.y;
} else {
v1 = 0;
}
--v1;
}
v1 = v3;
while (v1 < rows) {
tile = grid[v1][v2];
if (tile.dropthru) {
f_FX(tile.x, tile.y + tilesize, bgdepth, 'beam', 100, 100);
var v4 = tile.y + tilesize;
} else {
v1 = rows;
}
++v1;
}
if (p1.x + p1.w > tile.x) {
if (p1.x - p1.w < tile.x + tilesize) {
if (p1.y <= storedv4) {
if (p1.y >= storedv5) {
f_Damage(p1, za.beamdamage);
}
}
}
}
}
function f_Beam(z, za) {
var v6 = game.beam;
v6._x = z.x;
if (v6._currentframe == 1 or v6._currentframe == 4) {
za.weaponSound.start(0, 0);
beamloop.s_beamloop.start(0, 999999);
}
v6.gotoAndPlay('on');
var v5 = int((z.y / grid_height) * rows);
var v4 = int((z.x / grid_width) * columns);
tile = grid[v5][v4];
var v2 = tile.y;
var v3 = tile.y;
var v1 = v5 - 1;
while (v1 >= 0) {
tile = grid[v1][v4];
if (tile.dropthru) {
v2 = tile.y;
} else {
break;
}
--v1;
}
v1 = v5;
while (v1 < rows) {
tile = grid[v1][v4];
if (tile.dropthru) {
v3 = tile.y + tilesize;
} else {
break;
}
++v1;
}
game.beam._y = v2;
game.beam.mask1._height = v3 - v2;
game.beam.bottom._y = v3 - v2;
game.beam.top._y = 0;
if (Math.abs(p1.x - v6._x) < tilesize / 2) {
if (p1.y <= v3 + tilesize) {
if (p1.y >= v2) {
f_Damage(p1, za.beamdamage);
}
}
}
}
function f_Sword(z) {
if (!z.swording || !z.alive) {
f_EndSwording(z);
return undefined;
} else {
if (p1.invincible_timer > 0 || b1.teleport_timer > 0) {
return undefined;
} else {
if (p1.alive) {
var v7 = false;
if (z.y - z.h / 2 < p1.y) {
if (z.y > p1.y - p1.h / 2) {
if (z._xscale > 0) {
if (p1.x > z.x and p1.x < z.x + 190) {
v7 = true;
}
} else {
if (p1.x < z.x and p1.x > z.x - 190) {
v7 = true;
}
}
}
}
if (v7) {
if (z.x < p1.x and p1._xscale > 0) {
p1._xscale *= -1;
} else {
if (z.x > p1.x and p1._xscale < 0) {
p1._xscale *= -1;
}
}
_root['s_bumpRobot' + (random(2) + 1)].start(0, 0);
f_Damage(p1, 5);
}
}
}
}
var v6 = false;
if (z._xscale > 0) {
var v4 = 1;
while (v4 < 5) {
var v3 = f_GetTile(z.x - 20 + v4 * 50, z.y - 50);
if (v3.num == 1) {
var v5 = f_FX(v3.x, v3.y, z.y - 50, 'sworded', 100, 100);
v5.body.body.gotoAndPlay(random(16) + 1);
v6 = true;
}
++v4;
}
} else {
var v4 = 1;
while (v4 < 5) {
var v3 = f_GetTile(z.x + 20 - v4 * 50, z.y - 50);
if (v3.num == 1) {
var v5 = f_FX(v3.x, v3.y, z.y - 50, 'sworded', 100, 100);
v5.body.body.gotoAndPlay(random(16) + 1);
v6 = true;
}
++v4;
}
}
if (v6) {
if (!swordwallsound) {
swordwallsound = true;
swordwall.s_swordwall.start(0, 9999);
}
} else {
if (swordwallsound) {
swordwallsound = false;
swordwall.s_swordwall.stop();
}
}
}
function f_BulletDemo() {
za = weapon;
if (bd_timer < 0) {
f_ProcessAttack(b1, za);
b1.body.gun.gotoAndPlay('shoot');
bd_timer = za.bulletrecovery;
} else {
--bd_timer;
}
}
function f_BombDemo() {
za = weapon;
if (b1._xscale > 0) {
f_SetXY(b1, b1.x + 3, b1.y);
if (b1.x > grid[6][15].x) {
b1._xscale *= -1;
}
} else {
f_SetXY(b1, b1.x - 3, b1.y);
if (b1.x < grid[6][9].x) {
b1._xscale *= -1;
}
}
if (bd_timer < 0) {
bd_timer = za.bombrecovery;
f_ProcessAttack(b1, za);
} else {
--bd_timer;
}
}
function f_BeamDemo() {
za = weapon;
f_ProcessAttack(b1, za);
}
function f_TeleportDemo() {
za = weapon;
z = b1;
if (z.teleport_timer > 0) {
--z.teleport_timer;
if (z.teleport_timer == teleportFrames) {
f_FX(z.x, z.y, z.y + 1, 'warpin', 100, 100);
}
if (z.teleport_timer <= 0) {
z.teleported = false;
f_AssignPlatform(z, f_GetTile(z.x, z.y));
if (z.speed_y < 0 or !z.platform.solid) {
z.platform = undefined;
}
z.gotoAndStop('stand');
} else {
return undefined;
}
}
if (bd_timer < 0) {
za.weaponSound.start(0, 0);
bd_timer = za.teleportrecovery;
if (bd_alternate == 1) {
bd_alternate = 2;
var v2 = grid[6][10].x + tilesize / 2;
var v1 = grid[6][10].y;
} else {
bd_alternate = 1;
var v2 = grid[6][13].x + tilesize / 2;
var v1 = grid[6][13].y;
}
f_FX(z.x, z.y, z.y - 1, 'warpout', 100, 100);
f_NewSparkle(z.x, z.y, v2, v1);
f_SetXY(z, v2, v1);
z.teleport_timer = teleportdelay;
z.gotoAndStop('blank');
} else {
--bd_timer;
}
}
function f_BombExplosion(z) {
if (Math.abs(z.x - p1.x) < 50) {
if (z.y - 50 < p1.y) {
if (z.y > p1.y - p1.h / 2) {
f_Damage(p1, z.damage);
}
}
}
s_explosion.start(0, 0);
if (z.bombtype == 2) {
z.gotoAndStop('vortex');
} else {
z.gotoAndStop('bombexplode');
}
}
function f_Bomb(z) {
--z.timer;
if (z.timer <= 0) {
f_BombExplosion(z);
return undefined;
}
if (p1.alive) {
if (Math.abs(z.x - p1.x) < 30) {
if (z.y - z.h < p1.y) {
if (z.y > p1.y - p1.h / 2) {
f_BombExplosion(z);
return undefined;
}
}
}
}
if (!z.platform and z.gravity != 0) {
var v3 = z.speed_y;
if (z.speed_y > 0) {
if (f_PY(z, z.speed_y) == false) {
f_MoveV(z, z.speed_y);
} else {
_root['s_cling' + random(3)].start(0, 0);
if (v3 > 5) {
z.speed_y = v3 * -0.5;
z.platform = undefined;
}
}
} else {
f_MoveV(z, f_WA(z, z.speed_y));
}
f_Depth(z, z.y + 30);
z.speed_y += z.gravity;
}
}
function f_Vortex(z) {
if (p1.alive && p1.invincible_timer <= 0) {
if (Math.sqrt(Math.pow(b1.x - p1.x, 2) + Math.pow(b1.y - p1.y, 2)) <= 400) {
if (z.x > p1.x) {
f_MoveH(p1, 2);
} else {
f_MoveH(p1, -2);
}
if (Math.abs(p1.y - z.y) > 10) {
if (z.y > p1.y) {
var v1 = 1;
} else {
var v1 = -1;
}
if (v1 >= 0) {
if (f_PY(p1, v1) == false) {
f_MoveV(p1, v1);
}
} else {
p1.float_timer = 5;
f_MoveV(p1, f_WA(p1, v1));
p1.platform = undefined;
}
}
}
}
}
function f_DropBomb(z, za) {
if (za.bombtype == 2) {
var v3 = 'bomb2';
} else {
var v3 = 'bomb';
}
var v1 = f_FX(z.x, z.y - 20, z.y + 1, v3, 100, 100);
v1.timer = za.bombtimer;
v1.bombtype = za.bombtype;
v1.x = v1._x;
v1.y = v1._y;
v1.h = 26;
v1.speed_y = 0;
v1.damage = za.bombdamage;
v1.gravity = za.bombgravity;
v1.platform = f_GetTile(v1.x, v1.y);
if (!v1.platform.solid) {
v1.platform = undefined;
}
}
function f_NewSparkle(x, y, x2, y2) {
var v2 = 80 + random(40);
var v1 = f_FX(x, y, y + 1, 'sparkle', v2, v2);
var v4 = x2 - x;
var v3 = y2 - y;
v1.speed_x = v4 / (teleportdelay - teleportFrames);
v1.speed_y = v3 / (teleportdelay - teleportFrames);
v1.timer = teleportdelay - teleportFrames;
}
function f_Sparkle(z) {
z._x += z.speed_x;
z._y += z.speed_y;
--z.timer;
if (z.timer <= 0) {
z.gotoAndStop('blank');
}
}
function f_Shrapnel(z) {
if (!z.resting) {
z.wall_pt = undefined;
z.wall_dir = 0;
z.x = z._x + z.speed_x;
z.y = z._y + z.speed_y;
if (f_BW(z)) {
if (z.wall_dir == 1) {
z.y = z.wall_pt.y + tilesize + (z.h + 1);
} else {
if (z.wall_dir == 2) {
z.speed_x *= -0.75;
} else {
if (z.wall_dir == 3) {
z.y = z.wall_pt.y - z.h;
z.bounceSound.start(0, 0);
if (z.bounces > 0) {
z.speed_y *= -0.75;
--z.bounces;
} else {
z.resting = true;
}
} else {
if (z.wall_dir == 4) {
z.speed_x *= -0.75;
}
}
}
}
}
z.speed_y += gravity;
if (z.speed_y > 20) {
z.speed_y = 20;
}
z._x = z.x;
z._y = z.y;
}
}
function f_MakeShrapnel(z, bounceSound) {
z.w = z._width / 2 - 2;
z.h = z._height / 2 - 2;
z.bounces = 3;
z.resting = false;
if (!bounceSound) {
z.bounceSound = _root['s_cling' + random(3)];
} else {
z.bounceSound = bounceSound;
}
}
function f_TVShrapnel() {
if (b1._xscale < 0) {
var v2 = -100;
var v1 = -1;
} else {
var v2 = 100;
var v1 = 1;
}
var v3 = f_FX(b1.x - 2 * v1, b1.y - 15, b1.y + 5, 'tube', v2, 100);
v3.speed_x = 0;
v3.speed_y = -11;
f_MakeShrapnel(v3);
v3.bounces = 1;
v3.w = 24;
v3.h = 15;
v3 = f_FX(b1.x, b1.y - 40, b1.y + 6, 'hat', v2, 100);
v3.speed_x = random(6) - 3;
v3.speed_y = -12;
f_MakeShrapnel(v3);
v3.h = 9;
v3.bounces = 1;
v3 = f_FX(b1.x - 30 * v1, b1.y - 28, b1.y + 5, 'bits', v2, 100);
v3.body.gotoAndStop(1);
v3.speed_x = -8 * v1;
v3.speed_y = -8;
f_MakeShrapnel(v3);
v3 = f_FX(b1.x - 30 * v1, b1.y - 12, b1.y + 5, 'bits', v2, 100);
v3.body.gotoAndStop(2);
v3.speed_x = -9 * v1;
v3.speed_y = -6;
f_MakeShrapnel(v3);
v3 = f_FX(b1.x - 10 * v1, b1.y, b1.y + 5, 'bits', v2, 100);
v3.body.gotoAndStop(4);
v3.speed_x = -3 * v1;
v3.speed_y = -6;
f_MakeShrapnel(v3);
v3 = f_FX(b1.x + 10 * v1, b1.y, b1.y + 5, 'bits', v2, 100);
v3.body.gotoAndStop(5);
v3.speed_x = 3 * v1;
v3.speed_y = 6;
f_MakeShrapnel(v3);
v3 = f_FX(b1.x + 27 * v1, b1.y - 23, b1.y + 4, 'bits', v2, 100);
v3.body.gotoAndStop(6);
v3.speed_x = 8 * v1;
v3.speed_y = -6;
f_MakeShrapnel(v3);
v3 = f_FX(b1.x + 22 * v1, b1.y - 8, b1.y + 4, 'bits', v2, 100);
v3.body.gotoAndStop(7);
v3.speed_x = 7 * v1;
v3.speed_y = -4;
f_MakeShrapnel(v3);
v3 = f_FX(b1.x + 21 * v1, b1.y - 28, b1.y + 4, 'bits', v2, 100);
v3.body.gotoAndStop(8);
v3.speed_x = 8 * v1;
v3.speed_y = -8;
f_MakeShrapnel(v3);
v3 = f_FX(b1.x + 30 * v1, b1.y - 14, b1.y + 5, 'bits', v2, 100);
v3.body.gotoAndStop(9);
v3.speed_x = 8 * v1;
v3.speed_y = -4;
f_MakeShrapnel(v3);
v3 = f_FX(b1.x - 20 * v1, b1.y - 15, b1.y + 5, 'bits', v2, 100);
v3.body.gotoAndStop(10);
v3.speed_x = -8 * v1;
v3.speed_y = -4;
f_MakeShrapnel(v3);
v3.w = 10;
v3.h = 5;
}
function f_BrainShrapnel() {
if (p1._xscale < 0) {
var v3 = -100;
var v4 = -1;
} else {
var v3 = 100;
var v4 = 1;
}
var v1 = f_FX(p1.x, p1.y - 35, p1.y + 6, 'brain', v3, 100);
v1.speed_x = random(6) - 3;
v1.speed_y = -12;
f_MakeShrapnel(v1, s_bone);
v1.bounces = 1;
var v2 = 1;
while (v2 <= 9) {
v1 = f_FX(p1.x - 15 + random(30), p1.y - (30 + random(10)), p1.y + 6, 'glass', 100, 100);
v1.body.gotoAndStop(v2);
v1.speed_x = random(14) - 7;
v1.speed_y = -(4 + random(10));
f_MakeShrapnel(v1, s_bone);
v1.bounceSound = undefined;
++v2;
}
}
function f_InitDraw() {
b1size = 50;
b2size = 50;
if (savetarget == 2) {
bitmapsize = b1size;
} else {
if (savetarget == 3) {
bitmapsize = b2size;
} else {
bitmapsize = headsize;
}
}
bitmap = new flash.display.BitmapData(bitmapsize, bitmapsize, true, 0);
editor = menu.editor;
tools = menu.tools;
f_SwapBitmap(1);
coloring = false;
if (!color) {
color = 4278190080.0;
}
f_ShowColor(colorToHexString(color), menu.showcolor.body);
prevcolor = color;
f_SetDrawTool(1, true);
if (!backups_current) {
backups = new Array();
backups_total = 50;
backups_current = -1;
f_MakeBackup();
}
changed = false;
f_DrawGrid(grid_pixeltool);
drawSounds = menu.drawSounds;
drawSounds.s_draw1 = new Sound(drawSounds);
drawSounds.s_draw1.attachSound('sound_draw1');
drawSounds.s_draw2 = new Sound(drawSounds);
drawSounds.s_draw2.attachSound('sound_draw2');
drawSounds.s_draw3 = new Sound(drawSounds);
drawSounds.s_draw3.attachSound('sound_draw3');
drawSound = 0;
f_SetXY(b1, grid[6][14].x + tilesize / 2, grid[6][14].y);
b1._xscale = 100;
b1.gotoAndStop('stand');
b1.head = bitmap;
oldXMouse;
oldYMouse;
}
function f_SwapModel(num, bitmap) {
b1.body.head.head.head.attachBitmap(bitmap, 0, true, true);
}
function f_SwapBitmap(num) {
if (savetarget) {
f_SaveBitmap();
}
savetarget = num;
bitmap = new flash.display.BitmapData(headsize, headsize, true, 0);
bitmap.copyPixels(headbitmap, headbitmap.rectangle, new flash.geom.Point());
var v1 = 100 * (297 / headsize);
editor.bg._xscale = headsize;
editor.bg._yscale = headsize;
f_SwapModel(num, bitmap);
editor.removeBitmap(bitmap);
editor._xscale = v1;
editor._yscale = v1;
editor.attachBitmap(bitmap, 0, true, false);
}
function colorMouseDown() {
if (editor == menu.editor) {
oldXMouse = editor._xmouse;
oldYMouse = editor._ymouse;
var v2 = int(editor._xmouse);
var v1 = int(editor._ymouse);
if (v2 >= 0 && v1 >= 0 && v2 < bitmap.width & v1 < bitmap.height) {
changed = true;
if (!coloring) {
++drawSound;
if (drawSound > 3) {
drawSound = 1;
}
drawSounds['s_draw' + drawSound].start(0, 0);
}
}
coloring = true;
}
}
function fillMouseDown() {
var v2 = int(editor._xmouse);
var v1 = int(editor._ymouse);
if (v2 >= 0 && v1 >= 0 && v2 < bitmap.width & v1 < bitmap.height) {
changed = true;
bitmap.floodFill(v2, v1, color);
}
}
function pickerMouseDown() {
var v2 = int(editor._xmouse);
var v1 = int(editor._ymouse);
if (v2 >= 0 && v1 >= 0 && v2 < bitmap.width & v1 < bitmap.height) {
setColor(bitmap.getPixel32(v2, v1));
drawtool = 1;
onMouseDown = colorMouseDown;
tools.gotoAndStop(1);
}
}
function f_ClearBitmap() {
editor.removeBitmap(bitmap);
delete bitmap;
if (savetarget == 2) {
bitmapsize = b1size;
} else {
if (savetarget == 3) {
bitmapsize = b2size;
} else {
bitmapsize = headsize;
}
}
bitmap = new flash.display.BitmapData(bitmapsize, bitmapsize, true, 0);
editor.attachBitmap(bitmap, 0, true, false);
f_SwapModel(savetarget, bitmap);
}
function f_CropBitmap(bitmap) {
var v1 = bitmap.getColorBoundsRect(4278190080.0, 0, false);
var v2 = new flash.display.BitmapData(v1.width, v1.height, true, 0);
v2.copyPixels(bitmap, v1, new flash.geom.Point());
return v2;
}
function f_ExpandBitmap(bitmap, width, height) {
var v2 = new flash.display.BitmapData(width, height, bitmap.transparent, 0);
v2.copyPixels(bitmap, bitmap.rectangle, new flash.geom.Point((width - bitmap.width) / 2, (height - bitmap.height) / 2));
return v2;
}
function f_SaveBitmap() {
headbitmap = new flash.display.BitmapData(headsize, headsize, true, 0);
headbitmap.copyPixels(bitmap, bitmap.rectangle, new flash.geom.Point());
b1.head = headbitmap;
}
function f_ExitEditDraw() {
onMouseDown = null;
f_SaveBitmap();
savetarget = undefined;
b1.gotoAndStop('blank');
f_DrawGrid(grid_level);
menu.gotoAndStop('raybots');
}
function f_UnToggleEditDraw() {
f_SaveBitmap();
savetarget = undefined;
}
function f_ExitImageSelect() {
savetarget = undefined;
menu.gotoAndStop('raybots');
f_DrawGrid(grid_level);
b1.gotoAndStop('blank');
}
function f_SaveHead() {
headbitmap = new flash.display.BitmapData(bitmapsize, bitmapsize, true, 0);
headbitmap.copyPixels(bitmap, bitmap.rectangle, new flash.geom.Point());
b1.head = headbitmap;
menu.gotoAndStop('raybots');
}
function onMouseUp() {
coloring = false;
drawSounds.s_draw1.stop();
drawSounds.s_draw2.stop();
drawSounds.s_draw3.stop();
if (changed) {
changed = false;
f_MakeBackup();
}
}
function f_MakeBackup() {
++backups_current;
if (backups_current > backups_total) {
backups_current = backups_total;
backups.splice(0, 1);
}
if (savetarget == 2) {
bitmapsize = b1size;
} else {
if (savetarget == 3) {
bitmapsize = b2size;
} else {
bitmapsize = headsize;
}
}
backups[backups_current] = new flash.display.BitmapData(bitmapsize, bitmapsize, true, 0);
backups[backups_current].copyPixels(bitmap, bitmap.rectangle, new flash.geom.Point());
}
function f_DrawUndo() {
--backups_current;
if (backups_current < 0) {
backups_current = 0;
} else {
var v1 = backups[backups_current];
if (v1) {
s_undo.start(0, 0);
f_ClearBitmap();
bitmap.copyPixels(v1, v1.rectangle, new flash.geom.Point());
editor.attachBitmap(bitmap, 0, true, false);
f_SwapModel(savetarget, bitmap);
}
}
}
function drawLine(color, xStart, yStart, xEnd, yEnd) {
xStart = int(xStart);
xEnd = int(xEnd);
yStart = int(yStart);
yEnd = int(yEnd);
var v9 = Math.abs(yEnd - yStart) > Math.abs(xEnd - xStart);
if (v9) {
var v8 = xStart;
xStart = yStart;
yStart = v8;
v8 = xEnd;
xEnd = yEnd;
yEnd = v8;
}
if (xStart > xEnd) {
v8 = xStart;
xStart = xEnd;
xEnd = v8;
v8 = yStart;
yStart = yEnd;
yEnd = v8;
}
var v10 = xEnd - xStart;
var v12 = Math.abs(yEnd - yStart);
var v2 = v10 >> 1;
var v13 = yStart < yEnd ? 1 : -1;
var v3 = yStart;
var v1 = xStart;
while (v1 <= xEnd) {
if (v9) {
bitmap.setPixel32(v3, v1, color);
} else {
bitmap.setPixel32(v1, v3, color);
}
v2 -= v12;
if (v2 < 0) {
v3 += v13;
v2 += v10;
}
++v1;
}
}
function f_LineWork() {
if (coloring) {
var v4 = int(oldXMouse);
var v3 = int(oldYMouse);
var v1 = int(editor._xmouse);
var v2 = int(editor._ymouse);
drawLine(color, v4, v3, v1, v2);
oldXMouse = editor._xmouse;
oldYMouse = editor._ymouse;
}
}
function f_PickColor(hexcolor) {
s_colorPick.start(0, 0);
color = '0xff' + hexcolor;
prevcolor = color;
f_SetDrawTool(drawtool, true);
menu.colorpicker.gotoAndStop('off');
f_ShowColor(hexcolor, menu.showcolor.body);
}
function f_ShowColor(hexcolor, colortarget) {
thecolor = {'ra': 0, 'ga': 0, 'ba': 0, 'aa': 100, 'rb': 0, 'gb': 0, 'bb': 0, 'ab': 0};
thecolor.rb = Number('0x' + hexcolor.substr(0, 2));
thecolor.gb = Number('0x' + hexcolor.substr(2, 2));
thecolor.bb = Number('0x' + hexcolor.substr(4, 2));
zColor = new Color(colortarget);
zColor.setTransform(thecolor);
}
function f_SetDrawTool(toolnum, noSound) {
if (!noSound and toolnum != 0) {
s_click1.start(0, 0);
}
if (toolnum == 1) {
drawtool = toolnum;
onMouseDown = colorMouseDown;
menu.tools.gotoAndStop(1);
} else {
if (toolnum == 3) {
onMouseDown = fillMouseDown;
drawtool = 3;
menu.tools.gotoAndStop(3);
} else {
if (toolnum == 4) {
onMouseDown = pickerMouseDown;
drawtool = 4;
menu.tools.gotoAndStop(4);
} else {
if (toolnum == 0) {
onMouseDown = undefined;
drawtool = toolnum;
menu.tools.gotoAndStop('none');
}
}
}
}
}
function getColorAlpha(color) {
return (color >>> 24) / 255;
}
function colorToHexString(color) {
color &= 16777215;
var v1 = color.toString(16);
while (v1.length < 6) {
v1 = '0' + v1;
}
return v1;
}
function setColor(myColor) {
s_colorPick.start(0, 0);
color = 4278190080.0 | myColor;
prevcolor = color;
f_ShowColor(colorToHexString(color), menu.showcolor.body);
}
bossChannel = new Array();
var c = 0;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'Random Gang';
bC.medal = 'Gang Banger';
bC.bosses = undefined;
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'N00BS';
bC.medal = 'N00Binator';
bC.bosses = [366647, 368815];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'Regular TV';
bC.medal = 'Channel Flipper';
bC.bosses = [360323, 373745];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'Patriots';
bC.medal = 'Unpatriotic';
bC.bosses = [360044, 360394];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'Bourgeois';
bC.medal = 'Proletariat';
bC.bosses = [379132, 360306, 360159];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'Emotes';
bC.medal = 'Emotikiller';
bC.bosses = [376410, 376413, 375856, 376418, 375366];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'NG Folks';
bC.medal = 'Troll';
bC.bosses = [368633, 375768, 360292, 369455, 374922, 374897, 378192, 368541];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'NG Legends';
bC.medal = 'Killer of Legends';
bC.bosses = [376360, 376108, 375443, 375357, 374490, 375451, 368299];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'Castle Crashers';
bC.medal = 'Castle Crusher';
bC.bosses = [375157, 375391, 375415, 375431, 375475];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'VG Legends';
bC.medal = 'Hate the Game';
bC.bosses = [360278, 377044, 351607];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'Bad Dudes';
bC.medal = 'Bad Dude';
bC.bosses = [368715, 368623, 368807, 371980, 360159, 360851];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'Evil';
bC.medal = 'Evil Slayer';
bC.bosses = [360359, 360028, 368351, 376341, 377048, 377052];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'Jerk Squad';
bC.medal = 'Jerk Killer';
bC.bosses = [352410, 354300, 369081, 359587, 368612, 370854];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'TravisBots';
bC.medal = 'Travisty';
bC.bosses = [360054, 360109, 360343, 360514, 360915, 361356, 362391];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = '67 Bots';
bC.medal = '67 Deep Sixer';
bC.bosses = [362911, 362927, 362957, 362972, 362994, 363013, 363017, 363026, 363035, 363049, 363054, 363235, 363258, 363273, 363289];
++c;
bossChannel[c] = new Object();
var bC = bossChannel[c];
bC.title = 'HUGE Jerks';
bC.medal = 'Butt Pincher';
bC.bosses = [375373, 360061, 354616, 354677];
++c;
f_Clear();
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_REQUESTED, onFileRequested);
}
movieClip 177 {
}
movieClip 180 {
}
movieClip 183 {
}
movieClip 185 {
}
movieClip 187 {
}
movieClip 188 {
}
button 190 {
on (release) {
com.newgrounds.API.loadCustomLink('JohnnyUtah');
}
}
movieClip 192 {
}
movieClip 194 {
}
movieClip 195 {
}
button 196 {
on (release) {
com.newgrounds.API.loadCustomLink('TomFulp');
}
}
instance of movieClip 172 APIConnector {
onClipEvent (construct) {
apiId = '28406:t2wWEO7G';
encryptionKey = 'wGYkOhlYBoSnvMChkljQLZO7CZOnWHfF';
debugMode = 'Off';
movieVersion = '';
connectorType = 'Flash Ad + Preloader';
redirectOnNewVersion = true;
redirectOnHostBlocked = true;
adType = 'Simple';
}
}
movieClip 200 {
}
button 201 {
on (release) {
com.newgrounds.API.loadNewgrounds();
}
}
movieClip 203 {
}
button 204 {
on (release) {
com.newgrounds.API.loadCustomLink('Soundtrack');
}
}
movieClip 125 __Packages.com.newgrounds.APIConnection {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.APIConnection) {
var v1 = function () {
this.reset();
};
com.newgrounds.APIConnection = v1;
var v2 = v1.prototype;
v2.__get__hostURL = function () {
return this._hostURL;
};
v2.__set__hostURL = function (value) {
this._hostURL = value;
this.hostDomain = null;
if (this._hostURL) {
var v2 = this._hostURL.split('/');
if (v2[0] != 'file:' && this._hostURL != 'localhost') {
this.hostDomain = (v2.splice(0, 3)).join('/');
}
}
if (!this.hostDomain) {
this.hostDomain = 'localhost';
}
return this.__get__hostURL();
};
v2.__get__sandboxType = function () {
return System.security.sandboxType;
};
v2.__get__isNetworkHost = function () {
switch (this.__get__sandboxType()) {
return true;
case 'localWithFile':
case 'localWithNetwork':
case 'localTrusted':
case 'application':
return false;
case 'remote':
}
return true;
};
v2.__get__hasUserSession = function () {
return this.sessionId != null && this.sessionId != '' && this.publisherId != 0;
};
v2.__get__connected = function () {
return this.connectionState == com.newgrounds.APIConnection.CONNECTED;
};
v2.reset = function () {
this.connectionState = com.newgrounds.APIConnection.NOT_CONNECTED;
this.encryptionKey = null;
this.sessionId = null;
this.userEmail = null;
this.username = null;
this.userId = 0;
this.userpageFormat = 0;
};
v2.assertInitialized = function () {
if (!this.initialized) {
com.newgrounds.Logger.logError('You must initialized the API using API.connect() before using this command.');
return false;
}
return true;
};
v2.assertConnected = function () {
if (!this.connectionState == com.newgrounds.APIConnection.CONNECTED) {
com.newgrounds.Logger.logError('You must establish a connection using API.connect() before using this command.');
return false;
}
return true;
};
v2.sendSimpleCommand = function (command, completeHandler, parameters, secureParameters) {
if (parameters == undefined) {
parameters = null;
}
if (secureParameters == undefined) {
secureParameters = null;
}
var v2 = new com.newgrounds.APICommand(command);
v2.__set__parameters(parameters);
v2.__set__secureParameters(secureParameters);
if (completeHandler != null) {
v2.addEventListener(com.newgrounds.APIEvent.COMMAND_COMPLETE, completeHandler);
}
v2.send(this);
};
v2.sendCommand = function (command) {
command.send(this);
};
v2.loadInBrowser = function (command, newWindow, parameters) {
if (newWindow == undefined) {
newWindow = true;
}
if (parameters == undefined) {
parameters = null;
}
var v2 = new com.newgrounds.APICommand(command);
v2.__set__parameters(parameters);
v2.loadInBrowser(this, newWindow);
};
v1.NOT_CONNECTED = 'notConnected';
v1.CONNECTING = 'connecting';
v1.CONNECTED = 'connected';
v2.connectionState = com.newgrounds.APIConnection.NOT_CONNECTED;
v2.apiURL = 'http://www.ngads.com/gateway_v2.php';
v2.addProperty('connected', v2.__get__connected, function () {});
v2.addProperty('hasUserSession', v2.__get__hasUserSession, function () {});
v2.addProperty('hostURL', v2.__get__hostURL, v2.__set__hostURL);
v2.addProperty('isNetworkHost', v2.__get__isNetworkHost, function () {});
v2.addProperty('sandboxType', v2.__get__sandboxType, function () {});
ASSetPropFlags(com.newgrounds.APIConnection.prototype, null, 1);
}
#endinitclip
}
movieClip 118 __Packages.com.newgrounds.EventDispatcher {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.EventDispatcher) {
var v1 = function () {
this._listeners = {};
};
com.newgrounds.EventDispatcher = v1;
var v2 = v1.prototype;
v2.addEventListener = function (type, listener) {
if (!this._listeners[type]) {
this._listeners[type] = [];
}
if (typeof listener == 'function') {
this._listeners[type].push({'target': null, 'func': listener});
} else {
this._listeners[type].push(listener);
}
};
v2.removeEventListener = function (type, listener) {
var v3 = this._listeners[type];
if (v3) {
var v5 = v3.length;
var v2 = 0;
while (v2 < v5) {
if (v3[v2].func == listener || v3[v2] == listener) {
v3.splice(v2, 1);
return undefined;
}
++v2;
}
}
};
v2.dispatchEvent = function (event) {
var v4 = this._listeners[event.__get__type()];
if (v4) {
var v5 = v4.length;
var v2 = 0;
while (v2 < v5) {
var v3 = v4[v2];
v3.func.call(v3.target, event);
++v2;
}
}
return true;
};
ASSetPropFlags(com.newgrounds.EventDispatcher.prototype, null, 1);
}
#endinitclip
}
movieClip 117 __Packages.com.newgrounds.Event {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.Event) {
var v1 = function (type) {
this._type = type;
};
com.newgrounds.Event = v1;
var v2 = v1.prototype;
v2.__get__type = function () {
return this._type;
};
v2.addProperty('type', v2.__get__type, function () {});
ASSetPropFlags(com.newgrounds.Event.prototype, null, 1);
}
#endinitclip
}
movieClip 119 __Packages.com.newgrounds.APIEventDispatcher {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.APIEventDispatcher) {
var v1 = function () {
super();
};
com.newgrounds.APIEventDispatcher = v1;
com.newgrounds.APIEventDispatcher extends com.newgrounds.EventDispatcher;
var v2 = v1.prototype;
v1.__get__globalDispatcher = function () {
return com.newgrounds.APIEventDispatcher._globalDispatcher;
};
v1.__set__globalDispatcher = function (value) {
com.newgrounds.APIEventDispatcher._globalDispatcher = value;
return com.newgrounds.APIEventDispatcher.__get__globalDispatcher();
};
v1.initEventQueue = function () {
setInterval(com.newgrounds.APIEventDispatcher.runEventQueue, 50);
return [];
};
v2.dispatchEvent = function (event) {
com.newgrounds.APIEventDispatcher._eventQueue.push({'dispatcher': this, 'event': event});
return true;
};
v2.actualDispatchEvent = function (event) {
var v3 = super.dispatchEvent(event);
if (com.newgrounds.APIEventDispatcher._globalDispatcher && this != com.newgrounds.APIEventDispatcher._globalDispatcher) {
com.newgrounds.APIEventDispatcher._globalDispatcher.dispatchEvent(event);
}
};
v1.runEventQueue = function (event) {
var v3 = com.newgrounds.APIEventDispatcher._eventQueue.length;
if (v3) {
var v4 = com.newgrounds.APIEventDispatcher._eventQueue;
com.newgrounds.APIEventDispatcher._eventQueue = [];
var v1 = 0;
while (v1 < v3) {
var v2 = v4[v1];
v2.dispatcher.actualDispatchEvent(v2.event);
++v1;
}
}
};
v1._eventQueue = com.newgrounds.APIEventDispatcher.initEventQueue();
v1.addProperty('globalDispatcher', v1.__get__globalDispatcher, v1.__set__globalDispatcher);
ASSetPropFlags(com.newgrounds.APIEventDispatcher.prototype, null, 1);
}
#endinitclip
}
movieClip 122 __Packages.com.newgrounds.encoders.BaseN {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.encoders) {
_global.com.newgrounds.encoders = new Object();
}
if (!_global.com.newgrounds.encoders.BaseN) {
var v1 = function (hash) {
if (hash) {
this._hash = hash;
} else {
this._hash = com.newgrounds.encoders.BaseN.DEFAULT_HASH;
}
this._base = this._hash.length;
this._reverseHash = new Object();
var v2 = 0;
while (v2 < this._hash.length) {
this._reverseHash[this._hash.charAt(v2)] = v2;
++v2;
}
};
com.newgrounds.encoders.BaseN = v1;
var v2 = v1.prototype;
v2.encodeUint = function (number, minimumChars) {
if (minimumChars == undefined) {
minimumChars = 1;
}
var v2 = '';
var v3 = number;
while (v3 != 0) {
v2 = this._hash.charAt(v3 % this._base) + v2;
v3 /= this._base;
v3 = int(v3);
}
while (v2.length < minimumChars) {
v2 = this._hash.charAt(0) + v2;
}
return v2;
};
v2.decodeUint = function (encodedNumber) {
var v3 = 0;
var v2 = 0;
while (v2 < encodedNumber.length) {
v3 *= this._base;
v3 += this._reverseHash[encodedNumber.charAt(v2)];
++v2;
}
return v3;
};
v1.DEFAULT_HASH = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~@#$%^&*()+|;/';
ASSetPropFlags(com.newgrounds.encoders.BaseN.prototype, null, 1);
}
#endinitclip
}
movieClip 128 __Packages.com.newgrounds.APICommand {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.APICommand) {
var v1 = function (command) {
super();
this._command = command;
this._parameters = new Object();
this._secureParameters = new Object();
this._hasTimeout = true;
};
com.newgrounds.APICommand = v1;
com.newgrounds.APICommand extends com.newgrounds.APIEventDispatcher;
var v2 = v1.prototype;
v1.stopPendingCommands = function () {
for (var v2 in com.newgrounds.APICommand._pendingCommands) {
var v1 = com.newgrounds.APICommand._pendingCommands[v2];
v1.close();
}
com.newgrounds.APICommand._pendingCommands = [];
};
v1.onThrottleTimer = function (event) {
if (getTimer() - com.newgrounds.APICommand._throttleTimestamp >= com.newgrounds.APICommand.THROTTLE_INTERVAL) {
com.newgrounds.APICommand._throttleCount = 0;
com.newgrounds.APICommand._throttleCount = 0;
for (;;) {
if (!(com.newgrounds.APICommand._commandQueue.length && com.newgrounds.APICommand._throttleCount < com.newgrounds.APICommand.THROTTLE_THRESHOLD)) break;
var v1 = com.newgrounds.APICommand._commandQueue.shift();
v1.command.send(v1.connection);
++com.newgrounds.APICommand._throttleCount;
}
}
};
v1.encryptHex = function (hexValue) {
var v4 = hexValue.length % 6;
var v3 = '';
var v1 = 0;
while (v1 < hexValue.length) {
v3 += com.newgrounds.APICommand._encryptor.encodeUint(int('0x' + hexValue.substr(v1, 6)), 4);
v1 += 6;
}
return v4.toString() + v3;
};
v2.__get__command = function () {
return this._command;
};
v2.__set__command = function (value) {
this._command = value;
return this.__get__command();
};
v2.__get__hasTimeout = function () {
return this._hasTimeout;
};
v2.__set__hasTimeout = function (val) {
this._hasTimeout = val;
return this.__get__hasTimeout();
};
v2.__get__parameters = function () {
return this._parameters;
};
v2.__set__parameters = function (object) {
this._parameters = new Object();
if (object) {
for (var v3 in object) {
this._parameters[v3] = object[v3];
}
}
return this.__get__parameters();
};
v2.__get__preventCache = function () {
return this._preventCache;
};
v2.__set__preventCache = function (value) {
this._preventCache = value;
return this.__get__preventCache();
};
v2.__get__secureParameters = function () {
return this._secureParameters;
};
v2.__set__secureParameters = function (object) {
this._secureParameters = new Object();
if (object) {
for (var v3 in object) {
this._secureParameters[v3] = object[v3];
}
}
return this.__get__secureParameters();
};
v2.__get__hasSecureParameters = function () {
for (var v2 in this._secureParameters) {
return true;
}
return false;
};
v2.addFile = function (filename, data, dataField, contentType) {
if (contentType == undefined) {
contentType = 'application/octet-stream';
}
if (!this._files) {
this._files = new Object();
}
var v3 = {'filename': filename, 'data': data, 'dataField': dataField, 'contentType': contentType};
this._files[filename] = v3;
};
v2.removeFile = function (filename) {
if (this._files) {
delete this._files[filename];
}
};
v2.clearFiles = function () {
this._files = null;
};
v2.close = function () {
if (this._loader) {
clearInterval(this._timeoutTimer);
var v2 = 0;
while (v2 < com.newgrounds.APICommand._pendingCommands.length) {
if (com.newgrounds.APICommand._pendingCommands[v2] == this) {
com.newgrounds.APICommand._pendingCommands.splice(v2, 1);
break;
}
++v2;
}
this._loader = null;
}
};
v2.loadInBrowser = function (connection, newWindow) {
this._parameters.command_id = this._command;
this._parameters.tracker_id = connection.apiId ? connection.apiId : 1;
if (connection.debug) {
this._parameters.debug = 1;
}
var v3 = connection.apiURL + '?host=' + escape(connection.hostDomain);
for (var v4 in this._parameters) {
v3 += '&' + escape(v4) + '=' + escape(this._parameters[v4]);
}
var v6;
if (newWindow) {
v6 = '_blank';
} else {
v6 = '_top';
}
_root.getURL(v3, v6);
};
v2.send = function (connection) {
if (com.newgrounds.APICommand._throttleCount >= com.newgrounds.APICommand.THROTTLE_THRESHOLD) {
com.newgrounds.APICommand._commandQueue.push({'connection': connection, 'command': this});
} else {
this.sendInternal(connection);
}
};
v2.sendInternal = function (connection) {
var v4;
v4 = new LoadVars();
v4.command_id = this._command;
v4.tracker_id = connection.apiId;
if (connection.debug) {
v4.debug = 1;
}
if (this._preventCache) {
v4.seed = Math.random();
}
var v2;
var v3;
var v7;
for (v2 in this._parameters) {
v3 = this._parameters[v2];
if (v3 != null) {
if (typeof v3 == 'boolean') {
v4[v2] = int(v3);
} else {
v4[v2] = v3;
}
}
}
if (this.__get__hasSecureParameters()) {
var v6 = new Object();
for (v2 in this._secureParameters) {
v3 = this._secureParameters[v2];
if (v3 != null) {
if (typeof v3 == 'boolean') {
v6[v2] = int(v3);
} else {
v6[v2] = v3;
}
}
}
var v8 = '';
v7 = 0;
while (v7 < 16) {
v8 += com.newgrounds.APICommand.ENCRYPTOR_RADIX.charAt(int(Math.random() * com.newgrounds.APICommand.ENCRYPTOR_RADIX.length));
++v7;
}
v4.command_id = 'securePacket';
v6.command_id = this._command;
v6.as_version = 3;
v6.session_id = connection.sessionId;
v6.user_email = connection.userEmail;
v6.publisher_id = connection.publisherId;
v6.seed = v8;
var v13 = com.newgrounds.crypto.MD5.hash(v8);
var v11 = com.newgrounds.crypto.RC4.encrypt(com.newgrounds.encoders.json.JSON.encode(v6), connection.encryptionKey);
v4.secure = com.newgrounds.APICommand.encryptHex(v13 + v11);
}
com.newgrounds.Logger.logInternal('Sending packet:', v4);
var v12;
v12 = 'application/x-www-form-urlencoded';
for (v2 in v4) {
if (typeof v4[v2] == 'object') {
v4[v2] = com.newgrounds.encoders.json.JSON.encode(v4[v2]);
}
}
if (this._files) {
for (var v10 in this._files) {
var v5 = this._files[v10];
if (typeof v5.data == 'string') {
v4[v10] = v5.data;
} else {
v4[v10] = com.newgrounds.encoders.json.JSON.encode(v5.data);
}
}
}
com.newgrounds.APICommand._pendingCommands.push(this);
++com.newgrounds.APICommand._throttleCount;
com.newgrounds.APICommand._throttleTimestamp = getTimer();
this.startLoader(connection.apiURL, v4, v12);
};
v2.startLoader = function (url, data, contentType) {
this._loader = LoadVars(data);
this._loader.onData = this.as2CompleteHandler;
this._loader.contentType = contentType;
this._loader.sendAndLoad(url, this._loader, 'POST');
if (this._hasTimeout) {
setInterval(this, this.onTimeout, com.newgrounds.APICommand.TIMEOUT_INTERVAL);
}
};
v2.as2CompleteHandler = function (data) {
var v3;
var v2 = 0;
while (v2 < com.newgrounds.APICommand._pendingCommands.length) {
if (com.newgrounds.APICommand._pendingCommands[v2]._loader == this) {
v3 = com.newgrounds.APICommand._pendingCommands[v2];
break;
}
++v2;
}
v3.onComplete(data);
};
v2.onTimeout = function (event) {
this.close();
com.newgrounds.Logger.logError('Command timed out.');
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, null, com.newgrounds.APIEvent.ERROR_TIMED_OUT));
};
v2.onError = function (error) {
com.newgrounds.Logger.logError('Error when sending command:', error);
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, null, com.newgrounds.APIEvent.ERROR_UNKNOWN));
this.close();
};
v2.onComplete = function (data) {
com.newgrounds.Logger.logInternal('Received packet:', data);
try {
if (!data || data == '') {
throw new Error();
}
var v2 = com.newgrounds.encoders.json.JSON.decode(data);
if (!v2) {
throw new Error();
}
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, v2, (v2 && v2.success) ? com.newgrounds.APIEvent.ERROR_NONE : com.newgrounds.APIEvent.ERROR_COMMAND_FAILED));
if (com.newgrounds.APICommand.bridge) {
com.newgrounds.APICommand.bridge.sendEvent(v2.command_id, v2);
}
}
catch (e) {
com.newgrounds.Logger.logError('Invalid response returned from server: ' + data);
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, null, com.newgrounds.APIEvent.ERROR_BAD_RESPONSE));
}
this.close();
};
v1.TIMEOUT_INTERVAL = 10000;
v1.THROTTLE_INTERVAL = 10050;
v1.THROTTLE_TICK_INTERVAL = 1000;
v1.THROTTLE_THRESHOLD = 24;
v1._throttleCount = 0;
v1._commandQueue = [];
v1._throttleTimer = setInterval(com.newgrounds.APICommand.onThrottleTimer, com.newgrounds.APICommand.THROTTLE_TICK_INTERVAL);
v1.ENCRYPTOR_RADIX = '/g8236klvBQ#&|;Zb*7CEA59%s`Oue1wziFp$rDVY@TKxUPWytSaGHJ>dmoMR^<0~4qNLhc(I+fjn)X';
v1._encryptor = new com.newgrounds.encoders.BaseN(com.newgrounds.APICommand.ENCRYPTOR_RADIX);
v1._pendingCommands = [];
v1.CRLF = '\r\n';
v2.addProperty('command', v2.__get__command, v2.__set__command);
v2.addProperty('hasSecureParameters', v2.__get__hasSecureParameters, function () {});
v2.addProperty('hasTimeout', v2.__get__hasTimeout, v2.__set__hasTimeout);
v2.addProperty('parameters', v2.__get__parameters, v2.__set__parameters);
v2.addProperty('preventCache', v2.__get__preventCache, v2.__set__preventCache);
v2.addProperty('secureParameters', v2.__get__secureParameters, v2.__set__secureParameters);
ASSetPropFlags(com.newgrounds.APICommand.prototype, null, 1);
}
#endinitclip
}
movieClip 124 __Packages.com.newgrounds.Bridge {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.Bridge) {
var v1 = function (id) {
super();
this._widgetId = id;
this._inConnection = new LocalConnection();
this._outConnection = new LocalConnection();
var me = this;
this._inConnection.receiveEvent = function () {
me.receiveEvent.apply(me, arguments);
};
this._inConnection.allowInsecureDomain = function (d) {
return d == 'www.newgrounds.com' || d == 'newgrounds.com' || d == 'uploads.ungrounded.net';
};
this._inConnection.allowDomain = this._inConnection.allowInsecureDomain;
this._inConnection.connect('_rec_' + this._widgetId);
com.newgrounds.Logger.addEventListener(com.newgrounds.APIEvent.LOG, {'target': this, 'func': this.onLogMessage});
};
com.newgrounds.Bridge = v1;
com.newgrounds.Bridge extends com.newgrounds.EventDispatcher;
var v2 = v1.prototype;
v2.__get__widgetId = function () {
return this._widgetId;
};
v2.onLogMessage = function (event) {
try {
this._outConnection.send(this._widgetId, 'sendEvent', 'trace', String(event.__get__data()));
}
};
v2.sendEvent = function (command, parameters) {
if (this._outConnection) {
parameters = {'data': parameters};
try {
this._outConnection.send(this._widgetId, 'sendEvent', command, parameters);
}
}
};
v2.receiveEvent = function (responseData) {
var v2;
try {
v2 = com.newgrounds.encoders.json.JSON.decode(responseData);
}
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.BRIDGE_EVENT_RECEIVED, v2, (v2 == null) ? com.newgrounds.APIEvent.ERROR_UNKNOWN : null));
};
v2.onStatus = function (event) {};
v2.addProperty('widgetId', v2.__get__widgetId, function () {});
ASSetPropFlags(com.newgrounds.Bridge.prototype, null, 1);
}
#endinitclip
}
movieClip 120 __Packages.com.newgrounds.APIEvent {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.APIEvent) {
var v1 = function (type, data, error) {
super(type);
if (data == undefined) {
data = null;
}
if (error == undefined) {
error = null;
}
if (!error || error == '' || error == com.newgrounds.APIEvent.ERROR_NONE) {
this._error = com.newgrounds.APIEvent.ERROR_NONE;
this._success = true;
} else {
this._error = error;
this._success = false;
}
if (data) {
this._data = data;
} else {
this._data = {};
}
};
com.newgrounds.APIEvent = v1;
com.newgrounds.APIEvent extends com.newgrounds.Event;
var v2 = v1.prototype;
v2.clone = function () {
return new com.newgrounds.APIEvent(this.__get__type(), this._data, this._error);
};
v2.__get__success = function () {
return this._success;
};
v2.__get__data = function () {
return this._data;
};
v2.__get__error = function () {
return this._error;
};
v1.COMMAND_COMPLETE = 'commandComplete';
v1.MEDAL_UNLOCK_CONFIRMED = 'medalUnlockConfirmed';
v1.ICON_LOADED = 'iconLoaded';
v1.BRIDGE_EVENT_RECEIVED = 'brdigeEventReceived';
v1.API_CONNECTED = 'movieConnected';
v1.LOG = 'log';
v1.MEDAL_UNLOCKED = 'medalUnlocked';
v1.SCORES_LOADED = 'scoresLoaded';
v1.SCORE_POSTED = 'scorePosted';
v1.QUERY_COMPLETE = 'queryComplete';
v1.FILE_LOADED = 'fileLoaded';
v1.FILE_SAVED = 'fileSaved';
v1.FILE_DELETED = 'fileDeleted';
v1.FILE_REQUESTED = 'fileRequested';
v1.VOTE_COMPLETE = 'voteComplete';
v1.USER_SIGNED_IN = 'userSignedIn';
v1.ERROR_NONE = 'noError';
v1.ERROR_UNKNOWN = 'unknownError';
v1.ERROR_COMMAND_FAILED = 'commandFailed';
v1.ERROR_NOT_CONNECTED = 'notConnected';
v1.ERROR_INVALID_ARGUMENT = 'invalidArgument';
v1.ERROR_TIMED_OUT = 'timedOut';
v1.ERROR_BAD_FILE = 'badFile';
v1.ERROR_BAD_RESPONSE = 'badResponse';
v1.ERROR_SENDING_COMMAND = 'errorSendingCommand';
v1.ERROR_HOST_BLOCKED = 'hostBlocked';
v1.ERROR_ALREADY_VOTED = 'alreadyVoted';
v1.ERROR_NOT_LOGGED_IN = 'notLoggedIn';
v1.ERROR_WRONG_ENCRYPTION_KEY = 'wrongEncryptionKey';
v1.ERROR_SIGN_IN_FAILED = 'signInFailed';
v2.addProperty('data', v2.__get__data, function () {});
v2.addProperty('error', v2.__get__error, function () {});
v2.addProperty('success', v2.__get__success, function () {});
ASSetPropFlags(com.newgrounds.APIEvent.prototype, null, 1);
}
#endinitclip
}
movieClip 139 __Packages.com.newgrounds.API {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.API) {
var v1 = function () {};
com.newgrounds.API = v1;
var v2 = v1.prototype;
v1.__get__connected = function () {
return com.newgrounds.API._connection.__get__connected();
};
v1.__get__isNetworkHost = function () {
return com.newgrounds.API._connection.__get__isNetworkHost();
};
v1.__get__apiId = function () {
com.newgrounds.API._connection.assertInitialized();
return com.newgrounds.API._connection.apiId;
};
v1.__get__debugMode = function () {
return com.newgrounds.API._debugMode;
};
v1.__set__debugMode = function (val) {
com.newgrounds.API._debugMode = val;
return com.newgrounds.API.__get__debugMode();
};
v1.__get__publisherId = function () {
com.newgrounds.API._connection.assertInitialized();
return com.newgrounds.API._connection.publisherId;
};
v1.__get__sessionId = function () {
com.newgrounds.API._connection.assertInitialized();
return com.newgrounds.API._connection.sessionId;
};
v1.__get__hostDomain = function () {
com.newgrounds.API._connection.assertInitialized();
return com.newgrounds.API._connection.hostDomain;
};
v1.__get__hostURL = function () {
com.newgrounds.API._connection.assertInitialized();
return com.newgrounds.API._connection.__get__hostURL();
};
v1.__get__isNewgrounds = function () {
return com.newgrounds.API._connection.publisherId == 1;
};
v1.__get__hasUserSession = function () {
com.newgrounds.API._connection.assertInitialized();
return com.newgrounds.API._connection.__get__hasUserSession();
};
v1.__get__username = function () {
com.newgrounds.API._connection.assertInitialized();
return com.newgrounds.API._connection.username;
};
v1.__get__userId = function () {
com.newgrounds.API._connection.assertInitialized();
return com.newgrounds.API._connection.userId;
};
v1.assertConnected = function (eventType) {
if (eventType == undefined) {
eventType = null;
}
if (com.newgrounds.API._connection.assertConnected()) {
return true;
} else {
if (eventType) {
com.newgrounds.API.dispatchEvent(eventType, null, com.newgrounds.APIEvent.ERROR_NOT_CONNECTED);
}
return false;
}
};
v1.__get__serverTime = function () {
return com.newgrounds.API._serverTime;
};
v1.__get__adsApproved = function () {
return com.newgrounds.API._adsApproved;
};
v1.__get__adFeedURL = function () {
return com.newgrounds.API._adFeedURL;
};
v1.__get__medals = function () {
return com.newgrounds.API._medalsArray;
};
v1.__get__scoreBoards = function () {
return com.newgrounds.API._scoreBoardsArray;
};
v1.__get__saveGroups = function () {
return com.newgrounds.API._saveGroupsArray;
};
v1.connect = function (_root, apiId, encryptionKey, movieVersion) {
if (encryptionKey == undefined) {
encryptionKey = null;
}
if (movieVersion == undefined) {
movieVersion = '';
}
com.newgrounds.APIEventDispatcher.__set__globalDispatcher(com.newgrounds.API._dispatcher);
System.security.loadPolicyFile('http://apifiles.ngfiles.com/crossdomain.xml');
if (com.newgrounds.API._connection.initialized) {
com.newgrounds.Logger.logError('Connection already in progress. Please call API.disconnect() before attempting another connection.');
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, false, com.newgrounds.APIEvent.ERROR_NOT_CONNECTED);
return undefined;
}
apiId = com.newgrounds.API.trimWhitespace(apiId);
if (encryptionKey) {
encryptionKey = com.newgrounds.API.trimWhitespace(encryptionKey);
}
if (!apiId || apiId == '') {
com.newgrounds.Logger.logError('No apiId given. Please use the API ID from your API settings page.');
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, false, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT);
return undefined;
}
com.newgrounds.Logger.logMessage('====== Newgrounds API v' + com.newgrounds.API.VERSION + ' ======');
com.newgrounds.API._connection.connectionState = com.newgrounds.APIConnection.CONNECTING;
_root = _root;
com.newgrounds.API._movieVersion = movieVersion;
com.newgrounds.API._connection.apiId = apiId;
var v4;
v4 = apiId.indexOf(':');
if (v4 != -1) {
com.newgrounds.API._connection.trackerId = int(apiId.substring(0, v4));
} else {
com.newgrounds.API._connection.trackerId = int(apiId);
}
if (!com.newgrounds.API._connection.trackerId) {
com.newgrounds.Logger.logError('Invalid API ID: ' + apiId);
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, false, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT);
return undefined;
}
com.newgrounds.API._connection.encryptionKey = encryptionKey;
com.newgrounds.API._connection.initialized = true;
com.newgrounds.API._connection.__set__hostURL(_root._url);
com.newgrounds.API.doConnect(_root);
};
v1.doConnect = function (flashVars) {
if (com.newgrounds.API.__get__isNetworkHost() && com.newgrounds.API._debugMode != com.newgrounds.API.RELEASE_MODE) {
com.newgrounds.Logger.logMessage('Live file detected, turning off debug mode.');
com.newgrounds.API._debugMode = com.newgrounds.API.RELEASE_MODE;
}
if (flashVars && flashVars.NewgroundsAPI_SandboxID) {
com.newgrounds.API._bridge = new com.newgrounds.Bridge(flashVars.NewgroundsAPI_SandboxID);
com.newgrounds.APICommand.bridge = com.newgrounds.API._bridge;
} else {
com.newgrounds.API._bridge = new com.newgrounds.Bridge(com.newgrounds.crypto.MD5.hash(String(Math.random())));
com.newgrounds.APICommand.bridge = com.newgrounds.API._bridge;
}
if (com.newgrounds.API._debugMode == com.newgrounds.API.RELEASE_MODE) {
if (flashVars) {
if (flashVars.NewgroundsAPI_UserName) {
com.newgrounds.API._connection.username = flashVars.NewgroundsAPI_UserName;
}
if (flashVars.NewgroundsAPI_UserID) {
com.newgrounds.API._connection.userId = flashVars.NewgroundsAPI_UserID;
}
if (flashVars.NewgroundsAPI_PublisherID) {
com.newgrounds.API._connection.publisherId = flashVars.NewgroundsAPI_PublisherID;
}
if (flashVars.NewgroundsAPI_UserpageFormat) {
com.newgrounds.API._connection.userpageFormat = flashVars.NewgroundsAPI_UserpageFormat;
}
if (flashVars.NewgroundsAPI_SessionID) {
com.newgrounds.API._connection.sessionId = flashVars.NewgroundsAPI_SessionID;
}
if (flashVars.NewgroundsAPI_SaveGroupID) {
com.newgrounds.API._requestedSaveGroupId = flashVars.NewgroundsAPI_SaveGroupID;
}
if (flashVars.NewgroundsAPI_SaveFileID) {
com.newgrounds.API._requestedSaveFileId = flashVars.NewgroundsAPI_SaveFileID;
}
}
} else {
com.newgrounds.API._connection.debug = true;
if (com.newgrounds.API._debugMode == com.newgrounds.API.DEBUG_MODE_LOGGED_IN || com.newgrounds.API._debugMode == com.newgrounds.API.DEBUG_MODE_LOGGED_OUT) {
com.newgrounds.API._connection.publisherId = 1;
}
if (com.newgrounds.API._debugMode == com.newgrounds.API.DEBUG_MODE_LOGGED_IN) {
com.newgrounds.API._connection.sessionId = 'D3bu64p1U53R';
com.newgrounds.API._connection.userId = 10;
com.newgrounds.API._connection.username = 'API-Debugger';
}
}
com.newgrounds.API._connection.sendSimpleCommand('connectMovie', com.newgrounds.API.onConnect, {'host': com.newgrounds.API._connection.hostDomain, 'movie_version': com.newgrounds.API._movieVersion, 'publisher_id': com.newgrounds.API._connection.publisherId});
};
v1.onConnect = function (event) {
var v1 = event.__get__data();
if (!event.__get__success()) {
com.newgrounds.Logger.logError('Unable to connect to the API.');
com.newgrounds.API._connection.reset();
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, event.__get__data(), event.__get__error());
return undefined;
}
if (com.newgrounds.API.__get__debugMode() != com.newgrounds.API.RELEASE_MODE) {
com.newgrounds.API._adFeedURL = com.newgrounds.API.TEST_AD_FEED_URL;
} else {
if (v1.ad_url) {
com.newgrounds.API._adFeedURL = unescape(v1.ad_url);
}
}
switch (v1.ad_status) {
case -1:
com.newgrounds.Logger.logWarning('Your movie is not approved to run Flash Ads.');
break;
case 0:
com.newgrounds.Logger.logWarning('Your movie is still awaiting approval to run Flash Ads.');
break;
case 1:
com.newgrounds.Logger.logMessage('Your movie is approved to run Flash Ads!');
}
com.newgrounds.API._adsApproved = v1.ad_status == 1;
if (com.newgrounds.API._debugMode == com.newgrounds.API.DEBUG_MODE_HOST_BLOCKED || v1.deny_host) {
com.newgrounds.Logger.logWarning(com.newgrounds.API._connection.hostDomain + ' does not have permission to host this movie!', 'Update your API configuration to allow this host.');
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, {'officialURL': unescape(v1.movie_url)}, com.newgrounds.APIEvent.ERROR_HOST_BLOCKED);
com.newgrounds.API._connection.reset();
return undefined;
}
com.newgrounds.API._movieName = v1.movieName ? v1.movieName : '';
com.newgrounds.Logger.logMessage('Connecting to the Newgrounds API Gateway...', '----- ' + v1.movie_name + ' -----');
if (com.newgrounds.API._debugMode == com.newgrounds.API.DEBUG_MODE_NEW_VERSION) {
v1.movie_version = 'Debug Mode';
}
if (v1.movie_version) {
com.newgrounds.Logger.logMessage('A new version of this movie is available.', 'Current version:\t' + com.newgrounds.API._movieVersion, 'Newest version:\t' + v1.movie_version, 'Use API.loadOfficialVersion() to link to the latest version.');
com.newgrounds.API._newVersion = true;
} else {
com.newgrounds.API._newVersion = false;
}
com.newgrounds.API._serverTime = new Date(int(v1.time) * 1000);
if (v1.request_portal_url) {
com.newgrounds.API._connection.sendSimpleCommand('setPortalID', null, {'portal_url': com.newgrounds.API._connection.__get__hostURL()});
}
com.newgrounds.API._connection.sendSimpleCommand('preloadSettings', com.newgrounds.API.onMetadataLoaded, {'publisher_id': com.newgrounds.API._connection.publisherId, 'user_id': com.newgrounds.API._connection.userId});
};
v1.onMetadataLoaded = function (event) {
var v11 = event.__get__data();
var v4;
var v1;
if (!event.__get__success()) {
com.newgrounds.Logger.logWarning('Unable to load movie metadata.');
com.newgrounds.API.disconnect();
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, null, event.__get__error());
return undefined;
}
var v10 = 0;
if (v11.medals) {
v10 = v11.medals.length;
var v18;
if (com.newgrounds.API.__get__hasUserSession()) {
v18 = com.newgrounds.API.loadLocal('medals_unlocked_' + com.newgrounds.API.__get__username());
} else {
v18 = com.newgrounds.API.loadLocal('medals_unlocked');
}
v4 = 0;
while (v4 < v10) {
var v5 = v11.medals[v4];
var v15 = v5.medal_unlocked;
var v17 = v18 && v18[v5.medal_id];
var v14 = com.newgrounds.API.__get__hasUserSession() ? v15 : v17;
if (com.newgrounds.API.__get__debugMode() != com.newgrounds.API.RELEASE_MODE) {
v14 = false;
}
var v6 = new com.newgrounds.Medal(com.newgrounds.API._connection, v5.medal_id, v5.medal_name, v5.medal_description, Boolean(int(v5.secret)), v14, v5.medal_value, v5.medal_difficulty, v5.medal_icon);
v6.addEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCKED, com.newgrounds.API.onMedalUnlocked, false, 0, true);
v6.addEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCK_CONFIRMED, com.newgrounds.API.onMedalUnlockConfirmed, false, 0, true);
com.newgrounds.API._medals[v6.__get__name()] = v6;
com.newgrounds.API._medalsArray.push(v6);
com.newgrounds.Logger.logMessage(v6);
if (com.newgrounds.API.__get__hasUserSession() && v17 && !v15) {
com.newgrounds.Logger.logMessage('Server missed the "' + v6.__get__name() + '" unlock. Resending...');
v6.unlock();
}
++v4;
}
}
com.newgrounds.Logger.logMessage(v10 + ' medal' + ((v10 != 1) ? 's' : '') + ' initialized.');
v10 = 0;
if (v11.score_boards) {
v10 = v11.score_boards.length;
v4 = 0;
while (v4 < v10) {
var v16 = v11.score_boards[v4];
var v9 = new com.newgrounds.ScoreBoard(com.newgrounds.API._connection, v16.name, v16.id);
com.newgrounds.API._scoreBoards[v9.__get__name()] = v9;
com.newgrounds.API._scoreBoardsArray.push(v9);
com.newgrounds.Logger.logMessage(v9);
++v4;
}
}
com.newgrounds.Logger.logMessage(v10 + ' scoreboard' + ((v10 != 1) ? 's' : '') + ' initialized.');
v10 = 0;
if (v11.save_groups) {
v10 = v11.save_groups.length;
v4 = 0;
while (v4 < v10) {
var v2 = v11.save_groups[v4];
var v13 = [];
if (v2.keys) {
v1 = 0;
while (v1 < v2.keys.length) {
var v7 = v2.keys[v1];
v13.push(new com.newgrounds.SaveKey(v7.name, v7.id, v7.type));
++v1;
}
}
var v12 = [];
if (v2.ratings) {
v1 = 0;
while (v1 < v2.ratings.length) {
var v3 = v2.ratings[v1];
v12.push(new com.newgrounds.SaveRating(v3.name, v3.id, v3.float, v3.min, v3.max));
++v1;
}
}
var v8 = new com.newgrounds.SaveGroup(com.newgrounds.API._connection, v2.group_name, v2.group_id, v2.group_type, v13, v12);
com.newgrounds.API._saveGroups[v8.__get__name()] = v8;
com.newgrounds.API._saveGroupsArray.push(v8);
com.newgrounds.Logger.logMessage(v8);
++v4;
}
}
com.newgrounds.Logger.logMessage(v10 + ' save group' + ((v10 != 1) ? 's' : '') + ' initialized.');
if (v11.save_file_path) {
com.newgrounds.API._saveFilePath = v11.save_file_path + '/';
com.newgrounds.SaveFile._saveFilePath = com.newgrounds.API._saveFilePath;
com.newgrounds.Logger.logInternal('Save file path: ' + com.newgrounds.API._saveFilePath);
}
if (v11.image_file_path) {
com.newgrounds.API._imageFilePath = v11.image_file_path + '/';
com.newgrounds.SaveFile._imageFilePath = com.newgrounds.API._imageFilePath;
com.newgrounds.Logger.logInternal('Image file path: ' + com.newgrounds.API._imageFilePath);
}
com.newgrounds.Logger.logMessage('Connection complete!');
com.newgrounds.API._connection.connectionState = com.newgrounds.APIConnection.CONNECTED;
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, {'movieName': com.newgrounds.API._movieName, 'newVersion': com.newgrounds.API._newVersion});
if (com.newgrounds.API._requestedSaveFileId && com.newgrounds.API._requestedSaveGroupId) {
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_LOADED, com.newgrounds.API.onRequestedFileLoaded);
com.newgrounds.API.loadSaveFile(com.newgrounds.API._requestedSaveFileId, false);
}
};
v1.disconnect = function () {
if (!com.newgrounds.API._connection.__get__connected()) {
com.newgrounds.Logger.logWarning('The Newgrounds API is already disconnected.');
return undefined;
}
com.newgrounds.API._connection.reset();
for (var v2 in com.newgrounds.API._medals) {
var v1 = com.newgrounds.API._medals[v2];
v1.removeEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCKED, com.newgrounds.API.onMedalUnlocked);
v1.removeEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCK_CONFIRMED, com.newgrounds.API.onMedalUnlockConfirmed);
}
com.newgrounds.API._newVersion = false;
com.newgrounds.API._medals = new Object();
com.newgrounds.API._medalsArray = [];
com.newgrounds.API._scoreBoards = new Object();
com.newgrounds.API._scoreBoardsArray = [];
com.newgrounds.API._saveGroups = new Object();
com.newgrounds.API._saveGroupsArray = [];
com.newgrounds.API._sharedObjects = new Object();
com.newgrounds.API._imageFilePath = null;
com.newgrounds.API._saveFilePath = null;
com.newgrounds.Logger.logMessage('Disconnected from the Newgrounds API.');
};
v1.loadNewgrounds = function () {
com.newgrounds.API._connection.loadInBrowser('loadNewgrounds');
};
v1.loadOfficialVersion = function () {
if (com.newgrounds.API._connection.assertInitialized()) {
com.newgrounds.API._connection.loadInBrowser('loadOfficialVersion', false);
}
};
v1.promptSignIn = function () {
if (com.newgrounds.API._connection.assertInitialized()) {
getURL(com.newgrounds.API.PASSPORT_URL + com.newgrounds.API._bridge.__get__widgetId(), '_blank');
com.newgrounds.API._bridge.addEventListener(com.newgrounds.APIEvent.BRIDGE_EVENT_RECEIVED, com.newgrounds.API.onUserSignedIn, false, 0, true);
}
};
v1.onUserSignedIn = function (e) {
com.newgrounds.API._bridge.removeEventListener(com.newgrounds.APIEvent.BRIDGE_EVENT_RECEIVED, com.newgrounds.API.onUserSignedIn);
var v1 = e.__get__data();
if (e.__get__success()) {
try {
if (v1.NewgroundsAPI_UserName) {
com.newgrounds.API._connection.username = v1.NewgroundsAPI_UserName;
}
if (v1.NewgroundsAPI_UserID) {
com.newgrounds.API._connection.userId = v1.NewgroundsAPI_UserID;
}
if (v1.NewgroundsAPI_PublisherID) {
com.newgrounds.API._connection.publisherId = v1.NewgroundsAPI_PublisherID;
}
if (v1.NewgroundsAPI_SessionID) {
com.newgrounds.API._connection.sessionId = v1.NewgroundsAPI_SessionID;
}
com.newgrounds.API._connection.sendSimpleCommand('preloadSettings', com.newgrounds.API.onMetadataLoaded, {'publisher_id': com.newgrounds.API._connection.publisherId, 'user_id': com.newgrounds.API._connection.userId});
}
com.newgrounds.Logger.logMessage('User ' + com.newgrounds.API._connection.username + ' signed in.');
}
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.USER_SIGNED_IN, null, e.__get__success() ? null : com.newgrounds.APIEvent.ERROR_SIGN_IN_FAILED);
};
v1.loadMySite = function () {
if (com.newgrounds.API._connection.assertInitialized()) {
com.newgrounds.API._connection.loadInBrowser('loadMySite');
}
};
v1.loadCustomLink = function (linkName) {
if (com.newgrounds.API._connection.assertInitialized()) {
com.newgrounds.API._connection.loadInBrowser('loadCustomLink', true, {'link': linkName});
}
};
v1.getMedal = function (medalName) {
return com.newgrounds.API._medals[medalName];
};
v1.unlockMedal = function (medalName) {
if (!com.newgrounds.API.assertConnected()) {
return undefined;
}
var v1 = com.newgrounds.API._medals[medalName];
if (!v1) {
com.newgrounds.Logger.logError('No medal named "' + medalName + '" w.');
return undefined;
}
v1.unlock();
};
v1.onMedalUnlocked = function (event) {
if (event.__get__success()) {
var v2 = com.newgrounds.Medal(event.__get__data());
var v1;
if (com.newgrounds.API.__get__hasUserSession()) {
v1 = com.newgrounds.API.loadLocal('medals_unlocked_' + com.newgrounds.API.__get__username());
if (!v1) {
v1 = new Object();
}
v1[v2.__get__id()] = true;
com.newgrounds.API.saveLocal('medals_unlocked_' + com.newgrounds.API.__get__username(), v1);
} else {
v1 = com.newgrounds.API.loadLocal('medals_unlocked');
if (!v1) {
v1 = new Object();
}
v1[(com.newgrounds.Medal(event.__get__data())).__get__id()] = true;
com.newgrounds.API.saveLocal('medals_unlocked', v1);
com.newgrounds.Logger.logMessage('User instanceof not logged in. Medal "' + v2.__get__name() + '" unlocked locally.');
}
}
};
v1.onMedalUnlockConfirmed = function (event) {
if (com.newgrounds.API.__get__hasUserSession()) {
var v1 = com.newgrounds.API.loadLocal('medals_unlocked_' + com.newgrounds.API.__get__username());
if (!v1) {
v1 = new Object();
} else {
delete v1[(com.newgrounds.Medal(event.__get__data())).__get__id()];
}
com.newgrounds.API.saveLocal('medals_unlocked_' + com.newgrounds.API.__get__username(), v1);
}
};
v1.clearLocalMedals = function () {
for (var v2 in com.newgrounds.API._medals) {
var v1 = com.newgrounds.API._medals[v2];
v1.setUnlocked(false);
}
if (!com.newgrounds.API.__get__hasUserSession()) {
com.newgrounds.API.saveLocal('medals_unlocked', new Object());
}
};
v1.getScoreBoard = function (scoreBoardName) {
if (!com.newgrounds.API.assertConnected()) {
return null;
}
return com.newgrounds.API._scoreBoards[scoreBoardName];
};
v1.loadScores = function (scoreBoardName, period, firstResult, numResults, showFriendsOnly, tag) {
if (period == undefined) {
period = 'All-Time';
}
if (firstResult == undefined) {
firstResult = 1;
}
if (numResults == undefined) {
numResults = 10;
}
if (showFriendsOnly == undefined) {
showFriendsOnly = false;
}
if (tag == undefined) {
tag = null;
}
if (!com.newgrounds.API.assertConnected()) {
return null;
}
var v1 = com.newgrounds.API._scoreBoards[scoreBoardName];
if (!v1) {
com.newgrounds.Logger.logError('No scoreboard named "' + scoreBoardName + '" w.');
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.SCORES_LOADED, null, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT);
return null;
}
v1.__set__period(period);
v1.__set__firstResult(firstResult);
v1.__set__numResults(numResults);
v1.__set__tag(tag);
if (showFriendsOnly) {
v1.__set__friendsOf(com.newgrounds.API.userId);
}
v1.loadScores();
return v1;
};
v1.postScore = function (scoreBoardName, numericScore, tag) {
if (tag == undefined) {
tag = null;
}
if (!com.newgrounds.API.assertConnected()) {
return undefined;
}
if (!com.newgrounds.API.__get__hasUserSession()) {
com.newgrounds.Logger.logError('The user must be logged-in to post a score.');
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.SCORE_POSTED, null, com.newgrounds.APIEvent.ERROR_NOT_LOGGED_IN);
return undefined;
}
var v1 = com.newgrounds.API._scoreBoards[scoreBoardName];
if (!v1) {
com.newgrounds.Logger.logError('No scoreboard named "' + scoreBoardName + '" w.');
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.SCORE_POSTED, null, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT);
return undefined;
}
v1.postScore(numericScore, tag);
};
v1.getSaveGroup = function (groupName) {
if (!com.newgrounds.API.assertConnected()) {
return null;
}
return com.newgrounds.API._saveGroups[groupName];
};
v1.getSaveGroupById = function (id) {
for (var v3 in com.newgrounds.API._saveGroups) {
var v1 = com.newgrounds.API._saveGroups[v3];
if (v1.__get__id() == id) {
return v1;
}
}
return null;
};
v1.createSaveFile = function (groupName) {
if (!com.newgrounds.API.assertConnected()) {
return null;
}
var v1 = com.newgrounds.API.getSaveGroup(groupName);
if (!v1) {
com.newgrounds.Logger.logError('The save group "' + groupName + '" w found.');
return null;
}
return new com.newgrounds.SaveFile(v1);
};
v1.loadSaveFile = function (saveId, loadContents) {
if (loadContents == undefined) {
loadContents = true;
}
com.newgrounds.API._connection.sendSimpleCommand('loadSaveFile', com.newgrounds.API.onFileLoaded, {'save_id': saveId, 'get_contents': loadContents});
};
v1.onFileLoaded = function (event) {
var v2;
if (event.__get__success()) {
v2 = com.newgrounds.SaveFile.fromObject(com.newgrounds.API.getSaveGroupById((event.__get__data()).group_id), (event.__get__data()).file);
if ((event.__get__data()).get_contents) {
v2.load();
} else {
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.FILE_LOADED, v2);
}
} else {
com.newgrounds.Logger.logError('Unable to load file:', event.__get__error());
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.FILE_LOADED, null, event.__get__error());
}
};
v1.createSaveQuery = function (groupName) {
if (!com.newgrounds.API.assertConnected()) {
return null;
}
var v1 = com.newgrounds.API.getSaveGroup(groupName);
if (!v1) {
com.newgrounds.Logger.logError('The save group "' + groupName + '" w found.');
return null;
}
var v2 = new com.newgrounds.SaveQuery(v1);
return v2;
};
v1.createSaveQueryByDate = function (groupName, sortDescending) {
if (sortDescending == undefined) {
sortDescending = true;
}
var v1 = com.newgrounds.API.createSaveQuery(groupName);
if (!v1) {
return null;
}
v1.sortOn(com.newgrounds.SaveQuery.CREATED_ON, sortDescending);
return v1;
};
v1.createSaveQueryByName = function (groupName, filename, exactMatch, sortDescending) {
if (exactMatch == undefined) {
exactMatch = false;
}
if (sortDescending == undefined) {
sortDescending = false;
}
var v1 = com.newgrounds.API.createSaveQuery(groupName);
if (!exactMatch) {
v1.addCondition(com.newgrounds.SaveQuery.FILE_NAME, com.newgrounds.SaveQuery.OPERATOR_CONTAINS, filename);
return v1;
}
v1.addCondition(com.newgrounds.SaveQuery.FILE_NAME, com.newgrounds.SaveQuery.OPERATOR_EQUAL, filename);
return v1;
};
v1.createSaveQueryByRating = function (groupName, ratingName, sortDescending) {
if (sortDescending == undefined) {
sortDescending = true;
}
var v1 = com.newgrounds.API.createSaveQuery(groupName);
v1.sortOn(ratingName, sortDescending);
return v1;
};
v1.onRequestedFileLoaded = function (event) {
com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.FILE_LOADED, com.newgrounds.API.onRequestedFileLoaded);
if (event.__get__success()) {
var v1 = event.__get__data();
if (v1) {
com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.FILE_REQUESTED, v1);
}
}
};
v1.addEventListener = function (eventType, listener, priority, useWeakReference) {
if (priority == undefined) {
priority = 0;
}
if (useWeakReference == undefined) {
useWeakReference = true;
}
com.newgrounds.API._dispatcher.addEventListener(eventType, listener, false, priority, useWeakReference);
};
v1.removeEventListener = function (eventType, listener) {
com.newgrounds.API._dispatcher.removeEventListener(eventType, listener);
};
v1.dispatchEvent = function (event, data, error) {
if (data == undefined) {
data = null;
}
if (error == undefined) {
error = null;
}
com.newgrounds.API._dispatcher.dispatchEvent(new com.newgrounds.APIEvent(event, data, error));
};
v1.saveLocal = function (saveId, saveData) {
try {
var v3;
var v2 = 'ng_ap_secure_' + com.newgrounds.API._connection.trackerId + '_' + com.newgrounds.crypto.RC4.encrypt(saveId, com.newgrounds.API._connection.encryptionKey);
if (!com.newgrounds.API._sharedObjects[saveId]) {
com.newgrounds.API._sharedObjects[saveId] = SharedObject.getLocal(v2);
}
v3 = com.newgrounds.API._sharedObjects[saveId];
v3.data.data = com.newgrounds.API.encodeData(saveData);
}
catch (v0) {
if (Error(v0) != null) {
var error = Error(v0);
com.newgrounds.Logger.logError('Unable to save local data.', error);
return false;
return true;
}
throw v0;
}
return true;
};
v1.loadLocal = function (saveId) {
try {
var v1;
var v3 = 'ng_ap_secure_' + com.newgrounds.API._connection.trackerId + '_' + com.newgrounds.crypto.RC4.encrypt(saveId, com.newgrounds.API._connection.encryptionKey);
if (!com.newgrounds.API._sharedObjects[saveId]) {
com.newgrounds.API._sharedObjects[saveId] = SharedObject.getLocal(v3);
}
v1 = com.newgrounds.API._sharedObjects[saveId];
if (v1 && v1.data && v1.data.data) {
return com.newgrounds.API.decodeData(v1.data.data);
}
return null;
}
catch (v0) {
if (Error(v0) != null) {
var error = Error(v0);
com.newgrounds.Logger.logError('Unable to load local data.', error);
return null;
}
throw v0;
}
return null;
};
v1.logCustomEvent = function (eventName) {
if (com.newgrounds.API.assertConnected()) {
com.newgrounds.Logger.logMessage('Logged event: ' + eventName);
com.newgrounds.API._connection.sendSimpleCommand('logCustomEvent', null, {'event': eventName});
}
};
v1.encodeData = function (data) {
if (!com.newgrounds.API._connection.assertInitialized()) {
return null;
}
return com.newgrounds.crypto.RC4.encrypt(com.newgrounds.encoders.json.JSON.encode(data), com.newgrounds.API._connection.encryptionKey);
};
v1.decodeData = function (data) {
if (!com.newgrounds.API._connection.assertInitialized()) {
return null;
}
try {
return com.newgrounds.encoders.json.JSON.decode(com.newgrounds.crypto.RC4.decrypt(data, com.newgrounds.API._connection.encryptionKey));
}
catch (v0) {
if (Error(v0) != null) {
var error = Error(v0);
return null;
}
throw v0;
}
return null;
};
v1.stopPendingCommands = function () {
com.newgrounds.APICommand.stopPendingCommands();
com.newgrounds.Logger.logMessage('Pending commands stopped.');
};
v1.trimWhitespace = function (string) {
if (!string) {
return null;
}
var v3 = 0;
while (string.charAt(v3) == ' ') {
++v3;
}
var v1 = string.length - 1;
for (;;) {
if (!(string.charAt(v1) == ' ' && v1 >= 0)) break;
--v1;
}
return string.slice(v3, v1 + 1);
};
v1.VERSION = '3.2 AS2';
v1.RELEASE_MODE = 'releaseMode';
v1.DEBUG_MODE_LOGGED_IN = 'debugModeLoggedIn';
v1.DEBUG_MODE_LOGGED_OUT = 'debugModeLoggedOut';
v1.DEBUG_MODE_NEW_VERSION = 'debugModeNewVersion';
v1.DEBUG_MODE_HOST_BLOCKED = 'debugModeHostBlocked';
v1.TEST_AD_FEED_URL = 'http://www.ngads.com/adtest.php';
v1.PASSPORT_URL = 'https://www.newgrounds.com/login/remote/';
v1._dispatcher = new com.newgrounds.APIEventDispatcher();
v1._connection = new com.newgrounds.APIConnection();
v1._debugMode = com.newgrounds.API.DEBUG_MODE_LOGGED_IN;
v1._adsApproved = false;
v1._medals = new Object();
v1._medalsArray = [];
v1._scoreBoards = new Object();
v1._scoreBoardsArray = [];
v1._saveGroups = new Object();
v1._saveGroupsArray = [];
v1._sharedObjects = new Object();
v1.addProperty('adFeedURL', v1.__get__adFeedURL, function () {});
v1.addProperty('adsApproved', v1.__get__adsApproved, function () {});
v1.addProperty('apiId', v1.__get__apiId, function () {});
v1.addProperty('connected', v1.__get__connected, function () {});
v1.addProperty('debugMode', v1.__get__debugMode, v1.__set__debugMode);
v1.addProperty('hasUserSession', v1.__get__hasUserSession, function () {});
v1.addProperty('hostDomain', v1.__get__hostDomain, function () {});
v1.addProperty('hostURL', v1.__get__hostURL, function () {});
v1.addProperty('isNetworkHost', v1.__get__isNetworkHost, function () {});
v1.addProperty('isNewgrounds', v1.__get__isNewgrounds, function () {});
v1.addProperty('medals', v1.__get__medals, function () {});
v1.addProperty('publisherId', v1.__get__publisherId, function () {});
v1.addProperty('saveGroups', v1.__get__saveGroups, function () {});
v1.addProperty('scoreBoards', v1.__get__scoreBoards, function () {});
v1.addProperty('serverTime', v1.__get__serverTime, function () {});
v1.addProperty('sessionId', v1.__get__sessionId, function () {});
v1.addProperty('userId', v1.__get__userId, function () {});
v1.addProperty('username', v1.__get__username, function () {});
ASSetPropFlags(com.newgrounds.API.prototype, null, 1);
}
#endinitclip
}
movieClip 136 __Packages.com.newgrounds.encoders.ImageScanner {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.encoders) {
_global.com.newgrounds.encoders = new Object();
}
if (!_global.com.newgrounds.encoders.ImageScanner) {
var v1 = function (hashLength, charsPerPixel) {
if (hashLength) {
this._hash = com.newgrounds.encoders.ImageScanner.DEFAULT_HASH.substr(0, hashLength);
}
this._baseN = new com.newgrounds.encoders.BaseN(this._hash);
if (charsPerPixel) {
this._charsPerPixel = charsPerPixel;
}
this.__set__encodeAlpha(false);
};
com.newgrounds.encoders.ImageScanner = v1;
var v2 = v1.prototype;
v2.__get__encodeAlpha = function () {
return this._encodeAlpha;
};
v2.__set__encodeAlpha = function (v) {
this._encodeAlpha = v;
this._maxPerChannel = int(Math.pow(this._hash.length, this._charsPerPixel / (this._encodeAlpha ? 4 : 3)));
if (this._maxPerChannel > 256) {
this._maxPerChannel = 256;
}
return this.__get__encodeAlpha();
};
v2.encode = function (source, callbackFunction, callbackObject) {
var v4 = {'callbackFunction': callbackFunction, 'callbackObject': callbackObject, 'source': source, 'x': 0, 'y': 0, 'output': null};
var v2 = source.width.toString();
var v3 = source.height.toString();
while (v2.length < 3) {
v2 = '0' + v2;
}
while (v3.length < 3) {
v3 = '0' + v3;
}
v4.output = v2 + v3;
var v6 = setInterval(this, 'doEncode', com.newgrounds.encoders.ImageScanner.WORK_INTERVAL, v4);
v4.interval = v6;
};
v2.decode = function (source, callbackFunction, callbackObject) {
var v4 = {'callbackFunction': callbackFunction, 'callbackObject': callbackObject, 'source': source, 'i': 6, 'x': 0, 'y': 0, 'output': null};
var v3 = source.substr(0, 3);
var v2 = source.substr(3, 3);
while (v3.charAt(0) == '0') {
v3 = v3.substr(1);
}
while (v2.charAt(0) == '0') {
v2 = v2.substr(1);
}
var v7 = int(v3);
var v8 = int(v2);
v4.output = new flash.display.BitmapData(v7, v8, this._encodeAlpha);
var v6 = setInterval(this, 'doDecode', com.newgrounds.encoders.ImageScanner.WORK_INTERVAL, v4);
v4.interval = v6;
};
v2.doEncode = function (state) {
var v3 = getTimer();
for (;;) {
if (!(state.y < state.source.height && getTimer() - v3 < com.newgrounds.encoders.ImageScanner.WORK_INTERVAL)) break;
state.output += this.encodePixel(state.source.getPixel32(state.x, state.y));
++state.x;
if (state.x == state.source.width) {
state.x = 0;
++state.y;
}
}
if (state.y == state.source.height) {
clearInterval(state.interval);
state.callbackFunction.call(state.callbackObject, state.output);
}
};
v2.doDecode = function (state) {
var v4 = getTimer();
for (;;) {
if (!(state.y < state.output.height && getTimer() - v4 < com.newgrounds.encoders.ImageScanner.WORK_INTERVAL)) break;
var v3 = this.decodePixel(state.source.substr(state.i, this._charsPerPixel));
state.output.setPixel32(state.x, state.y, v3);
state.i += this._charsPerPixel;
++state.x;
if (state.x == state.output.width) {
state.x = 0;
++state.y;
}
}
if (state.y == state.output.height) {
clearInterval(state.interval);
state.callbackFunction.call(state.callbackObject, state.output);
}
};
v2.encodePixel = function (pixel) {
var v3 = pixel >> 24 & 255;
var v4 = pixel >> 16 & 255;
var v5 = pixel >> 8 & 255;
var v2 = pixel & 255;
v3 = int((v3 / 256) * this._maxPerChannel);
v4 = int((v4 / 256) * this._maxPerChannel);
v5 = int((v5 / 256) * this._maxPerChannel);
v2 = int((v2 / 256) * this._maxPerChannel);
var v7 = v4 * this._maxPerChannel * this._maxPerChannel + v5 * this._maxPerChannel + v2;
if (this._encodeAlpha) {
v7 += v3 * this._maxPerChannel * this._maxPerChannel * this._maxPerChannel;
}
return this._baseN.encodeUint(v7, this._charsPerPixel);
};
v2.decodePixel = function (encodedPixel) {
var v3 = 255;
var v5;
var v6;
var v4;
var v7 = 0;
var v2 = this._baseN.decodeUint(encodedPixel);
v4 = v2 % this._maxPerChannel;
v2 /= int(this._maxPerChannel);
v6 = v2 % this._maxPerChannel;
v2 /= int(this._maxPerChannel);
v5 = v2 % this._maxPerChannel;
v2 /= int(this._maxPerChannel);
if (this._encodeAlpha) {
v3 = v2 % this._maxPerChannel;
v2 /= int(this._maxPerChannel);
}
return v3 << 24 | v5 << 16 | v6 << 8 | v4;
};
v1.DEFAULT_HASH = '0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ<>?:;-_=+()!&';
v2._hash = com.newgrounds.encoders.ImageScanner.DEFAULT_HASH;
v2._charsPerPixel = 2;
v1.WORK_INTERVAL = 33.33333333333334;
v2.addProperty('encodeAlpha', v2.__get__encodeAlpha, v2.__set__encodeAlpha);
ASSetPropFlags(com.newgrounds.encoders.ImageScanner.prototype, null, 1);
}
#endinitclip
}
movieClip 137 __Packages.com.newgrounds.SaveFile {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.SaveFile) {
var v1 = function (group) {
super();
this._iconLoader = new com.newgrounds.BitmapLoader(com.newgrounds.SaveFile.DEFAULT_ICON, null);
this._group = group;
this._keys = {};
this._ratings = {};
this._numVotes = {};
};
com.newgrounds.SaveFile = v1;
com.newgrounds.SaveFile extends com.newgrounds.APIEventDispatcher;
var v2 = v1.prototype;
v1.__get__currentFile = function () {
return com.newgrounds.SaveFile._currentFile;
};
v1.fromObject = function (group, fileData) {
var v3 = new com.newgrounds.SaveFile(group);
v3._name = fileData.filename;
v3._description = fileData.description;
v3._id = fileData.save_id;
v3._authorId = fileData.user_id;
v3._authorName = fileData.user_name;
v3._createdDate = fileData.created;
v3._modifiedDate = fileData.last_update;
v3._views = fileData.views;
if (fileData.thumb && fileData.thumb != '') {
v3._iconLoader.__set__url(com.newgrounds.SaveFile._imageFilePath + fileData.thumb + '?' + Math.random());
}
v3._dataURL = com.newgrounds.SaveFile._saveFilePath + fileData.file;
v3._fileSize = fileData.file_size;
v3._approved = fileData.status != com.newgrounds.SaveFile.STATUS_UNAPPROVED;
v3._readOnly = false;
v3._public = fileData.status != com.newgrounds.SaveFile.STATUS_PRIVATE && fileData.status != com.newgrounds.SaveFile.STATUS_UNAPPROVED;
for (var v8 in fileData.keys) {
var v6 = fileData.keys[v8];
var v4 = group.getKeyById(v6.id);
if (v4) {
v3._keys[v4.__get__name()] = v4.validateValue(v6.value);
}
}
for (var v9 in fileData.ratings) {
var v5 = fileData.ratings[v9];
var v2 = group.getRatingById(v5.id);
if (v2) {
v3._ratings[v2.__get__name()] = v2.validateValue(v5.score);
v3._numVotes[v2.__get__name()] = int(v5.votes);
}
}
return v3;
};
v2.__get__group = function () {
return this._group;
};
v2.__get__name = function () {
return this._name;
};
v2.__set__name = function (val) {
this._name = val;
return this.__get__name();
};
v2.__get__description = function () {
return this._description;
};
v2.__set__description = function (val) {
this._description = val;
return this.__get__description();
};
v2.__get__id = function () {
return this._id;
};
v2.__get__data = function () {
return this._data;
};
v2.__set__data = function (val) {
this._data = val;
return this.__get__data();
};
v2.__get__bytesLoaded = function () {
if (this._data) {
return this.__get__bytesTotal();
} else {
if (!this._dataLoader) {
return 0;
} else {
return this._dataLoader.getBytesLoaded();
}
}
};
v2.__get__bytesTotal = function () {
return this._fileSize;
};
v2.__get__readOnly = function () {
return this._readOnly;
};
v2.__get__draft = function () {
return this._draft;
};
v2.__set__draft = function (v) {
this._draft = v;
return this.__get__draft();
};
v2.__get__authorId = function () {
return this._authorId;
};
v2.__get__authorName = function () {
return this._authorName;
};
v2.__get__keys = function () {
return this._keys;
};
v2.__get__ratings = function () {
return this._ratings;
};
v2.__get__numVotes = function () {
return this._numVotes;
};
v2.__get__views = function () {
return this._views;
};
v2.__get__createdDate = function () {
return this._createdDate;
};
v2.__get__updatedDate = function () {
return this._modifiedDate;
};
v2.toString = function () {
return 'Save File: ' + this._name;
};
v2.__get__icon = function () {
return this._iconLoader.__get__bitmapData();
};
v2.__set__icon = function (v) {
this.createIcon(v);
return this.__get__icon();
};
v2.__get__iconLoaded = function () {
return this._iconLoader.__get__loaded();
};
v2.createIcon = function (source) {
var v9 = new flash.display.BitmapData(com.newgrounds.SaveFile.ICON_WIDTH, com.newgrounds.SaveFile.ICON_HEIGHT, false, 0);
var v7;
var v6;
var v10 = 0;
var v8 = 0;
if (source instanceof flash.display.BitmapData) {
v7 = source.width;
v6 = source.height;
} else {
if (source instanceof MovieClip) {
var v2 = (MovieClip(source)).getBounds(source);
v7 = v2.xMax - v2.xMin;
v6 = v2.yMax - v2.yMin;
v10 = v2.xMin;
v8 = v2.yMin;
}
}
var v4 = new flash.geom.Matrix();
var v5;
v5 = Math.min(com.newgrounds.SaveFile.ICON_WIDTH / v7, com.newgrounds.SaveFile.ICON_HEIGHT / v6);
v4.translate(-v10, -v8);
v4.scale(v5, v5);
v4.translate((com.newgrounds.SaveFile.ICON_WIDTH - v7 * v5) / 2, (com.newgrounds.SaveFile.ICON_HEIGHT - v6 * v5) / 2);
v9.draw(source, v4);
this._iconLoader.__set__bitmapData(v9);
};
v2.attachIcon = function (parent) {
if (this._iconLoader) {
return this._iconLoader.attachBitmap(parent);
}
com.newgrounds.Logger.logError('No icon available for this sumbission.');
return null;
};
v2.deleteFile = function () {
if (!(this._group.__get__connection()).__get__hasUserSession()) {
com.newgrounds.Logger.logError('The user must be logged-in to delete a file.');
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_DELETED, null, com.newgrounds.APIEvent.ERROR_NOT_LOGGED_IN));
return undefined;
}
if (!this._id) {
com.newgrounds.Logger.logError('The file does not exist.');
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_DELETED, null, com.newgrounds.APIEvent.ERROR_NOT_LOGGED_IN));
return undefined;
}
var v2 = new com.newgrounds.APICommand('deleteSaveFile');
(v2.__get__secureParameters()).save_id = this._id;
v2.addEventListener(com.newgrounds.APIEvent.COMMAND_COMPLETE, {'target': this, 'func': this.onFileDeleted});
(this._group.__get__connection()).sendCommand(v2);
};
v2.save = function () {
if (!(this._group.__get__connection()).__get__hasUserSession()) {
com.newgrounds.Logger.logError('The user must be logged-in to save a file.');
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_SAVED, null, com.newgrounds.APIEvent.ERROR_NOT_LOGGED_IN));
return undefined;
}
++com.newgrounds.BitmapLoader._cacheSeed;
com.newgrounds.SaveFile._currentFile = this;
if (this.__get__iconLoaded()) {
com.newgrounds.SaveFile.ICON_IMAGE_SCANNER.encode(this.__get__icon(), this.onIconEncoded, this);
} else {
this.encodeData(true);
}
};
v2.onIconEncoded = function (encodedIcon) {
this._encodedIcon = encodedIcon;
this.encodeData(true);
};
v2.doSave = function () {
var v4 = new com.newgrounds.APICommand('saveFile');
(v4.__get__secureParameters()).group = this._group.id;
(v4.__get__secureParameters()).user_name = (this._group.__get__connection()).username;
(v4.__get__secureParameters()).filename = this._name;
(v4.__get__secureParameters()).description = this._description;
if (this._draft) {
(v4.__get__secureParameters()).draft = true;
}
if (this._id && !this._readOnly) {
(v4.__get__secureParameters()).overwrite = 1;
(v4.__get__secureParameters()).save_id = this._id;
}
var v8 = [];
for (var v9 in this._keys) {
var v2 = this._group.getKey(v9);
if (v2) {
v8.push({'id': v2.__get__id(), 'value': v2.validateValue(this._keys[v9])});
} else {
com.newgrounds.Logger.logError('No key named "' + v9 + '" in save group "' + this._group.__get__name() + '".');
}
}
(v4.__get__secureParameters()).keys = v8;
var v7 = [];
for (var v10 in this._ratings) {
var v3 = this._group.getRating(v10);
if (v3) {
v7.push({'id': v3.__get__id(), 'value': v3.validateValue(this._ratings[v10])});
} else {
com.newgrounds.Logger.logError('No rating named "' + v10 + '" in save group "' + this._group.__get__name() + '".');
}
}
(v4.__get__secureParameters()).ratings = v7;
if (typeof this._encodedData == 'string') {
v4.addFile('file', this._encodedData, 'file');
} else {
v4.addFile('file', com.newgrounds.encoders.json.JSON.encode(this._encodedData), 'file');
}
if (this.__get__iconLoaded()) {
v4.addFile('thumbnail', this._encodedIcon, 'thumbnail');
}
v4.addEventListener(com.newgrounds.APIEvent.COMMAND_COMPLETE, {'target': this, 'func': this.onSaveComplete});
(this._group.__get__connection()).sendCommand(v4);
};
v2.encodeData = function (encode) {
this._encoderQueue = [];
this._encoding = encode;
if (encode) {
this._encodedData = this._data;
this.preEncodeObject(this, '_encodedData');
} else {
this.preEncodeObject(this, '_data');
}
this.encodeObject();
};
v2.preEncodeObject = function (parent, property) {
var v3 = parent[property];
var v5;
try {
if (this._encoding) {
v5 = v3 instanceof flash.display.BitmapData;
} else {
v5 = v3.type == '__bitmap';
}
}
var v2 = v3;
var v8;
if (v5) {
this._encoderQueue.push({'parent': parent, 'property': property});
} else {
if (typeof v3 == 'object' && !v8) {
if (this._encoding) {
if (v3 instanceof Array) {
v2 = [];
} else {
v2 = {};
}
for (var v4 in v3) {
v2[v4] = v3[v4];
}
parent[property] = v2;
}
for (v4 in v2) {
this.preEncodeObject(v2, v4);
}
}
}
};
v2.encodeObject = function () {
if (!this._encoderQueue.length) {
if (this._encoding) {
this.doSave();
} else {
this._dataLoaded = true;
this.checkLoadComplete();
}
return undefined;
}
var v6 = this._encoderQueue.pop();
var v4 = v6.parent;
var v3 = v6.property;
var v2 = v4[v3];
var v5;
if (this._encoding) {
v5 = {'type': '__bitmap', 'width': v2.width, 'height': v2.height, 'transparent': v2.transparent};
v4[v3] = v5;
this._encodingParent = v5;
this._encodingProperty = 'data';
com.newgrounds.SaveFile.DATA_IMAGE_SCANNER.__set__encodeAlpha(v2.transparent);
com.newgrounds.SaveFile.DATA_IMAGE_SCANNER.encode(flash.display.BitmapData(v2), this.encodeBitmapComplete, this);
} else {
this._encodingParent = v4;
this._encodingProperty = v3;
com.newgrounds.SaveFile.DATA_IMAGE_SCANNER.__set__encodeAlpha(v2.transparent);
com.newgrounds.SaveFile.DATA_IMAGE_SCANNER.decode(String(v2.data), this.encodeBitmapComplete, this);
}
};
v2.encodeBitmapComplete = function (data) {
this._encodingParent[this._encodingProperty] = data;
this.encodeObject();
};
v2.load = function () {
com.newgrounds.SaveFile._currentFile = this;
this._dataLoaded = false;
this._data = null;
if (!this.__get__iconLoaded()) {
this._iconLoader.addEventListener(com.newgrounds.APIEvent.ICON_LOADED, {'target': this, 'func': this.onIconLoaded});
this._iconLoader.load();
}
this._dataLoader = new LoadVars();
var file = this;
this._dataLoader.onData = function (data) {
file.onDataLoaded(data);
};
this._dataLoader.load(this._dataURL + '&random=' + Math.random());
};
v2.onIconLoaded = function (event) {
if (!event.__get__success() && this._iconLoader.__get__url()) {
com.newgrounds.Logger.logWarning('Unable to load the icon for this save file.');
}
this._iconLoader.removeEventListener(com.newgrounds.APIEvent.ICON_LOADED, this.onIconLoaded);
this.checkLoadComplete();
};
v2.checkLoadComplete = function () {
if (this._dataLoaded && this.__get__iconLoaded()) {
com.newgrounds.Logger.logMessage('Data loaded.');
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_LOADED, this));
}
};
v2.onDataLoaded = function (data) {
try {
if (data) {
if (data.charAt(0) == '{') {
this._data = com.newgrounds.encoders.json.JSON.decode(String(data));
} else {
this._data = String(data);
}
this.encodeData(false);
}
}
catch (v0) {
if (Error(v0) != null) {
var error = Error(v0);
com.newgrounds.Logger.logError('Error while loading data:', error);
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_LOADED, this, com.newgrounds.APIEvent.ERROR_BAD_FILE));
} else {
throw v0;
}
}
};
v2.onDataError = function (error) {
com.newgrounds.Logger.logError('Unable to load data:', error);
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_LOADED, this, com.newgrounds.APIEvent.ERROR_BAD_FILE));
};
v2.onSaveComplete = function (event) {
if (event.__get__success()) {
com.newgrounds.Logger.logMessage('File "' + this._name + '" saved!');
if (event.__get__data()) {
this._id = (event.__get__data()).save_id;
this._dataURL = unescape((event.__get__data()).file_url);
}
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_SAVED, this));
} else {
com.newgrounds.Logger.logError('Error saving file "' + this._name + '":', event.__get__error());
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_SAVED, this, event.__get__error()));
}
};
v2.sendVote = function (ratingName, vote) {
var v2 = this._group.getRating(ratingName);
if (!v2) {
com.newgrounds.Logger.logError('No save rating named "' + ratingName + '" exists for this save group.');
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.VOTE_COMPLETE, {}, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT));
return undefined;
}
vote = v2.validateValue(vote);
if (isNaN(vote)) {
com.newgrounds.Logger.logError('Invalid vote (' + vote + '). ' + ratingName + ' allows a range of ' + v2.__get__minimum() + '-' + v2.__get__maximum() + '.');
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.VOTE_COMPLETE, {}, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT));
return undefined;
}
com.newgrounds.Logger.logMessage('Voting ' + vote + ' for ' + ratingName + ' on ' + this._name + '...');
(this._group.__get__connection()).sendSimpleCommand('rateSaveFile', {'target': this, 'func': this.onVoteComplete}, null, {'group': this._group.__get__id(), 'save_id': this._id, 'rating_id': v2.__get__id(), 'vote': vote});
};
v2.onVoteComplete = function (event) {
var v2 = event.__get__error();
if ((event.__get__data()).already_voted) {
com.newgrounds.Logger.logError('Vote failed. You\'ve already voted on this rating today.');
v2 = com.newgrounds.APIEvent.ERROR_ALREADY_VOTED;
}
if (v2 == com.newgrounds.APIEvent.ERROR_NONE) {
var v3 = this._group.getRatingById((event.__get__data()).rating_id);
if (v3) {
this._ratings[v3.__get__name()] = v3.validateValue((event.__get__data()).score);
}
com.newgrounds.Logger.logMessage('Vote complete!');
}
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.VOTE_COMPLETE, this, v2));
};
v2.onFileDeleted = function (event) {
if (event.__get__success()) {
this._id = 0;
}
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_DELETED, this, event.__get__error()));
};
v2.clone = function () {
var v3 = new com.newgrounds.SaveFile(this._group);
v3._data = this._data;
v3._description = this._description;
v3._draft = this._draft;
v3._fileSize = this._fileSize;
v3._iconLoader.__set__bitmapData(this._iconLoader.bitmapData);
var v2;
for (v2 in this._keys) {
v3._keys[v2] = this._keys[v2];
}
for (v2 in this._ratings) {
v3._ratings[v2] = this._ratings[v2];
}
for (v2 in this._numVotes) {
v3._numVotes[v2] = this._numVotes[v2];
}
v3._name = this._name;
return v3;
};
v1.ICON_WIDTH = 90;
v1.ICON_HEIGHT = 90;
v1.DEFAULT_ICON = new flash.display.BitmapData(com.newgrounds.SaveFile.ICON_WIDTH, com.newgrounds.SaveFile.ICON_HEIGHT, false, 0);
v1.STATUS_PRIVATE = 0;
v1.STATUS_SHARED = 1;
v1.STATUS_UNAPPROVED = 2;
v1.STATUS_APPROVED = 3;
v1._imageFilePath = '';
v1._saveFilePath = '';
v1.ICON_IMAGE_SCANNER = new com.newgrounds.encoders.ImageScanner();
v1.DATA_IMAGE_SCANNER = new com.newgrounds.encoders.ImageScanner(64, 6);
v2.addProperty('authorId', v2.__get__authorId, function () {});
v2.addProperty('authorName', v2.__get__authorName, function () {});
v2.addProperty('bytesLoaded', v2.__get__bytesLoaded, function () {});
v2.addProperty('bytesTotal', v2.__get__bytesTotal, function () {});
v2.addProperty('createdDate', v2.__get__createdDate, function () {});
v1.addProperty('currentFile', v1.__get__currentFile, function () {});
v2.addProperty('data', v2.__get__data, v2.__set__data);
v2.addProperty('description', v2.__get__description, v2.__set__description);
v2.addProperty('draft', v2.__get__draft, v2.__set__draft);
v2.addProperty('group', v2.__get__group, function () {});
v2.addProperty('icon', v2.__get__icon, v2.__set__icon);
v2.addProperty('iconLoaded', v2.__get__iconLoaded, function () {});
v2.addProperty('id', v2.__get__id, function () {});
v2.addProperty('keys', v2.__get__keys, function () {});
v2.addProperty('name', v2.__get__name, v2.__set__name);
v2.addProperty('numVotes', v2.__get__numVotes, function () {});
v2.addProperty('ratings', v2.__get__ratings, function () {});
v2.addProperty('readOnly', v2.__get__readOnly, function () {});
v2.addProperty('updatedDate', v2.__get__updatedDate, function () {});
v2.addProperty('views', v2.__get__views, function () {});
ASSetPropFlags(com.newgrounds.SaveFile.prototype, null, 1);
}
#endinitclip
}
movieClip 135 __Packages.com.newgrounds.SaveGroup {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.SaveGroup) {
var v1 = function (connection, name, id, type, keys, ratings) {
this._connection = connection;
this._id = id;
this._name = name;
this._type = type;
this._keysArray = keys;
this._ratingsArray = ratings;
this._keys = new Object();
this._ratings = new Object();
var v11;
for (var v7 in keys) {
var v2 = keys[v7];
this._keys[v2.__get__name()] = v2;
}
for (var v6 in ratings) {
var v3 = ratings[v6];
this._ratings[v3.__get__name()] = v3;
}
};
com.newgrounds.SaveGroup = v1;
var v2 = v1.prototype;
v2.__get__connection = function () {
return this._connection;
};
v2.__get__name = function () {
return this._name;
};
v2.__get__type = function () {
return this._type;
};
v2.__get__id = function () {
return this._id;
};
v2.__get__keys = function () {
return this._keysArray;
};
v2.__get__ratings = function () {
return this._ratingsArray;
};
v2.getKey = function (name) {
return this._keys[name];
};
v2.getRating = function (name) {
return this._ratings[name];
};
v2.getKeyById = function (id) {
for (var v4 in this._keys) {
var v2 = this._keys[v4];
if (v2.__get__id() == id) {
return v2;
}
}
return null;
};
v2.getRatingById = function (id) {
for (var v4 in this._ratings) {
var v2 = this._ratings[v4];
if (v2.__get__id() == id) {
return v2;
}
}
return null;
};
v2.toString = function () {
return 'SaveGroup: ' + this.__get__name() + ' Keys: ' + this._keysArray + ' Ratings: ' + this._ratingsArray;
};
v1.TYPE_SYSTEM = 0;
v1.TYPE_PRIVATE = 1;
v1.TYPE_PUBLIC = 2;
v1.TYPE_MODERATED = 3;
v2.addProperty('connection', v2.__get__connection, function () {});
v2.addProperty('id', v2.__get__id, function () {});
v2.addProperty('keys', v2.__get__keys, function () {});
v2.addProperty('name', v2.__get__name, function () {});
v2.addProperty('ratings', v2.__get__ratings, function () {});
v2.addProperty('type', v2.__get__type, function () {});
ASSetPropFlags(com.newgrounds.SaveGroup.prototype, null, 1);
}
#endinitclip
}
movieClip 133 __Packages.com.newgrounds.SaveKey {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.SaveKey) {
var v1 = function (name, id, type) {
this._name = name;
this._id = id;
this._type = type;
};
com.newgrounds.SaveKey = v1;
var v2 = v1.prototype;
v2.__get__name = function () {
return this._name;
};
v2.__get__id = function () {
return this._id;
};
v2.__get__type = function () {
return this._type;
};
v2.validateValue = function (value) {
switch (this._type) {
return null;
case com.newgrounds.SaveKey.TYPE_INTEGER:
value = Number(value);
if (!isNaN(value)) {
var v3 = int(value);
if (v3 != value) {
com.newgrounds.Logger.logWarning('Float value ' + value + ' given for integer key "' + this._name + '". Clamping to ' + v3 + '.');
}
return v3;
}
return null;
case com.newgrounds.SaveKey.TYPE_FLOAT:
value = Number(value);
if (!isNaN(value)) {
return isNaN(Number(value));
}
return null;
case com.newgrounds.SaveKey.TYPE_BOOLEAN:
return Boolean(value) && int(value) != 0;
return null;
case com.newgrounds.SaveKey.TYPE_STRING:
return value ? value.toString() : '';
return null;
}
return null;
};
v2.toString = function () {
return this._name;
};
v1.TYPE_FLOAT = 1;
v1.TYPE_INTEGER = 2;
v1.TYPE_STRING = 3;
v1.TYPE_BOOLEAN = 4;
v2.addProperty('id', v2.__get__id, function () {});
v2.addProperty('name', v2.__get__name, function () {});
v2.addProperty('type', v2.__get__type, function () {});
ASSetPropFlags(com.newgrounds.SaveKey.prototype, null, 1);
}
#endinitclip
}
movieClip 134 __Packages.com.newgrounds.SaveRating {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.SaveRating) {
var v1 = function (name, id, isFloat, minimum, maximum) {
this._name = name;
this._id = id;
this._isFloat = isFloat;
this._minimum = minimum;
this._maximum = maximum;
};
com.newgrounds.SaveRating = v1;
var v2 = v1.prototype;
v2.__get__name = function () {
return this._name;
};
v2.__get__id = function () {
return this._id;
};
v2.__get__isFloat = function () {
return this._isFloat;
};
v2.__get__minimum = function () {
return this._minimum;
};
v2.__get__maximum = function () {
return this._maximum;
};
v2.validateValue = function (value) {
var v2 = Number(value);
if (isNaN(v2)) {
com.newgrounds.Logger.logError('Invalid value for rating "' + this._name + '".');
return NaN;
}
if (v2 < this._minimum) {
com.newgrounds.Logger.logWarning(v2 + ' is out of acceptable range for rating "' + this._name + '". Clamping to ' + this._minimum + '.');
return this._minimum;
}
if (v2 > this._maximum) {
com.newgrounds.Logger.logWarning(v2 + ' is out of acceptable range for rating "' + this._name + '". Clamping to ' + this._maximum + '.');
return this._maximum;
}
if (!this.__get__isFloat()) {
var v3 = int(v2);
if (v3 != v2) {
com.newgrounds.Logger.logWarning('Float value ' + v2 + ' given for integer rating "' + this._name + '". Clamping to ' + v3 + '.');
}
return v3;
}
return v2;
};
v2.toString = function () {
return this._name;
};
v2.addProperty('id', v2.__get__id, function () {});
v2.addProperty('isFloat', v2.__get__isFloat, function () {});
v2.addProperty('maximum', v2.__get__maximum, function () {});
v2.addProperty('minimum', v2.__get__minimum, function () {});
v2.addProperty('name', v2.__get__name, function () {});
ASSetPropFlags(com.newgrounds.SaveRating.prototype, null, 1);
}
#endinitclip
}
movieClip 129 __Packages.com.newgrounds.BitmapLoader {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.BitmapLoader) {
var v1 = function (defaultBitmap, url) {
super();
this._bitmapData = defaultBitmap;
this._url = url;
};
com.newgrounds.BitmapLoader = v1;
com.newgrounds.BitmapLoader extends com.newgrounds.APIEventDispatcher;
var v2 = v1.prototype;
v2.__get__url = function () {
return this._url;
};
v2.__set__url = function (v) {
this._loaded = false;
this._url = v;
return this.__get__url();
};
v2.__get__bitmapData = function () {
return this._bitmapData;
};
v2.__set__bitmapData = function (v) {
this._bitmapData = v;
this._loaded = true;
return this.__get__bitmapData();
};
v2.__get__loaded = function () {
return this._loaded;
};
v2.disposeLoader = function () {
if (this._loader) {
if (this._loaderClip._parent == _root) {
this._loader.unloadClip(this._loaderClip.bitmap);
this._loaderClip.removeMovieClip();
}
this._loader = null;
this._loaderClip = null;
}
};
v2.load = function () {
if (!this._url || this._url == '') {
this.onLoadComplete();
return undefined;
}
this._loaded = false;
if (this._bitmapData) {
this._bitmapData.dispose();
this._bitmapData = null;
}
this.disposeLoader();
this.attachBitmap(null);
};
v2.attachBitmap = function (parent) {
if (!parent) {
parent = _root;
}
var v5 = parent.getNextHighestDepth();
var v3 = parent.createEmptyMovieClip('__bitmap' + v5, v5);
if (!this._loaded && this._url && this._url != '') {
v3.createEmptyMovieClip('bitmap', 0);
this._loader = new MovieClipLoader();
this._loaderClip = v3;
if (parent == _root) {
this._loaderClip._visible = false;
}
var thisObj = this;
this._loaderClip.onEnterFrame = function () {
thisObj.pollLoad();
};
this._loader.addListener({'onLoadError': function () {
thisObj.onLoadComplete();
}});
this._loader.loadClip(this._url, v3.bitmap);
return v3;
}
v3.attachBitmap(this._bitmapData, 0);
return v3;
};
v2.pollLoad = function () {
if (this._loaderClip._width) {
this.onLoadComplete();
}
};
v2.onLoadComplete = function () {
var v2;
if (this._loader && this._loaderClip && this._loaderClip._width) {
try {
this._loaderClip.onEnterFrame = null;
v2 = new flash.display.BitmapData(this._loaderClip._width, this._loaderClip._height, true, 0);
v2.draw(this._loaderClip);
this._bitmapData = v2;
this._loaded = true;
}
catch (error) {
if (v2) {
v2.dispose();
}
}
}
this.disposeLoader();
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.ICON_LOADED, this, this._loaded ? null : com.newgrounds.APIEvent.ERROR_BAD_FILE));
};
v1._cacheSeed = 0;
v2._loaded = true;
v2.addProperty('bitmapData', v2.__get__bitmapData, v2.__set__bitmapData);
v2.addProperty('loaded', v2.__get__loaded, function () {});
v2.addProperty('url', v2.__get__url, v2.__set__url);
ASSetPropFlags(com.newgrounds.BitmapLoader.prototype, null, 1);
}
#endinitclip
}
movieClip 138 __Packages.com.newgrounds.SaveQuery {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.SaveQuery) {
var v1 = function (group) {
super();
this._group = group;
this._connection = group.connection;
this.reset();
};
com.newgrounds.SaveQuery = v1;
com.newgrounds.SaveQuery extends com.newgrounds.APIEventDispatcher;
var v2 = v1.prototype;
v2.__get__group = function () {
return this._group;
};
v2.__get__resultsPerPage = function () {
return this._resultsPerPage;
};
v2.__set__resultsPerPage = function (val) {
this._resultsPerPage = Math.min(Math.max(val, 1), 100);
return this.__get__resultsPerPage();
};
v2.__get__page = function () {
return this._page;
};
v2.__set__page = function (val) {
this._page = Math.max(val, 1);
return this.__get__page();
};
v2.prevPage = function () {
this.__set__page(this.__get__page() - 1);
};
v2.nextPage = function () {
this.__set__page(this.__get__page() + 1);
};
v2.__get__isRandomized = function () {
return this._isRandomized;
};
v2.__set__isRandomized = function (val) {
this._isRandomized = val;
return this.__get__isRandomized();
};
v2.__get__files = function () {
return this._files;
};
v2.reset = function () {
this._page = 1;
this._resultsPerPage = 10;
this._isRandomized = false;
this._lookupKeys = [];
this._lookupRatings = [];
this._fileConditions = [];
this._keyConditions = [];
this._ratingConditions = [];
this._sortFields = [];
this._files = [];
this.includeAllFields();
};
v2.clone = function () {
var v2 = new com.newgrounds.SaveQuery(this._group);
v2._page = this._page;
v2._resultsPerPage = this._resultsPerPage;
v2._isRandomized = this._isRandomized;
v2._lookupKeys = this._lookupKeys.concat();
v2._lookupRatings = this._lookupRatings.concat();
v2._fileConditions = this._fileConditions.concat();
v2._keyConditions = this._keyConditions.concat();
v2._ratingConditions = this._ratingConditions.concat();
return v2;
};
v2.includeAllFields = function () {
for (var v5 in this._group.__get__keys()) {
var v2 = (this._group.__get__keys())[v5];
this._lookupKeys.push(v2.__get__id());
}
for (var v4 in this._group.__get__ratings()) {
var v3 = (this._group.__get__ratings())[v4];
this._lookupRatings.push(v3.__get__id());
}
};
v2.addCondition = function (field, operator, value) {
var v2;
v2 = 0;
while (v2 < com.newgrounds.SaveQuery.FILE_FIELDS.length) {
if (com.newgrounds.SaveQuery.FILE_FIELDS[v2] == field) {
break;
}
++v2;
}
if (v2 == com.newgrounds.SaveQuery.FILE_FIELDS.length) {
v2 = -1;
}
if (v2 >= 0) {
this._fileConditions.push({'field': v2, 'operator': operator, 'value': value});
} else {
var v4 = this._group.getKey(field);
if (v4) {
value = v4.validateValue(value);
this._keyConditions.push({'key_id': v4.__get__id(), 'operator': operator, 'value': value});
return undefined;
}
var v3 = field.split('.');
var v6 = this._group.getRating(v3[0]);
if (v6) {
if (v3[1] != 'votes') {
value = v6.validateValue(value);
}
this._ratingConditions.push({'rating_id': v6.__get__id(), 'operator': operator, 'value': value, 'column': v3[1] ? v3[1] : 'score'});
return undefined;
}
com.newgrounds.Logger.logError('The save group "' + this._group.__get__name() + '" does not have a field named "' + field + '".');
}
};
v2.sortOn = function (field, sortDescending) {
if (sortDescending == undefined) {
sortDescending = false;
}
var v2;
v2 = 0;
while (v2 < com.newgrounds.SaveQuery.FILE_FIELDS.length) {
if (com.newgrounds.SaveQuery.FILE_FIELDS[v2] == field) {
break;
}
++v2;
}
if (v2 == com.newgrounds.SaveQuery.FILE_FIELDS.length) {
v2 = -1;
}
if (v2 >= 0) {
this._sortFields.push({'table': com.newgrounds.SaveQuery.TABLE_FILES, 'field': v2, 'desc': sortDescending});
} else {
var v5 = this._group.getKey(field);
if (v5) {
this._sortFields.push({'table': com.newgrounds.SaveQuery.TABLE_KEYS, 'field': v5.__get__id(), 'desc': sortDescending});
return undefined;
}
var v3 = field.split('.');
var v6 = this._group.getRating(v3[0]);
if (v6) {
this._sortFields.push({'table': com.newgrounds.SaveQuery.TABLE_RATINGS, 'field': v6.__get__id(), 'desc': sortDescending, 'extra': v3[1] ? v3[1] : 'score'});
return undefined;
}
com.newgrounds.Logger.logError('The save group "' + this._group.__get__name() + '" does not have a field named "' + field + '".');
}
};
v2.execute = function () {
var v5 = {};
v5.page = this._page;
v5.num_results = this._resultsPerPage;
if (this._isRandomized) {
v5.randomize = 1;
}
if (this._lookupKeys && this._lookupKeys.length) {
v5.lookup_keys = this._lookupKeys;
}
if (this._lookupRatings && this._lookupRatings.length) {
v5.lookup_ratings = this._lookupRatings;
}
if (this._fileConditions && this._fileConditions.length) {
v5.file_conditions = this._fileConditions;
}
if (this._keyConditions && this._keyConditions.length) {
v5.key_conditions = this._keyConditions;
}
if (this._ratingConditions && this._ratingConditions.length) {
v5.rating_conditions = this._ratingConditions;
}
if (this._sortFields && this._sortFields.length) {
v5.sort_conditions = this._sortFields;
}
this._connection.sendSimpleCommand('lookupSaveFiles', {'target': this, 'func': this.onQueryComplete}, {'publisher_id': this._connection.publisherId, 'group_id': this._group.__get__id(), 'query': v5});
};
v2.onQueryComplete = function (event) {
if (event.__get__success()) {
var v4 = event.__get__data();
this._files = [];
if (v4.files) {
var v2 = 0;
while (v2 < v4.files.length) {
var v3 = com.newgrounds.SaveFile.fromObject(this._group, v4.files[v2]);
if (v3) {
this._files.push(v3);
}
++v2;
}
}
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.QUERY_COMPLETE, this));
} else {
com.newgrounds.Logger.logError('Query failed: ' + event.__get__error());
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.QUERY_COMPLETE, this, event.__get__error()));
}
};
v1.FILE_ID = 'fileId';
v1.AUTHOR_ID = 'authorId';
v1.AUTHOR_NAME = 'authorName';
v1.FILE_NAME = 'fileName';
v1.CREATED_ON = 'createdOn';
v1.UPDATED_ON = 'updatedOn';
v1.FILE_VIEWS = 'fileViews';
v1.FILE_STATUS = 'fileStatus';
v1.FILE_FIELDS = [com.newgrounds.SaveQuery.FILE_ID, com.newgrounds.SaveQuery.AUTHOR_ID, com.newgrounds.SaveQuery.AUTHOR_NAME, com.newgrounds.SaveQuery.FILE_NAME, com.newgrounds.SaveQuery.CREATED_ON, com.newgrounds.SaveQuery.UPDATED_ON, com.newgrounds.SaveQuery.FILE_VIEWS, com.newgrounds.SaveQuery.FILE_STATUS];
v1.OPERATOR_EQUAL = '=';
v1.OPERATOR_LESS_THAN = '<';
v1.OPERATOR_GREATER_THAN = '>';
v1.OPERATOR_NOT_EQUAL = '!=';
v1.OPERATOR_LESS_OR_EQUAL = '<=';
v1.OPERATOR_GREATER_OR_EQUAL = '>=';
v1.OPERATOR_CONTAINS = '*';
v1.OPERATOR_NOT_CONTAINS = '!*';
v1.OPERATOR_NOT_BEGINS_WITH = '!*=';
v1.OPERATOR_NOT_ENDS_WITH = '!=*';
v1.OPERATOR_BEGINS_WITH = '*=';
v1.OPERATOR_ENDS_WITH = '=*';
v1.TABLE_FILES = 1;
v1.TABLE_KEYS = 2;
v1.TABLE_RATINGS = 3;
v2._page = 1;
v2._resultsPerPage = 10;
v2._isRandomized = false;
v2.addProperty('files', v2.__get__files, function () {});
v2.addProperty('group', v2.__get__group, function () {});
v2.addProperty('isRandomized', v2.__get__isRandomized, v2.__set__isRandomized);
v2.addProperty('page', v2.__get__page, v2.__set__page);
v2.addProperty('resultsPerPage', v2.__get__resultsPerPage, v2.__set__resultsPerPage);
ASSetPropFlags(com.newgrounds.SaveQuery.prototype, null, 1);
}
#endinitclip
}
movieClip 130 __Packages.com.newgrounds.Medal {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.Medal) {
var v1 = function (connection, id, name, description, secret, unlocked, value, difficultyId, iconURL) {
super();
this._connection = connection;
this._id = id;
this._name = name;
this._description = description;
this._secret = secret;
this._unlocked = unlocked;
this._value = value;
this._difficulty = com.newgrounds.Medal.DIFFICULTIES[difficultyId];
this._iconLoader = new com.newgrounds.BitmapLoader(com.newgrounds.Medal.DEFAULT_ICON, iconURL);
this._iconLoader.load();
};
com.newgrounds.Medal = v1;
com.newgrounds.Medal extends com.newgrounds.APIEventDispatcher;
var v2 = v1.prototype;
v2.__get__difficulty = function () {
return this._difficulty;
};
v2.__get__icon = function () {
return this._iconLoader.__get__bitmapData();
};
v2.__get__id = function () {
return this._id;
};
v2.__get__name = function () {
return this._name;
};
v2.__get__description = function () {
return this._description;
};
v2.__get__secret = function () {
return this._secret;
};
v2.__get__unlocked = function () {
return this._unlocked;
};
v2.__get__value = function () {
return this._value;
};
v2.toString = function () {
if (!this._unlocked) {
return 'Medal: ' + this._name + '\t\t(' + 'locked, ' + this._value + 'pts, ' + this._difficulty + ')';
}
return 'Medal: ' + this._name + '\t\t(' + 'unlocked, ' + this._value + 'pts, ' + this._difficulty + ')';
};
v2.attachIcon = function (parent) {
return this._iconLoader.attachBitmap(parent);
};
v2.unlock = function () {
if (this._unlocked) {
com.newgrounds.Logger.logWarning('Medal "' + this._name + '" is already unlocked.');
return undefined;
}
com.newgrounds.Logger.logMessage('Unlocking medal "' + this.__get__name() + '"...');
this._unlocked = true;
if (this._connection.__get__hasUserSession()) {
this._connection.sendSimpleCommand('unlockMedal', {'target': this, 'func': this.onUnlockConfirmed}, null, {'medal_id': this.__get__id()});
}
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.MEDAL_UNLOCKED, this));
};
v2.setUnlocked = function (unlocked) {
this._unlocked = unlocked;
};
v2.onUnlockConfirmed = function (event) {
if (event.__get__success()) {
com.newgrounds.Logger.logMessage('Medal "' + this.__get__name() + '" unlocked.');
} else {
com.newgrounds.Logger.logError('Failed to unlock "' + this.__get__name() + '"!');
}
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.MEDAL_UNLOCK_CONFIRMED, this, event.__get__error()));
};
v1.ICON_WIDTH = 50;
v1.ICON_HEIGHT = 50;
v1.DEFAULT_ICON = flash.display.BitmapData.loadBitmap('DefaultMedalIcon');
v1.DIFFICULTY_EASY = 'Easy';
v1.DIFFICULTY_MODERATE = 'Moderate';
v1.DIFFICULTY_CHALLENGING = 'Challenging';
v1.DIFFICULTY_DIFFICULT = 'Difficult';
v1.DIFFICULTY_BRUTAL = 'Brutal';
v1.DIFFICULTIES = ['Unknown', com.newgrounds.Medal.DIFFICULTY_EASY, com.newgrounds.Medal.DIFFICULTY_MODERATE, com.newgrounds.Medal.DIFFICULTY_CHALLENGING, com.newgrounds.Medal.DIFFICULTY_DIFFICULT, com.newgrounds.Medal.DIFFICULTY_BRUTAL];
v2.addProperty('description', v2.__get__description, function () {});
v2.addProperty('difficulty', v2.__get__difficulty, function () {});
v2.addProperty('icon', v2.__get__icon, function () {});
v2.addProperty('id', v2.__get__id, function () {});
v2.addProperty('name', v2.__get__name, function () {});
v2.addProperty('secret', v2.__get__secret, function () {});
v2.addProperty('unlocked', v2.__get__unlocked, function () {});
v2.addProperty('value', v2.__get__value, function () {});
ASSetPropFlags(com.newgrounds.Medal.prototype, null, 1);
}
#endinitclip
}
movieClip 132 __Packages.com.newgrounds.ScoreBoard {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.ScoreBoard) {
var v1 = function (connection, name, id) {
super();
this._connection = connection;
this._name = name;
this._id = id;
};
com.newgrounds.ScoreBoard = v1;
com.newgrounds.ScoreBoard extends com.newgrounds.APIEventDispatcher;
var v2 = v1.prototype;
v2.__get__name = function () {
return this._name;
};
v2.__get__scores = function () {
return this._scores;
};
v2.__get__period = function () {
return this._period;
};
v2.__set__period = function (val) {
this._period = val;
return this.__get__period();
};
v2.__get__firstResult = function () {
return this._firstResult;
};
v2.__set__firstResult = function (val) {
this._firstResult = Math.max(1, val);
return this.__get__firstResult();
};
v2.__get__numResults = function () {
return this._numResults;
};
v2.__set__numResults = function (val) {
this._numResults = val;
return this.__get__numResults();
};
v2.__get__friendsOf = function () {
return this._friendsOf;
};
v2.__set__friendsOf = function (val) {
this._friendsOf = val;
return this.__get__friendsOf();
};
v2.__get__tag = function () {
return this._tag;
};
v2.__set__tag = function (val) {
this._tag = val;
return this.__get__tag();
};
v2.__get__page = function () {
return Math.ceil((this._firstResult - 1) / this._numResults) + 1;
};
v2.prevPage = function () {
if (this.__get__firstResult() > this._numResults) {
this.firstResult -= this._numResults;
}
};
v2.nextPage = function () {
this.firstResult += this._numResults;
};
v2.loadScores = function () {
var v2 = {'publisher_id': this._connection.publisherId, 'board': this._id, 'page': (this._firstResult - 1) / this._numResults + 1, 'num_results': this._numResults, 'period': this._period, 'tag': this._tag};
if (this._friendsOf > 0) {
v2.friends_of = this._friendsOf;
}
this._connection.sendSimpleCommand('loadScores', {'target': this, 'func': this.onScoresLoaded}, v2);
};
v2.postScore = function (numericScore, tag) {
if (tag == undefined) {
tag = null;
}
if (isNaN(numericScore)) {
com.newgrounds.Logger.logError('Cannot post invalid score: ' + numericScore);
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.SCORE_POSTED, null, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT));
return undefined;
}
com.newgrounds.Logger.logMessage('Posting a score of ' + numericScore + ' by ' + this._connection.username + ' to scoreboard "' + this._name + '"...');
this._connection.sendSimpleCommand('postScore', {'target': this, 'func': this.onScorePosted}, null, {'user_name': this._connection.username, 'board': this._id, 'value': numericScore, 'tag': tag});
};
v2.onScoresLoaded = function (event) {
var v4 = event.__get__data();
this._scores = [];
var v5;
if (v4.first_result) {
v5 = v4.first_result;
} else {
v5 = this._firstResult;
}
if (v4.scores) {
var v3 = 0;
while (v3 < v4.scores.length) {
var v2 = v4.scores[v3];
if (v2) {
this._scores[v3] = new com.newgrounds.Score(v5, v2.username, v2.value, v2.numeric_value, v2.tag);
}
v3++;
v5++;
}
}
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.SCORES_LOADED, this));
};
v2.onScorePosted = function (event) {
if (event.__get__success()) {
com.newgrounds.Logger.logMessage('Score posted!');
var v4 = event.__get__data();
var v2 = {};
v2.score = v4.value;
v2.scoreBoard = this;
} else {
com.newgrounds.Logger.logError('Error posting score: ' + event.__get__error());
}
this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.SCORE_POSTED, storedv2, event.__get__error()));
};
v2.toString = function () {
return 'Scoreboard: ' + this._name;
};
v1.TODAY = 'Today';
v1.THIS_WEEK = 'This Week';
v1.THIS_MONTH = 'This Month';
v1.THIS_YEAR = 'This Year';
v1.ALL_TIME = 'All-Time';
v2._period = com.newgrounds.ScoreBoard.ALL_TIME;
v2._firstResult = 1;
v2._numResults = 10;
v2.addProperty('firstResult', v2.__get__firstResult, v2.__set__firstResult);
v2.addProperty('friendsOf', v2.__get__friendsOf, v2.__set__friendsOf);
v2.addProperty('name', v2.__get__name, function () {});
v2.addProperty('numResults', v2.__get__numResults, v2.__set__numResults);
v2.addProperty('page', v2.__get__page, function () {});
v2.addProperty('period', v2.__get__period, v2.__set__period);
v2.addProperty('scores', v2.__get__scores, function () {});
v2.addProperty('tag', v2.__get__tag, v2.__set__tag);
ASSetPropFlags(com.newgrounds.ScoreBoard.prototype, null, 1);
}
#endinitclip
}
movieClip 121 __Packages.com.newgrounds.Logger {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.Logger) {
var v1 = function () {};
com.newgrounds.Logger = v1;
var v2 = v1.prototype;
v1.logInternal = function () {
var v2 = arguments;
com.newgrounds.Logger.log(com.newgrounds.Logger.PRIORITY_INTERNAL, v2);
};
v1.logMessage = function () {
var v2 = arguments;
com.newgrounds.Logger.log(com.newgrounds.Logger.PRIORITY_MESSAGE, v2);
};
v1.logWarning = function () {
var v2 = arguments;
com.newgrounds.Logger.log(com.newgrounds.Logger.PRIORITY_WARNING, v2);
};
v1.logError = function () {
var v2 = arguments;
com.newgrounds.Logger.log(com.newgrounds.Logger.PRIORITY_ERROR, v2);
};
v1.log = function (priority, messages) {
if (priority == undefined) {
priority = com.newgrounds.Logger.PRIORITY_MESSAGE;
}
if (messages == undefined) {
messages = null;
}
if (priority >= com.newgrounds.Logger._messageLevel) {
var v1 = 0;
while (v1 < messages.length) {
trace(com.newgrounds.Logger.HEADER + messages[v1]);
com.newgrounds.Logger._eventDispatcher.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.LOG, messages[v1]));
++v1;
}
}
if (priority >= com.newgrounds.Logger._throwLevel) {
throw new Error(messages.join('\n'));
}
};
v1.addEventListener = function (event, listener) {
com.newgrounds.Logger._eventDispatcher.addEventListener(event, listener, false, 0, false);
};
v1.PRIORITY_INTERNAL = 0;
v1.PRIORITY_MESSAGE = 1;
v1.PRIORITY_WARNING = 2;
v1.PRIORITY_ERROR = 3;
v1.PRIORITY_MAX = 4;
v1.HEADER = '[Newgrounds API] :: ';
v1._eventDispatcher = new com.newgrounds.EventDispatcher();
v1._messageLevel = com.newgrounds.Logger.PRIORITY_INTERNAL;
v1._throwLevel = com.newgrounds.Logger.PRIORITY_MAX;
ASSetPropFlags(com.newgrounds.Logger.prototype, null, 1);
}
#endinitclip
}
movieClip 140 __Packages.com.newgrounds.components.FlashAdBase {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.components) {
_global.com.newgrounds.components = new Object();
}
if (!_global.com.newgrounds.components.FlashAdBase) {
var v1 = function () {
super();
try {
System.security.allowDomain('server.cpmstar.com');
System.security.allowInsecureDomain('server.cpmstar.com');
}
this.gotoAndStop('idle');
this._x = int(this._x);
this._y = int(this._y);
this.stop();
if (this.__get___newgroundsButton()) {
(this.__get___newgroundsButton()).onRelease = this.onNGClick;
}
this.onUnload = this.removeAd;
var v4 = this;
this._adListener = {'onLoadError': function (target, error, httpStatus) {
target._parent.onAdError(target, error, httpStatus);
}};
if (this.__get__fullScreen()) {
this.drawFullScreenRect();
}
if (com.newgrounds.API.__get__adFeedURL()) {
this.loadAdFeed();
} else {
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.API_CONNECTED, {'target': this, 'func': this.loadAdFeed});
}
};
com.newgrounds.components.FlashAdBase = v1;
com.newgrounds.components.FlashAdBase extends MovieClip;
var v2 = v1.prototype;
v2.__get___adContainer = function () {
return this.adContainer;
};
v2.__get___newgroundsButton = function () {
return this.newgroundsButton;
};
v2.__get__fullScreen = function () {
return this._fullScreen;
};
v2.__set__fullScreen = function (v) {
this._fullScreen = v;
if (v) {
this.drawFullScreenRect();
} else {
this.clear();
}
return this.__get__fullScreen();
};
v2.__get__showBorder = function () {
return this._showBorder;
};
v2.__set__showBorder = function (value) {
this._showBorder = value;
if (this._showBorder) {
if (this._ad) {
var v2 = this._ad.getProgress(this.__get___adContainer());
if (v2.bytesLoaded >= v2.bytesTotal) {
this.gotoAndStop('loaded');
} else {
this.gotoAndStop('loading');
}
} else {
this.gotoAndStop('idle');
}
} else {
this.gotoAndStop('noBorder');
}
return this.__get__showBorder();
};
v2.loadAdFeed = function (event) {
if (event == undefined) {
event = null;
}
this._adFeedLoader = new LoadVars();
var target = this;
this._adFeedLoader.onData = function (data) {
target.onAdFeedLoaded(data);
};
this._adFeedLoader.load(com.newgrounds.API.__get__adFeedURL(), this._adFeedLoader);
};
v2.onAdFeedLoaded = function (data) {
if (data && data != '') {
this.loadAd(data);
} else {
this.onAdError();
}
};
v2.loadAd = function (adURL) {
if (this.adType != this.VIDEO_ADS) {
if (adURL.indexOf('?') >= 0) {
adURL += '&';
} else {
adURL += '?';
}
adURL += 'blockoverlays=1';
}
this._ad = new MovieClipLoader();
this._ad.addListener(this._adListener);
(this.__get___adContainer())._lockroot = true;
this._ad.loadClip(adURL, this.__get___adContainer());
};
v2.removeAd = function () {
this._adFeedLoader.onData = null;
this._adFeedLoader = null;
this._ad.removeListener(this._adListener);
if (this.__get___adContainer()) {
this._ad.unloadClip(this.__get___adContainer());
}
this._ad = null;
};
v2.onAdError = function (target, error, httpStatus) {
com.newgrounds.Logger.logError('Unable to load ad.');
this.removeAd();
};
v2.onNGClick = function () {
com.newgrounds.API.loadNewgrounds();
};
v2.drawFullScreenRect = function () {
this._x = (Stage.width - this._width) / 2;
this._y = (Stage.height - this._height) / 2;
this.beginFill(0);
this.moveTo(-Stage.width, -Stage.height);
this.lineTo(Stage.width, -Stage.height);
this.lineTo(Stage.width, Stage.height);
this.lineTo(-Stage.width, Stage.height);
this.lineTo(-Stage.width, -Stage.height);
this.endFill();
};
v2._showBorder = true;
v2.adType = com.newgrounds.components.FlashAdBase.prototype.VIDEO_ADS;
v2.VIDEO_ADS = 'Video';
v2.SIMPLE_ADS = 'Simple';
v2.addProperty('_adContainer', v2.__get___adContainer, function () {});
v2.addProperty('_newgroundsButton', v2.__get___newgroundsButton, function () {});
v2.addProperty('fullScreen', v2.__get__fullScreen, v2.__set__fullScreen);
v2.addProperty('showBorder', v2.__get__showBorder, v2.__set__showBorder);
ASSetPropFlags(com.newgrounds.components.FlashAdBase.prototype, null, 1);
}
#endinitclip
}
movieClip 131 __Packages.com.newgrounds.Score {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.Score) {
var v1 = function (rank, username, score, numericValue, tag) {
this._rank = rank;
this._username = username;
this._score = score;
this._numericValue = numericValue;
this._tag = tag;
};
com.newgrounds.Score = v1;
var v2 = v1.prototype;
v2.__get__numericValue = function () {
return this._numericValue;
};
v2.__get__rank = function () {
return this._rank;
};
v2.__get__score = function () {
return this._score;
};
v2.__get__tag = function () {
return this._tag;
};
v2.__get__username = function () {
return this._username;
};
v2.toString = function () {
return this._rank + '.\t' + this._username + '\t' + this._score;
};
v2.addProperty('numericValue', v2.__get__numericValue, function () {});
v2.addProperty('rank', v2.__get__rank, function () {});
v2.addProperty('score', v2.__get__score, function () {});
v2.addProperty('tag', v2.__get__tag, function () {});
v2.addProperty('username', v2.__get__username, function () {});
ASSetPropFlags(com.newgrounds.Score.prototype, null, 1);
}
#endinitclip
}
movieClip 115 __Packages.com.newgrounds.shims.APIShim {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.shims) {
_global.com.newgrounds.shims = new Object();
}
if (!_global.com.newgrounds.shims.APIShim) {
var v1 = function () {
super();
};
com.newgrounds.shims.APIShim = v1;
com.newgrounds.shims.APIShim extends MovieClip;
var v2 = v1.prototype;
ASSetPropFlags(com.newgrounds.shims.APIShim.prototype, null, 1);
}
#endinitclip
}
movieClip 123 __Packages.com.newgrounds.encoders.json.JSON {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.encoders) {
_global.com.newgrounds.encoders = new Object();
}
if (!_global.com.newgrounds.encoders.json) {
_global.com.newgrounds.encoders.json = new Object();
}
if (!_global.com.newgrounds.encoders.json.JSON) {
var v1 = function () {};
com.newgrounds.encoders.json.JSON = v1;
var v2 = v1.prototype;
v1.encode = function (arg, noquotes) {
var v3;
var v2;
var v6;
var v1 = '';
var v4;
if (arg.isSServerVar()) {
var v8 = 'sservervariable';
} else {
var v8 = typeof arg;
}
switch (v8) {
return 'null';
case 'sservervariable':
return '?' + arg.getEncodedValue();
break;
case 'object':
if (arg) {
if (arg instanceof Array) {
v2 = 0;
while (v2 < arg.length) {
v4 = com.newgrounds.encoders.json.JSON.encode(arg[v2]);
if (v1) {
v1 += ',';
}
v1 += v4;
++v2;
}
return '[' + v1 + ']';
} else {
if (typeof arg.toString != 'undefined') {
for (v2 in arg) {
v4 = arg[v2];
if (typeof v4 != 'undefined' && typeof v4 != 'function') {
v4 = com.newgrounds.encoders.json.JSON.encode(v4);
if (v1) {
v1 += ',';
}
v1 += com.newgrounds.encoders.json.JSON.encode(v2) + ':' + v4;
}
}
return '{' + v1 + '}';
}
}
}
return 'null';
case 'number':
return isFinite(arg) ? String(arg) : 'null';
case 'string':
v6 = arg.length;
if (noquotes) {
var v7 = '';
} else {
var v7 = '"';
}
v1 = v7;
v2 = 0;
while (v2 < v6) {
v3 = arg.charAt(v2);
if (v3 >= ' ') {
if (v3 == '\\' || v3 == '"') {
v1 += '\\';
}
v1 += v3;
} else {
switch (v3) {
case '\b':
v1 += '\\b';
break;
case '\f':
v1 += '\\f';
break;
case '\n':
v1 += '\\n';
break;
case '\r':
v1 += '\\r';
break;
case '\t':
v1 += '\\t';
break;
default:
v3 = v3.charCodeAt();
v1 += '\\u00' + (Math.floor(v3 / 16)).toString(16) + (v3 % 16).toString(16);
}
}
v2 += 1;
}
return v1 + v7;
case 'boolean':
return String(arg);
default:
return 'null';
}
};
v1.background_encode = function (arg, callback) {
if (com.newgrounds.encoders.json.JSON.busy) {
trace('[Newgrounds Encoder] :: Cannot encode a new file until the previous file is completed');
return false;
} else {
if (!callback) {
trace('[Newgrounds Encoder] :: Missing a callback function, skipping encode');
return false;
}
}
com.newgrounds.encoders.json.JSON.busy = true;
var v2 = new Date();
com.newgrounds.encoders.json.JSON.start = v2.getTime();
com.newgrounds.encoders.json.JSON.cache = {'busy': false, 'complete': false, 'arg': arg, 'target': arg, 'parents': [], 'encoded': '', 'callback': callback, 'encode_chunk': function () {
com.newgrounds.encoders.json.JSON.encode_chunk();
}};
if (com.newgrounds.encoders.json.JSON.getType(arg) == 'object') {
com.newgrounds.encoders.json.JSON.cache.encoded = '{';
com.newgrounds.encoders.json.JSON.interval = setInterval(com.newgrounds.encoders.json.JSON.cache, 'encode_chunk', 25);
return true;
}
if (com.newgrounds.encoders.json.JSON.getType(arg) == 'array') {
com.newgrounds.encoders.json.JSON.cache.encoded = '[';
}
com.newgrounds.encoders.json.JSON.interval = setInterval(com.newgrounds.encoders.json.JSON.cache, 'encode_chunk', 25);
return true;
};
v1.background_decode = function (arg, callback) {
if (com.newgrounds.encoders.json.JSON.busy) {
trace('[Newgrounds Encoder] :: Cannot decode a new file until the previous file is completed');
return false;
} else {
if (!callback) {
trace('[Newgrounds Encoder] :: Missing a callback function, skipping decode');
return false;
}
}
com.newgrounds.encoders.json.JSON.busy = true;
var v1 = new Date();
com.newgrounds.encoders.json.JSON.start = v1.getTime();
com.newgrounds.encoders.json.JSON.cache = {'busy': false, 'callback': callback, 'complete': false, 'arg': arg, 'pos': 0, 'parents': ['root'], 'target': null, 'scratch': '', 'decode_chunk': function () {
com.newgrounds.encoders.json.JSON.decode_chunk();
}};
com.newgrounds.encoders.json.JSON.interval = setInterval(com.newgrounds.encoders.json.JSON.cache, 'decode_chunk', 25);
return true;
};
v1.decode = function (text) {
var at = 0;
var ch = ' ';
var _value;
var _error = function (m) {
throw {'name': 'JSONError', 'message': m, 'at': at - 1, 'text': text};
};
var _next = function () {
ch = text.charAt(at);
at += 1;
return ch;
};
var _white = function () {
while (ch) {
if (ch <= ' ') {
_next();
} else {
if (ch == '/') {
switch (_next()) {
case '/':
for (;;) {
if (!(_next() && ch != '\n' && ch != '\r')) break;
}
break;
case '*':
_next();
for (;;) {
if (ch) {
if (ch == '*') {
if (_next() == '/') {
_next();
break;
}
} else {
_next();
}
continue;
}
_error('Unterminated comment');
}
break;
default:
_error('Syntax error');
}
} else {
break;
}
}
}
};
var _string = function () {
var v4;
var v1 = '';
var v3;
var v2;
var v5 = false;
if (ch == '"') {
while (_next()) {
if (ch == '"') {
_next();
return v1;
} else {
if (ch == '\\') {
switch (_next()) {
case 'b':
v1 += '\b';
break;
case 'f':
v1 += '\f';
break;
case 'n':
v1 += '\n';
break;
case 'r':
v1 += '\r';
break;
case 't':
v1 += '\t';
break;
case 'u':
v2 = 0;
v4 = 0;
while (v4 < 4) {
v3 = parseInt(_next(), 16);
if (!isFinite(v3)) {
v5 = true;
break;
}
v2 = v2 * 16 + v3;
v4 += 1;
}
if (v5) {
v5 = false;
} else {
v1 += String.fromCharCode(v2);
break;
default:
v1 += ch;
}
}
} else {
v1 += ch;
}
}
}
}
_error('Bad string');
};
var _array = function () {
var v1 = [];
if (ch == '[') {
_next();
_white();
if (ch == ']') {
_next();
return v1;
}
while (ch) {
v1.push(_value());
_white();
if (ch == ']') {
_next();
return v1;
} else {
if (ch != ',') {
break;
}
}
_next();
_white();
}
}
_error('Bad array');
};
var _object = function () {
var v2;
var v1 = {};
if (ch == '{') {
_next();
_white();
if (ch == '}') {
_next();
return v1;
}
while (ch) {
v2 = _string();
_white();
if (ch != ':') {
break;
}
_next();
v1[v2] = _value();
_white();
if (ch == '}') {
_next();
return v1;
} else {
if (ch != ',') {
break;
}
}
_next();
_white();
}
}
_error('Bad object');
};
var _number = function () {
var v1 = '';
var v2;
if (ch == '-') {
v1 = '-';
_next();
}
for (;;) {
if (!(ch >= '0' && ch <= '9')) break;
v1 += ch;
_next();
}
if (ch == '.') {
v1 += '.';
for (;;) {
if (!(_next() && ch >= '0' && ch <= '9')) break;
v1 += ch;
}
}
v2 = 1 * v1;
if (!isFinite(v2)) {
_error('Bad number');
} else {
return v2;
}
};
var _word = function () {
switch (ch) {
case 't':
if (_next() == 'r' && _next() == 'u' && _next() == 'e') {
_next();
return true;
}
break;
case 'f':
if (_next() == 'a' && _next() == 'l' && _next() == 's' && _next() == 'e') {
_next();
return false;
}
break;
case 'n':
if (_next() == 'u' && _next() == 'l' && _next() == 'l') {
_next();
return null;
}
}
_error('Syntax error');
};
_value = function () {
_white();
switch (ch) {
case '{':
return _object();
case '[':
return _array();
case '"':
return _string();
case '-':
return _number();
}
return (ch >= '0' && ch <= '9') ? _number() : _word();
};
return _value();
};
v1.getType = function (v) {
if (v instanceof Array) {
return 'array';
} else {
return typeof v;
}
};
v1.decode_chunk = function () {
if (!com.newgrounds.encoders.json.JSON.cache.busy && !com.newgrounds.encoders.json.JSON.cache.complete) {
com.newgrounds.encoders.json.JSON.cache.busy = true;
var v1 = 0;
while (v1 < com.newgrounds.encoders.json.JSON.decode_chunks) {
com.newgrounds.encoders.json.JSON.chunk_decoder();
if (com.newgrounds.encoders.json.JSON.cache.complete) {
break;
}
++v1;
}
trace(Math.round((com.newgrounds.encoders.json.JSON.cache.pos / com.newgrounds.encoders.json.JSON.cache.arg.length) * 100) + '% decoded');
com.newgrounds.encoders.json.JSON.cache.busy = false;
}
if (com.newgrounds.encoders.json.JSON.cache.complete) {
var v2 = new Date();
com.newgrounds.encoders.json.JSON.busy = false;
clearInterval(com.newgrounds.encoders.json.JSON.interval);
com.newgrounds.encoders.json.JSON.cache.callback(com.newgrounds.encoders.json.JSON.cache.root, v2.getTime() - com.newgrounds.encoders.json.JSON.start);
com.newgrounds.encoders.json.JSON.cache.arg = '';
}
};
v1.encode_chunk = function () {
if (!com.newgrounds.encoders.json.JSON.cache.busy && !com.newgrounds.encoders.json.JSON.cache.complete) {
com.newgrounds.encoders.json.JSON.cache.busy = true;
var v1 = 0;
while (v1 < com.newgrounds.encoders.json.JSON.encode_chunks) {
com.newgrounds.encoders.json.JSON.chunk_encoder();
if (com.newgrounds.encoders.json.JSON.cache.complete) {
break;
}
++v1;
}
com.newgrounds.encoders.json.JSON.cache.busy = false;
}
if (com.newgrounds.encoders.json.JSON.cache.complete) {
var v3 = new Date();
var v2 = v3.getTime();
com.newgrounds.encoders.json.JSON.busy = false;
clearInterval(com.newgrounds.encoders.json.JSON.interval);
com.newgrounds.encoders.json.JSON.cache.callback(com.newgrounds.encoders.json.JSON.cache.encoded, v2 - com.newgrounds.encoders.json.JSON.start);
com.newgrounds.encoders.json.JSON.cache.encoded = '';
}
};
v1.chunk_decoder = function () {
function _object() {
var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (!com.newgrounds.encoders.json.JSON.cache.mode) {
com.newgrounds.encoders.json.JSON.cache.mode = 'object';
++com.newgrounds.encoders.json.JSON.cache.pos;
v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (v1 != '"') {
throw 'Malformed object key in encoded string. Keys must be wrapped in quotes ("")';
}
com.newgrounds.encoders.json.JSON.cache.scratch = '';
_setTargetValue({});
} else {
if (v1 == ',') {
++com.newgrounds.encoders.json.JSON.cache.pos;
v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (v1 != '"') {
throw 'Malformed object key in encoded string. Keys must be wrapped in quotes ("")';
}
com.newgrounds.encoders.json.JSON.cache.scratch = '';
} else {
if (v1 == '}') {
_useParent();
} else {
if (v1 == '"') {
++com.newgrounds.encoders.json.JSON.cache.pos;
v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (v1 != ':') {
throw 'Malformed object notation. Object keys and values must be separated by colons(:)';
}
_addParent(com.newgrounds.encoders.json.JSON.cache.scratch);
com.newgrounds.encoders.json.JSON.cache.mode = null;
} else {
if (v1 == '\\') {
++com.newgrounds.encoders.json.JSON.cache.pos;
v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
}
com.newgrounds.encoders.json.JSON.cache.scratch += v1;
}
}
}
}
++com.newgrounds.encoders.json.JSON.cache.pos;
}
function _array() {
var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (!com.newgrounds.encoders.json.JSON.cache.mode) {
com.newgrounds.encoders.json.JSON.cache.mode = 'array';
++com.newgrounds.encoders.json.JSON.cache.pos;
v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
_setTargetValue([]);
if (v1 != ']') {
_addArrayKey();
} else {
_useParent();
}
return undefined;
} else {
if (v1 == ',') {
_addArrayKey();
} else {
if (v1 == ']') {
_useParent();
}
}
}
++com.newgrounds.encoders.json.JSON.cache.pos;
}
function _boolean() {
var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (v1 == 't') {
_setTargetValue(true);
com.newgrounds.encoders.json.JSON.cache.pos += 3;
} else {
if (v1 == 'f') {
_setTargetValue(false);
com.newgrounds.encoders.json.JSON.cache.pos += 4;
} else {
throw 'Bool values must be true or false';
}
}
_useParent();
}
function _null() {
var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (v1 == 'n') {
_setTargetValue(null);
com.newgrounds.encoders.json.JSON.cache.pos += 2;
} else {
throw 'Null values must be null';
}
_useParent();
}
function _string() {
var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
if (!com.newgrounds.encoders.json.JSON.cache.mode) {
if (v1 != '"') {
throw 'Strings must be wrapped in quotes ("")';
}
com.newgrounds.encoders.json.JSON.cache.scratch = '';
com.newgrounds.encoders.json.JSON.cache.mode = 'string';
} else {
if (v1 == '"') {
_setTargetValue(com.newgrounds.encoders.json.JSON.cache.scratch);
_useParent();
} else {
if (v1 == '\\') {
++com.newgrounds.encoders.json.JSON.cache.pos;
v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
switch (v1) {
case 'n':
v1 = '\n';
break;
case 'r':
v1 = '\n';
break;
case 't':
v1 = '\t';
break;
case 'u':
v1 = '\\' + v1;
}
}
com.newgrounds.encoders.json.JSON.cache.scratch += v1;
}
}
++com.newgrounds.encoders.json.JSON.cache.pos;
}
function _number() {
var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
var v2 = '01234567890.-';
if (!com.newgrounds.encoders.json.JSON.cache.mode) {
com.newgrounds.encoders.json.JSON.cache.mode = 'number';
com.newgrounds.encoders.json.JSON.cache.scratch = '';
}
if (v2.indexOf(v1) < 0) {
_setTargetValue(Number(com.newgrounds.encoders.json.JSON.cache.scratch));
_useParent();
} else {
com.newgrounds.encoders.json.JSON.cache.scratch += v1;
++com.newgrounds.encoders.json.JSON.cache.pos;
}
}
function _setTargetValue(newval) {
var v2 = (_getParent()).obj;
var v1 = com.newgrounds.encoders.json.JSON.cache.parents[com.newgrounds.encoders.json.JSON.cache.parents.length - 1];
v2[v1] = newval;
}
function _useParent() {
com.newgrounds.encoders.json.JSON.cache.mode = com.newgrounds.encoders.json.JSON.getType((_getParent()).obj);
com.newgrounds.encoders.json.JSON.cache.parents.pop();
}
function _getParent() {
var v2 = com.newgrounds.encoders.json.JSON.cache;
var v1 = 0;
while (v1 < com.newgrounds.encoders.json.JSON.cache.parents.length - 1) {
v2 = v2[com.newgrounds.encoders.json.JSON.cache.parents[v1]];
++v1;
}
return {'obj': v2, 'name': com.newgrounds.encoders.json.JSON.cache.parents[v1]};
}
function _getCurrent() {
var v2 = com.newgrounds.encoders.json.JSON.cache;
var v1 = 0;
while (v1 < com.newgrounds.encoders.json.JSON.cache.parents.length) {
v2 = v2[com.newgrounds.encoders.json.JSON.cache.parents[v1]];
++v1;
}
return {'obj': v2, 'name': com.newgrounds.encoders.json.JSON.cache.parents[v1]};
}
function _addParent(child) {
com.newgrounds.encoders.json.JSON.cache.parents.push(child);
}
function _addArrayKey() {
var v1 = (_getCurrent()).obj.length;
com.newgrounds.encoders.json.JSON.cache.parents.push(v1);
com.newgrounds.encoders.json.JSON.cache.mode = null;
}
if (com.newgrounds.encoders.json.JSON.cache.pos >= com.newgrounds.encoders.json.JSON.cache.arg.length) {
com.newgrounds.encoders.json.JSON.cache.complete = true;
return undefined;
} else {
if (com.newgrounds.encoders.json.JSON.cache.mode) {
('_' + com.newgrounds.encoders.json.JSON.cache.mode)();
} else {
var char = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos);
switch (char) {
case '{':
_object();
break;
case '[':
_array();
break;
case '"':
_string();
break;
case 'n':
_null();
break;
case 't':
_boolean();
break;
case 'f':
_boolean();
break;
default:
_number();
}
}
}
};
v1.chunk_encoder = function () {
if (com.newgrounds.encoders.json.JSON.cache.complete) {
return undefined;
}
var v2 = com.newgrounds.encoders.json.JSON.getType(com.newgrounds.encoders.json.JSON.cache.target);
switch (v2) {
case 'number':
com.newgrounds.encoders.json.JSON.cache.encoded += com.newgrounds.encoders.json.JSON.cache.target;
com.newgrounds.encoders.json.JSON.getParent();
break;
case 'string':
com.newgrounds.encoders.json.JSON.cache.encoded += '"' + (com.newgrounds.encoders.json.JSON.cache.target.split('"')).join('\\"') + '"';
com.newgrounds.encoders.json.JSON.getParent();
break;
case 'boolean':
com.newgrounds.encoders.json.JSON.cache.encoded += (com.newgrounds.encoders.json.JSON.cache.target == true) ? 'true' : 'false';
com.newgrounds.encoders.json.JSON.getParent();
break;
case 'null':
com.newgrounds.encoders.json.JSON.cache.encoded += 'null';
com.newgrounds.encoders.json.JSON.getParent();
break;
case 'array':
if (com.newgrounds.encoders.json.JSON.cache.target.length < 1) {
com.newgrounds.encoders.json.JSON.cache.encoded += ']';
com.newgrounds.encoders.json.JSON.getParent();
} else {
com.newgrounds.encoders.json.JSON.cache.parents.push(com.newgrounds.encoders.json.JSON.cache.target);
com.newgrounds.encoders.json.JSON.cache.target = com.newgrounds.encoders.json.JSON.cache.target[0];
if (com.newgrounds.encoders.json.JSON.getType(com.newgrounds.encoders.json.JSON.cache.target) == 'array') {
com.newgrounds.encoders.json.JSON.cache.encoded += '[';
} else {
if (com.newgrounds.encoders.json.JSON.getType(com.newgrounds.encoders.json.JSON.cache.target) == 'object') {
com.newgrounds.encoders.json.JSON.cache.encoded += '{';
}
}
}
break;
case 'object':
for (var v1 in com.newgrounds.encoders.json.JSON.cache.target) {
break;
}
if (v1 === undefined) {
com.newgrounds.encoders.json.JSON.cache.encoded += '}';
com.newgrounds.encoders.json.JSON.getParent();
} else {
com.newgrounds.encoders.json.JSON.cache.parents.push(com.newgrounds.encoders.json.JSON.cache.target);
com.newgrounds.encoders.json.JSON.cache.target = com.newgrounds.encoders.json.JSON.cache.target[v1];
com.newgrounds.encoders.json.JSON.cache.encoded += '"' + (v1.split('"')).join('\\"') + '":';
if (com.newgrounds.encoders.json.JSON.getType(com.newgrounds.encoders.json.JSON.cache.target) == 'array') {
com.newgrounds.encoders.json.JSON.cache.encoded += '[';
} else {
if (com.newgrounds.encoders.json.JSON.getType(com.newgrounds.encoders.json.JSON.cache.target) == 'object') {
com.newgrounds.encoders.json.JSON.cache.encoded += '{';
}
}
}
break;
default:
com.newgrounds.encoders.json.JSON.cache.encoded += 'null';
com.newgrounds.encoders.json.JSON.getParent();
}
};
v1.getParent = function () {
if (com.newgrounds.encoders.json.JSON.cache.parents.length > 0) {
var v1 = com.newgrounds.encoders.json.JSON.cache.parents.pop();
if (com.newgrounds.encoders.json.JSON.getType(v1) == 'array') {
v1.shift();
} else {
for (var v3 in v1) {
delete v1[v3];
break;
}
}
if (com.newgrounds.encoders.json.JSON.getType(v1) == 'object' or com.newgrounds.encoders.json.JSON.getType(v1) == 'array') {
for (var v2 in v1) {
break;
}
if (v2 !== undefined) {
com.newgrounds.encoders.json.JSON.cache.encoded += ',';
}
}
com.newgrounds.encoders.json.JSON.cache.target = v1;
} else {
com.newgrounds.encoders.json.JSON.cache.complete = true;
}
};
v1.encode_chunks = 20000;
v1.decode_chunks = 20000;
v1.busy = false;
ASSetPropFlags(com.newgrounds.encoders.json.JSON.prototype, null, 1);
}
#endinitclip
}
movieClip 126 __Packages.com.newgrounds.crypto.MD5 {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.crypto) {
_global.com.newgrounds.crypto = new Object();
}
if (!_global.com.newgrounds.crypto.MD5) {
var v1 = function () {};
com.newgrounds.crypto.MD5 = v1;
var v2 = v1.prototype;
v1.hash = function (src) {
return com.newgrounds.crypto.MD5.hex_md5(src);
};
v1.hex_md5 = function (src) {
return com.newgrounds.crypto.MD5.binl2hex(com.newgrounds.crypto.MD5.core_md5(com.newgrounds.crypto.MD5.str2binl(src), src.length * 8));
};
v1.core_md5 = function (x, len) {
x[len >> 5] |= 128 << len % 32;
x[(len + 64 >>> 9 << 4) + 14] = len;
var v4 = 1732584193;
var v3 = -271733879;
var v2 = -1732584194;
var v1 = 271733878;
var v5 = 0;
while (v5 < x.length) {
var v10 = v4;
var v9 = v3;
var v8 = v2;
var v7 = v1;
v4 = com.newgrounds.crypto.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 0], 7, -680876936);
v1 = com.newgrounds.crypto.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 1], 12, -389564586);
v2 = com.newgrounds.crypto.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 2], 17, 606105819);
v3 = com.newgrounds.crypto.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 3], 22, -1044525330);
v4 = com.newgrounds.crypto.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 4], 7, -176418897);
v1 = com.newgrounds.crypto.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 5], 12, 1200080426);
v2 = com.newgrounds.crypto.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 6], 17, -1473231341);
v3 = com.newgrounds.crypto.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 7], 22, -45705983);
v4 = com.newgrounds.crypto.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 8], 7, 1770035416);
v1 = com.newgrounds.crypto.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 9], 12, -1958414417);
v2 = com.newgrounds.crypto.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 10], 17, -42063);
v3 = com.newgrounds.crypto.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 11], 22, -1990404162);
v4 = com.newgrounds.crypto.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 12], 7, 1804603682);
v1 = com.newgrounds.crypto.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 13], 12, -40341101);
v2 = com.newgrounds.crypto.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 14], 17, -1502002290);
v3 = com.newgrounds.crypto.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 15], 22, 1236535329);
v4 = com.newgrounds.crypto.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 1], 5, -165796510);
v1 = com.newgrounds.crypto.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 6], 9, -1069501632);
v2 = com.newgrounds.crypto.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 11], 14, 643717713);
v3 = com.newgrounds.crypto.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 0], 20, -373897302);
v4 = com.newgrounds.crypto.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 5], 5, -701558691);
v1 = com.newgrounds.crypto.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 10], 9, 38016083);
v2 = com.newgrounds.crypto.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 15], 14, -660478335);
v3 = com.newgrounds.crypto.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 4], 20, -405537848);
v4 = com.newgrounds.crypto.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 9], 5, 568446438);
v1 = com.newgrounds.crypto.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 14], 9, -1019803690);
v2 = com.newgrounds.crypto.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 3], 14, -187363961);
v3 = com.newgrounds.crypto.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 8], 20, 1163531501);
v4 = com.newgrounds.crypto.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 13], 5, -1444681467);
v1 = com.newgrounds.crypto.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 2], 9, -51403784);
v2 = com.newgrounds.crypto.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 7], 14, 1735328473);
v3 = com.newgrounds.crypto.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 12], 20, -1926607734);
v4 = com.newgrounds.crypto.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 5], 4, -378558);
v1 = com.newgrounds.crypto.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 8], 11, -2022574463);
v2 = com.newgrounds.crypto.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 11], 16, 1839030562);
v3 = com.newgrounds.crypto.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 14], 23, -35309556);
v4 = com.newgrounds.crypto.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 1], 4, -1530992060);
v1 = com.newgrounds.crypto.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 4], 11, 1272893353);
v2 = com.newgrounds.crypto.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 7], 16, -155497632);
v3 = com.newgrounds.crypto.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 10], 23, -1094730640);
v4 = com.newgrounds.crypto.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 13], 4, 681279174);
v1 = com.newgrounds.crypto.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 0], 11, -358537222);
v2 = com.newgrounds.crypto.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 3], 16, -722521979);
v3 = com.newgrounds.crypto.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 6], 23, 76029189);
v4 = com.newgrounds.crypto.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 9], 4, -640364487);
v1 = com.newgrounds.crypto.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 12], 11, -421815835);
v2 = com.newgrounds.crypto.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 15], 16, 530742520);
v3 = com.newgrounds.crypto.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 2], 23, -995338651);
v4 = com.newgrounds.crypto.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 0], 6, -198630844);
v1 = com.newgrounds.crypto.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 7], 10, 1126891415);
v2 = com.newgrounds.crypto.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 14], 15, -1416354905);
v3 = com.newgrounds.crypto.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 5], 21, -57434055);
v4 = com.newgrounds.crypto.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 12], 6, 1700485571);
v1 = com.newgrounds.crypto.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 3], 10, -1894986606);
v2 = com.newgrounds.crypto.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 10], 15, -1051523);
v3 = com.newgrounds.crypto.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 1], 21, -2054922799);
v4 = com.newgrounds.crypto.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 8], 6, 1873313359);
v1 = com.newgrounds.crypto.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 15], 10, -30611744);
v2 = com.newgrounds.crypto.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 6], 15, -1560198380);
v3 = com.newgrounds.crypto.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 13], 21, 1309151649);
v4 = com.newgrounds.crypto.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 4], 6, -145523070);
v1 = com.newgrounds.crypto.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 11], 10, -1120210379);
v2 = com.newgrounds.crypto.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 2], 15, 718787259);
v3 = com.newgrounds.crypto.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 9], 21, -343485551);
v4 = com.newgrounds.crypto.MD5.safe_add(v4, v10);
v3 = com.newgrounds.crypto.MD5.safe_add(v3, v9);
v2 = com.newgrounds.crypto.MD5.safe_add(v2, v8);
v1 = com.newgrounds.crypto.MD5.safe_add(v1, v7);
v5 += 16;
}
return new Array(v4, v3, v2, v1);
};
v1.md5_cmn = function (q, a, b, x, s, t) {
return com.newgrounds.crypto.MD5.safe_add(com.newgrounds.crypto.MD5.bit_rol(com.newgrounds.crypto.MD5.safe_add(com.newgrounds.crypto.MD5.safe_add(a, q), com.newgrounds.crypto.MD5.safe_add(x, t)), s), b);
};
v1.md5_ff = function (a, b, c, d, x, s, t) {
return com.newgrounds.crypto.MD5.md5_cmn(b & c | ~b & d, a, b, x, s, t);
};
v1.md5_gg = function (a, b, c, d, x, s, t) {
return com.newgrounds.crypto.MD5.md5_cmn(b & d | c & ~d, a, b, x, s, t);
};
v1.md5_hh = function (a, b, c, d, x, s, t) {
return com.newgrounds.crypto.MD5.md5_cmn(b ^ c ^ d, a, b, x, s, t);
};
v1.md5_ii = function (a, b, c, d, x, s, t) {
return com.newgrounds.crypto.MD5.md5_cmn(c ^ (b | ~d), a, b, x, s, t);
};
v1.bit_rol = function (num, cnt) {
return num << cnt | num >>> 32 - cnt;
};
v1.safe_add = function (x, y) {
var v1 = (x & 65535) + (y & 65535);
var v2 = (x >> 16) + (y >> 16) + (v1 >> 16);
return v2 << 16 | v1 & 65535;
};
v1.str2binl = function (str) {
var v3 = new Array();
var v4 = 255;
var v1 = 0;
while (v1 < str.length * 8) {
v3[v1 >> 5] |= (str.charCodeAt(v1 / 8) & v4) << v1 % 32;
v1 += 8;
}
return v3;
};
v1.binl2hex = function (binarray) {
var v4 = new String('');
var v3 = new String('0123456789abcdef');
var v1 = 0;
while (v1 < binarray.length * 4) {
v4 += v3.charAt(binarray[v1 >> 2] >> (v1 % 4) * 8 + 4 & 15) + v3.charAt(binarray[v1 >> 2] >> (v1 % 4) * 8 & 15);
++v1;
}
return v4;
};
ASSetPropFlags(com.newgrounds.crypto.MD5.prototype, null, 1);
}
#endinitclip
}
movieClip 127 __Packages.com.newgrounds.crypto.RC4 {
#initclip
if (!_global.com) {
_global.com = new Object();
}
if (!_global.com.newgrounds) {
_global.com.newgrounds = new Object();
}
if (!_global.com.newgrounds.crypto) {
_global.com.newgrounds.crypto = new Object();
}
if (!_global.com.newgrounds.crypto.RC4) {
var v1 = function () {};
com.newgrounds.crypto.RC4 = v1;
var v2 = v1.prototype;
v1.encrypt = function (src, key) {
var v3 = com.newgrounds.crypto.RC4.strToChars(src);
var v1 = com.newgrounds.crypto.RC4.strToChars(key);
var v2 = com.newgrounds.crypto.RC4.calculate(v3, v1);
return com.newgrounds.crypto.RC4.charsToHex(v2);
};
v1.encryptbin = function (src, key) {
var v3 = com.newgrounds.crypto.RC4.strToChars(src);
var v1 = com.newgrounds.crypto.RC4.strToChars(key);
var v2 = com.newgrounds.crypto.RC4.calculate(v3, v1);
return v2;
};
v1.decrypt = function (src, key) {
var v3 = com.newgrounds.crypto.RC4.hexToChars(src);
var v1 = com.newgrounds.crypto.RC4.strToChars(key);
var v2 = com.newgrounds.crypto.RC4.calculate(v3, v1);
return com.newgrounds.crypto.RC4.charsToStr(v2);
};
v1.initialize = function (pwd) {
var v2 = 0;
var v3;
var v4 = pwd.length;
var v1 = 0;
while (v1 <= 255) {
com.newgrounds.crypto.RC4.mykey[v1] = pwd[v1 % v4];
com.newgrounds.crypto.RC4.sbox[v1] = v1;
++v1;
}
v1 = 0;
while (v1 <= 255) {
v2 = (v2 + com.newgrounds.crypto.RC4.sbox[v1] + com.newgrounds.crypto.RC4.mykey[v1]) % 256;
v3 = com.newgrounds.crypto.RC4.sbox[v1];
com.newgrounds.crypto.RC4.sbox[v1] = com.newgrounds.crypto.RC4.sbox[v2];
com.newgrounds.crypto.RC4.sbox[v2] = v3;
++v1;
}
};
v1.calculate = function (plaintxt, psw) {
com.newgrounds.crypto.RC4.initialize(psw);
var v1 = 0;
var v2 = 0;
var v9 = new Array();
var v7;
var v5;
var v6;
var v3 = 0;
while (v3 < plaintxt.length) {
v1 = (v1 + 1) % 256;
v2 = (v2 + com.newgrounds.crypto.RC4.sbox[v1]) % 256;
v5 = com.newgrounds.crypto.RC4.sbox[v1];
com.newgrounds.crypto.RC4.sbox[v1] = com.newgrounds.crypto.RC4.sbox[v2];
com.newgrounds.crypto.RC4.sbox[v2] = v5;
var v4 = (com.newgrounds.crypto.RC4.sbox[v1] + com.newgrounds.crypto.RC4.sbox[v2]) % 256;
v7 = com.newgrounds.crypto.RC4.sbox[v4];
v6 = plaintxt[v3] ^ v7;
v9.push(v6);
++v3;
}
return v9;
};
v1.charsToHex = function (chars) {
var v4 = new String('');
var v3 = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
var v1 = 0;
while (v1 < chars.length) {
v4 += v3[chars[v1] >> 4] + v3[chars[v1] & 15];
++v1;
}
return v4;
};
v1.hexToChars = function (hex) {
var v3 = new Array();
var v1 = (hex.substr(0, 2) == '0x') ? 2 : 0;
while (v1 < hex.length) {
v3.push(parseInt(hex.substr(v1, 2), 16));
v1 += 2;
}
return v3;
};
v1.charsToStr = function (chars) {
var v3 = new String('');
var v1 = 0;
while (v1 < chars.length) {
v3 += String.fromCharCode(chars[v1]);
++v1;
}
return v3;
};
v1.strToChars = function (str) {
var v3 = new Array();
var v1 = 0;
while (v1 < str.length) {
v3.push(str.charCodeAt(v1));
++v1;
}
return v3;
};
v1.sbox = new Array(255);
v1.mykey = new Array(255);
ASSetPropFlags(com.newgrounds.crypto.RC4.prototype, null, 1);
}
#endinitclip
}
frame 2 {
play();
}
movieClip 205 {
}
movieClip 208 {
}
movieClip 221 {
}
movieClip 224 {
}
movieClip 227 {
}
movieClip 230 {
}
movieClip 231 {
frame 1 {
stop();
}
frame 6 {
play();
}
frame 17 {
stop();
}
frame 60 {
stop();
}
}
movieClip 232 {
}
movieClip 233 {
frame 60 {
_parent.phase = 2;
stop();
}
}
movieClip 234 {
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_SetXY(_root.p1, _root.p1.x, _root.tbot._y + _root.tbot.body._y + _root.tbot.body.body._y);
}
}
frame 136 {
_root.f_DeliverPlayer();
}
frame 221 {
stop();
}
}
movieClip 238 {
frame 1 {
stop();
}
}
movieClip 245 {
}
movieClip 262 {
instance of movieClip 205 {
onClipEvent (load) {
_parent.gotoAndStop(_root.p1.chargeshot + 1);
}
onClipEvent (enterFrame) {
_parent.gotoAndStop(_root.p1.chargeshot + 1);
}
}
frame 207 {
stop();
}
}
movieClip 265 {
}
movieClip 268 {
}
movieClip 271 {
}
movieClip 276 {
frame 1 {
stop();
}
}
movieClip 281 {
frame 1 {
stop();
}
}
movieClip 287 {
}
movieClip 290 {
}
movieClip 291 {
frame 1 {
stop();
}
frame 2 {
play();
}
frame 6 {
stop();
}
}
movieClip 303 {
frame 1 {
stop();
}
frame 2 {
play();
}
}
movieClip 305 {
frame 1 {
stop();
}
frame 4 {
play();
}
frame 57 {
_root.f_SetXY(_root.p1, _root.p1.default_x, _root.p1.default_y);
_root.p1.gotoAndStop('stand');
}
frame 87 {
stop();
}
}
movieClip 306 {
frame 97 {
spider.gotoAndPlay('build');
}
frame 217 {
_parent.gotoAndStop('blank');
stop();
}
}
movieClip 307 transferbot {
frame 1 {
stop();
}
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_parent.speed_y -= 0.5;
_parent._x += _parent.speed_x;
_parent._y += _parent.speed_y;
if (_parent._x + _root.game._x > _root.screen_width + 100) {
_parent.gotoAndStop('blank');
}
}
}
}
movieClip 312 {
}
movieClip 315 {
}
movieClip 318 {
}
movieClip 332 {
frame 1 {
stop();
}
frame 2 {
play();
}
}
movieClip 348 {
}
movieClip 349 {
frame 1 {
if (_root.b1.swording) {
gotoAndStop('on');
}
stop();
}
frame 10 {
stop();
}
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_Sword(_parent._parent._parent._parent);
}
}
}
movieClip 350 {
frame 1 {
stop();
}
frame 2 {
barrel.gotoAndPlay(2);
play();
}
}
movieClip 353 {
frame 1 {
_root.f_SetHead(this);
c = true;
}
}
movieClip 354 {
}
movieClip 358 {
}
movieClip 359 {
}
movieClip 363 {
}
movieClip 448 {
frame 1 {
_root.f_SetHat(this);
}
}
movieClip 531 {
frame 1 {
_root.f_SetHand(this);
stop();
}
}
movieClip 532 {
}
movieClip 533 {
}
movieClip 536 {
frame 1 {
stop();
}
}
movieClip 551 {
}
movieClip 552 {
}
movieClip 562 {
}
movieClip 563 {
frame 73 {
gotoAndPlay(1);
}
}
movieClip 564 {
frame 1 {
if (_parent.hasShield) {
gotoAndStop(2);
} else {
stop();
}
}
instance of movieClip 95 blank {
onClipEvent (load) {
if (_parent._parent._xscale < 0) {
if (_parent._xscale > 0) {
_parent._xscale = -100;
}
} else {
if (_parent._xscale < 0) {
_parent._xscale = 100;
}
}
}
onClipEvent (enterFrame) {
if (_parent._parent._xscale < 0) {
if (_parent._xscale > 0) {
_parent._xscale = -100;
}
} else {
if (_parent._xscale < 0) {
_parent._xscale = 100;
}
}
}
}
}
movieClip 581 {
}
movieClip 604 {
}
movieClip 611 {
}
movieClip 614 {
frame 28 {
stop();
}
frame 69 {
stop();
}
}
button 616 {
on (release) {
_root.f_ClickChar(this);
}
}
movieClip 640 {
frame 1 {
if (_root.b1._xscale < 0) {
_xscale = -100;
}
}
frame 158 {
stop();
}
}
movieClip 641 {
frame 135 {
stop();
}
}
movieClip 642 {
frame 136 {
stop();
}
}
movieClip 644 {
}
movieClip 645 {
}
movieClip 646 {
}
movieClip 647 {
}
movieClip 649 {
frame 57 {
stop();
}
}
movieClip 651 {
}
movieClip 652 {
}
movieClip 653 {
}
movieClip 682 {
}
movieClip 715 {
frame 5 {
_root.s_explosion.start(0, 0);
}
frame 9 {
_root.s_explosion.start(0, 0);
}
frame 15 {
_root.s_explosion.start(0, 0);
}
frame 20 {
_root.s_explosion.start(0, 0);
}
frame 29 {
_root.s_explosion.start(0, 0);
}
frame 40 {
_root.s_explosion2.start(0, 0);
}
frame 44 {
_root.f_TVShrapnel();
}
frame 118 {
stop();
}
}
movieClip 722 {
}
movieClip 724 {
}
movieClip 730 {
}
movieClip 734 {
}
movieClip 738 {
}
movieClip 741 {
}
movieClip 758 {
frame 117 {
stop();
}
}
movieClip 760 {
}
movieClip 761 raybot {
frame 1 {
c = true;
stop();
}
instance of movieClip 205 {
onClipEvent (enterFrame) {
_root.f_Jumping(_parent);
}
}
}
movieClip 770 {
}
movieClip 773 {
frame 1 {
stop();
}
}
movieClip 776 {
}
movieClip 779 {
}
movieClip 780 {
}
movieClip 783 {
}
movieClip 784 {
frame 1 {
stop();
}
frame 2 {
play();
}
frame 7 {
stop();
}
}
movieClip 801 {
}
movieClip 810 {
}
movieClip 813 {
}
movieClip 819 {
}
movieClip 821 {
frame 8 {
if (_parent.speed_y > 0) {
gotoAndStop('end');
}
}
instance of movieClip 205 {
onClipEvent (enterFrame) {
if (_parent._parent.speed_y > 0) {
_parent.gotoAndPlay('down');
}
}
}
frame 40 {
if (_parent.speed_y < 0) {
gotoAndPlay('spin');
} else {
play();
}
}
frame 56 {
stop();
}
}
movieClip 834 {
}
movieClip 837 {
}
movieClip 840 {
}
movieClip 841 {
frame 30 {
_parent.animatic = false;
stop();
}
}
movieClip 848 {
frame 14 {
stop();
}
}
movieClip 869 {
frame 13 {
var u = _root.f_FX(_parent.x, _parent.y - 40, _parent.y + 6, 'skull', _parent._xscale, 100);
u.speed_x = random(6) - 3;
u.speed_y = -12;
_root.f_MakeShrapnel(u, _root.s_bone);
}
frame 39 {
stop();
}
}
movieClip 872 {
}
movieClip 908 {
frame 110 {
stop();
}
}
movieClip 916 {
frame 12 {
stop();
}
}
movieClip 917 {
frame 7 {
gotoAndPlay(1);
}
}
movieClip 918 {
instance of movieClip 205 {
onClipEvent (enterFrame) {
trace('SPEED Y: ' + _parent._parent.speed_y);
if (_parent._parent.speed_y > 0) {
_parent.gotoAndStop('down');
}
}
}
frame 8 {
play();
}
frame 39 {
if (_parent.speed_y < 0) {
gotoAndPlay('spin');
}
}
frame 40 {
stop();
}
}
movieClip 919 soldier {
frame 1 {
c = true;
gotoAndStop(2);
}
frame 13 {
body.stop();
}
}
movieClip 920 {
}
movieClip 921 {
}
movieClip 922 {
frame 12 {
stop();
}
}
movieClip 931 {
}
movieClip 932 {
}
movieClip 937 {
}
movieClip 942 {
}
movieClip 945 {
}
movieClip 954 {
frame 2 {
_root.f_BrainShrapnel();
}
frame 40 {
stop();
}
}
movieClip 955 robosoldier {
frame 1 {
c = true;
gotoAndStop(2);
}
frame 10 {
body.stop();
}
}
movieClip 974 {
frame 19 {
stop();
}
}
movieClip 1019 {
frame 37 {
stop();
}
}
movieClip 1038 {
frame 19 {
stop();
}
}
movieClip 1057 {
frame 19 {
stop();
}
}
movieClip 1076 {
frame 19 {
stop();
}
}
movieClip 1077 {
frame 1 {
stop();
}
frame 2 {
_root.s_explosion.start(0, 0);
}
}
movieClip 1110 {
frame 33 {
_parent.gotoAndStop(1);
}
}
movieClip 1125 {
frame 29 {
stop();
}
}
movieClip 1138 {
frame 27 {
stop();
}
}
movieClip 1155 {
frame 22 {
stop();
}
}
movieClip 1170 {
frame 24 {
stop();
}
}
movieClip 1187 {
frame 17 {
stop();
}
}
movieClip 1204 {
frame 28 {
stop();
}
}
movieClip 1211 {
}
movieClip 1228 {
frame 16 {
stop();
}
}
movieClip 1233 {
frame 17 {
stop();
}
}
movieClip 1238 {
}
movieClip 1241 {
}
movieClip 1258 {
}
movieClip 1267 {
}
movieClip 1268 {
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_Vortex(_parent._parent);
}
}
frame 88 {
stop();
}
}
movieClip 1269 {
frame 40 {
stop();
}
}
movieClip 1286 {
frame 12 {
stop();
}
}
movieClip 1301 {
frame 35 {
stop();
}
}
movieClip 1303 {
frame 2 {
stop();
}
}
movieClip 1320 {
}
movieClip 1321 {
frame 1 {
play();
}
frame 21 {
stop();
}
}
movieClip 1326 {
}
movieClip 1327 {
}
movieClip 1330 {
}
movieClip 1333 {
}
movieClip 1336 {
}
movieClip 1339 {
}
movieClip 1342 {
}
movieClip 1345 {
}
movieClip 1348 {
}
movieClip 1351 {
}
movieClip 1354 {
}
movieClip 1355 {
frame 1 {
stop();
}
}
movieClip 1358 {
}
movieClip 1361 {
}
movieClip 1364 {
}
movieClip 1367 {
}
movieClip 1370 {
}
movieClip 1373 {
}
movieClip 1376 {
}
movieClip 1379 {
}
movieClip 1382 {
}
movieClip 1385 {
}
movieClip 1388 {
}
movieClip 1389 {
frame 1 {
stop();
}
}
movieClip 1390 {
frame 32 {
stop();
}
}
movieClip 1392 fx {
frame 1 {
stop();
}
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_Bullet(_parent);
}
}
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_Flame(_parent);
}
}
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_Sparkle(_parent);
}
}
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_Bomb(_parent);
}
}
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_Shrapnel(_parent);
}
}
}
movieClip 1500 {
frame 1 {
stop();
}
}
movieClip 1651 {
frame 1 {
stop();
}
frame 16 {
stop();
}
}
movieClip 1672 {
frame 1 {
stop();
}
frame 6 {
stop();
}
}
movieClip 1673 tile {
}
movieClip 1675 {
}
button 1677 {
on (release) {
stopAllSounds();
getURL(authorLink, '_blank');
}
}
button 1678 {
on (release) {
stopAllSounds();
getURL(directurl, '_blank');
}
}
movieClip 1699 {
}
movieClip 1701 {
}
movieClip 1702 {
}
movieClip 1715 {
frame 29 {
stop();
}
}
movieClip 1722 {
frame 12 {
stop();
}
}
movieClip 1730 {
}
movieClip 1731 {
}
movieClip 1737 {
frame 12 {
stop();
}
}
movieClip 1743 {
}
movieClip 1744 {
}
movieClip 1750 {
frame 12 {
stop();
}
}
movieClip 1753 {
}
movieClip 1761 {
}
movieClip 1763 {
}
movieClip 1764 {
}
movieClip 1765 {
frame 2 {
_root.s_fireblast.start(0, 0);
}
frame 7 {
hat.gotoAndStop(_parent.num);
}
frame 60 {
_root.s_hatUnlocked.start(0, 0);
stop();
}
}
movieClip 1769 {
}
movieClip 1770 {
}
movieClip 1771 {
frame 2 {
_root.s_fireblast.start(0, 0);
}
frame 7 {
hand.gotoAndStop(_parent.num);
}
frame 60 {
_root.s_handUnlocked.start(0, 0);
stop();
}
}
movieClip 1772 {
}
movieClip 1773 VoteBar {
frame 2 {
function start() {
trace('saveFile: ' + saveFile);
if (saveFile) {
_rating = (saveFile.__get__group()).getRating(ratingName);
if (!ratingName) {
if (saveFile.__get__group() && ((saveFile.__get__group()).__get__ratings()).length) {
_rating = ((saveFile.__get__group()).__get__ratings())[0];
ratingName = _rating.name;
com.newgrounds.Logger.logWarning('No rating name set in Vote Bar. Defaulting to "' + ratingName + '".');
} else {
com.newgrounds.Logger.logError('The save group "' + saveFile.__get__group() + '" has no ratings to vote on. You can create ratings on you API Settings page at http://www.newgrounds.com/account/flashapi');
return undefined;
}
}
gotoAndStop('ballot');
}
}
function _onNewFile(event) {
if (event.__get__success()) {
saveFile = event.data;
start();
}
}
var title;
var fileMode;
var ratingName;
var saveFile;
var _numButtons = 6;
var _rating;
_x = int(_x);
_y = int(_y);
if (!title) {
title = 'Submit your vote!';
}
if (!fileMode) {
fileMode = 'Use Current File';
}
if (fileMode == 'Use Current File') {
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_LOADED, _onNewFile);
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_SAVED, _onNewFile);
if (com.newgrounds.SaveFile.__get__currentFile()) {
saveFile = com.newgrounds.SaveFile.currentFile;
start();
}
}
gotoAndStop('hidden');
start();
}
frame 3 {
function _onVoteClick() {
var v3 = this;
if (!voteMenu) {
return undefined;
}
var v2 = 0;
while (v2 < _numButtons) {
if (v3 == voteMenu['voteButton' + v2]) {
break;
}
++v2;
}
if (v2 < _numButtons) {
var v4 = _rating.minimum + v2 * (_rating.maximum - _rating.minimum) / (_numButtons - 1);
saveFile.sendVote(ratingName, v4);
gotoAndStop('voting');
saveFile.addEventListener(com.newgrounds.APIEvent.VOTE_COMPLETE, _onVoteComplete);
}
}
function _onVoteComplete(event) {
if (event.__get__success()) {
gotoAndPlay('voteComplete');
} else {
gotoAndStop('hidden');
}
}
if (!saveFile) {
gotoAndStop('hidden');
}
if (titleText) {
titleText.text = title;
}
if (voteMenu) {
var i = 0;
while (i < _numButtons) {
var voteButton = voteMenu['voteButton' + i];
if (voteButton) {
voteButton.onRelease = _onVoteClick;
}
++i;
}
}
}
frame 22 {
_root.f_UnlockItem(saveFile.id, saveFile.authorName, this);
}
frame 51 {
stop();
}
frame 60 {
stop();
}
}
movieClip 1774 BossLogBox {
frame 1 {
logbox = true;
}
instance votebar of movieClip 1773 VoteBar {
onClipEvent (construct) {
title = 'Submit your vote!';
ratingName = 'Rating';
fileMode = 'Manually Set File';
}
}
}
movieClip 1778 {
}
movieClip 1781 {
}
movieClip 1782 {
}
movieClip 1783 {
}
movieClip 1784 {
}
button 1785 {
on (release) {
if (num > 0 && _xmouse >= 227 && _xmouse <= 290 && _ymouse >= 14 && _ymouse <= 34) {
_root.menu.notices.bossChannel = _root.bossChannel[num];
_root.menu.notices.gotoAndStop('scores');
} else {
_root.f_BossRush(num);
}
}
on (rollOver) {
if (num > 0) {
scores.gotoAndStop(2);
}
}
on (rollOut) {
scores.gotoAndStop(1);
}
}
movieClip 1788 {
}
movieClip 1789 {
frame 1 {
stop();
}
instance of movieClip 205 {
onClipEvent (enterFrame) {
if (_parent._xmouse >= 0 && _parent._xmouse <= 63 && _parent._ymouse >= 0 and _parent._ymouse <= 20) {
_parent.gotoAndStop(3);
} else {
_parent.gotoAndStop(2);
}
}
}
}
movieClip 1792 {
}
movieClip 1794 {
}
movieClip 1796 {
frame 224 {
gotoAndPlay(1);
}
}
movieClip 1797 {
}
button 1798 {
on (release) {
if (num > 0 && _xmouse >= 227 && _xmouse <= 290 && _ymouse >= 14 && _ymouse <= 34) {
_root.menu.notices.bossChannel = _root.bossChannel[num];
_root.menu.notices.gotoAndStop('scores');
} else {
_root.f_BossRush(num);
}
}
on (rollOver) {
if (num > 0) {
scores.gotoAndStop(2);
}
}
on (rollOut) {
scores.gotoAndStop(1);
}
}
movieClip 1799 ChannelBox {
frame 1 {
stop();
}
}
button 1804 {
on (release) {
_root.f_UpdateHand(_parent.num);
}
}
movieClip 1807 {
frame 1 {
stop();
}
}
movieClip 1808 hands {
}
button 1809 {
on (release) {
_root.f_UpdateHat(_parent.num);
}
}
movieClip 1810 {
frame 1 {
stop();
}
}
movieClip 1811 hats {
}
movieClip 1813 {
}
movieClip 1816 {
}
movieClip 1820 {
}
movieClip 1824 {
}
movieClip 1830 {
}
movieClip 1832 {
}
movieClip 1834 {
}
movieClip 1836 {
}
movieClip 1838 {
}
movieClip 1840 MedalPopup {
frame 1 {
function onMedalUnlocked(event) {
if (event.__get__success()) {
_medalQueue.push(event.__get__data());
showNextUnlock();
}
}
function showNextUnlock() {
if (_unlockedMedal) {
return undefined;
}
if (!_medalQueue.length) {
gotoAndStop('hidden');
onEnterFrame = null;
return undefined;
}
_unlockedMedal = com.newgrounds.Medal(_medalQueue.shift());
gotoAndPlay('medalUnlocked');
}
gotoAndStop('hidden');
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCKED, onMedalUnlocked);
var alwaysOnTop;
_x = int(_x);
_y = int(_y);
var _unlockedMedal;
var _medalQueue = [];
var _alwaysOnTop = true;
if (alwaysOnTop) {
_alwaysOnTop = alwaysOnTop == 'true';
}
}
frame 15 {
function medalPopupEnterFrame() {
if (_alwaysOnTop) {
var v1 = getNextHighestDepth();
swapDepths(v1);
}
if (_medalScrollRect) {
_medalScrollRect.offset(2, 0);
medalNameClip.scrollRect = _medalScrollRect;
if (_medalScrollRect.left >= medalNameClip.textField.textWidth + 10) {
_medalScrollRect = null;
play();
}
}
}
var _medalScrollRect;
if (_unlockedMedal) {
if (medalNameClip && medalNameClip.textField) {
medalNameClip.textField.text = _unlockedMedal.name;
}
if (medalPointsText) {
medalPointsText.text = _unlockedMedal.value.toString();
}
if (medalNameClip.textField.textWidth > medalNameClip._width) {
_medalScrollRect = new flash.geom.Rectangle(-medalNameClip._width, 0, medalNameClip._width, medalNameClip._height);
medalNameClip.textField._width = 1000;
medalNameClip.scrollRect = _medalScrollRect;
}
onEnterFrame = medalPopupEnterFrame;
}
}
frame 23 {
if (_unlockedMedal && medalIcon) {
_unlockedMedal.attachIcon(medalIcon);
}
}
frame 84 {
if (_medalScrollRect) {
stop();
}
}
frame 105 {
stop();
_unlockedMedal = null;
showNextUnlock();
}
}
instance of movieClip 1840 MedalPopup {
onClipEvent (construct) {
alwaysOnTop = 'true';
}
}
frame 4 {
if (_root.directfile) {
gotoAndStop('full');
} else {
stop();
}
}
movieClip 1843 {
}
movieClip 1846 {
}
movieClip 1849 {
}
movieClip 1851 {
}
movieClip 1854 {
}
movieClip 1855 {
}
button 1856 {
on (release) {
_root.nextFrame();
}
}
movieClip 1879 {
}
movieClip 1880 {
}
movieClip 1895 {
}
movieClip 1896 {
frame 2125 {
_root.nextFrame();
}
}
frame 5 {
stop();
}
movieClip 1898 {
}
button 1908 {
on (release) {
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.USER_SIGNED_IN, onUserSignedIn);
com.newgrounds.API.promptSignIn();
gotoAndStop('waiting');
}
}
button 1912 {
on (release) {
_root.play();
}
}
movieClip 1917 {
}
button 1919 {
on (release) {
com.newgrounds.API.promptSignIn();
}
}
button 1923 {
on (release) {
_root.play();
}
}
movieClip 1924 {
frame 1 {
function onUserSignedIn(event) {
if (event.success) {
gotoAndStop('connected');
}
}
if (com.newgrounds.API.__get__hasUserSession()) {
_root.play();
}
}
frame 5 {
stop();
}
frame 7 {
username.text = 'Welcome, ' + com.newgrounds.API.__get__username() + '!';
}
}
frame 6 {
stop();
}
movieClip 1927 {
}
movieClip 1930 {
}
movieClip 1933 {
}
movieClip 1936 {
}
movieClip 1939 {
}
movieClip 1940 {
}
movieClip 1942 {
}
movieClip 1969 {
}
movieClip 1970 {
frame 13 {
stop();
}
}
movieClip 1981 {
}
movieClip 1982 {
frame 1 {
stop();
}
frame 2 {
play();
}
frame 4 {
_root.beamloop.s_beamloop.stop();
stop();
}
}
button 1985 {
on (press) {
_root.f_TileClick();
}
on (release) {
_root.f_TileRelease();
}
}
movieClip 1986 {
frame 1 {
gotoAndStop('off');
}
}
movieClip 1988 {
frame 1 {
gotoAndStop(2);
}
}
movieClip 2001 {
}
movieClip 2014 {
}
movieClip 2015 {
frame 1 {
gotoAndStop('off');
}
}
movieClip 2016 {
frame 1 {
stop();
}
instance of movieClip 95 blank {
onClipEvent (load) {
_root.f_InitGame();
}
onClipEvent (enterFrame) {
_root.f_Game();
}
}
}
movieClip 2018 {
}
movieClip 2019 {
frame 1 {
stop();
}
}
movieClip 2022 {
}
button 2028 {
on (release) {
if (_root.phase >= 1 && _root.phase <= 3) {
_root.bm = new Array(0);
_root.b1.moves = _root.bm;
}
_root.f_ExitTest();
}
}
movieClip 2029 {
}
movieClip 2034 {
frame 1 {
stop();
}
}
movieClip 2038 {
frame 1 {
stop();
}
frame 2 {
_root.f_RenderClock();
}
frame 3 {
_root.f_RenderClock();
}
}
movieClip 2044 {
frame 1 {
stop();
}
}
movieClip 2045 {
}
movieClip 2046 {
frame 534 {
gotoAndPlay(1);
}
}
movieClip 2054 {
}
movieClip 2056 {
}
movieClip 2059 {
}
movieClip 2060 {
frame 47 {
gotoAndPlay(1);
}
}
movieClip 2062 {
}
movieClip 2084 {
}
movieClip 2086 {
}
movieClip 2091 {
}
movieClip 2100 {
}
movieClip 2103 {
}
movieClip 2104 {
}
movieClip 2107 {
}
movieClip 2108 {
}
movieClip 2109 {
}
movieClip 2111 {
}
movieClip 2114 {
}
movieClip 2117 {
}
movieClip 2118 {
frame 46 {
gotoAndPlay(26);
}
}
movieClip 2121 {
}
movieClip 2123 {
}
movieClip 2124 {
}
movieClip 2125 {
frame 10 {
stop();
}
}
movieClip 2128 {
}
movieClip 2129 {
}
movieClip 2130 {
frame 441 {
gotoAndPlay(1);
}
}
movieClip 2133 {
}
movieClip 2134 {
frame 301 {
gotoAndPlay(1);
}
}
movieClip 2136 {
}
movieClip 2137 {
frame 477 {
gotoAndPlay(1);
}
}
movieClip 2138 {
}
movieClip 2140 {
}
movieClip 2143 {
}
movieClip 2144 {
}
movieClip 2147 {
}
movieClip 2149 {
}
movieClip 2156 {
frame 47 {
gotoAndPlay(1);
}
}
movieClip 2158 {
}
movieClip 2160 {
}
movieClip 2161 {
frame 201 {
gotoAndPlay(1);
}
}
movieClip 2163 {
}
movieClip 2164 {
frame 107 {
gotoAndPlay(1);
}
}
movieClip 2166 {
}
movieClip 2167 {
}
movieClip 2168 {
frame 270 {
gotoAndPlay(1);
}
}
movieClip 2169 {
}
movieClip 2170 {
frame 6 {
stop();
}
}
button 2173 {
on (rollOver) {
_root.sword.s_selectHuman.stop();
_root.sword.s_selectRaybot.start(0, 0);
}
on (release) {
gotoAndPlay('raybot');
}
}
movieClip 2178 {
}
movieClip 2181 {
}
movieClip 2184 {
}
movieClip 2187 {
}
movieClip 2190 {
}
movieClip 2191 {
frame 145 {
gotoAndPlay(32);
}
}
movieClip 2193 {
}
movieClip 2194 {
}
movieClip 2195 {
frame 441 {
gotoAndPlay(1);
}
}
movieClip 2200 {
}
movieClip 2202 {
}
movieClip 2206 {
frame 6 {
stop();
}
}
button 2207 {
on (rollOver) {
_root.sword.s_selectRaybot.stop();
_root.sword.s_selectHuman.start(0, 0);
}
on (release) {
gotoAndPlay('human');
}
}
movieClip 2219 {
frame 1 {
_quality = 'low';
}
frame 169 {
if (_root.menumode != 1) {
_root.m_select.start(0, 9999);
}
stop();
}
frame 209 {
_root.f_HumanMode();
stop();
}
frame 251 {
_root.f_RaybotMode();
stop();
}
}
movieClip 2224 {
}
button 2227 {
on (release) {
gotoAndStop('browseyourbosses');
}
}
movieClip 2232 {
}
movieClip 2233 {
}
button 2238 {
on (release) {
_root.f_EndDemo();
_root.f_Test(true);
}
}
movieClip 2239 {
frame 1 {
stop();
}
}
movieClip 2243 {
}
button 2247 {
on (release) {
if (com.newgrounds.API.__get__hasUserSession() == true) {
_parent.notices.gotoAndStop('saveboss');
} else {
_parent.notices.targetframe = 'saveboss';
_parent.notices.gotoAndStop('passport');
}
}
}
movieClip 2248 {
frame 1 {
stop();
}
}
button 2254 {
on (release) {
_root.f_EditRoom();
}
}
button 2257 {
on (release) {
_root.f_EndDemo();
_root.f_EditDraw();
}
}
button 2260 {
on (release) {
_root.passtest = false;
_root.f_EndDemo();
_root.f_EditWeapons();
}
}
button 2263 {
on (release) {
_root.passtest = false;
_root.f_EndDemo();
_root.f_RecordPattern();
}
}
movieClip 2266 {
}
movieClip 2269 {
}
button 2271 {
on (release) {
if (_root.justSaved) {
_root.m_makeraybot.stop();
gotoAndStop('on');
} else {
notices.gotoAndStop('exitedit');
}
}
}
button 2277 {
on (release) {
_root.f_SaveFace();
gotoAndStop(1);
}
}
button 2278 {
on (release) {
gotoAndStop(1);
}
}
button 2286 {
on (release) {
gotoAndStop(2);
}
}
button 2289 {
on (release) {
gotoAndStop(1);
}
}
movieClip 2292 {
frame 1 {
if (_root.headfile.keys.personal == true || _root.headfile.keys.personal == undefined) {
_root.personal = true;
stop();
} else {
gotoAndStop(2);
}
}
frame 2 {
_root.personal = false;
}
}
button 2295 {
on (release) {
_root.headfile = undefined;
_root.f_SaveFace();
gotoAndStop(1);
}
}
button 2298 {
on (release) {
_root.f_SaveBoss();
_root.f_Demo();
gotoAndStop(1);
}
}
button 2301 {
on (release) {
_root.bossfile = undefined;
_root.f_SaveBoss();
_root.f_Demo();
gotoAndStop(1);
}
}
button 2303 {
on (release) {
_root.bm = new Array(0);
_root.b1.moves = _root.bm;
_root.f_EditRoom();
}
}
button 2307 {
on (release) {
_root.m_makeraybot.stop();
_parent.gotoAndStop('on');
gotoAndStop(1);
}
}
button 2309 {
on (release) {
com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.USER_SIGNED_IN, onUserSignedIn);
com.newgrounds.API.promptSignIn();
gotoAndStop('passportwait');
}
}
movieClip 2321 {
}
movieClip 2325 {
frame 1 {
stop();
mouseChildren = false;
}
}
movieClip 2328 {
}
movieClip 2329 {
frame 1 {
function setListItems(listItems) {
if (!listItems) {
_listItems = [];
} else {
_listItems = listItems.concat();
}
var v1 = 0;
while (v1 < _listItems.length) {
if (typeof _listItems[v1] == 'string') {
_listItems[v1] = {'label': _listItems[v1], 'data': _listItems[v1]};
}
++v1;
}
setSelectedIndex(0);
}
function setSelectedItem(data) {
var v1 = 0;
while (v1 < _listItems.length) {
if (_listItems[v1].data == data) {
setSelectedIndex(v1);
return undefined;
}
++v1;
}
}
function setSelectedIndex(i) {
if (i < _listItems.length) {
_selectedItem = _listItems[i];
if (currentItem && currentItem.label) {
currentItem.label.text = _selectedItem.label;
}
}
}
function hideList() {
_listDown = false;
gotoAndStop('sortUP');
}
function _onListClick() {
_listDown = !_listDown;
if (_listDown) {
gotoAndStop('sortDOWN');
} else {
gotoAndStop('sortUP');
}
}
stop();
if (listButton) {
listButton.onRelease = _onListClick;
}
if (currentItem) {
currentItem.onRelease = _onListClick;
if (currentItem.label) {
if (_selectedItem) {
currentItem.label.text = _selectedItem.label;
} else {
currentItem.label.text = '';
}
}
}
var _listItems;
var _listDown;
var _selectedItem;
if (!_listItems) {
_listItems = [];
}
}
frame 10 {
function _onItemClick() {
var v3 = MovieClip(this);
if (v3.item) {
setSelectedItem(v3.item.data);
}
if (v3 && _parent && _parent instanceof MovieClip && (MovieClip(_parent))._onListChange) {
(MovieClip(_parent))._onListChange(v3.item);
}
}
var i = 0;
var itemClip = item0;
while (itemClip) {
if (i < _listItems.length) {
itemClip.item = _listItems[i];
itemClip.label.text = _listItems[i].label;
itemClip.onRelease = _onItemClick;
} else {
itemClip._visible = false;
}
++i;
itemClip = this['item' + i];
}
}
}
button 2334 {
on (release) {
gotoAndStop('sortDOWN');
}
}
movieClip 2337 {
frame 1 {
stop();
}
}
button 2338 {
on (release) {
gotoAndStop('sortDOWN');
}
}
button 2339 {
on (release) {
gotoAndStop('sortUP');
}
}
button 2340 {
on (release) {
headertext.gotoAndStop('everyone');
_parent.friendsOnly = false;
_parent.loadScores();
gotoAndStop('sortUP');
}
}
button 2341 {
on (release) {
headertext.gotoAndStop('friends');
_parent.friendsOnly = true;
_parent.loadScores();
gotoAndStop('sortUP');
}
}
button 2342 {
on (release) {
gotoAndStop('sortUP');
}
}
movieClip 2343 {
frame 1 {
stop();
}
}
movieClip 2350 {
frame 1 {
stop();
mouseChildren = false;
}
}
movieClip 2351 {
}
movieClip 2353 {
}
movieClip 2360 ScoreBrowser {
frame 1 {
function loadScores() {
if (_scoreBoard) {
_scoreBoard.removeEventListener(com.newgrounds.APIEvent.SCORES_LOADED, _onScoresLoaded);
}
_scoreBoard = com.newgrounds.API.getScoreBoard(scoreBoardName);
if (!_scoreBoard) {
if (!(com.newgrounds.API.__get__scoreBoards())[0]) {
com.newgrounds.Logger.logError('No scoreboards created for this movie. You can create scoreboards on your API Settings page at http://www.newgrounds.com/account/flashapi');
gotoAndPlay('error');
return undefined;
} else {
_scoreBoard = (com.newgrounds.API.__get__scoreBoards())[0];
scoreBoardName = _scoreBoard.name;
com.newgrounds.Logger.logWarning('No scoreboard name set in the Score Browser component. Defaulting to scoreboard "' + _scoreBoard.__get__name() + '".');
}
}
_scoreBoard.addEventListener(com.newgrounds.APIEvent.SCORES_LOADED, _onScoresLoaded);
_scoreBoard.__set__numResults(_numScores);
_scoreBoard.__set__period(period);
if (friendsOnly) {
_scoreBoard.__set__friendsOf(com.newgrounds.API.userId);
} else {
_scoreBoard.__set__friendsOf(0);
}
if (pageText) {
pageText.text = 'Page ' + _scoreBoard.__get__page();
}
_loading = true;
if (listBox) {
listBox.mouseChildren = false;
listBox.hideList();
}
gotoAndStop('loading');
_scoreBoard.loadScores();
}
function _onScoresLoaded(event) {
_loading = false;
if (listBox) {
listBox.mouseChildren = true;
}
if (event.__get__success()) {
gotoAndStop('scores');
} else {
gotoAndPlay('error');
}
}
function _onPageClick() {
var v2 = this;
if (_scoreBoard && !_loading) {
if (v2 == prevButton) {
_scoreBoard.prevPage();
} else {
_scoreBoard.nextPage();
}
loadScores();
}
}
function _onListChange(selection) {
period = selection.data;
loadScores();
}
var title;
var scoreBoardName;
var period;
var friendsOnly;
if (!title) {
title = 'High Scores';
}
if (!period) {
period = com.newgrounds.ScoreBoard.ALL_TIME;
}
var _scoreBoard;
var _loading;
var _numScores = 10;
var _listItems = [com.newgrounds.ScoreBoard.TODAY, com.newgrounds.ScoreBoard.THIS_WEEK, com.newgrounds.ScoreBoard.THIS_MONTH, com.newgrounds.ScoreBoard.THIS_YEAR, com.newgrounds.ScoreBoard.ALL_TIME];
_x = int(_x);
_y = int(_y);
if (prevButton) {
prevButton.onRelease = _onPageClick;
}
if (nextButton) {
nextButton.onRelease = _onPageClick;
}
gotoAndPlay('error');
loadScores();
}
frame 2 {
if (listBox) {
listBox.setListItems(_listItems);
listBox.setSelectedItem(period);
}
}
frame 11 {
function onScoreClick() {
var v3 = MovieClip(this);
if (v3.usernameText) {
_root.getURL('http://' + v3.usernameText.text + '.newgrounds.com', '_blank');
}
}
var i = 0;
var scoreClip = scoreContainer.score0;
while (scoreClip) {
var score = com.newgrounds.Score(_scoreBoard.scores[i]);
if (score) {
if (scoreClip.rankText) {
scoreClip.rankText.text = (score.__get__rank()).toString();
}
if (scoreClip.usernameText) {
scoreClip.usernameText.text = score.username;
}
if (scoreClip.scoreText) {
scoreClip.scoreText.text = score.score;
}
scoreClip.onRelease = onScoreClick;
} else {
if (scoreClip.rankText) {
scoreClip.rankText.text = '';
}
if (scoreClip.usernameText) {
scoreClip.usernameText.text = '';
}
if (scoreClip.scoreText) {
scoreClip.scoreText.text = '';
}
scoreClip.enabled = false;
}
++i;
scoreClip = scoreContainer['score' + i];
}
}
frame 21 {
function onReloadClick() {
loadScores();
}
if (reloadButton) {
reloadButton.onRelease = onReloadClick;
}
}
frame 30 {
stop();
}
}
movieClip 2362 {
}
button 2363 {
on (release) {
gotoAndStop(1);
}
}
movieClip 2364 {
frame 1 {
function onUserSignedIn(event) {
if (event.success) {
gotoAndStop(targetframe);
}
}
_root.textInput = false;
stop();
}
frame 2 {
_root.textInput = true;
if (_root.headfile) {
gotoAndStop('saveface2');
}
}
frame 3 {
_root.textInput = true;
textfield.text = _root.headfile.name;
}
frame 5 {
_root.textInput = true;
f_EndDemo();
if (_root.bossfile) {
gotoAndStop('saveboss2');
}
}
frame 6 {
_root.textInput = true;
textfield.text = _root.bossfile.name;
}
frame 12 {
trace('BOSS CHANNEL: ' + bossChannel.title);
scoreboard.scoreBoardName = bossChannel.title;
scoreboard.titleText = bossChannel.title + ' HIGH SCORES';
}
instance scoreboard of movieClip 2360 ScoreBrowser {
onClipEvent (construct) {
scoreBoardName = '';
period = 'All-Time';
title = 'High Scores';
}
}
}
movieClip 2366 {
}
movieClip 2368 {
}
movieClip 2370 {
}
movieClip 2374 {
}
movieClip 2375 {
}
movieClip 2378 {
}
movieClip 2379 {
}
movieClip 2381 {
}
movieClip 2382 {
}
movieClip 2384 {
}
movieClip 2385 {
frame 60 {
gotoAndPlay(1);
}
}
movieClip 2386 {
}
movieClip 2388 {
}
movieClip 2397 {
}
movieClip 2418 {
}
movieClip 2423 {
}
movieClip 2424 {
frame 224 {
gotoAndPlay(1);
}
}
movieClip 2426 {
}
movieClip 2427 {
}
movieClip 2428 {
}
movieClip 2429 {
frame 57 {
gotoAndPlay(1);
}
}
movieClip 2433 {
frame 1 {
stop();
}
}
movieClip 2435 {
}
movieClip 2436 {
}
movieClip 2440 {
}
movieClip 2442 {
}
movieClip 2445 {
}
movieClip 2446 {
}
movieClip 2449 {
}
movieClip 2451 {
}
movieClip 2454 {
}
movieClip 2455 {
frame 85 {
stop();
}
}
movieClip 2456 {
}
movieClip 2459 {
}
movieClip 2460 {
}
movieClip 2464 {
frame 22 {
stop();
}
}
movieClip 2467 {
}
movieClip 2471 {
}
movieClip 2474 {
frame 22 {
stop();
}
}
movieClip 2478 {
}
movieClip 2480 {
}
button 2482 {
on (release) {
_parent.gotoAndStop('browsebosses');
}
}
movieClip 2484 {
}
movieClip 2485 {
}
movieClip 2486 {
}
movieClip 2490 {
}
movieClip 2493 {
}
button 2494 {
on (release) {
_parent.gotoAndStop('on');
}
}
movieClip 2495 {
frame 56 {
_root.f_Channels();
onMouseDown = _root.f_ClickOn;
onMouseUp = _root.f_ClickOff;
}
instance of movieClip 205 {
onClipEvent (enterFrame) {
_root.f_ListScroll();
}
}
frame 72 {
stop();
}
}
movieClip 2498 {
}
movieClip 2501 {
}
movieClip 2504 {
}
movieClip 2507 {
}
movieClip 2508 {
frame 1 {
if (!_root.winner) {
gotoAndStop(2);
} else {
stop();
}
}
}
movieClip 2509 {
}
movieClip 2510 {
}
movieClip 2515 {
frame 1 {
if (!_root.winner) {
gotoAndStop(2);
} else {
stop();
}
}
}
movieClip 2517 {
}
movieClip 2520 {
frame 1 {
if (com.newgrounds.API.__get__hasUserSession()) {
username.text = com.newgrounds.API.__get__username() + ' BATTLE LOG';
} else {
username.text = 'BATTLE LOG';
}
}
}
movieClip 2522 {
}
movieClip 2523 {
}
movieClip 2525 {
}
button 2526 {
on (release) {
_parent.gotoAndStop('humans');
}
}
movieClip 2529 {
}
button 2530 {
on (release) {
gotoAndStop('scores');
}
}
movieClip 2532 {
}
button 2533 {
on (release) {
com.newgrounds.API.loadNewgrounds();
}
}
button 2534 {
on (release) {
gotoAndStop(1);
}
}
movieClip 2535 {
frame 1 {
if (_root.doScores > 0) {
stop();
} else {
gotoAndStop(2);
}
}
frame 3 {
scoreboard.scoreBoardName = _root.bossChannel[_root.doScores].title;
scoreboard.titleText = _root.bossChannel[_root.doScores].title + ' HIGH SCORES';
}
instance scoreboard of movieClip 2360 ScoreBrowser {
onClipEvent (construct) {
scoreBoardName = '';
period = 'All-Time';
title = 'High Scores';
}
}
}
movieClip 2552 {
frame 1 {
trace('Setting Grade: ' + _root.finalGrade);
if (!_root.winner) {
gotoAndStop('F');
} else {
if (_root.finalGrade > 92) {
stop();
} else {
if (_root.finalGrade > 84) {
gotoAndStop(2);
} else {
if (_root.finalGrade > 76) {
gotoAndStop(3);
} else {
if (_root.finalGrade > 68) {
gotoAndStop(4);
} else {
if (_root.finalGrade > 60) {
gotoAndStop(5);
} else {
if (_root.finalGrade > 52) {
gotoAndStop(6);
} else {
if (_root.finalGrade > 44) {
gotoAndStop(7);
} else {
if (_root.finalGrade > 36) {
gotoAndStop(8);
} else {
if (_root.finalGrade > 28) {
gotoAndStop(9);
} else {
if (_root.finalGrade > 20) {
gotoAndStop(10);
} else {
if (_root.finalGrade > 12) {
gotoAndStop(11);
} else {
gotoAndStop(12);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
movieClip 2553 {
frame 14 {
stop();
}
}
movieClip 2554 {
frame 47 {
_root.f_BossLogOutput();
onMouseDown = _root.f_ClickOn;
onMouseUp = _root.f_ClickOff;
}
instance of movieClip 205 {
onClipEvent (enterFrame) {
_root.f_ListScroll();
}
}
frame 61 {
stop();
}
}
button 2557 {
on (release) {
_root.f_SetTileSelect(1);
gotoAndStop(1);
}
}
button 2558 {
on (release) {
_root.f_SetTileSelect(2);
gotoAndStop(2);
}
}
button 2559 {
on (release) {
_root.f_SetTileSelect(0);
gotoAndStop(3);
}
}
movieClip 2562 {
}
movieClip 2565 {
}
movieClip 2568 {
}
movieClip 2569 {
frame 1 {
if (_root.tileselect == 1) {
gotoAndStop(1);
} else {
if (_root.tileselect == 2) {
gotoAndStop(2);
} else {
if (_root.tileselect == 0) {
gotoAndStop(3);
}
}
}
}
}
movieClip 2572 {
}
button 2575 {
on (release) {
_root.tc.gotoAndStop('off');
_parent.tilemenu.gotoAndStop(1);
gotoAndStop(2);
}
}
button 2576 {
on (release) {
gotoAndStop(1);
}
}
button 2579 {
on (release) {
_root.f_SetClock(30);
gotoAndStop(1);
}
}
button 2580 {
on (release) {
_root.f_SetClock(60);
gotoAndStop(1);
}
}
button 2581 {
on (release) {
_root.f_SetClock(90);
gotoAndStop(1);
}
}
button 2582 {
on (release) {
_root.f_SetClock(120);
gotoAndStop(1);
}
}
button 2583 {
on (release) {
_root.f_SetClock(180);
gotoAndStop(1);
}
}
button 2584 {
on (release) {
_root.f_SetClock(300);
gotoAndStop(1);
}
}
button 2585 {
on (release) {
_root.f_SetClock(600);
gotoAndStop(1);
}
}
movieClip 2590 {
}
movieClip 2593 {
}
movieClip 2594 {
frame 1 {
stop();
}
frame 2 {
var u = _root.gameclockdefault / 60;
dot._x = b0._x;
if (u == 30) {
dot._y = b0._y;
} else {
if (u == 60) {
dot._y = b1._y;
} else {
if (u == 90) {
dot._y = b2._y;
} else {
if (u == 120) {
dot._y = b3._y;
} else {
if (u == 180) {
dot._y = b4._y;
} else {
if (u == 300) {
dot._y = b5._y;
} else {
if (u == 600) {
dot._y = b6._y;
}
}
}
}
}
}
}
}
}
button 2595 {
on (release) {
_root.f_ExitEditRoom();
}
}
movieClip 2600 {
}
movieClip 2603 {
}
movieClip 2605 {
}
movieClip 2606 {
frame 1 {
clicker.onMouseDown = function () {
if (clicker._xmouse >= clicker._x && clicker._xmouse <= clicker._x + bg._width) {
if (clicker._ymouse >= clicker._y && clicker._ymouse <= clicker._y + clicker._height) {
active = true;
}
}
};
clicker.onMouseUp = function () {
active = false;
};
}
instance of movieClip 205 {
onClipEvent (enterFrame) {
_root.f_DragBar(_parent);
}
}
}
movieClip 2614 {
frame 1 {
stop();
}
}
button 2617 {
on (release) {
gotoAndStop(1);
}
}
button 2620 {
on (release) {
gotoAndStop(2);
}
}
movieClip 2622 {
frame 1 {
stop();
}
}
movieClip 2623 {
frame 1 {
_root.weapon = _root.b1.a1;
_parent.atype.gotoAndStop('reset');
stop();
}
frame 2 {
_root.weapon = _root.b1.a2;
_parent.atype.gotoAndStop('reset');
}
}
movieClip 2625 {
}
movieClip 2637 {
frame 1 {
stop();
}
}
movieClip 2642 {
frame 1 {
stop();
}
}
button 2643 {
on (release) {
if (_root.weapon.atype == 1) {
_root.f_ChangeBulletArt(1);
}
gotoAndStop(2);
}
}
button 2644 {
on (release) {
if (_root.weapon.atype == 2) {
_root.f_ChangeBombType(1);
}
gotoAndStop(3);
}
}
button 2645 {
on (release) {
gotoAndStop(4);
}
}
button 2646 {
on (release) {
gotoAndStop(5);
}
}
button 2647 {
on (release) {
gotoAndStop(6);
}
}
button 2648 {
on (release) {
gotoAndStop(7);
}
}
movieClip 2649 {
frame 1 {
stop();
}
frame 2 {
_root.f_EditBullet();
_parent.keys.line.gotoAndStop(_root.weapon.atype);
}
frame 3 {
_root.f_EditBomb();
_parent.keys.line.gotoAndStop(_root.weapon.atype);
}
frame 4 {
_root.f_EditBeam();
_parent.keys.line.gotoAndStop(_root.weapon.atype);
}
frame 5 {
_root.f_EditTeleport();
_parent.keys.line.gotoAndStop(_root.weapon.atype);
}
frame 6 {
_root.f_EditShield();
_parent.keys.line.gotoAndStop(_root.weapon.atype);
}
frame 7 {
_root.f_EditSword();
_parent.keys.line.gotoAndStop(_root.weapon.atype);
}
frame 8 {
_parent.keys.line.gotoAndStop(_root.weapon.atype);
gotoAndStop(_root.weapon.atype + 1);
}
}
button 2653 {
on (release) {
_root.f_ExitEditBullet();
}
}
movieClip 2664 {
}
movieClip 2665 {
}
movieClip 2666 {
}
movieClip 2669 {
}
button 2670 {
on (release) {
_root.f_SetDrawTool(1);
}
}
movieClip 2673 {
}
button 2674 {
on (release) {
_root.f_SetDrawTool(3);
}
}
movieClip 2677 {
}
button 2678 {
on (release) {
_root.f_SetDrawTool(4);
}
}
movieClip 2679 {
frame 1 {
stop();
}
}
movieClip 2682 {
}
button 2684 {
on (release) {
_root.s_monitorBreak.start(0, 0);
_root.f_MakeBackup();
_root.f_ClearBitmap();
}
}
movieClip 2687 {
}
button 2689 {
on (release) {
_root.f_DrawUndo();
}
}
movieClip 2690 {
}
button 2693 {
on (release) {
_root.f_SetDrawTool(0);
if (com.newgrounds.API.__get__hasUserSession()) {
notices.gotoAndStop('saveface');
} else {
notices.targetframe = 'saveface';
notices.gotoAndStop('passport');
}
}
}
button 2694 {
on (release) {
_root.f_ExitEditDraw();
}
}
button 2696 {
on (release) {
_parent.colorpicker.gotoAndStop('on');
_root.onMouseDown = undefined;
}
}
movieClip 2697 {
}
movieClip 2699 {
}
button 2700 {
on (release) {
_root.f_ExitFaceLoad();
_root.f_UnToggleEditDraw();
gotoAndStop('loaddefault');
}
}
movieClip 2703 {
frame 1 {
var bmp = new flash.display.BitmapData(this._width, this._height, false);
bmp.draw(this);
this.onMouseMove = function () {
var v5 = bmp.getPixel(_xmouse, _ymouse);
var v2 = (v5.toString(16)).toUpperCase();
while (v2.length < 6) {
v2 = '0' + v2;
}
var v4 = Number('0x' + v2.substr(0, 2));
var v6 = Number('0x' + v2.substr(2, 2));
var v3 = Number('0x' + v2.substr(4, 2));
_parent.testo.text = '#' + v2 + ' (R:' + v4 + ', G:' + v6 + ', B:' + v3 + ')';
_parent.hexcolor = v2;
};
}
}
button 2704 {
on (release) {
_root.f_PickColor(hexcolor);
}
}
movieClip 2705 {
}
movieClip 2708 {
}
button 2710 {
on (release) {
_root.f_SetDrawTool(0);
_root.f_ExitFaceLoad();
_root.f_UnToggleEditDraw();
gotoAndStop('hats');
}
}
movieClip 2713 {
}
button 2715 {
on (release) {
_root.f_SetDrawTool(0);
_root.f_ExitFaceLoad();
_root.f_UnToggleEditDraw();
gotoAndStop('hands');
}
}
button 2716 {
on (release) {
gotoAndStop(1);
}
}
movieClip 2719 {
frame 1 {
var bmp = new flash.display.BitmapData(this._width, this._height, false);
bmp.draw(this);
this.onMouseMove = function () {
var v6 = bmp.getPixel(_xmouse, _ymouse);
var v3 = (v6.toString(16)).toUpperCase();
while (v3.length < 6) {
v3 = '0' + v3;
}
var v5 = Number('0x' + v3.substr(0, 2));
var v7 = Number('0x' + v3.substr(2, 2));
var v4 = Number('0x' + v3.substr(4, 2));
_parent.testo.text = '#' + v3 + ' (R:' + v5 + ', G:' + v7 + ', B:' + v4 + ')';
_parent.hexcolor = v3;
_root.f_ShowColor(v3, _parent.showcolor);
};
}
}
movieClip 2720 {
frame 1 {
stop();
}
frame 2 {
_root.f_ShowColor(_root.colorToHexString(_root.color), currentcolor);
}
}
movieClip 2727 {
}
movieClip 2728 {
}
movieClip 2729 {
frame 1 {
stop();
var icon;
icon = null;
}
frame 7 {
var file;
if (!icon && file && iconContainer) {
icon = file.attachIcon(iconContainer);
}
}
}
movieClip 2730 {
}
movieClip 2734 {
frame 1 {
stop();
}
}
movieClip 2737 {
frame 1 {
stop();
mouseChildren = false;
}
}
movieClip 2738 {
frame 1 {
function setListItems(listItems) {
if (!listItems) {
_listItems = [];
} else {
_listItems = listItems.concat();
}
var v1 = 0;
while (v1 < _listItems.length) {
if (typeof _listItems[v1] == 'string') {
_listItems[v1] = {'label': _listItems[v1], 'data': _listItems[v1]};
}
++v1;
}
setSelectedIndex(0);
}
function setSelectedItem(data) {
var v1 = 0;
while (v1 < _listItems.length) {
if (_listItems[v1].data == data) {
setSelectedIndex(v1);
return undefined;
}
++v1;
}
}
function setSelectedIndex(i) {
if (i < _listItems.length) {
_selectedItem = _listItems[i];
if (currentItem && currentItem.label) {
currentItem.label.text = _selectedItem.label;
}
}
}
function hideList() {
_listDown = false;
gotoAndStop('sortUP');
}
function _onListClick() {
_listDown = !_listDown;
if (_listDown) {
gotoAndStop('sortDOWN');
} else {
gotoAndStop('sortUP');
}
}
stop();
if (listButton) {
listButton.onRelease = _onListClick;
}
if (currentItem) {
currentItem.onRelease = _onListClick;
if (currentItem.label) {
if (_selectedItem) {
currentItem.label.text = _selectedItem.label;
} else {
currentItem.label.text = '';
}
}
}
var _listItems;
var _listDown;
var _selectedItem;
if (!_listItems) {
_listItems = [];
}
}
frame 10 {
function _onItemClick() {
var v3 = MovieClip(this);
if (v3.item) {
setSelectedItem(v3.item.data);
}
if (v3 && _parent && _parent instanceof MovieClip && (MovieClip(_parent))._onListChange) {
(MovieClip(_parent))._onListChange(v3.item);
}
}
var i = 0;
var itemClip = item0;
while (itemClip) {
if (i < _listItems.length) {
itemClip.item = _listItems[i];
itemClip.label.text = _listItems[i].label;
itemClip.onRelease = _onItemClick;
} else {
itemClip._visible = false;
}
++i;
itemClip = this['item' + i];
}
}
}
movieClip 2744 {
}
movieClip 2747 SaveBrowser {
frame 1 {
function onEnterFrame() {
loadFiles();
onEnterFrame = null;
}
function loadFiles() {
_saveGroup = com.newgrounds.API.getSaveGroup(saveGroupName);
if (!_saveGroup) {
if (!(com.newgrounds.API.__get__saveGroups())[0]) {
com.newgrounds.Logger.logError('No save group created for this movie. You can create save groups on your API Settings page at http://www.newgrounds.com/account/flashapi');
gotoAndPlay('error');
return undefined;
} else {
_saveGroup = (com.newgrounds.API.__get__saveGroups())[0];
this.saveGroupName = _saveGroup.name;
com.newgrounds.Logger.logWarning('No save group name set in the Save Browser component. Defaulting to save group "' + _saveGroup.__get__name() + '".');
}
}
if (_customQuery) {
_currentQuery = _customQuery.clone();
} else {
_currentQuery = com.newgrounds.API.createSaveQuery(saveGroupName);
}
if (!_currentQuery) {
gotoAndPlay('error');
return undefined;
}
_currentQuery.__set__resultsPerPage(_numIcons);
_currentQuery.__set__page(_page);
_currentQuery.addEventListener(com.newgrounds.APIEvent.QUERY_COMPLETE, _onQueryComplete);
if (sortField) {
_currentQuery.sortOn(sortField, sortDescending);
}
if (pageText) {
pageText.text = 'Page ' + _currentQuery.__get__page();
}
if (orderText) {
orderText.text = 'Sorted by ' + _sortLabel + ', ' + (sortDescending ? 'Descending' : 'Ascending');
}
if (orderButton) {
if (sortDescending) {
orderButton.gotoAndStop('sortDESC');
} else {
orderButton.gotoAndStop('sortASC');
}
}
_loading = true;
gotoAndStop('loading');
_clearFiles();
_currentQuery.execute();
}
function setQuery(query) {
_customQuery = query;
}
function _onQueryComplete(event) {
_loading = false;
if (listBox) {
listBox.mouseChildren = true;
}
if (event.__get__success()) {
_currentQuery.removeEventListener(com.newgrounds.APIEvent.QUERY_COMPLETE, _onQueryComplete);
if ((_currentQuery.__get__files()).length) {
gotoAndStop('files');
} else {
gotoAndPlay('noResults');
}
} else {
gotoAndPlay('error');
}
}
function _onPageClick() {
var v2 = this;
if (_saveGroup && !_loading) {
if (v2 == prevButton) {
--_page;
} else {
++_page;
}
if (_page < 1) {
_page = 1;
}
loadFiles();
}
}
function _onListChange(selection) {
if (_saveGroup) {
sortField = selection.data;
_sortLabel = selection.label;
loadFiles();
}
}
function _onOrderClick() {
sortDescending = !sortDescending;
loadFiles();
}
function _clearFiles() {
if (!iconList) {
return undefined;
}
var v2 = 0;
while (v2 < _numIcons) {
var v1 = iconList['icon' + v2];
if (v1) {
v1.gotoAndStop('empty');
v1.file = null;
v1.onRelease = null;
v1.onRollOver = null;
v1.onRollOut = null;
v1.enabled = false;
}
++v2;
}
}
var title;
var saveGroupName;
var sortField;
var customSortField;
var sortDescending;
if (!title) {
title = 'Select a file:';
}
if (customSortField) {
sortField = customSortField;
} else {
if (!sortField) {
sortField = com.newgrounds.SaveQuery.CREATED_ON;
}
}
var _sortLabel = 'Date';
var _saveGroup;
var _currentQuery;
var _customQuery;
var _loading;
var _numIcons = 18;
var _page = 1;
var _initialized;
_x = int(_x);
_y = int(_y);
if (titleText) {
titleText.text = title;
}
if (prevButton) {
prevButton.onRelease = _onPageClick;
}
if (nextButton) {
nextButton.onRelease = _onPageClick;
}
if (orderButton) {
orderButton.onRelease = _onOrderClick;
}
stop();
}
frame 2 {
if (listBox) {
if (!listBox.hideList) {
listBox._visible = false;
} else {
listBox.hideList();
var items = [{'label': 'Date', 'data': com.newgrounds.SaveQuery.CREATED_ON}, {'label': 'Name', 'data': com.newgrounds.SaveQuery.FILE_NAME}, {'label': 'Views', 'data': com.newgrounds.SaveQuery.FILE_VIEWS}];
var i;
i = 0;
while (i < _saveGroup.ratings.length) {
if (_saveGroup.ratings[i].name == 'Rating') {
items.push(_saveGroup.ratings[i].name);
}
++i;
}
listBox.setListItems(items);
listBox.setSelectedItem(sortField);
}
}
}
frame 10 {
function _onFileOver() {
var v6 = MovieClip(this);
if (!_loading && v6) {
var v3 = com.newgrounds.SaveFile(v6.file);
v6.gotoAndStop('fileHover');
if (!_loading && infoBox && _saveGroup) {
infoBox._visible = true;
if (infoBox.filenameText) {
infoBox.filenameText.text = v3.name;
}
var v4 = 'by ' + v3.__get__authorName() + '\n';
v4 += v3.__get__description() + '\n';
var v7 = 0;
if (_root.browseType == 0) {
v4 += 'Battles: ' + v3.__get__views() + '\n';
} else {
v4 += 'Loadouts: ' + v3.__get__views() + '\n';
}
for (var v5 in v3.__get__ratings()) {
if (v5 == 'Difficulty') {
v4 += v5 + ': ' + Math.round((v3.__get__ratings())[v5] * 10) / 10 + ' / 5' + '\n';
}
if (v5 == 'Rating') {
v4 += 'Score: ' + Math.round((v3.__get__ratings())[v5] * 10) / 10 + ' / 5' + '\n';
}
}
if (infoBox.infoText) {
infoBox.infoText.text = v4;
}
}
}
}
function _onFileOut() {
var v2 = MovieClip(this);
if (!_loading && v2) {
v2.gotoAndStop('file');
}
if (infoBox) {
infoBox._visible = false;
}
}
function _onFileClick() {
var v2 = MovieClip(this);
if (!_loading && v2 && v2.file) {
_loading = true;
v2.gotoAndStop('file');
v2.file.addEventListener(com.newgrounds.APIEvent.FILE_LOADED, _onFileLoaded);
gotoAndStop('loading');
v2.file.load();
}
}
function _onFileLoaded(event) {
_loading = false;
gotoAndStop('files');
}
if (infoBox) {
infoBox.startDrag(true);
infoBox.enabled = false;
infoBox._visible = false;
}
if (iconList && _currentQuery) {
i = 0;
while (i < _numIcons) {
var iconClip = iconList['icon' + i];
var file = com.newgrounds.SaveFile(_currentQuery.files[i]);
if (iconClip && file && !iconClip.file) {
iconClip.file = file;
iconClip.gotoAndStop('file');
iconClip.onRollOver = _onFileOver;
iconClip.onRollOut = _onFileOut;
iconClip.onRelease = _onFileClick;
iconClip.enabled = true;
}
++i;
}
}
}
frame 20 {
function _onReloadClick() {
loadFiles();
}
if (reloadButton) {
reloadButton.onRelease = _onReloadClick;
}
}
frame 28 {
stop();
}
frame 29 {
if (reloadButton) {
reloadButton.onRelease = _onReloadClick;
}
}
frame 37 {
stop();
}
}
button 2748 {
on (release) {
_root.f_ExitFaceLoad();
gotoAndStop('editdraw');
}
}
button 2749 {
on (release) {
gotoAndStop('loadyours');
}
}
button 2751 {
on (release) {
gotoAndStop('loaddefault');
}
}
button 2755 {
on (release) {
gotoAndStop('editdraw');
}
}
button 2756 {
on (release) {
_root.f_ExitFaceLoad();
_root.f_UnToggleEditDraw();
gotoAndStop('hats');
}
}
button 2757 {
on (release) {
_root.f_ExitFaceLoad();
_root.f_UnToggleEditDraw();
gotoAndStop('hands');
}
}
movieClip 2764 {
}
button 2765 {
on (release) {
_root.f_UpdateHat(9999);
}
}
button 2766 {
on (release) {
_root.f_UpdateHand(1);
}
}
button 2767 {
on (release) {
_root.f_ExitBossLoad();
}
}
button 2770 {
on (release) {
gotoAndStop('raybots');
}
}
movieClip 2771 {
frame 1 {
stop();
}
}
movieClip 2773 {
}
movieClip 2774 {
frame 1 {
Mouse.removeListener(_root.wheelListener);
stop();
}
frame 2 {
_root.f_EndDemo();
Mouse.removeListener(_root.wheelListener);
if (_root.sawselect) {
select.gotoAndStop('choose');
} else {
_root.sawselect = true;
}
_root.fromSelect = true;
}
frame 3 {
_root.f_RaybotsMenu();
}
frame 4 {
_root.f_HumanMenu();
Mouse.addListener(_root.wheelListener);
_root.campaignselect = true;
_root.bosslogselect = false;
}
frame 5 {
_quality = 'medium';
Mouse.addListener(_root.wheelListener);
_root.campaignselect = false;
_root.bosslogselect = true;
}
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_BulletDemo();
}
}
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_BombDemo();
}
}
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_BeamDemo();
}
}
instance of movieClip 95 blank {
onClipEvent (enterFrame) {
_root.f_TeleportDemo();
}
}
frame 16 {
function setColor(myColor) {
_root.setColor(myColor);
}
_root.f_InitDraw();
}
instance of movieClip 205 {
onClipEvent (enterFrame) {
_root.f_LineWork();
if (Key.isDown(90)) {
if (!pressedUndo) {
pressedUndo = true;
_root.f_DrawUndo();
}
} else {
pressedUndo = false;
}
}
}
frame 17 {
_root.browseType = 1;
var query = com.newgrounds.API.createSaveQuery('Faces');
query.addCondition('personal', '!=', true);
saveBrowser._customQuery = query;
_root.f_FaceListener();
}
instance saveBrowser of movieClip 2747 SaveBrowser {
onClipEvent (construct) {
saveGroupName = 'Faces';
title = 'Select a face to load:';
sortDescending = true;
sortField = 'createdOn';
customSortField = '';
}
}
frame 19 {
_root.browseType = 1;
var query = com.newgrounds.API.createSaveQuery('Faces');
query.addCondition(com.newgrounds.SaveQuery.AUTHOR_NAME, '=', com.newgrounds.API.__get__username());
saveBrowser._customQuery = query;
_root.f_FaceListener();
}
instance saveBrowser of movieClip 2747 SaveBrowser {
onClipEvent (construct) {
saveGroupName = 'Faces';
title = 'Select a face to load:';
sortDescending = true;
sortField = 'createdOn';
customSortField = '';
}
}
frame 20 {
_root.f_PopulateItems(itemlist, 'hats', _root.hatsTotal);
}
frame 21 {
_root.f_PopulateItems(itemlist, 'hands', _root.handsTotal);
}
frame 22 {
_root.browseType = 0;
_root.singlebossfight = true;
_root.f_BossListener();
}
instance saveBrowser of movieClip 2747 SaveBrowser {
onClipEvent (construct) {
saveGroupName = 'Bosses';
title = 'Select a boss to fight:';
sortDescending = true;
sortField = 'createdOn';
customSortField = '';
}
}
frame 24 {
_root.browseType = 0;
var query = com.newgrounds.API.createSaveQuery('Bosses');
query.addCondition(com.newgrounds.SaveQuery.AUTHOR_NAME, '=', com.newgrounds.API.__get__username());
saveBrowser._customQuery = query;
_root.f_BossListener();
}
instance saveBrowser of movieClip 2747 SaveBrowser {
onClipEvent (construct) {
saveGroupName = 'Bosses';
title = 'Select a boss to load:';
sortDescending = true;
sortField = 'createdOn';
customSortField = '';
}
}
instance of movieClip 205 {
onClipEvent (load) {
timer = _root.logdelay;
}
onClipEvent (enterFrame) {
--timer;
if (timer == 40) {
_parent.earth.gotoAndStop('on');
}
if (timer <= 0) {
_parent.gotoAndStop('bosslog');
}
}
}
}
movieClip 2777 {
frame 1 {
stop();
}
}