Frame 1
function init_movie() {
if (!visited) {
visited = true;
sendTracker(3);
}
levelnum = 0;
score = 0;
patients_saved = 0;
patients_died = 0;
ntime = 5;
show_tip();
surgeon_mc.gotoAndPlay("show");
init_map();
}
function getTimeOfDay() {
var _local3 = new Date();
var _local1 = _local3.getHours();
var _local2;
if ((_local1 >= 0) && (_local1 <= 11)) {
_local2 = "morning";
} else if ((_local1 >= 12) && (_local1 <= 17)) {
_local2 = "afternoon";
} else {
_local2 = "evening";
}
return(_local2);
}
function show_tip(str, delay, callback) {
pause_game();
clearInterval(tipdelay);
if (str != null) {
tip_mc.field.autoSize = "center";
tip_mc.txt = get_tip_string(str);
tip_mc.field._y = tip_mc.reg._y - (tip_mc.field._height / 2);
tip_mc.mid._y = tip_mc.field._y;
tip_mc.mid._height = tip_mc.field._height;
tip_mc.top._y = tip_mc.mid._y - tip_mc.top._height;
tip_mc.bot._y = tip_mc.mid._y + tip_mc.mid._height;
tip_mc.field._y = tip_mc.field._y - 5;
tip_mc._visible = 1;
if (delay != null) {
_global.tipdelay = setInterval(function () {
show_tip();
callback();
}, delay);
}
} else {
tip_mc.txt = "";
tip_mc._visible = 0;
}
}
function get_tip_string(strid) {
tips = [];
tips.demo0 = ("Good " + getTimeOfDay()) + " surgeon. Your shift is about to start. It's time for the changeover so we'd better let you know what's happening on the ward.";
tips.demo1 = "First of all you have a patient in the waiting area awaiting an urgent transplant. You can see how much 'time' he/she has left from the bedside icon next to him/her. This icon also illustrates which organ is needed. So in this case, he/she requires a heart. Pay attention, time is ticking. You need to click on the patient and drag them to a made bed.";
tips.demo2 = "In the organ delivery area there are icons displaying all of your available choices. Ah! Just in time\u2026look. A heart has arrived for your patient. Click on the heart icon. Hurry now\u2026it won\u2019t stay useful for long.";
tips.demo3 = "Excellent. Now you\u2019ve picked it up, click on the patient to transplant the organ.";
tips.demo4 = "Good job. Now remember, some of your patients could be children, so make sure you use the right organ for the right patient. In the organ delivery room you can see the difference quite clearly.";
tips.demo5 = "Oh and one last thing: Keep an eye on your waiting room on the left hand side. You don\u2019t want that to get full - their time\u2019s ticking as well. After each transplant, it\u2019s up to you to select the next patient across by clicking on them, but only up to the maximum allowed on the ward. Well, that\u2019s it for me. Now it\u2019s over to you. Good luck with your shift, looks like it could be a busy one.";
tips.levelstart = "Begin your shift. 12 hrs remaining.";
var _local1 = ((patients_saved == 1) ? "transplant" : "transplants.");
tips.levelend = (("Shift over: You have managed " + patients_saved) + " successful ") + _local1;
tips.levelfail = ("GAME OVER\n\nFinal Score: " + score) + "\n\nToo many lives have been lost, but don't worry you don't have to be a surgeon to save lives. There is a serious shortage of donated organs. Why not play again (or even better, sign up to the NHS Organ Donor Register)?";
return(tips[strid]);
}
function init_map() {
offsetx = mapclip._x;
offsety = mapclip._y;
buildMap();
}
function buildMap() {
tileW = (tileH = 24.4);
d = 0;
for (mc in mapclip) {
mapclip[mc].removeMovieClip();
}
r = 0;
while (r < map.length) {
c = 0;
while (c < map[0].length) {
initObj = {_x:c * tileW, _y:r * tileH, frame:map[r][c] + 1};
var _local1 = mapclip.attachMovie("tile", (("tile_" + r) + "_") + c, d++, initObj);
_local1.r = r;
_local1.c = c;
_local1.gotoAndStop(_local1.frame);
if (_local1.frame > 2) {
astar.nodes[(("node" + c) + "_") + r] = astar.solidOb;
}
c++;
}
r++;
}
}
function scrolltxt(field, speed) {
this.onMouseUp = function () {
scroll_process.removeMovieClip();
delete this.onMouseUp;
};
createEmptyMovieClip("scroll_process", 1);
scroll_process.onEnterFrame = function () {
field.scroll = field.scroll + speed;
};
}
stop();
_global.mainTL = this;
Stage.showMenu = false;
_global.MD5 = new Object();
MD5.hexcase = 0;
MD5.b64pad = "";
MD5.chrsz = 8;
MD5.hex_md5 = function (s) {
var _local1 = this;
return(_local1.binl2hex(_local1.core_md5(_local1.str2binl(s), s.length * _local1.chrsz)));
};
MD5.b64_md5 = function (s) {
var _local1 = this;
return(_local1.binl2b64(_local1.core_md5(_local1.str2binl(s), s.length * _local1.chrsz)));
};
MD5.str_md5 = function (s) {
var _local1 = this;
return(_local1.binl2str(_local1.core_md5(_local1.str2binl(s), s.length * _local1.chrsz)));
};
MD5.hex_hmac_md5 = function (key, data) {
return(this.binl2hex(this.core_hmac_md5(key, data)));
};
MD5.b64_hmac_md5 = function (key, data) {
return(this.binl2b64(this.core_hmac_md5(key, data)));
};
MD5.str_hmac_md5 = function (key, data) {
return(this.binl2str(this.core_hmac_md5(key, data)));
};
MD5.md5_vm_test = function () {
return(this.hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72");
};
MD5.core_md5 = function (x, len) {
var olda;
var oldb;
var oldc;
var oldd;
x[len >> 5] = x[len >> 5] | (128 << (len & 31));
x[(((len + 64) >>> 9) << 4) + 14] = len;
var a = 1732584193;
var _local3 = -271733879;
var _local2 = -1732584194;
var _local1 = 271733878 /* 0x10325476 */;
var max = x.length;
var i = 0;
while (i < max) {
olda = a;
oldb = _local3;
oldc = _local2;
oldd = _local1;
a = this.md5_ff(a, _local3, _local2, _local1, x[i + 0], 7, -680876936);
_local1 = this.md5_ff(_local1, a, _local3, _local2, x[i + 1], 12, -389564586);
_local2 = this.md5_ff(_local2, _local1, a, _local3, x[i + 2], 17, 606105819);
_local3 = this.md5_ff(_local3, _local2, _local1, a, x[i + 3], 22, -1044525330);
a = this.md5_ff(a, _local3, _local2, _local1, x[i + 4], 7, -176418897);
_local1 = this.md5_ff(_local1, a, _local3, _local2, x[i + 5], 12, 1200080426);
_local2 = this.md5_ff(_local2, _local1, a, _local3, x[i + 6], 17, -1473231341);
_local3 = this.md5_ff(_local3, _local2, _local1, a, x[i + 7], 22, -45705983);
a = this.md5_ff(a, _local3, _local2, _local1, x[i + 8], 7, 1770035416);
_local1 = this.md5_ff(_local1, a, _local3, _local2, x[i + 9], 12, -1958414417);
_local2 = this.md5_ff(_local2, _local1, a, _local3, x[i + 10], 17, -42063);
_local3 = this.md5_ff(_local3, _local2, _local1, a, x[i + 11], 22, -1990404162);
a = this.md5_ff(a, _local3, _local2, _local1, x[i + 12], 7, 1804603682);
_local1 = this.md5_ff(_local1, a, _local3, _local2, x[i + 13], 12, -40341101);
_local2 = this.md5_ff(_local2, _local1, a, _local3, x[i + 14], 17, -1502002290);
_local3 = this.md5_ff(_local3, _local2, _local1, a, x[i + 15], 22, 1236535329);
a = this.md5_gg(a, _local3, _local2, _local1, x[i + 1], 5, -165796510);
_local1 = this.md5_gg(_local1, a, _local3, _local2, x[i + 6], 9, -1069501632);
_local2 = this.md5_gg(_local2, _local1, a, _local3, x[i + 11], 14, 643717713);
_local3 = this.md5_gg(_local3, _local2, _local1, a, x[i + 0], 20, -373897302);
a = this.md5_gg(a, _local3, _local2, _local1, x[i + 5], 5, -701558691);
_local1 = this.md5_gg(_local1, a, _local3, _local2, x[i + 10], 9, 38016083);
_local2 = this.md5_gg(_local2, _local1, a, _local3, x[i + 15], 14, -660478335);
_local3 = this.md5_gg(_local3, _local2, _local1, a, x[i + 4], 20, -405537848);
a = this.md5_gg(a, _local3, _local2, _local1, x[i + 9], 5, 568446438);
_local1 = this.md5_gg(_local1, a, _local3, _local2, x[i + 14], 9, -1019803690);
_local2 = this.md5_gg(_local2, _local1, a, _local3, x[i + 3], 14, -187363961);
_local3 = this.md5_gg(_local3, _local2, _local1, a, x[i + 8], 20, 1163531501);
a = this.md5_gg(a, _local3, _local2, _local1, x[i + 13], 5, -1444681467);
_local1 = this.md5_gg(_local1, a, _local3, _local2, x[i + 2], 9, -51403784);
_local2 = this.md5_gg(_local2, _local1, a, _local3, x[i + 7], 14, 1735328473);
_local3 = this.md5_gg(_local3, _local2, _local1, a, x[i + 12], 20, -1926607734);
a = this.md5_hh(a, _local3, _local2, _local1, x[i + 5], 4, -378558);
_local1 = this.md5_hh(_local1, a, _local3, _local2, x[i + 8], 11, -2022574463);
_local2 = this.md5_hh(_local2, _local1, a, _local3, x[i + 11], 16, 1839030562);
_local3 = this.md5_hh(_local3, _local2, _local1, a, x[i + 14], 23, -35309556);
a = this.md5_hh(a, _local3, _local2, _local1, x[i + 1], 4, -1530992060);
_local1 = this.md5_hh(_local1, a, _local3, _local2, x[i + 4], 11, 1272893353);
_local2 = this.md5_hh(_local2, _local1, a, _local3, x[i + 7], 16, -155497632);
_local3 = this.md5_hh(_local3, _local2, _local1, a, x[i + 10], 23, -1094730640);
a = this.md5_hh(a, _local3, _local2, _local1, x[i + 13], 4, 681279174);
_local1 = this.md5_hh(_local1, a, _local3, _local2, x[i + 0], 11, -358537222);
_local2 = this.md5_hh(_local2, _local1, a, _local3, x[i + 3], 16, -722521979);
_local3 = this.md5_hh(_local3, _local2, _local1, a, x[i + 6], 23, 76029189);
a = this.md5_hh(a, _local3, _local2, _local1, x[i + 9], 4, -640364487);
_local1 = this.md5_hh(_local1, a, _local3, _local2, x[i + 12], 11, -421815835);
_local2 = this.md5_hh(_local2, _local1, a, _local3, x[i + 15], 16, 530742520);
_local3 = this.md5_hh(_local3, _local2, _local1, a, x[i + 2], 23, -995338651);
a = this.md5_ii(a, _local3, _local2, _local1, x[i + 0], 6, -198630844);
_local1 = this.md5_ii(_local1, a, _local3, _local2, x[i + 7], 10, 1126891415);
_local2 = this.md5_ii(_local2, _local1, a, _local3, x[i + 14], 15, -1416354905);
_local3 = this.md5_ii(_local3, _local2, _local1, a, x[i + 5], 21, -57434055);
a = this.md5_ii(a, _local3, _local2, _local1, x[i + 12], 6, 1700485571);
_local1 = this.md5_ii(_local1, a, _local3, _local2, x[i + 3], 10, -1894986606);
_local2 = this.md5_ii(_local2, _local1, a, _local3, x[i + 10], 15, -1051523);
_local3 = this.md5_ii(_local3, _local2, _local1, a, x[i + 1], 21, -2054922799);
a = this.md5_ii(a, _local3, _local2, _local1, x[i + 8], 6, 1873313359);
_local1 = this.md5_ii(_local1, a, _local3, _local2, x[i + 15], 10, -30611744);
_local2 = this.md5_ii(_local2, _local1, a, _local3, x[i + 6], 15, -1560198380);
_local3 = this.md5_ii(_local3, _local2, _local1, a, x[i + 13], 21, 1309151649);
a = this.md5_ii(a, _local3, _local2, _local1, x[i + 4], 6, -145523070);
_local1 = this.md5_ii(_local1, a, _local3, _local2, x[i + 11], 10, -1120210379);
_local2 = this.md5_ii(_local2, _local1, a, _local3, x[i + 2], 15, 718787259);
_local3 = this.md5_ii(_local3, _local2, _local1, a, x[i + 9], 21, -343485551);
a = this.safe_add(a, olda);
_local3 = this.safe_add(_local3, oldb);
_local2 = this.safe_add(_local2, oldc);
_local1 = this.safe_add(_local1, oldd);
i = i + 16;
}
var result = Array(a, _local3, _local2, _local1);
return(result);
};
MD5.md5_cmn = function (q, a, b, x, s, t) {
var _local1 = this;
var _local2 = _local1.safe_add(_local1.bit_rol(_local1.safe_add(_local1.safe_add(a, q), _local1.safe_add(x, t)), s), b);
return(_local2);
};
MD5.md5_ff = function (a, b, c, d, x, s, t) {
var _local1 = b;
return(this.md5_cmn((_local1 & c) | ((~_local1) & d), a, _local1, x, s, t));
};
MD5.test = function () {
};
MD5.md5_gg = function (a, b, c, d, x, s, t) {
return(this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t));
};
MD5.md5_hh = function (a, b, c, d, x, s, t) {
return(this.md5_cmn((b ^ c) ^ d, a, b, x, s, t));
};
MD5.md5_ii = function (a, b, c, d, x, s, t) {
return(this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t));
};
MD5.core_hmac_md5 = function (key, data) {
var _local2 = this.str2binl(key);
if (_local2.length > 16) {
_local2 = this.core_md5(_local2, key.length * this.chrsz);
}
var _local3 = Array(16);
var opad = Array(16);
var _local1 = 0;
while (_local1 < 16) {
_local3[_local1] = _local2[_local1] ^ 909522486;
opad[_local1] = _local2[_local1] ^ 1549556828;
_local1++;
}
var hash = this.core_md5(_local3.concat(this.str2binl(data)), 512 + (data.length * this.chrsz));
return(this.core_md5(opad.concat(hash), 640));
};
MD5.safe_add = function (x, y) {
var _local1 = (x & 65535) + (y & 65535);
var _local2 = ((x >> 16) + (y >> 16)) + (_local1 >> 16);
return((_local2 << 16) | (_local1 & 65535));
};
MD5.bit_rol = function (num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
};
MD5.str2binl = function (str) {
var _local2 = this;
var _local3 = Array();
var mask = ((1 << _local2.chrsz) - 1);
var max = (str.length * _local2.chrsz);
var _local1 = 0;
while (_local1 < max) {
_local3[_local1 >> 5] = _local3[_local1 >> 5] | ((str.charCodeAt(_local1 / _local2.chrsz) & mask) << (_local1 & 31));
_local1 = _local1 + _local2.chrsz;
}
return(_local3);
};
MD5.binl2str = function (bin) {
var _local2 = "";
var _local3 = (1 << this.chrsz) - 1;
var max = (bin.length * 32);
var _local1 = 0;
while (_local1 < max) {
_local2 = _local2 + String.fromCharCode((bin[_local1 >> 5] >>> (_local1 & 31)) & _local3);
_local1 = _local1 + this.chrsz;
}
return(_local2);
};
MD5.binl2hex = function (binarray) {
var _local3 = binarray;
var _local2 = (this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef");
var str = "";
var max = (_local3.length * 4);
var _local1 = 0;
while (_local1 < max) {
str = str + (_local2.charAt((_local3[_local1 >> 2] >> (((_local1 & 3) * 8) + 4)) & 15) + _local2.charAt((_local3[_local1 >> 2] >> ((_local1 & 3) * 8)) & 15));
_local1++;
}
return(str);
};
MD5.binl2b64 = function (binarray) {
var _local3 = binarray;
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
var max = (_local3.length * 4);
var m4x = (4 * max);
var _local1 = 0;
while (_local1 < max) {
var triplet = (((((_local3[_local1 >> 2] >> (8 * (_local1 & 3))) & 255) << 16) | (((_local3[(_local1 + 1) >> 2] >> (8 * ((_local1 + 1) & 3))) & 255) << 8)) | ((_local3[(_local1 + 2) >> 2] >> (8 * ((_local1 + 2) & 3))) & 255));
_local1 = _local1 + 3;
}
var _local2 = 0;
while (_local2 < 4) {
if (((_local1 * 8) + (_local2 * 6)) > m4x) {
str = str + this.b64pad;
} else {
str = str + tab.charAt((triplet >> (6 * (3 - _local2))) & 63);
}
_local2++;
}
return(str);
};
_global.doClickthru = function (id) {
var _local1 = [];
_local1[0] = {loc:"https://www.uktransplant.org.uk/ukt/Consent.do?campaign=1000", trackerid:7};
_local1[1] = {loc:"https://www.uktransplant.org.uk/ukt/Consent.do?campaign=1000", trackerid:7};
sendTracker(_local1[id - 1].trackerid);
getURL (_local1[id - 1].loc, "_blank");
};
my_so = SharedObject.getLocal("ukt_cookie");
hs_name = (sendername = ((my_so.data.stored_name != undefined) ? (my_so.data.stored_name) : ""));
hs_email = (senderemail = ((my_so.data.stored_email != undefined) ? (my_so.data.stored_email) : ""));
ingame = false;
gotoframe = null;
btn_view.onPress = function () {
gotoframe = "intro";
gotoAndStop ("hs_display");
};
btn_more.onPress = function () {
gotoAndStop ("comp");
};
btn_forward.onPress = function () {
gotoAndStop ("f2f");
};
btn_start.onPress = function () {
gotoAndStop ("demo");
};
map = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
legalsXML = new XML();
legalsXML.ignoreWhite = true;
legalsXML.load("legals.xml");
legalsXML.onLoad = function (success) {
if (success) {
terms_txt = this.firstChild.childNodes[0].firstChild.nodeValue;
privacy_txt = this.firstChild.childNodes[1].firstChild.nodeValue;
} else {
trace("failed to load xml");
}
};
_global.sendTracker = function (id, num) {
var _local1 = num;
sendVars = new LoadVars();
replyVars = new LoadVars();
if (_local1 == null) {
_local1 = 1;
}
sendVars.id = id;
sendVars.num = _local1;
sendVars.sendAndLoad(siteURL + "scripts/tracker.php", replyVars, "POST");
};
init_movie();
Instance of Symbol 128 MovieClip in Frame 1
on (release) {
doClickthru(2);
}
Frame 2
function init_demo() {
init_map();
clickorgan._visible = 0;
clickpatient._visible = 0;
clickbed._visible = 0;
next_demo_function = demo_stage1;
btn_skip.onPress = function () {
gotoAndStop ("interlude");
};
btn_next.onPress = function () {
next_demo_function();
};
bed.gotoAndStop("empty");
organ._visible = 0;
patient_mc.organ.sel_mc._visible = 0;
demo_stage0();
}
function demo_stage0() {
surgeon_mc.gotoAndPlay("show");
next_demo_function = demo_stage1;
show_tip("demo0");
}
function demo_stage1() {
surgeon_mc.gotoAndPlay("hide");
next_demo_function = stage1_interact;
show_tip("demo1");
}
function stage1_interact() {
var _local1 = this;
trace("stage1_interact()");
show_tip();
clickpatient._visible = 1;
btn_next._visible = false;
patient_mc.startx = patient_mc._x;
patient_mc.starty = patient_mc._y;
patient_mc.onPress = function () {
var _local1 = this;
clickpatient._visible = 0;
_local1.startDrag();
patient_mc.onMouseUp = function () {
var _local1 = this;
if (_local1.hitTest(bed)) {
bed.gotoAndStop("occupied");
_local1._visible = 0;
demo_stage2();
} else {
clickpatient._visible = 1;
_local1._x = _local1.startx;
_local1._y = _local1.starty;
}
_local1.stopDrag();
delete _local1.onMouseUp;
};
};
}
function demo_stage2() {
btn_next._visible = true;
next_demo_function = stage2_interact;
show_tip("demo2");
organ._visible = 1;
}
function stage2_interact() {
trace("stage2_interact()");
show_tip();
btn_next._visible = false;
clickorgan._visible = 1;
organ.sel_mc._visible = 0;
organ.onPress = function () {
organ.sel_mc._visible = 1;
surgeon.gotoAndPlay("pickup");
clickorgan._visible = 0;
};
}
function demo_stage3() {
trace("demo_stage3()");
show_tip("demo3");
btn_next._visible = true;
next_demo_function = stage3_interact;
}
function stage3_interact() {
trace("stage3_interact()");
clickbed._visible = 1;
show_tip();
btn_next._visible = false;
next_demo_function = demo_stage4;
trace("stage3_interact()");
bed.onPress = function () {
delete this.onPress;
surgeon.gotoAndPlay("deliver");
clickbed._visible = 0;
};
}
function demo_stage4() {
trace("demo_stage4()");
btn_next._visible = true;
surgeon_mc.gotoAndPlay("show");
show_tip("demo4");
next_demo_function = demo_stage5;
}
function demo_stage5() {
show_tip("demo5");
next_demo_function = function () {
gotoAndStop ("game");
};
}
init_demo();
Frame 3
astar = {};
astar.initialize = function () {
var _local1 = this;
_local1.solidOb = {solid:true, exists:true};
_local1.maxSearchTime = 5000;
_local1.s = {};
_local1.g = {};
_local1.open = [];
_local1.closed = [];
_local1.nodes = {};
};
astar.findHeuristic = function (x, y) {
var _local2 = Math.abs(x - this.g.x);
var _local1 = Math.abs(y - this.g.y);
var val1 = (Math.min(_local2, _local1) * 1.41);
var _local3 = Math.max(_local2, _local1) - Math.min(_local2, _local1);
return(val1 + _local3);
};
astar.cost = function (who, newx, newy) {
var _local1 = who;
var _local2 = 1;
if (((_local1.x - newx) != 0) && ((_local1.y - newy) != 0)) {
_local2 = 1.41;
if (this.preventClipping) {
var _local3 = (_local1.x - newx) / Math.abs(_local1.x - newx);
var ysign = ((_local1.y - newy) / Math.abs(_local1.y - newy));
var cell1x = (_local1.x - _local3);
var cell1y = _local1.y;
var cell1 = this.nodes[(("node" + cell1x) + "_") + cell1y];
var cell2x = _local1.x;
var cell2y = (_local1.y - ysign);
var cell2 = this.nodes[(("node" + cell2x) + "_") + cell2y];
if (cell1.solid || (cell2.solid)) {
_local2 = 100000 /* 0x0186A0 */;
}
}
}
return(_local2);
};
astar.checkNode = function (newx, newy, whoName) {
var _local1 = this;
var who = _local1.nodes[whoName];
var name = ((("node" + newx) + "_") + newy);
var g = (who.g + _local1.cost(who, newx, newy));
if ((who.x == _local1.g.x) && (who.y == _local1.g.y)) {
_local1.keepSearching = false;
}
if (!_local1.nodes[name].exists) {
_local1.addOpen(newx, newy, g, whoName);
} else if (!_local1.nodes[name].solid) {
if (g < _local1.nodes[name].g) {
var ob = _local1.nodes[name];
ob.parent = whoName;
ob.g = g;
ob.f = ob.h + g;
var f = ob.f;
if (_local1.nodes[name].where == "open") {
var _local3 = 0;
while (_local3 < _local1.open.length) {
if (_local1.open[_local3].name == name) {
_local1.open.splice(_local3, 1);
}
_local3++;
}
var _local2 = 0;
while (_local2 < _local1.open.length) {
if (f < _local1.open[_local2].f) {
_local1.open.splice(_local2, 0, ob);
_local1.nodes[name] = _local1.open[_local2];
break;
}
if (_local2 == (_local1.open.length - 1)) {
_local1.open.push(ob);
_local1.nodes[name] = astar.open[_local2 + 1];
break;
}
_local2++;
}
}
if (_local1.nodes[name].where == "closed") {
var _local3 = 0;
while (_local3 < _local1.closed.length) {
if (_local1.closed[_local3].name == name) {
_local1.closed.splice(_local3, 1);
}
_local3++;
}
}
}
}
};
astar.buildPath = function (name) {
var _local1 = this;
var name = ((("node" + _local1.g.x) + "_") + _local1.g.y);
var _local2 = _local1.nodes[name].parent;
var _local3 = path.pop();
_local1.path = [];
while (_local2 != null) {
_local1.path.push([_local1.nodes[_local2].x, _local1.nodes[_local2].y]);
_local2 = _local1.nodes[_local2].parent;
}
if (_local3) {
_local1.path.push(_local3);
} else {
_local1.path.push([startCol, startRow]);
}
_local1.path.reverse();
_local1.path.shift();
_local1.path.push([_local1.g.x, _local1.g.y]);
};
astar.expandNode = function (index) {
var _local1 = this;
var who = _local1.open[index];
var _local3 = who.x;
var _local2 = who.y;
var whoName = ((("node" + _local3) + "_") + _local2);
_local1.checkNode(_local3 + 1, _local2, whoName);
_local1.checkNode(_local3 + 1, _local2 - 1, whoName);
_local1.checkNode(_local3, _local2 - 1, whoName);
_local1.checkNode(_local3 - 1, _local2 - 1, whoName);
_local1.checkNode(_local3 - 1, _local2, whoName);
_local1.checkNode(_local3 - 1, _local2 + 1, whoName);
_local1.checkNode(_local3, _local2 + 1, whoName);
_local1.checkNode(_local3 + 1, _local2 + 1, whoName);
var temp = _local1.open[index];
temp.where = "closed";
_local1.open.splice(index, 1);
_local1.closed.push(temp);
if (!_local1.keepSearching) {
_local1.buildPath();
}
};
astar.addOpen = function (x, y, g, parent) {
var _local2 = this;
var h = _local2.findHeuristic(x, y);
var f = (g + h);
var _local3 = (("node" + x) + "_") + y;
var ob = {x:x, y:y, g:g, h:h, f:f, name:_local3, parent:parent, exists:true, where:"open"};
if (parent == null) {
_local2.open.push(ob);
_local2.nodes[_local3] = open[0];
}
var _local1 = 0;
while (_local1 < _local2.open.length) {
if (f < _local2.open[_local1].f) {
_local2.open.splice(_local1, 0, ob);
_local2.nodes[_local3] = _local2.open[_local1];
return;
}
if (_local1 == (_local2.open.length - 1)) {
_local2.open.push(ob);
_local2.nodes[_local3] = astar.open[_local1 + 1];
return;
}
_local1++;
}
};
astar.search = function () {
var _local1 = this;
delete _local1.path;
_local1.now = getTimer();
_local1.addOpen(astar.s.x, astar.s.y, 0, null);
_local1.keepSearching = true;
while (_local1.keepSearching) {
_local1.expandNode(0);
if ((getTimer() - _local1.now) > _local1.maxSearchTime) {
trace("no solution");
_local1.keepSearching = false;
}
}
st.text = getTimer() - _local1.now;
_local1.initialize();
return(_local1.path);
};
function reset_waitingroom() {
waitingroom = {};
waitingroom.depth = 0;
waitingroom.numslots = 4;
waitingroom.decay = 0.4 + (levelnum / 10);
waitingroom.resetdelay = 5;
waitingroom.slot0 = {active:false, respawndelay:0};
waitingroom.slot1 = {active:false, respawndelay:0};
waitingroom.slot2 = {active:false, respawndelay:0};
waitingroom.slot3 = {active:false, respawndelay:0};
patientid = 0;
for (mc in waitingroom_mc) {
waitingroom_mc[mc].removeMovieClip();
}
}
function reset_ward() {
ward = {};
ward.numbeds = 4;
ward.makebed_delay = 1 + levelnum;
ward.decay = 0.6 + (levelnum / 10);
ward.bed0 = {active:false, lifetime:0, makebed_delay:0};
ward.bed1 = {active:false, lifetime:0, makebed_delay:0};
ward.bed2 = {active:false, lifetime:0, makebed_delay:0};
ward.bed3 = {active:false, lifetime:0, makebed_delay:0};
i = 0;
while (i < ward.numbeds) {
var _local1 = ward_mc["bed" + i];
_local1.gotoAndStop("empty");
var _local2 = ward_mc["status_mc" + i].organ;
_local2.removeMovieClip();
i++;
}
}
function reset_supplyroom() {
supplyroom = {};
supplyroom.depth = 0;
supplyroom.numslots = 6;
supplyroom.decay = 1.1;
supplyroom.respawndelay = 1 + levelnum;
supplyroom.slot0 = {active:false, lifetime:0, respawndelay:0};
supplyroom.slot1 = {active:false, lifetime:0, respawndelay:0};
supplyroom.slot2 = {active:false, lifetime:0, respawndelay:0};
supplyroom.slot3 = {active:false, lifetime:0, respawndelay:0};
supplyroom.slot4 = {active:false, lifetime:0, respawndelay:0};
supplyroom.slot5 = {active:false, lifetime:0, respawndelay:0};
for (mc in supplyroom_mc) {
supplyroom_mc[mc].removeMovieClip();
}
}
function init_game() {
astar.initialize();
init_map();
init_player();
init_waypoints();
reset_waitingroom();
reset_ward();
reset_supplyroom();
init_waitingroom();
init_supplyroom();
for (i in intervals) {
clearInterval(intervals[i]);
}
intervals = [];
surgeon_mc.gotoAndPlay("show");
show_tip("levelstart", 3000, function () {
resume_game();
surgeon_mc.gotoAndPlay("hide");
});
waitingroom_process();
ward_process();
supplyroom_process();
patients_died = 0;
livesleft = maxlives;
resetHUD();
}
function update_game_status(state) {
if (state == "success") {
patients_saved++;
} else {
patients_died++;
}
livesleft = maxlives - patients_died;
trace("livesleft = " + livesleft);
score = patients_saved * score_multiplier;
updateHUD(livesleft, score);
if (livesleft == -1) {
end_level("fail");
}
}
function resetHUD() {
hud_mc.gotoAndStop(1);
hud_mc.score = score;
i = 0;
while (i < maxlives) {
hud_mc["l" + i].gotoAndStop(1);
i++;
}
}
function updateHUD(livesleft, score) {
var _local2 = livesleft;
i = 0;
while (i < maxlives) {
var _local1 = hud_mc["l" + i];
if ((i >= _local2) && (_local1._currentframe == 1)) {
_local1.gotoAndPlay("show");
}
i++;
}
hud_mc.score = score;
}
function pause_game() {
gameon = false;
}
function resume_game() {
hud_mc.gotoAndPlay("show");
gameon = true;
}
function end_level(bool) {
gameon = false;
if (bool == "fail") {
gotoAndStop ("levelfail");
} else {
gotoAndStop ("levelend");
levelnum++;
}
clock.gotoAndStop(1);
resetHUD();
surgeon_mc.gotoAndPlay("show");
}
function init_supplyroom() {
i = 0;
while (i < supplyroom.numslots) {
create_organ(i);
i++;
}
}
function create_organ(slot) {
if (levelnum > 2) {
var agegroup = ageArray[random(ageArray.length)];
} else {
var agegroup = ageArray[0];
}
var organArray = eval (agegroup + "OrganArray");
var organ = organArray[random(organArray.length)];
organ.agegroup = agegroup;
supplyroom["slot" + slot].id = slot;
supplyroom["slot" + slot].active = true;
supplyroom["slot" + slot].respawndelay = 0;
supplyroom["slot" + slot].lifetime = (supplyroom["slot" + slot].lifeleft = organ.lifetime);
var xgap = 35;
var o_clip = supplyroom_mc.attachMovie("organ_mc_" + agegroup, "organ" + slot, supplyroom.depth++, organ);
o_clip._x = (((-supplyroom.numslots) / 2) + slot) * xgap;
o_clip.gotoAndStop(organ.ref);
o_clip.sel_mc._visible = 0;
o_clip.onPress = function () {
if ((!p.operating) && (gameon)) {
var _local1 = 0;
while (_local1 < supplyroom.numslots) {
supplyroom_mc["organ" + _local1].sel_mc._visible = 0;
_local1++;
}
this.sel_mc._visible = 1;
currbedid = null;
p.selected_organ = organ;
p.selected_supplyroom_slot = supplyroom["slot" + slot];
var _local2 = mapclip[(("tile_" + waypointtile[4].y) + "_") + waypointtile[4].x];
setCourse(_local2);
}
};
}
function init_waitingroom() {
i = 0;
while (i < waitingroom.numslots) {
create_patient(i);
i++;
}
}
function create_patient(slot) {
if (levelnum > 2) {
var agegroup = ageArray[random(ageArray.length)];
} else {
var agegroup = ageArray[0];
}
var blood_type = random(2);
var organArray = eval (agegroup + "OrganArray");
var organ = organArray[random(organArray.length)];
organ.agegroup = agegroup;
var charArray = eval (agegroup + "FramesArray");
var character = charArray[random(charArray.length)];
var patient = {agegroup:agegroup, character:character, bloodtype:blood_type, organ:organ, slot:slot};
var ygap = 35;
var xgap = 48;
waitingroom["slot" + slot].active = true;
waitingroom["slot" + slot].resetting = false;
waitingroom["slot" + slot].resettime = waitingroom.resetdelay;
waitingroom["slot" + slot].lifetime = (waitingroom["slot" + slot].lifeleft = organ.lifetime);
var p_clip = waitingroom_mc.attachMovie("patient_mc", "patient" + slot, waitingroom.depth++, patient);
p_clip._y = patient.slot * ygap;
p_clip.gotoAndStop(patient.character);
var o_clip = p_clip.attachMovie("organ_mc_" + patient.agegroup, "organ_mc", 1, organ);
o_clip._x = xgap;
o_clip.sel_mc._visible = 0;
o_clip.gotoAndStop(organ.ref);
p_clip.startx = p_clip._x;
p_clip.starty = p_clip._y;
p_clip.onPress = click_patient;
}
function click_patient() {
if (gameon) {
var clip = this;
clip.startDrag();
mainTL.onMouseUp = function () {
var _local1 = clip.bedhit();
if (((_local1 == "reset") || (ward["bed" + _local1].active)) || (ward["bed" + _local1].used)) {
clip._x = clip.startx;
clip._y = clip.starty;
clip.stopDrag();
} else {
var _local3 = mainTL.ward_mc["bed" + _local1];
_local3.gotoAndStop("occupied");
_local3.patient_mc.gotoAndStop(clip.character);
var _local2 = mainTL.ward_mc["status_mc" + _local1].attachMovie("organ_mc_" + clip.agegroup, "organ", 1);
_local2.gotoAndStop(clip.organ.ref);
_local2.sel_mc._visible = 0;
_local2.fill._yscale = 100;
ward["bed" + _local1].active = true;
ward["bed" + _local1].organ = clip.organ;
ward["bed" + _local1].lifetime = (ward["bed" + _local1].lifeleft = clip.organ.lifetime);
waitingroom["slot" + clip.slot].active = false;
clip.removeMovieClip();
}
delete mainTL.onMouseUp;
};
}
}
function waitingroom_process() {
_global.waitingroom_interval = setInterval(function () {
if (gameon) {
var _local2 = 0;
while (_local2 < waitingroom.numslots) {
var _local1 = waitingroom["slot" + _local2];
var slotIsActive = _local1.active;
if (!slotIsActive) {
if (_local1.respawndelay <= patient_respawndelay) {
_local1.respawndelay++;
} else {
_local1.respawndelay = 0;
create_patient(_local2);
}
} else {
if ((_local1.lifeleft - waitingroom.decay) > 0) {
_local1.lifeleft = _local1.lifeleft - waitingroom.decay;
} else if (!_local1.resetting) {
var _local3 = waitingroom_mc.attachMovie("patient_removed_icon", "si" + waitingroom.depth, waitingroom.depth++);
_local3._x = waitingroom_mc["patient" + _local2]._x + (waitingroom_mc["patient" + _local2]._width / 2);
_local3._y = waitingroom_mc["patient" + _local2]._y + (waitingroom_mc["patient" + _local2]._height / 2);
_local3.gotoAndPlay("fail");
waitingroom_mc["patient" + _local2].removeMovieClip();
_local1.resetting = true;
_local1.active = false;
update_game_status("fail");
}
var fill = waitingroom_mc["patient" + _local2].organ_mc.fill;
var percent = ((_local1.lifeleft / _local1.lifetime) * 100);
fill._yscale = percent;
}
_local2++;
}
}
}, 1000);
intervals.push(waitingroom_interval);
}
function ward_process() {
_global.ward_interval = setInterval(function () {
if (gameon) {
var _local2 = 0;
while (_local2 < ward.numbeds) {
var _local1 = ward["bed" + _local2];
if (_local1.active) {
if (_local1.lifeleft > 0) {
_local1.lifeleft = _local1.lifeleft - ward.decay;
_local1.lifepercent = Math.floor((_local1.lifeleft / _local1.lifetime) * 100);
ward_mc["status_mc" + _local2].organ.fill._yscale = _local1.lifepercent;
} else {
_local1.lifeleft = 0;
empty_bed(_local2, "fail");
if (op_bedid == _local2) {
p.stop_operating();
}
}
} else if (_local1.used) {
if (_local1.makebed_delay < ward.makebed_delay) {
_local1.makebed_delay++;
} else {
_local1.used = false;
_local1.makebed_delay = 0;
ward_mc["bed" + _local2].gotoAndStop("empty");
ward_mc["status_mc" + _local2].organ.removeMovieClip();
}
}
_local2++;
}
}
}, 1000);
intervals.push(ward_interval);
}
function empty_bed(bedid, state) {
var _local1 = bedid;
trace(((("empty_bed(" + _local1) + ",") + state) + ")");
if (op_bedid == _local1) {
clearInterval(operation_delay);
p.animate("idle");
}
var _local3 = ward_mc["bed" + _local1];
var status_mc = ward_mc["status_mc" + _local1].organ;
_local3.gotoAndStop("used");
status_mc.removeMovieClip();
ward["bed" + _local1].used = true;
ward["bed" + _local1].active = false;
ward["bed" + _local1].success = state;
update_game_status(state);
var _local2 = ward_mc.attachMovie("patient_removed_icon", "si" + _local1, ward.depth++);
_local2._x = _local3._x;
_local2._y = _local3._y;
_local2.gotoAndPlay(state);
}
function supplyroom_process() {
_global.supplyroom_interval = setInterval(function () {
if (gameon) {
var _local2 = 0;
while (_local2 < supplyroom.numslots) {
var _local1 = supplyroom["slot" + _local2];
var _local3 = _local1.active;
if (_local3) {
if ((_local1.lifeleft - supplyroom.decay) > 0) {
_local1.lifeleft = _local1.lifeleft - supplyroom.decay;
_local1.lifepercent = Math.floor((_local1.lifeleft / _local1.lifetime) * 100);
supplyroom_mc["organ" + _local2].fill._yscale = _local1.lifepercent;
} else {
supplyroom_mc["organ" + _local2].removeMovieClip();
supplyroom["slot" + _local2].active = false;
supplyroom["slot" + _local2].lifeleft = 0;
}
} else if (_local1.respawndelay <= supplyroom.respawndelay) {
_local1.respawndelay++;
} else {
create_organ(_local2);
}
_local2++;
}
}
}, 1000);
intervals.push(supplyroom_interval);
}
function describe(obj, desc) {
var _local1 = obj;
debug(("======Begin:" + desc) + "======");
for (i in _local1) {
if (typeof(_local1[i]) == "object") {
debug(("---" + i) + "....");
for (o in _local1[i]) {
debug(((" " + o) + " : ") + _local1[i][o]);
}
} else {
debug((("-- " + i) + " : ") + _local1[i]);
}
}
debug("------------");
}
function debug(str) {
debugtxt = debugtxt + (str + newline);
debugtxt.scroll = debugtxt.maxscroll;
}
function init_player() {
var _local3 = this;
var startRow = 12;
var startCol = 9;
p = {};
p.clip = char;
p.x = x_tile_to_coord(startCol);
p.y = y_tile_to_coord(startRow);
p.rot = 0;
p.speed = 10;
p.operating = false;
p.operatetime = 2;
p.operatetimetaken = 0;
p.currframe = "idle";
p.organ = null;
p.selected_organ = null;
p.selected_supplyroom_slot = null;
allowExec = true;
p.showorgan = function (obj) {
var _local2 = obj;
if (_local2 == null) {
p.organ = null;
p.clip.organ_mc.clip.removeMovieClip();
} else {
var _local1 = p.clip.organ_mc.attachMovie("organ_mc_" + _local2.agegroup, "clip", 1);
p.organ = _local2;
_local1.sel_mc._visible = 0;
_local1.gotoAndStop(p.organ.ref);
}
};
p.collectOrgan = function () {
var _local1 = p.selected_supplyroom_slot;
if (_local1.active) {
p.showorgan(p.selected_organ);
supplyroom_mc["organ" + p.selected_supplyroom_slot.id].removeMovieClip();
_local1.active = false;
}
};
p.operate = function () {
p.animate("operate");
p.operating = true;
op_bedid = currbedid;
_global.operation_delay = setInterval(function () {
if (p.operatetimetaken < p.operatetime) {
trace("Working... keep operating");
p.operatetimetaken++;
} else {
trace("completed operation... stop operating");
empty_bed(op_bedid, "success");
p.stop_operating();
}
}, 1000);
};
p.stop_operating = function () {
trace("stop operating now");
p.operating = false;
p.animate("idle");
p.showorgan();
p.operatetimetaken = 0;
op_bedid = null;
clearInterval(operation_delay);
};
p.animate = function (frame) {
var _local1 = frame;
var _local2 = this;
if (_local2.currframe != _local1) {
if (_local1 == "operate") {
p.rot = ((currbedid < 2) ? 180 : 0);
p.render();
}
_local2.clip.inner.gotoAndStop(_local1);
_local2.currframe = _local1;
}
};
p.showorgan();
p.render();
}
function setCourse(destTile) {
astar.s.x = x_coord_to_tile(p.x);
astar.s.y = y_coord_to_tile(p.y);
astar.g.x = destTile.c;
astar.g.y = destTile.r;
buildMap();
path = astar.search();
movechar();
}
function trig_move(ob, a, s) {
var _local1 = ob;
_local1.x = _local1.x - (Math.sin(a * (Math.PI/180)) * s);
_local1.y = _local1.y - (Math.cos(a * (Math.PI/180)) * s);
_local1.render();
}
function trig_rotate(obj, x, y) {
obj.rot = (Math.atan2(y, x) / (Math.PI/180)) + 90;
}
function x_tile_to_coord(n) {
var _local1 = offsetx + (n * tileW);
return(_local1);
}
function y_tile_to_coord(n) {
var _local1 = offsety + (n * tileH);
return(_local1);
}
function x_coord_to_tile(x) {
var _local1 = Math.round((x - offsetx) / tileW);
return(_local1);
}
function y_coord_to_tile(y) {
var _local1 = Math.round((y - offsety) / tileH);
return(_local1);
}
function movechar() {
pathid = 0;
p.x = x_tile_to_coord(path[pathid][0]);
p.y = y_tile_to_coord(path[pathid][1]);
p.render();
this.onEnterFrame = function () {
allowExec = false;
tx = x_tile_to_coord(path[pathid][0]);
ty = y_tile_to_coord(path[pathid][1]);
distx = tx - p.x;
disty = ty - p.y;
dist = Math.sqrt((distx * distx) + (disty * disty));
a = Math.atan2(p.x - tx, p.y - ty) / (Math.PI/180);
trig_rotate(p, distx, disty);
trig_move(p, a, p.speed);
if (dist < p.speed) {
p.x = tx;
p.y = ty;
if (pathid < (path.length - 1)) {
pathid++;
} else {
if (currbedid != null) {
if (checkCompatiblePatient()) {
p.operate();
} else {
p.animate("idle");
}
} else {
p.animate("idle");
p.collectOrgan();
}
allowExec = true;
delete this.onEnterFrame;
return(undefined);
}
p.animate("run");
}
};
}
function checkCompatiblePatient() {
var _local1 = ward["bed" + currbedid];
if (p.organ.ref == _local1.organ.ref) {
if (p.organ.agegroup == _local1.organ.agegroup) {
return(true);
}
}
return(false);
}
function init_waypoints() {
waypointtile = [];
waypointtile[0] = {x:5, y:3};
waypointtile[1] = {x:13, y:3};
waypointtile[2] = {x:5, y:10};
waypointtile[3] = {x:13, y:10};
waypointtile[4] = {x:9, y:13};
var i = 0;
while (i < 4) {
var b = eval ("btn" + i);
b.id = i;
b.onRelease = function () {
var _local1 = this;
if (((currbedid != _local1.id) && (!p.operating)) && (gameon)) {
if (ward["bed" + _local1.id].active) {
currbedid = _local1.id;
trace("currbedid = " + currbedid);
var _local2 = mapclip[(("tile_" + waypointtile[_local1.id].y) + "_") + waypointtile[_local1.id].x];
setCourse(_local2);
}
}
};
i++;
}
}
stop();
var adultFramesArray = [1, 2, 3, 4, 5, 6, 7, 8];
var childFramesArray = [9, 10, 11, 12];
var ageArray = ["adult", "child"];
var patient_respawndelay = 5;
var organ_respawndelay = 5;
var maxlives = 3;
var score_multiplier = 15;
ticksnd = new Sound();
ticksnd.attachSound("bleep");
clock.gotoAndStop(1);
if (!played_once) {
played_once = true;
sendTracker(4);
ingame = true;
} else if (!ingame) {
ingame = true;
sendTracker(5);
}
MovieClip.prototype.getGlobalCoords = function () {
var _local2 = this;
var _local1 = {x:_local2._x, y:_local2._y};
_local2.localToGlobal(_local1);
return(_local1);
};
var childOrganArray = [];
var adultOrganArray = [];
adultOrganArray[0] = {ref:"heart", lifetime:25};
adultOrganArray[1] = {ref:"kidney", lifetime:32};
adultOrganArray[2] = {ref:"liver", lifetime:28};
adultOrganArray[3] = {ref:"lung", lifetime:41};
childOrganArray[0] = {ref:"heart", lifetime:25};
childOrganArray[1] = {ref:"kidney", lifetime:32};
childOrganArray[2] = {ref:"liver", lifetime:28};
childOrganArray[3] = {ref:"lung", lifetime:41};
MovieClip.prototype.bedhit = function () {
var _local2 = this;
var _local1 = 0;
while (_local1 < ward.numbeds) {
if (_local2.hitTest(ward_mc["bed" + _local1])) {
return(_local1);
}
_local1++;
}
return("reset");
};
Object.prototype.render = function () {
var _local1 = this;
_local1.clip._x = _local1.x;
_local1.clip._y = _local1.y;
_local1.clip.inner._rotation = _local1.rot;
};
map = [[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [10, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 10], [10, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 10], [10, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 10], [10, 0, 11, 11, 11, 11, 11, 3, 0, 0, 0, 3, 11, 11, 11, 11, 11, 0, 10], [10, 0, 2, 2, 2, 2, 2, 4, 0, 0, 0, 5, 2, 2, 2, 2, 2, 0, 10], [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10], [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10], [10, 0, 2, 2, 2, 2, 2, 7, 0, 0, 0, 6, 2, 2, 2, 2, 2, 0, 10], [10, 0, 11, 11, 11, 11, 11, 3, 0, 0, 0, 3, 11, 11, 11, 11, 11, 0, 10], [10, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 10], [10, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 10], [10, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 10], [10, 2, 2, 2, 2, 2, 2, 4, 0, 0, 0, 5, 2, 2, 2, 2, 2, 2, 10], [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]];
init_game();
Frame 4
stop();
show_tip("levelend");
btn_next.onPress = function () {
gotoAndStop ("interlude");
};
Frame 5
stop();
show_tip("levelfail");
ingame = false;
btn_submitscore.onPress = function () {
gotoAndStop ("hs_submit");
};
btn_continue.onPress = function () {
gotoAndStop ("finalscreen");
};
Frame 6
function submit() {
var _local1 = this;
my_so.data.stored_name = hs_name;
my_so.data.stored_email = hs_email;
Key.removeListener(keyObj);
btn_submit.enabled = (btn_submit.useHandCursor = false);
sendvars = new LoadVars();
replyvars = new LoadVars();
sendvars.hs_name = hs_name;
sendvars.hs_gender = hs_gender;
sendvars.hs_email = hs_email;
sendvars.hs_location = hs_location;
sendvars.hs_course = hs_course;
sendvars.hs_score = score;
sendvars.hs_scoreid = MD5.hex_md5(hs_name + score);
trace("===========SENDING===========");
for (i in sendvars) {
trace((i + " = ") + sendvars[i]);
}
trace(unescape(sendvars));
sendvars.sendAndLoad(siteURL + "scripts/score_add.php", replyvars, "POST");
status_mc.msg = "Sending...";
status_mc.gotoAndStop("show");
replyvars.onLoad = function (success) {
var _local2 = this;
if (success) {
trace("error = " + _local2.error);
if (_local2.error == 0) {
trace("SUCCESS");
status_mc.msg = "Your score has been\nsuccessfully submitted";
rank = _local2.rank;
_global.msgdelay = setInterval(function () {
clearInterval(msgdelay);
gotoAndStop ("hs_display");
}, 2000);
} else {
errorArray = _local2.error.split(",");
status_mc.msg = "There are problems with the following...\n\n";
var _local1 = 0;
while (_local1 < errorArray.length) {
switch (errorArray[_local1]) {
case "1" :
status_mc.msg = status_mc.msg + "Name\n";
break;
case "2" :
status_mc.msg = status_mc.msg + "Sex\n";
break;
case "3" :
status_mc.msg = status_mc.msg + "Email\n";
break;
case "4" :
status_mc.msg = status_mc.msg + "Course\n";
break;
case "5" :
status_mc.msg = status_mc.msg + "University Location\n";
break;
case "6" :
status_mc.msg = "Score has been altered";
}
_local1++;
}
_global.msgdelay = setInterval(function () {
clearInterval(msgdelay);
status_mc.gotoAndStop(1);
Key.addListener(keyObj);
btn_submit.enabled = (btn_submit.useHandCursor = true);
}, 2000);
}
} else {
status_mc.msg = "No Reply";
}
};
}
stop();
show_tip();
_focusrect = false;
field1.restrict = "^ <>/\\$&\u00A3#";
field1.tabIndex = 1;
field2.tabIndex = 2;
focusdelay = setInterval(function () {
clearInterval(focusdelay);
Selection.setFocus(field1);
}, 100);
btn_submit.onPress = function () {
submit();
};
keyObj = {};
keyObj.onKeyDown = function () {
if (Key.isDown(13)) {
submit();
}
};
hs_gender = "";
hs_location = "";
hs_course = "";
Key.addListener(keyObj);
Instance of Symbol 218 MovieClip in Frame 6
onClipEvent (load) {
mylabel = "hs_course";
menuarray = [];
menuarray[0] = "Arts & Design";
menuarray[1] = "Humanities";
menuarray[2] = "IT & Engineering";
menuarray[3] = "Languages";
menuarray[4] = "Law";
menuarray[5] = "Media";
menuarray[6] = "Medicine";
menuarray[7] = "Sciences & Sport Science";
menuarray[8] = "Other";
}
Instance of Symbol 245 MovieClip in Frame 6
onClipEvent (load) {
mylabel = "hs_location";
menuarray = [];
menuarray[0] = "Southwest";
menuarray[1] = "Southeast";
menuarray[2] = "London";
menuarray[3] = "East Anglia";
menuarray[4] = "West Midlands";
menuarray[5] = "East Midlands";
menuarray[6] = "Yorkshire";
menuarray[7] = "Northwest";
menuarray[8] = "Northeast";
menuarray[9] = "Wales";
menuarray[10] = "Scotland";
menuarray[11] = "Northern Ireland";
}
Instance of Symbol 218 MovieClip in Frame 6
onClipEvent (load) {
mylabel = "hs_gender";
menuarray = [];
menuarray[0] = "Male";
menuarray[1] = "Female";
}
Frame 7
function doXML() {
hsXML = new XML();
randomStr = Math.round(Math.random() * 99999);
hsXML.load((siteURL + "scripts/score_show.php?") + randomStr);
hsXML.ignoreWhite = true;
hsXML.onLoad = function (success) {
if (success) {
trace("loaded xml......");
rootNode = hsXML.firstChild;
scores = rootNode.childNodes;
drawscores();
} else {
trace("failed xml load.......");
}
};
}
function drawscores() {
rankset = false;
for (mc in holder) {
holder[mc].removeMovieClip();
}
var ygap = 19;
i = 0;
while (i < scores.length) {
var _local2 = {_y:i * ygap, rank:i + 1, name:scores[i].childNodes[1].firstChild.nodeValue, location:scores[i].childNodes[2].firstChild.nodeValue, score:scores[i].childNodes[3].firstChild.nodeValue, email:scores[i].childNodes[4].firstChild.nodeValue};
var mc = holder.attachMovie("hs_item", "mc" + i, i, _local2);
if (mc.email == hs_email) {
mc.gotoAndStop(2);
}
trace((("email = " + mc.email) + " & hs_email = ") + hs_email);
if ((rankset == false) && (mc.email == hs_email)) {
rankset = true;
rank = i + 1;
trace("setting rank" + rank);
}
i++;
}
_global.bodgedelay = setInterval(function () {
trace("called bodge");
scrollpage.initialise("blah");
clearInterval(bodgedelay);
}, 750);
}
stop();
show_tip();
btn_continue.onPress = function () {
if (gotoframe == "intro") {
gotoAndStop ("intro");
} else {
gotoAndStop ("finalscreen");
}
};
var holder = scrollpage.page;
doXML();
Frame 8
stop();
show_tip();
btn_play.onPress = function () {
gotoAndStop ("intro");
};
Frame 9
stop();
show_tip();
sendTracker(8);
btn_play.onPress = function () {
gotoAndStop ("intro");
};
btn_terms.onPress = function () {
gotoAndStop ("terms");
};
Frame 10
function showmsg(delay, callback) {
status_mc.gotoAndPlay("show");
msgdelay = setInterval(function () {
status_mc.gotoAndStop(1);
clearInterval(msgdelay);
callback();
}, delay);
}
function reset_fields() {
var _local2 = this;
var _local1 = 1;
while (_local1 <= 4) {
_local2["friendsemail" + _local1] = "";
_local1++;
}
}
function submit() {
var _local1 = _global;
my_so.data.stored_name = sendername;
my_so.data.stored_email = senderemail;
f2fsent = false;
sendVars = new LoadVars();
replyVars = new LoadVars();
sendVars.sendername = sendername;
sendVars.senderemail = senderemail;
sendVars.friendsemail1 = friendsemail1;
sendVars.friendsemail2 = friendsemail2;
sendVars.friendsemail3 = friendsemail3;
sendVars.friendsemail4 = friendsemail4;
sendVars.score = score;
sendVars.sendAndLoad(siteURL + "scripts/f2f.php", replyVars, "POST");
status_mc.msg = "Sending...";
status_mc.gotoAndPlay("show");
Key.removeListener(keyObj);
replyVars.onLoad = function (success) {
var _local1 = _global;
if (success) {
status_mc.msg = "";
e_array = this.error.split(",");
trace("erray = " + e_array);
i = 0;
while (i < e_array.length) {
switch (e_array[i]) {
case "1" :
status_mc.msg = status_mc.msg + "Your name is invalid\n";
break;
case "2" :
status_mc.msg = status_mc.msg + "Your email is invalid\n";
break;
case "3" :
status_mc.msg = status_mc.msg + "Your 1st friends email is invalid\n";
break;
case "4" :
status_mc.msg = status_mc.msg + "Your 2nd friends email is invalid\n";
break;
case "5" :
status_mc.msg = status_mc.msg + "Your 3rd friends email is invalid\n";
break;
case "6" :
status_mc.msg = status_mc.msg + "Your 4th friends email is invalid\n";
break;
case "0" :
status_mc.msg = "Thank you.\n\nYour friends have been sent this game";
f2fsent = true;
}
i++;
}
if (f2fsent) {
sendTracker(9, this.numsent);
_local1.msgdelay = setInterval(function () {
clearInterval(msgdelay);
gotoAndStop ("intro");
}, 2000);
} else {
_local1.msgdelay = setInterval(function () {
clearInterval(msgdelay);
status_mc.gotoAndStop(1);
Key.addListener(keyObj);
}, 2000);
}
} else {
status_mc.msg = "No reply";
_local1.msgdelay = setInterval(function () {
clearInterval(msgdelay);
status_mc.gotoAndStop(1);
Key.addListener(keyObj);
}, 2000);
}
};
}
stop();
show_tip();
btn_play.onPress = function () {
gotoAndStop ("intro");
};
btn_submit.onPress = function () {
submit();
};
i = 1;
while (i <= 6) {
this["field" + i].tabIndex = i;
i++;
}
keyObj = {};
keyObj.onKeyDown = function () {
if (Key.getCode() == 13) {
submit();
}
};
Key.addListener(keyObj);
submitbtn.onRelease = function () {
submit();
};
focusdelay = setInterval(function () {
clearInterval(focusdelay);
Selection.setFocus(field1);
}, 100);
reset_fields();
Frame 11
stop();
show_tip();
btn_play.onPress = function () {
gotoAndStop ("intro");
};
btn_up.onPress = function () {
scrolltxt(txtfield, -1);
};
btn_down.onPress = function () {
scrolltxt(txtfield, 1);
};
Frame 12
stop();
show_tip();
btn_play.onPress = function () {
gotoAndStop ("intro");
};
btn_up.onPress = function () {
scrolltxt(txtfield, -1);
};
btn_down.onPress = function () {
scrolltxt(txtfield, 1);
};
Frame 13
stop();
show_tip();
surgeon_mc.gotoAndPlay("show");
disbutton.useHandCursor = false;
_global.interludeDelay = setInterval(function () {
clearInterval(interludeDelay);
gotoAndStop ("game");
}, 10000);
t1 = [];
t1[0] = "Almost 8,000 people need an organ transplant in the UK.";
t1[1] = "Black and South Asian people in the UK are three times more likely to develop organ failure than the population at large.";
t1[2] = "Around 90% of people in the UK support organ donation, yet today only 21% are on the register.";
t1[3] = "Donor organ shortage is most acute among Black and Asian people. Transplants are far more likely to succeed when both donor and recipient are from the same ethnic background.";
t1[4] = "About 400 people die every year in the UK while waiting for a kidney, lung, heart or liver transplant and many more will die before they even get on to the transplant list.";
t2 = [];
t2[0] = "About 2,800 organ transplants take place each year.";
t2[1] = "About one in five of all kidney transplants are from a living donor. You can live a completely normal life with only one functioning kidney.";
t2[2] = "One donor can give life to several people and restore the sight of two more.";
t2[3] = "The average waiting time for an adult kidney transplant is 729 days. That\u2019s almost two years.";
t2[4] = "Children wait an average of 105 days for a heart.";
t2[5] = "Everyone who signs up to the NHS Organ Donor Register chooses what they are happy to donate. Following death, next of kin are always consulted before the removal of any organs.";
t2[6] = "Surgical techniques, such as splitting livers, have meant that a donor can help more patients than ever before.";
t2[7] = "All the major religions support organ donation and many actively promote it.";
t2[8] = "A greater number of women (54%) than men (46%) are on the NHS Organ Donor Register, though gender is irrelevant for transplants.";
t2[9] = "Currently there are over 12 million big-hearted people on the NHS Organ Donor Register.";
t2[10] = "You are more likely to need a transplant than become a donor. It can happen to anyone at anytime.";
txt = t1[random(t1.length)] + "\n\n";
var txt2id = random(t2.length);
txt = txt + (t2.splice(txt2id, 1) + "\n\n");
Symbol 6 MovieClip [dropmenuitem_big] Frame 1
stop();
Symbol 16 MovieClip [tile] Frame 1
stop();
Symbol 29 MovieClip [organ_mc_child] Frame 1
stop();
Symbol 32 MovieClip [patient_removed_icon] Frame 1
stop();
Symbol 32 MovieClip [patient_removed_icon] Frame 2
play();
Symbol 32 MovieClip [patient_removed_icon] Frame 12
stop();
this.removeMovieClip();
Symbol 32 MovieClip [patient_removed_icon] Frame 13
play();
Symbol 32 MovieClip [patient_removed_icon] Frame 26
stop();
this.removeMovieClip();
Symbol 40 MovieClip [hs_item] Frame 1
stop();
Symbol 41 MovieClip [organ_mc_adult] Frame 1
stop();
Symbol 54 MovieClip [patient_mc] Frame 1
stop();
Symbol 66 MovieClip Frame 1
stop();
Symbol 70 Button
on (release) {
doClickthru(1);
}
Symbol 74 MovieClip Frame 1
stop();
t = 0;
Symbol 74 MovieClip Frame 8
if (t < 6) {
t++;
gotoAndPlay ("flash");
} else {
gotoAndStop (1);
}
Symbol 104 MovieClip Frame 1
stop();
_global.clock = this;
clearInterval(timecount);
inc = 50;
ntime = mainTL.ntime;
red = 0;
minute._rotation = (hour._rotation = 0);
dotick = false;
_parent.face.gotoAndStop(1);
timecount = setInterval(function () {
if (mainTL.gameon) {
minute._rotation = minute._rotation + ((360 / ntime) * (inc / 1000));
hour._rotation = hour._rotation + (((360 / ntime) * (inc / 1000)) / 12);
red = red + inc;
if (dotick) {
if (tick < (500 / inc)) {
tick++;
} else {
tick = 0;
mainTL.ticksnd.start();
}
}
if (red >= (ntime * 1000)) {
red = 0;
nextFrame();
}
}
}, inc);
Symbol 104 MovieClip Frame 11
dotick = true;
_parent.face.gotoAndPlay(2);
Symbol 104 MovieClip Frame 13
clearInterval(timecount);
mainTL.end_level();
gotoAndStop (1);
Symbol 122 MovieClip Frame 1
stop();
Symbol 122 MovieClip Frame 2
play();
Symbol 122 MovieClip Frame 7
stop();
Symbol 122 MovieClip Frame 8
play();
Symbol 122 MovieClip Frame 11
stop();
Symbol 128 MovieClip Frame 1
stop();
Symbol 132 Button
on (release) {
gotoAndStop ("terms");
}
Symbol 133 Button
on (release) {
gotoAndStop ("privacy");
}
Symbol 135 MovieClip Frame 1
stop();
Symbol 144 MovieClip Frame 1
stop();
Symbol 149 MovieClip Frame 7
stop();
Symbol 157 MovieClip Frame 1
stop();
Symbol 172 MovieClip Frame 7
stop();
Symbol 173 MovieClip Frame 1
stop();
Symbol 175 MovieClip Frame 1
stop();
Symbol 175 MovieClip Frame 2
mc.inner.gotoAndStop("run");
Symbol 175 MovieClip Frame 10
mc.inner.gotoAndStop("idle");
organ.sel_mc._visible = 0;
_parent.organ._visible = 0;
_parent.demo_stage3();
stop();
Symbol 175 MovieClip Frame 11
mc.inner.gotoAndStop("run");
Symbol 175 MovieClip Frame 20
mc.inner.gotoAndStop("operate");
stop();
_parent.demo_stage4();
Symbol 178 MovieClip Frame 1
stop();
Symbol 199 MovieClip Frame 1
stop();
Symbol 199 MovieClip Frame 2
play();
Symbol 199 MovieClip Frame 11
stop();
Symbol 200 MovieClip Frame 1
stop();
Symbol 200 MovieClip Frame 2
play();
Symbol 200 MovieClip Frame 8
stop();
Symbol 218 MovieClip Frame 1
function initialise() {
listmc._visible = 0;
txt = defaultval;
populate();
}
function populate() {
i = 0;
while (i < menuarray.length) {
initObj = {};
initObj.id = i;
initObj.txt = menuarray[i];
initObj._y = i * ygap;
initObj.onRollOver = btnon;
initObj.onRollOut = (initObj.onDragOut = btnoff);
initObj.onRelease = btnclick;
item = listmc.attachMovie("dropmenuitem_big", "dropmenuitem" + i, i, initObj);
i++;
}
listmc.bg._height = (item._y + ygap) + 2;
}
function btnon() {
this.gotoAndStop(2);
}
function btnoff() {
this.gotoAndStop(1);
}
function btnclick() {
txt = this.txt;
_parent[mylabel] = txt;
listmc._visible = 0;
}
function checkmouseover() {
var _local1 = this;
_local1.onEnterFrame = function () {
if (!this.hitTest(_root._xmouse, _root._ymouse, false)) {
delete this.onEnterFrame;
listmc._visible = 0;
}
};
}
var defaultval = "Please Select...";
ygap = 18;
mainbtn.onPress = function () {
checkmouseover();
listmc._y = ygap;
listmc._visible = !listmc._visible;
};
initialise();
Symbol 244 MovieClip Frame 1
stop();
mapTL = this;
ukareas = [];
ukareas[0] = "Scotland";
ukareas[1] = "Northern & Yorkshire";
ukareas[2] = "Trent";
ukareas[3] = "Eastern";
ukareas[4] = "London";
ukareas[5] = "South East";
ukareas[6] = "South West";
ukareas[7] = "West Midlands";
ukareas[8] = "Wales";
ukareas[9] = "North West";
ukareas[10] = "Northern Ireland";
i = 0;
while (i < ukareas.length) {
btn = eval (["btn" + i]);
btn.id = i;
btn.onRollOver = function () {
gotoAndStop(this.id + 2);
};
btn.onPress = function () {
var _local1 = _parent;
_local1.clicked = true;
_local1.txt = ukareas[this.id];
_local1.gotoAndStop(1);
};
i++;
}
Symbol 245 MovieClip Frame 1
stop();
btn.onPress = function () {
trace("doing");
play();
};
defaulttxt = "Please Select...";
if (!clicked) {
txt = defaulttxt;
}
if (txt != defaulttxt) {
_parent.hs_location = txt;
}
Symbol 245 MovieClip Frame 2
stop();
Symbol 248 MovieClip Frame 1
stop();
Symbol 248 MovieClip Frame 2
disbutton.useHandCursor = false;
play();
Symbol 248 MovieClip Frame 7
stop();
Symbol 261 MovieClip Frame 1
_global.scrollbar = this;
_visible = 0;
init = function (thePage, theMask, buttonClickPercent, inertiaFactor, sliderPadding) {
scrollbar.buttonClickPercent = buttonClickPercent;
scrollbar.inertiaFactor = inertiaFactor;
scrollbar.thePage = thePage;
scrollbar.pageMoveMax = thePage._height - theMask._height;
this._visible = Boolean(scrollbar.pageMoveMax > 0);
scrollbar.slideDragMax = (scrollbar.base._height - scrollbar.slidebar._height) - sliderPadding;
scrollbar.slideDragMin = (scrollbar.slidebar._y = sliderPadding);
scrollbar.slideDragTotal = scrollbar.slideDragMax - scrollbar.slideDragMin;
};
slidebar.onPress = function () {
this.startDrag(false, 0, scrollbar.slideDragMin, 0, scrollbar.slideDragMax);
this.onEnterFrame = scrollbar.setNewPagePosY;
updateAfterEvent();
};
slidebar.onRelease = (slidebar.onReleaseOutside = function () {
stopDrag();
delete this.onEnterFrame;
});
scrollButtonPress = function (direction) {
var _local1 = scrollbar.buttonClickPercent * scrollbar.slideDragTotal;
var _local2 = scrollbar.slideDragMax;
if (direction == "up") {
_local1 = _local1 * -1;
_local2 = scrollbar.slideDragMin;
}
if (((scrollbar.slidebar._y + _local1) >= scrollbar.slideDragMax) || ((scrollbar.slidebar._y + _local1) <= scrollbar.slideDragMin)) {
scrollbar.slidebar._y = _local2;
} else {
scrollbar.slidebar._y = scrollbar.slidebar._y + _local1;
}
scrollbar.setNewPagePosY();
};
btnDown.onPress = function () {
scrollbar.onEnterFrame = function () {
scrollbar.scrollButtonPress("down");
};
};
btnUp.onPress = function () {
scrollbar.onEnterFrame = function () {
scrollbar.scrollButtonPress("up");
};
};
btnDown.onRelease = (btnUp.onRelease = function () {
delete scrollbar.onEnterFrame;
});
setNewPagePosY = function () {
scrollbar.thePage.newPosY = scrollbar.thePage.pagestartY - (((scrollbar.slidebar._y - scrollbar.slideDragMin) / scrollbar.slideDragTotal) * scrollbar.pageMoveMax);
scrollbar.thePage.onEnterFrame = scrollbar.moveThePage;
};
moveThePage = function () {
var _local1 = this;
var _local2 = scrollbar.inertiaFactor * (_local1.newPosY - _local1._y);
if (Math.abs(_local2) > 0.5) {
_local1._y = _local1._y + _local2;
} else {
_local1._y = _local1.newPosY;
delete _local1.onEnterFrame;
}
};
Symbol 265 MovieClip Frame 2
function initialise(copy) {
trace("called " + copy);
page.textfield.autoSize = "left";
page.textfield.htmlText = copy;
scrollbar.init(page, pagemask, 0.1, 0.8, 24);
scrollbar.slidebar._y = scrollbar.slideDragMin;
scrollbar.setNewPagePosY();
page.fadein();
}
scrollbar._visible = false;
page.pagestartY = page._y;
loaded = true;
stop();
Symbol 271 Button
on (release) {
getURL ("http://www.uktransplant.org.uk", "_blank");
}
Symbol 277 MovieClip Frame 1
stop();
Symbol 289 MovieClip Frame 1
stop();