Frame 1
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
_quality = "LOW";
this.startTime = new Date().getTime();
play();
Frame 2
var percentLoaded_num = ((getBytesLoaded() / getBytesTotal()) * 100);
var requiredPercentage_num = 100;
trace("loaded:" + percentLoaded_num);
preloader_mc.gotoAndStop(Math.min(int(100 - percentLoaded_num), 100));
if ((percentLoaded_num >= requiredPercentage_num) && (getBytesLoaded() > 64)) {
var stopTime = new Date().getTime();
this.totalTime = stopTime - this.startTime;
this.dataRate = getBytesTotal() / this.totalTime;
gotoAndStop (4);
}
Frame 3
gotoAndPlay(_currentframe - 1);
Frame 4
_global.hahaURL = "";
play_mc.label = "play >>";
instructions_mc.label = "instructions >>";
play_mc.onRelease = function () {
gotoAndPlay (6);
};
instructions_mc.onRelease = function () {
gotoAndPlay (5);
};
stop();
Frame 5
trace("got to instructions");
stop();
Frame 6
Selection.setFocus(charSelect_mc.player_name_tf);
stop();
Frame 7
this.attachMovie("transition", "transition_mc", 800000);
_root._quality = "LOW";
play();
Frame 9
_root.debugLevel = 1E48;
_root.debug = function (tDebugLevel) {
if (tDebugLevel == undefined) {
tDebugLevel = 0;
}
if (tDebugLevel >= _root.debugLevel) {
var x;
return(undefined);
}
};
function Game() {
trace("NEW GAME OBJ");
this.paused = false;
this.objs = {};
this.keyDownObjs = {};
this.keyUpObjs = {};
this.enterFrameID = 0;
this.enterFrameObjs = {};
Key.addListener(this);
}
function Tile(tWalk, tFrame, tlink) {
this.walkable = tWalk;
this.frame = tFrame;
if (tlink == undefined) {
} else {
this.link = tlink;
}
}
function Tile0() {
super(true, 1, "floor1");
}
function Tile4() {
super(false, 1, emptyTile);
}
function TableSuper(walkable, frame, link) {
super(walkable, frame, link);
}
function Tile5() {
super(false, 1, "topTable");
this.hit = "you hit the a table " + new Date().getTime();
}
function Tile6() {
super(false, 1, "bottomTable");
this.hit = "you hit the a table " + new Date().getTime();
}
function Tile9() {
super(false, 1, "singleTable_3");
this.hit = "you hit the a table " + new Date().getTime();
}
function SuperChair(walkable, frame, link) {
super(walkable, frame, link);
}
function Tile10() {
super(false, 1, "chairDownUp");
}
function Tile11() {
super(false, 1, "chairUpDown");
}
function Tile12() {
super(false, 1, "chairLeftRight");
}
function Tile13() {
super(false, 1, "chairRightLeft");
}
function SofaSuper(walkable, frame, link) {
super(walkable, frame, link);
}
function Tile15() {
super(false, 1, "sofaLeftRight");
}
function Tile16() {
super(false, 1, "leftWallPilar");
}
function Tile17() {
super(false, 1, "cornerSofa");
}
function Tile18() {
super(false, 1, "sofaUpDown");
}
function Tile19() {
super(false, 1, "comfyChairUpDown");
}
function Tile20() {
super(false, 1, "comfyChairLeftRight");
}
function Tile21() {
super(false, 1, "comfyChairDownUp");
}
function Tile22() {
super(false, 1, "comfyChairRightLeft");
}
function Tile23() {
super(false, 1, "rightWallPillar");
}
function Tile24() {
super(true, 1, "floor2");
}
function BarSuper(walkable, frame, link) {
super(walkable, frame, link);
this.obj = _global.objs.game.objs.barman;
}
function Tile25() {
super(false, 1, "barFront");
}
function Tile26() {
super(false, 1, "barRightCorner");
}
function Tile27() {
super(false, 1, "barRight");
}
function Tile28() {
super(false, 1, "barLeftCorner");
}
function Tile29() {
super(false, 1, "barBack1");
}
function Tile30() {
super(false, 1, "barBack2");
}
function Tile31() {
super(false, 1, "barBackLeft");
}
function Tile32() {
super(false, 1, "barBackRight");
}
function Tile33() {
super(false, 1, "barLeft");
}
function KitchenSuper(walkable, frame, link) {
super(walkable, frame, link);
this.obj = _global.objs.game.objs.chef;
}
function Tile34() {
super(false, 1, "kitchenFront");
}
function Tile35() {
super(false, 1, "kitchenRight");
}
function Tile36() {
super(false, 1, "kitchenFrontLeft");
}
function Tile37() {
super(false, 1, "kitchenFrontRight");
}
function Tile38() {
super(false, 1, "kitchenLeft");
}
function Tile50() {
super(false, 1, "kitchenFrontPan");
}
function Tile39() {
super(false, 1, "fireplaceLeftRow3");
}
function Tile40() {
super(false, 1, "fireplaceLeftRow1");
}
function Tile41() {
super(false, 1, "firePlaceMiddleRow1");
}
function Tile42() {
super(false, 1, "fireplaceRightRow1");
}
function Tile44() {
super(false, 1, "firePlaceMiddleRow2");
}
function Tile45() {
super(false, 1, "fireplaceRightRow2");
}
function Tile46() {
super(false, 1, "fireplaceMain");
}
function Tile47() {
super(false, 1, "fireplaceMiddleRow3");
}
function Tile48() {
super(false, 1, "fireplaceRightRow3");
}
function Tile49() {
super(false, 1, "singleTable_2");
}
function Character(isoRef) {
super(10, 5, 3, 13, 13, isoRef.tileW / 4, isoRef.tileW / 4, isoRef);
this.state = "idle";
this.tray = new Tray();
this.defineTileShortcuts();
this.scoreObj = new ScoreObj(this);
_global.objs.game.enterFrameSubscribe(this);
_global.objs.game.keyDownSubscribe(this);
}
function IsoSprite(tXtile, tYtile, tSpeed, tWidth, tHeight, tXstep, tYstep, isoEngineRef) {
this.xtile = tXtile;
this.ytile = tYtile;
this.speed = tSpeed;
this.width = tWidth;
this.height = tHeight;
this.xStep = tXstep;
this.yStep = tYstep;
this.isoRef = isoEngineRef;
this.paused = false;
this.xDir = 0;
this.yDir = 0;
}
function IsoEngine() {
this.maps = new Array();
this.maps[0] = [[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], [4, 17, 18, 0, 0, 0, 23, 31, 29, 30, 29, 30, 32, 23, 0, 18, 18, 18, 0, 4], [4, 15, 24, 24, 24, 24, 24, 33, 24, 24, 24, 24, 27, 24, 24, 24, 24, 24, 24, 4], [4, 0, 0, 0, 0, 0, 0, 28, 25, 25, 25, 25, 26, 0, 0, 0, 0, 0, 0, 4], [4, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 4], [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4], [4, 24, 24, 24, 24, 42, 45, 48, 15, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 4], [4, 15, 0, 0, 0, 41, 44, 47, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4], [4, 15, 24, 24, 24, 40, 46, 39, 15, 24, 24, 24, 24, 24, 24, 24, 24, 37, 35, 4], [4, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 4], [4, 15, 24, 24, 24, 24, 11, 11, 24, 24, 19, 24, 24, 19, 24, 24, 24, 34, 24, 4], [4, 15, 0, 0, 0, 0, 5, 6, 0, 20, 9, 22, 0, 49, 0, 0, 0, 34, 0, 4], [4, 24, 24, 24, 24, 24, 10, 10, 24, 24, 24, 24, 24, 21, 24, 24, 24, 50, 24, 4], [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 38, 4], [4, 24, 11, 11, 24, 24, 11, 11, 24, 24, 11, 11, 24, 24, 11, 11, 24, 24, 24, 4], [4, 0, 5, 6, 0, 0, 5, 6, 0, 0, 5, 6, 0, 0, 5, 6, 0, 0, 0, 4], [4, 24, 10, 10, 24, 24, 10, 10, 24, 24, 10, 10, 24, 24, 10, 10, 24, 24, 24, 4], [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4], [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]];
this.tileW = 20;
this.visx = 20;
this.visy = 32;
this.centerx = 0;
this.centery = 0;
this.tiles = {};
this.mapNum = null;
}
function Group(isoRef, gmRef, tableRef, tableNum, tPlayerRef, tMemberCount, tTimeTollerence, tMode) {
this.iso = isoRef;
this.table = tableRef;
this.tableNum = tableNum;
this.playerRef = tPlayerRef;
this.groupManager = gmRef;
this.timeTol = tTimeTollerence;
this.timeTolID = null;
this.waitCount = 0;
this.clips = {};
this.memberCount = _global.fn.randomRange(2, tMemberCount);
this.members = [];
this.averageMood = 0;
this.keyActive = true;
this.done50percentMoodChange = false;
this.mode = tMode;
this.arriveTime = new Date().getTime();
if (this.mode == "foodThenDrink") {
this.targetFinish = 120000 /* 0x01D4C0 */;
} else if (this.mode == "foodAndDrink") {
this.targetFinish = 60000;
}
this.pointsPersecond = 1;
this.ordersWrong = 0;
this.orderWrongLeave = false;
this.orderLateLeave = false;
this.startTable = "";
this.state = "idle";
this.menuRef = _global.objs.game.objs.theMenu;
this.leaveID = null;
}
function DoubleTable(isoRef, gmRef, tableRef, tableNum, tPlayerRef, tMemberCount, tTimeTollerence, tMode) {
super(isoRef, gmRef, tableRef, tableNum, tPlayerRef, Math.min(tableRef.maxPeople, tMemberCount), tTimeTollerence, tMode);
this.chairs = {};
}
function SingleTable(isoRef, gmRef, tableRef, tableNum, tPlayerRef, tMemberCount, tTimeTollerence, tMode) {
super(isoRef, gmRef, tableRef, tableNum, tPlayerRef, Math.min(tableRef.maxPeople, tMemberCount), tTimeTollerence, tMode);
this.startTable = "top";
this.chairs = {};
this.undoHilite();
}
function GroupManager(isoRef, tPlayerRef) {
this.iso = isoRef;
this.playerRef = tPlayerRef;
this.groups = [];
this.tables = [];
this.freeTables = [];
this.usedTables = [];
this.dirtyTables = [];
this.difficultyPos = 0;
this.arriveStartTime = null;
this.difficultyStartTime = null;
this.maxTables = 7;
this.difficulty = [{maxPeople:2, groupArriveDelay:40000, nextLevelDelay:45000, maxGroups:2, gMode:"foodThenDrink"}, {maxPeople:3, groupArriveDelay:27000, nextLevelDelay:45000, maxGroups:4, gMode:"foodThenDrink"}, {maxPeople:3, groupArriveDelay:22000, nextLevelDelay:45000, maxGroups:5, gMode:"foodAndDrink"}, {maxPeople:4, groupArriveDelay:20000, nextLevelDelay:45000, maxGroups:6, gMode:"foodAndDrink"}];
this.totalGameTime = 0;
for (var i in this.difficulty) {
this.totalGameTime = this.totalGameTime + this.difficulty[i].nextLevelDelay;
}
this.gameTimeScale = 100 / this.totalGameTime;
this.gameStartTime = new Date().getTime();
this.arriveStartTime = new Date().getTime();
this.difficultyStartTime = new Date().getTime();
this.setupTables();
this.initFreeTables();
this.newGroup();
_global.objs.game.enterFrameSubscribe(this);
}
function Chef(tPlayer) {
this.playerRef = tPlayer;
this.clips = [];
}
function BarMan(tPlayer) {
this.playerRef = tPlayer;
this.clips = [];
}
function Worker(charRef) {
this.charRef = charRef;
this.busy = false;
}
function Drinker(xTile, yTile, speed, hesitanceFactor, isoRef, path, drinkerColCheck, linkage) {
super(xTile, yTile, speed, 13, 13, isoRef.tileW / 4, isoRef.tileW / 4, isoRef);
this.hesitence = hesitanceFactor;
this.path = path;
this.drinkerCol = drinkerColCheck;
this.pathIndex = 0;
this.targetSqX = null;
this.targetSqY = null;
this.intervalID = null;
this.playerColide = false;
this.walkable = false;
this.x = (this.xtile * isoRef.tileW) + (this.isoRef.tileW / 4);
this.y = (this.ytile * isoRef.tileW) + (this.isoRef.tileW / 4);
this.xiso = this.x - this.y;
this.yiso = (this.x + this.y) / 2;
this.depthshift = (isoRef.tileW - this.height) / 2;
this.depth = ((((this.yiso - this.depthshift) * 300) + this.xiso) + 1) + 100000;
var tName = (("drinker" + this.depth) + "_mc");
isoRef.clip.attachMovie(linkage, tName, this.depth);
this.clip = isoRef.clip[tName];
this.clip._x = this.xiso;
this.clip._y = this.yiso;
this.clip.gotoAndStop(this.frame);
this.xstep = this.xiso;
this.ystep = this.yiso;
this.xtilecount = 0;
this.ytilecount = 0;
this.oldXtile = this.xTile;
this.oldYtile = this.yTile;
this.setupPath();
_global.objs.game.enterFrameSubscribe(this);
}
function MenuObj(theClip) {
this.clip = theClip;
this.trayTF = this.clip.tray_tf;
this.orderedItems = [];
this.trayItemClips = [];
this.callBack = null;
this.currentType = null;
this.food = ["corn fed chicken", "chargrilled turkey", "oven roasted cod", "roast beef", "cannelloni", "garlic mushrooms", "salmon pate", "tiger prawns"];
this.drink = ["hoegaarden", "leffe", "chardonnay", "merlot", "latte", "macchiato", "earl grey", "acqua panna"];
this.foodInfo = ["Corn-fed breast of chicken stuffed with taleggio, wrapped in Parma ham, with creamy basil pesto and rocket pasta", "fresh chargrilled turkey escalopes with bubble & squeak pancetta cakes, parsnip and beetroot crisps and onion gravy", "oven roasted cod loin with a sun blushed tomato crust, served with a warm salad of wilted spinach and cherry tomatoes", "roast medallions of beef fillet seasoned with mushrooms, in pancetta and red wine jus, served with a horseradish mash", "butternut squash, spinach and ricotta cannelloni, cooked in a cheesy sauce", "creamy smoked garlic mushrooms with chunky croutons", "smoked salmon pate, served with rocket leaves and toasted focaccia", "crispy lime and chilli tiger prawns, served with aioli dip"];
}
function Tray() {
this.holding = false;
this.container = [];
this.itemsToRemove = [];
this.itemIndex = 0;
}
function Hint(tClip) {
this.clip = tClip;
trace(this.tf);
this.hints = {};
this.hintRemoveID = null;
this.setupHints();
}
function soundObject(theSoundHolder) {
this.soundHolder = theSoundHolder;
this.playList = new Array();
this.fadeList = {};
this.volume = 100;
this.setNewVolume(this.volume);
this.sounds = new Object();
_root.debug(999999999);
if (_root.soundPlayFlag == undefined) {
this.playFlag = true;
_root.soundPlayFlag = this.playFlag;
} else {
this.playFlag = _root.soundPlayFlag;
}
_global.tl.mute_mc.setup();
this.setupSounds();
}
function Conversation() {
this.speech = [];
this.speechIndex = 0;
this.callBack = null;
this.speechBubble = new SpeechBubble(this);
}
function SpeechBubble(convRef) {
this.conversationRef = convRef;
this.nextSentenceIntID = null;
this.clip = null;
this.active = false;
}
function ObjTile() {
}
Game.prototype.setupKeyShorts = function () {
_global.isDown = Key.isDown;
this.getCode = Key.getCode;
_global.kLeft = 37;
_global.kRight = 39;
_global.kUp = 38;
_global.kDown = 40;
_global.kSpace = 32;
};
Game.prototype.config = function () {
_root.frontPannel_mc.oldDepth = _root.frontPannel_mc.getDepth();
_root.frontPannel_mc.swapDepths(500200);
_root.score = 0;
this.satisfaction = 0;
this.maxSatisfaction = 10;
this.satScale = 100 / this.maxSatisfaction;
_global.ammounts = ["none", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"];
_global.trayItemLimit = 8;
_global.maxDrinkerWaypointDelay = 5000;
_global.nextAttachDepth = 500000 /* 0x07A120 */;
this.setupSofaFrames();
this.setupKeyShorts();
this.setupEvents();
this.objs.iso = new IsoEngine();
this.objs.player = new Character(this.objs.iso);
this.objs.barman = new BarMan(this.objs.player);
this.objs.chef = new Chef(this.objs.player);
_root.debug(2000);
this.objs.sound = new soundObject(_root.soundHolder_mc);
this.objs.sound.fadeInMusic();
var raceStart = new Date().getTime();
this.objs.iso.buildMap(0);
trace("-------!!!!!!!!!!!!!!--------");
trace(("took " + (new Date().getTime() - raceStart)) + " to build the map");
trace("-------!!!!!!!!!!!!!!--------");
this.objs.theMenu = new MenuObj(_global.tl.menu_mc);
this.objs.groupManager = new GroupManager(this.objs.iso, this.objs.player);
this.objs.hint = new Hint(_global.tl.hint_mc);
this.drinkerPaths = this.setupDrinkerPaths();
this.objs.drinkers = [];
this.hiliteTile = null;
this.objs.drinkers.push(new Drinker(10, 4, 1, 1, this.objs.iso, this.drinkerPaths[1], true, "drinker1"));
this.objs.drinkers.push(new Drinker(4, 4, 1, 1, this.objs.iso, this.drinkerPaths[2], true, "drinker2"));
this.objs.drinkers.push(new Drinker(18, 3, 1, 1, this.objs.iso, this.drinkerPaths[3], true, "drinker3"));
this.objs.drinkers.push(new Drinker(12, 4, 1, 1, this.objs.iso, this.drinkerPaths[5], true, "drinker4"));
this.objs.drinkers.push(new Drinker(3, 1, 1, 1, this.objs.iso, this.drinkerPaths[6], true, "drinker5"));
this.objs.drinkers.push(new Drinker(16, 9, 1, 1, this.objs.iso, this.drinkerPaths[7], true, "drinker6"));
this.objs.drinkers.push(new Drinker(10, 2, 1, 1, this.objs.iso, this.drinkerPaths[0], false, "barman"));
this.objs.drinkers.push(new Drinker(18, 9, 1, 1, this.objs.iso, this.drinkerPaths[4], false, "chef"));
this.objs.player.doFirstMove();
this.objs.hint.displayHint("startGame");
};
Game.prototype.setupDrinkerPaths = function () {
return([[["L", 30, false], ["D", 1, true], ["D", 0, true], ["D", 0, true], ["D", 0, true], ["R", 30, false], ["D", 1, true], ["D", 0, true], ["D", 0, true], ["D", 0, true], ["D", 0, true], ["U", 2, true]], [["R", 30, true], ["D", 60, true], ["L", 30, true], ["U", 60, true]], [["L", 40, true], ["D", 100, true], ["R", 40, true], ["U", 100, true]], [["L", 1, true], ["D", 70, true], ["L", 50, true], ["D", 30, true], ["L", 50, true], ["U", 100, true], ["R", 101, true]], [["D", 55, false], ["L", 1, true], ["L", 0, true], ["L", 0, true], ["L", 0, true], ["U", 55, false], ["L", 1, true], ["L", 0, true], ["L", 0, true], ["L", 0, true], ["L", 0, true], ["R", 2, true]], [["R", 20, true], ["U", 40, false], ["R", 0, true], ["R", 60, true], ["U", 0, true], ["U", 0, true], ["D", 40, true], ["L", 80, true], ["U", 0, true]], [["D", 120, true], ["R", 20, true], ["L", 20, true], ["R", 20, true], ["U", 120, true], ["L", 20, true]], [["L", 140, true], ["U", 40, false], ["L", 0, true], ["L", 0, true], ["L", 0, true], ["D", 40, false], ["R", 140, true]]]);
};
Game.prototype.setupSofaFrames = function () {
var sofaLen = 14;
var sofas = 9;
var sofaPick = [];
var i = 1;
while (i <= sofaLen) {
sofaPick.push(i);
i++;
}
this.sofaFrames = [];
while (sofaPick.length != 0) {
this.sofaFrames.push(sofaPick.splice(_global.fn.randomRange(0, sofaPick.length - 1), 1)[0]);
}
};
Game.prototype.shutdown = function () {
this.paused = true;
_root.debug(999999);
this.objs.sound.fadeOutMusic();
this.cleanUp();
this.objs.player.cleanUp();
this.objs.groupManager.cleanUp();
for (var i in this.objs.drinkers) {
this.objs.drinkers[i].cleanUp();
}
this.objs.hint.cleanUp();
this.objs.theMenu.cleanUp();
this.objs.sound.cleanUp();
this.objs.iso = null;
this.objs.player = null;
this.objs.barman = null;
this.objs.chef = null;
this.objs.hint = null;
this.objs.theMenu = null;
this.objs.groupManager = null;
for (var i in this.objs.drinkers) {
this.objs.drinkers[i] = null;
}
this.keyDownObjs = null;
this.keyUpObjs = null;
this.enterFrameObjs = null;
if (_root.score < 300) {
_root.feedback = "Not so good, try harder next time.";
} else if (_root.score < 600) {
_root.feedback = "You're getting there, keep trying!";
} else if (_root.score < 1000) {
_root.feedback = "Good effort, thanks for all the hard work this evening!";
} else {
_root.feedback = "You are a master, well done! Check the jobs page, Ha! Ha! needs you";
}
_root.gameOver_mc.swapDepths(600000);
_root.gameOver_mc.gotoAndStop("load");
};
Game.prototype.cleanUp = function () {
this.worker.removeMovieClip();
Key.removeListener(this);
};
Game.prototype.setupEvents = function () {
_root.createEmptyMovieClip("looper", _root.getNextHighestDepth());
this.worker = _root.looper;
this.worker.onEnterFrame = function () {
_global.objs.game.doLoop();
};
};
Game.prototype.onKeyDown = function () {
var tKey = this.getCode();
for (var i in this.keyDownObjs) {
this.keyDownObjs[i].onKeyDown(tKey);
}
};
Game.prototype.onKeyUp = function () {
for (var i in this.keyUpObjs) {
this.keyUpObjs[i].onKeyUp();
}
};
Game.prototype.doLoop = function () {
if (!this.paused) {
if (_global.objs.game.hiliteTile != null) {
_global.objs.game.hiliteTile.undoHilite();
_global.objs.game.hiliteTile = null;
}
for (var i in this.enterFrameObjs) {
this.enterFrameObjs[i].doLoop();
}
}
};
Game.prototype.keyDownSubscribe = function (tRef) {
this.keyDownObjs[tRef] = tRef;
};
Game.prototype.keyDownUnSubscribe = function (tRef) {
this.keyDownObjs[tRef] = null;
delete this.keyDownObjs[tRef];
};
Game.prototype.keyUpSubscribe = function (tRef) {
this.keyUpObjs[tRef] = tRef;
};
Game.prototype.keyUpUnSubscribe = function (tRef) {
this.keyUpObjs[tRef] = null;
delete this.keyUpObjs[tRef];
};
Game.prototype.enterFrameSubscribe = function (tRef) {
this.enterFrameObjs[this.enterFrameID++] = tRef;
tRef.efID = this.enterFrameID;
};
Game.prototype.enterFrameUnSubscribe = function (tRef) {
this.enterFrameObjs[tRef.efID] = null;
delete this.enterFrameObjs[tRef.efID];
};
Game.prototype.doPosScore = function () {
_root.score = _root.score + 10;
};
Game.prototype.doNegScore = function () {
_root.score = _root.score - 10;
_root.score = Math.max(0, _root.score);
};
Game.prototype.workOutFinalScore = function () {
trace((("score:" + _root.score) + " * satisfaction:") + this.satisfaction);
_root.finalScore = Math.round(_root.score * this.satisfaction);
};
Game.prototype.doPosSat = function () {
this.satisfaction = Math.min(this.satisfaction + 1, this.maxSatisfaction);
this.showSatisfaction();
};
Game.prototype.doCharBump = function () {
this.objs.sound.playANeg();
this.satisfaction = Math.max(0, this.satisfaction - 0.25);
this.showSatisfaction();
};
Game.prototype.doNegSat = function () {
this.objs.sound.playANeg();
this.satisfaction = Math.max(0, this.satisfaction - 1);
this.showSatisfaction();
};
Game.prototype.showSatisfaction = function () {
_root.satFrame = Math.max(1, int(this.satisfaction * this.satScale));
_root.frontPannel_mc.statusPannel_mc.satisfaction_mc.gotoAndStop(_root.satFrame);
};
Game.prototype.changeScore = function (toAdd) {
_root.score = _root.score + toAdd;
};
Game.prototype.changeSatisfaction = function (toAdd) {
this.satisfaction = this.satisfaction + toAdd;
this.satisfaction = Math.max(0, this.satisfaction);
this.satisfaction = Math.min(this.satisfaction, this.maxSatisfaction);
this.showSatisfaction();
};
Game.prototype.pausePlayer = function () {
this.objs.player.pause();
};
Game.prototype.resumePlayer = function () {
this.objs.player.resume();
};
Tile.prototype.doAction = function () {
return(false);
};
Tile.prototype.doKeyAction = function () {
if (this.obj == undefined) {
return(false);
}
this.obj.doKeyAction();
return(true);
};
Tile.prototype.doHilite = function () {
if (this.obj == undefined) {
return(false);
}
this.obj.doHilite();
return(true);
};
Tile.prototype.setPlayerObj = function () {
this.obj = _global.objs.game.objs.player;
return(true);
};
Tile.prototype.setClip = function (theClip) {
this.clip = theClip;
this.clip.gotoAndStop(this.frame);
};
Tile0.prototype.__proto__ = new Tile();
Tile4.prototype.__proto__ = new Tile();
TableSuper.prototype.__proto__ = new Tile();
TableSuper.prototype.setClip = function (theClip) {
this.clip = theClip;
this.clip.gotoAndStop(this.frame);
var i = 1;
while (i <= 4) {
this.clip.plateHolder_mc[i + "_mc"]._visible = false;
this.clip.glasses_mc[i + "_mc"]._visible = false;
i++;
}
this.clip.hilite_mc._visible = false;
this.clip.timer_mc._visible = false;
};
Tile5.prototype.__proto__ = new TableSuper();
Tile6.prototype.__proto__ = new TableSuper();
Tile9.prototype.__proto__ = new TableSuper();
SuperChair.prototype.doAction = function () {
return(true);
};
SuperChair.prototype.setClip = function (theClip) {
this.clip = theClip;
this.clip.gotoAndStop(this.frame);
this.clip.person_mc._visible = false;
};
SuperChair.prototype.__proto__ = new Tile();
Tile10.prototype.__proto__ = new SuperChair();
Tile11.prototype.__proto__ = new SuperChair();
Tile12.prototype.__proto__ = new SuperChair();
Tile13.prototype.__proto__ = new Tile();
SofaSuper.prototype.__proto__ = new Tile();
SofaSuper.prototype.setClip = function (theClip) {
this.clip = theClip;
this.clip.gotoAndStop(this.frame);
this.clip.person_mc.gotoAndStop(_global.objs.game.sofaFrames.splice(_global.fn.randomRange(1, _global.objs.game.sofaFrames.length - 1), 1)[0]);
};
Tile15.prototype.__proto__ = new SofaSuper();
Tile16.prototype.__proto__ = new Tile();
Tile17.prototype.__proto__ = new Tile();
Tile18.prototype.__proto__ = new SofaSuper();
Tile19.prototype.__proto__ = new SuperChair();
Tile20.prototype.__proto__ = new SuperChair();
Tile21.prototype.__proto__ = new SuperChair();
Tile22.prototype.__proto__ = new SuperChair();
Tile23.prototype.__proto__ = new Tile();
Tile24.prototype.__proto__ = new Tile();
BarSuper.prototype = new Tile();
BarSuper.prototype.setClip = function (theClip) {
this.clip = theClip;
this.clip.gotoAndStop(this.frame);
this.clip.hilite_mc._visible = false;
this.obj.setClip(this.clip);
};
Tile25.prototype.__proto__ = new BarSuper();
Tile26.prototype.__proto__ = new BarSuper();
Tile27.prototype.__proto__ = new BarSuper();
Tile28.prototype.__proto__ = new BarSuper();
Tile29.prototype.__proto__ = new BarSuper();
Tile30.prototype.__proto__ = new BarSuper();
Tile31.prototype.__proto__ = new BarSuper();
Tile32.prototype.__proto__ = new BarSuper();
Tile33.prototype.__proto__ = new BarSuper();
KitchenSuper.prototype = new Tile();
KitchenSuper.prototype.setClip = function (theClip) {
this.clip = theClip;
this.clip.gotoAndStop(this.frame);
this.clip.hilite_mc._visible = false;
this.obj.setClip(this.clip);
};
Tile34.prototype.__proto__ = new KitchenSuper();
Tile35.prototype.__proto__ = new KitchenSuper();
Tile36.prototype.__proto__ = new KitchenSuper();
Tile37.prototype.__proto__ = new KitchenSuper();
Tile38.prototype.__proto__ = new KitchenSuper();
Tile50.prototype.__proto__ = new KitchenSuper();
Tile39.prototype.__proto__ = new Tile();
Tile40.prototype.__proto__ = new Tile();
Tile41.prototype.__proto__ = new Tile();
Tile42.prototype.__proto__ = new Tile();
Tile44.prototype.__proto__ = new Tile();
Tile45.prototype.__proto__ = new Tile();
Tile46.prototype.__proto__ = new Tile();
Tile47.prototype.__proto__ = new Tile();
Tile48.prototype.__proto__ = new Tile();
Tile49.prototype.__proto__ = new TableSuper();
Character.prototype.__proto__ = new IsoSprite();
Character.prototype.doFirstMove = function () {
trace("player did first move");
this.changeDir(0, 1);
this.doMove();
};
Character.prototype.cleanUp = function () {
_global.objs.game.enterFrameUnSubscribe(this);
_global.objs.game.keyDownUnSubscribe(this);
this.pause();
};
Character.prototype.setClip = function (theClip) {
this.clip = theClip;
this.tray.setClip(this.clip);
};
Character.prototype.doLoop = function () {
if (!this.paused) {
this.handleMovement();
if (this.workOutDrinkerCollisions()) {
this.doMove(true);
}
}
};
Character.prototype.workOutDrinkerCollisions = function () {
var charBounds = _global.fn.workOutObjBounds(this, true);
var drinkBounds;
for (var i in _global.objs.game.objs.drinkers) {
drinkBounds = _global.fn.workOutObjBounds(_global.objs.game.objs.drinkers[i]);
if (_global.fn.rectangularCollision(charBounds, drinkBounds)) {
_global.objs.game.objs.drinkers[i].playersNotHittingMe();
continue;
}
_global.objs.game.objs.drinkers[i].playerHitMe();
return(false);
}
return(true);
};
Character.prototype.handleMovement = function () {
if (_global.isDown(_global.kRight)) {
this.clip.char_mc.play();
this.changeDir(1, 0);
} else if (_global.isDown(_global.kLeft)) {
this.clip.char_mc.play();
this.changeDir(-1, 0);
} else if (_global.isDown(_global.kUp)) {
this.clip.char_mc.play();
this.changeDir(0, -1);
} else if (_global.isDown(_global.kDown)) {
this.clip.char_mc.play();
this.changeDir(0, 1);
} else {
this.stopAnimating();
this.changeDir(0, 0);
}
};
Character.prototype.stopAnimating = function () {
this.clip.char_mc.gotoAndStop(17);
};
Character.prototype.onKeyDown = function (theKey) {
if ((theKey == _global.kSpace) && (!this.paused)) {
this.doCollisions(null, null, "doKeyAction", false);
}
};
Character.prototype.takenDrinksOrder = function () {
this.state = "gotDrinksOrder";
};
Character.prototype.hasTakenDrinksOrder = function () {
if (this.state == "gotDrinksOrder") {
return(true);
}
return(false);
};
Character.prototype.takenFoodOrder = function () {
this.state = "gotFoodOrder";
};
Character.prototype.hasTakenFoodOrder = function () {
if (this.state == "gotFoodOrder") {
return(true);
}
return(false);
};
Character.prototype.takenFoodAndDrinksOrder = function () {
this.state = "gotFoodAndDrinksOrder";
};
Character.prototype.hasTakenFoodAndDrinksOrder = function () {
if (this.state == "gotFoodAndDrinksOrder") {
return(true);
}
return(false);
};
Character.prototype.carrying = function () {
this.state = "holding";
};
Character.prototype.isCarrying = function () {
if (this.state == "holding") {
return(true);
}
return(false);
};
Character.prototype.pause = function () {
this.stopAnimating();
this.paused = true;
};
Character.prototype.resume = function () {
this.paused = false;
};
IsoSprite.prototype.changeDir = function (tX, tY) {
this.xDir = tx;
this.yDir = tY;
};
IsoSprite.prototype.doMove = function (calcHilite) {
if ((this.xDir == 0) && (this.yDir == 0)) {
if (calcHilite) {
this.doCollisions(null, null, ["doHilite"], false);
}
} else {
this.moveChar(this.xDir, this.yDir, calcHilite);
}
};
IsoSprite.prototype.doTileAction = function (theTile) {
};
IsoSprite.prototype.getMyCorners = function (x, y) {
this.downY = Math.floor(((y + this.height) - 1) / this.isoRef.tileW);
this.upY = Math.floor(y / this.isoRef.tileW);
this.leftX = Math.floor(x / this.isoRef.tileW);
this.rightX = Math.floor(((x + this.width) - 1) / this.isoRef.tileW);
this.upleft = this.isoRef.tiles[(("t_" + this.upY) + "_") + this.leftX];
this.downleft = this.isoRef.tiles[(("t_" + this.downY) + "_") + this.leftX];
this.upright = this.isoRef.tiles[(("t_" + this.upY) + "_") + this.rightX];
this.downright = this.isoRef.tiles[(("t_" + this.downY) + "_") + this.rightX];
};
IsoSprite.prototype.doCollisions = function (dirx, diry, theAction, moveChar) {
if (theAction instanceof Array) {
} else {
theAction = [theAction];
}
if ((dirx == null) && (diry == null)) {
dirx = this.lastXDir;
diry = this.lastYDir;
}
this.getMyCorners(this.x, this.y + (this.speed * diry));
if (diry == -1) {
if (this.upleft.walkable && (this.upright.walkable)) {
if (moveChar) {
this.y = this.y + (this.speed * diry);
}
} else {
this.y = (this.ytile * this.isoRef.tileW) + 1;
for (var i in theAction) {
if (this.isoRef.tiles[(("t_" + this.upY) + "_") + this.xtile][theAction[i]]()) {
} else if (this.isoRef.tiles[(("t_" + this.upY) + "_") + this.leftX][theAction[i]]()) {
} else if (this.isoRef.tiles[(("t_" + this.upY) + "_") + this.rightX][theAction[i]]()) {
}
}
this.hitWall();
}
}
if (diry == 1) {
if (this.downleft.walkable && (this.downright.walkable)) {
if (moveChar) {
this.y = this.y + (this.speed * diry);
}
} else {
this.y = (((this.ytile + 1) * this.isoRef.tileW) - this.height) - 1;
for (var i in theAction) {
if (this.isoRef.tiles[(("t_" + this.downY) + "_") + this.xtile][theAction[i]]()) {
} else if (this.isoRef.tiles[(("t_" + this.downY) + "_") + this.leftX][theAction[i]]()) {
} else if (this.isoRef.tiles[(("t_" + this.downY) + "_") + this.rightX][theAction[i]]()) {
}
}
this.hitWall();
}
}
this.getMyCorners(this.x + (this.speed * dirx), this.y);
if (dirx == -1) {
if (this.downleft.walkable && (this.upleft.walkable)) {
if (moveChar) {
this.x = this.x + (this.speed * dirx);
}
} else {
this.x = (this.xtile * this.isoRef.tileW) + 1;
for (var i in theAction) {
if (this.isoRef.tiles[(("t_" + this.yTile) + "_") + this.leftX][theAction[i]]()) {
} else if (this.isoRef.tiles[(("t_" + this.downY) + "_") + this.leftX][theAction[i]]()) {
} else if (this.isoRef.tiles[(("t_" + this.upY) + "_") + this.leftX][theAction[i]]()) {
}
}
this.hitWall();
}
}
if (dirx == 1) {
if (this.upright.walkable && (this.downright.walkable)) {
if (moveChar) {
this.x = this.x + (this.speed * dirx);
}
} else {
this.x = (((this.xtile + 1) * this.isoRef.tileW) - this.width) - 1;
for (var i in theAction) {
if (this.isoRef.tiles[(("t_" + this.yTile) + "_") + this.rightX][theAction[i]]()) {
} else if (this.isoRef.tiles[(("t_" + this.downY) + "_") + this.rightX][theAction[i]]()) {
} else if (this.isoRef.tiles[(("t_" + this.upY) + "_") + this.rightX][theAction[i]]()) {
}
}
this.hitWall();
}
}
};
IsoSprite.prototype.hitWall = function () {
};
IsoSprite.prototype.moveChar = function (dirx, diry, calcHilite) {
this.lastXDir = dirx;
this.lastYDir = diry;
if (calcHilite) {
this.doCollisions(dirx, diry, ["doAction", "doHilite"], true);
} else {
this.doCollisions(dirx, diry, ["doAction"], true);
}
this.xiso = this.x - this.y;
this.yiso = (this.x + this.y) / 2;
this.clip._x = this.xiso;
this.clip._y = this.yiso;
this.clip.gotoAndStop((dirx + (diry * 2)) + 3);
this.xtile = Math.round(this.x / this.isoRef.tileW);
this.ytile = Math.round(this.y / this.isoRef.tileW);
this.depth = ((((this.yiso - this.depthshift) * 300) + this.xiso) + 1) + 100000;
this.clip.swapDepths(this.depth);
return(true);
};
IsoEngine.prototype.makeUnwalkable = function (tX, tY) {
if (this.maps[this.mapNum][tY][tX] == 0) {
var tName = ((("t_" + tY) + "_") + tX);
this.tiles[tName].walkable = false;
}
};
IsoEngine.prototype.makeWalkable = function (tX, tY) {
if (this.maps[this.mapNum][tY][tX] == 0) {
var tName = ((("t_" + tY) + "_") + tX);
this.tiles[tName].walkable = true;
}
};
IsoEngine.prototype.buildMap = function (mapNum) {
this.mapNum = mapNum;
_root.attachMovie("empty", "tiles", 1);
_root.tiles.attachMovie("empty", "back", 0);
this.halfvisx = int(this.visx / 2);
this.halfvisy = this.visy;
var ob = _global.objs.game.objs.player;
ob.x = ob.xtile * this.tileW;
ob.y = ob.ytile * this.tileW;
ob.xiso = ob.x - ob.y;
ob.yiso = (ob.x + ob.y) / 2;
this.clip = _root.tiles;
this.clip._x = 320;
this.clip._y = 43;
var y = (-this.halfvisy);
while (y < this.halfvisy) {
var x = (-(this.halfvisx + 1));
while (x <= this.halfvisx) {
if ((y % 2) != 0) {
var noisox = ((((x * this.tileW) * 2) + this.tileW) + ob.xiso);
} else {
var noisox = (((x * this.tileW) * 2) + ob.xiso);
}
var noisoy = (((y * this.tileW) / 2) + ob.yiso);
var ytile = (((2 * noisoy) - noisox) / 2);
var xtile = (noisox + ytile);
ytile = Math.round(ytile / this.tileW);
xtile = Math.round(xtile / this.tileW);
var name_noiso = ((("t_" + y) + "_") + x);
var name = ((("t_" + ytile) + "_") + xtile);
if ((((ytile >= 0) && (xtile >= 0)) && (ytile <= (this.maps[mapNum].length - 1))) && (xtile <= (this.maps[mapNum][0].length - 1))) {
this.tiles[name] = new eval (["Tile" + this.maps[mapNum][ytile][xtile]])();
if (this.tiles[name].walkable) {
var clip = this.clip.back;
} else {
var clip = this.clip;
}
this.tiles[name].depth = ((((((ytile + xtile) * this.tileW) / 2) * 300) + ((xtile - ytile) * this.tileW)) + 1) + 100000;
clip.attachMovie(this.tiles[name].link, name_noiso, this.tiles[name].depth);
clip.tabEnabled = false;
clip.tabChildren = false;
this.tiles[name].setClip(clip[name_noiso]);
this.tiles[(("noiso_" + y) + "_") + x] = {clip:this.tiles[name].clip, parentclip:clip, x:noisox, y:noisoy, xtile:xtile, ytile:ytile};
this.tiles[name].clip._x = noisox;
this.tiles[name].clip._y = noisoy;
}
x++;
}
y++;
}
ob.depthshift = (this.tileW - ob.height) / 2;
ob.depth = ((((ob.yiso - ob.depthshift) * 300) + ob.xiso) + 1) + 100000;
this.clip.attachMovie(_root.charLink, "char", ob.depth);
_root.recordDepth(ob.depth, "isosprite");
ob.clip = this.clip.char;
ob.setClip(this.clip.char);
ob.clip._x = ob.xiso;
ob.clip._y = ob.yiso;
ob.clip.gotoAndStop(ob.frame);
ob.xstep = ob.xiso;
ob.ystep = ob.yiso;
ob.xtilecount = 0;
ob.ytilecount = 0;
};
IsoEngine.prototype.changeTile = function (xold, yold, x, y, mapNum) {
var nameold = this[(("noiso_" + yold) + "_") + xold];
if (nameold.x == undefined) {
return(undefined);
}
var noisox = (nameold.x + ((x * this.tileW) * 2));
var noisoy = (nameold.y + ((y * this.tileW) / 2));
var ytile = (((2 * noisoy) - noisox) / 2);
var xtile = (noisox + ytile);
ytile = Math.round(ytile / this.tileW);
xtile = Math.round(xtile / this.tileW);
var name = ((("t_" + ytile) + "_") + xtile);
if ((((ytile >= 0) and (xtile >= 0)) and (ytile <= (this.maps[mapNum].length - 1))) and (xtile <= (this.maps[mapNum][0].length - 1))) {
this[name] = new eval (["Tile" + this.maps[mapNum][ytile][xtile]])();
} else {
this[name] = new Tile4();
}
if (this.tiles[name].walkable) {
var clip = this.clip.back;
} else {
var clip = this.clip;
}
var namenew = ((("t_" + (yold + y)) + "_") + (xold + x));
var oldclip = nameold.parentclip;
this.tiles[name].depth = ((((((ytile + xtile) * this.tileW) / 2) * 300) + ((xtile - ytile) * this.tileW)) + 1) + 100000;
if (oldclip != clip) {
clip.attachMovie("tile", namenew, this.tiles[name].depth);
nameold.clip.removeMovieClip();
} else {
nameold.clip._name = namenew;
clip[namenew].swapDepths(this.tiles[name].depth);
}
this.tiles[name].clip = clip[namenew];
this.tiles[(("noiso_" + (yold + y)) + "_") + (xold + x)] = {clip:game[name].clip, parentclip:clip, x:noisox, y:noisoy, xtile:xtile, ytile:ytile};
this.tiles[name].clip._x = noisox;
this.tiles[name].clip._y = noisoy;
this.tiles[name].clip.gotoAndStop(this.tiles[name].frame);
delete this.tiles[(("t_" + nameold.ytile) + "_") + nameold.xtile];
delete this.tiles[(("noiso_" + yold) + "_") + xold];
};
Group.prototype = new ObjTile();
Group.prototype.init = function () {
this.conversation = new Conversation();
this.conversation.setCallBack(this);
trace("--------new group--------");
trace(this.memberCount + " people at the table");
this.defineMembers();
this.linkTableTiles();
this.setTableClip();
this.resetWaitInterval();
this.toggleTimer(true);
trace("--------------------------");
this.conversation.addSentence("Hey! Over here!");
this.conversation.activate(false, false);
};
Group.prototype.defineMembers = function () {
var i = 0;
while (i < this.memberCount) {
this.members.push({id:i, orderWaitType:null, drinksOrder:{order:null, complete:false}, foodOrder:{order:null, complete:false}, mood:1, table:null, tablePos:null});
i++;
}
};
Group.prototype.generatePeopleFrames = function (howMany) {
var ret = [];
var fill = [];
var i = 1;
while (i <= howMany) {
ret.push(i);
i++;
}
while (fill.length < howMany) {
fill.push(ret.splice(_global.fn.randomRange(0, howMany.length - 1), 1)[0]);
}
return(fill);
};
Group.prototype.linkMembersWithClips = function (memberIndex, plateIndex, tableClip, chairClip) {
this.members[memberIndex].table = tableClip;
this.members[memberIndex].plateIndex = plateIndex;
this.members[memberIndex].chair = chairClip;
};
Group.prototype.resetWaitInterval = function () {
this.waitCount = 0;
this.resetTimer();
this.cancelWaitInterval();
this.done50percentMoodChange = false;
this.startTime = new Date().getTime();
this.timeScale = 0.0013;
this.timeTolID = setInterval(this, "checkTime", 1000);
};
Group.prototype.checkTime = function () {
var elapsed = (new Date().getTime() - this.startTime);
var tFrame = int(Math.min(100, elapsed * this.timeScale));
this.setTimer(tFrame + 1);
if (tFrame == 100) {
this.done50percentMoodChange = true;
this.youveKeptMeWaiting();
}
};
Group.prototype.cancelWaitInterval = function () {
this.resetTimer();
clearInterval(this.timeTolID);
};
Group.prototype.youveKeptMeWaiting = function () {
if (this.state != "angryLeave") {
this.orderLateLeave = true;
this.state = "angryLeave";
this.cancelWaitInterval();
this.doIgnoreTalk();
}
};
Group.prototype.calcAndDisplayMood = function () {
};
Group.prototype.doKeyAction = function () {
if (!this.conversation.getActive()) {
this.conversation.deactivate();
switch (this.mode) {
case "foodThenDrink" :
this.foodThenDrinkAction();
return;
case "foodAndDrink" :
this.foodAndDrinkAction();
return;
}
}
};
Group.prototype.foodThenDrinkAction = function () {
trace("this.state: " + this.state);
switch (this.state) {
case "idle" :
this.pickDrinks();
this.state = "waitingDrinks";
return;
case "waitingDrinks" :
if (this.keyActive) {
this.checkDrinksOrder();
}
return;
case "waitingForFoodOrder" :
if (this.keyActive) {
this.pickFood();
}
return;
case "waitingFood" :
if (this.keyActive) {
this.checkFoodOrder();
}
return;
case "eatingFood" :
return;
case "dirtyPlates" :
_global.objs.game.doPosScore();
this.cleanUp("dirty");
}
};
Group.prototype.foodAndDrinkAction = function () {
switch (this.state) {
case "idle" :
this.pickFoodAndDrinks();
this.state = "waitingFoodAndDrinks";
return;
case "waitingFoodAndDrinks" :
if (this.keyActive) {
this.checkFoodAndDrinksOrder();
}
return;
case "eatingFood" :
return;
case "dirtyPlates" :
_global.objs.game.doPosScore();
this.cleanUp("dirty");
}
};
Group.prototype.conversationFinished = function () {
switch (this.state) {
case "eatingFood" :
if (this.leaveID == null) {
this.leaveID = setInterval(this, "leave", 5000);
}
return;
case "waitingDrinks" :
if (this.orderWrongLeave) {
this.leave();
this.cleanUp("clean");
}
return;
case "waitingForFoodOrder" :
return;
case "waitingFood" :
if (this.orderWrongLeave) {
this.leave();
this.cleanUp("clean");
}
return;
case "waitingFoodAndDrinks" :
if (this.orderWrongLeave) {
this.leave();
this.cleanUp("clean");
}
return;
case "angryLeave" :
this.leave();
}
};
Group.prototype.wrongOrder = function () {
this.ordersWrong++;
if (this.ordersWrong >= 3) {
for (var i in this.members) {
this.members[i].mood = this.members[i].mood - 100;
}
this.state = "angryLeave";
this.orderWrongLeave = true;
return(false);
}
return(true);
};
Group.prototype.doLeaveTalk = function () {
this.keyActive = false;
_global.objs.game.doNegSat();
this.conversation.addSentence("Hey! We can't wait around all day for you to get it right. We're off somewhere else!");
this.conversation.activate(false, false);
};
Group.prototype.doIgnoreTalk = function () {
_global.objs.game.doNegSat();
this.keyActive = false;
this.conversation.addSentence("OK... if you haven't got time to serve us... we're off somewhere else!");
this.conversation.activate(false, false);
_global.objs.game.objs.sound.playANeg();
};
Group.prototype.buildQuantitiesSentence = function (quantities, endOfSentence) {
var fOpen = "<font color='#FF0000'>";
var fClose = "</font>";
var tString = "";
var gram;
var c = 0;
var len = 0;
for (var i in quantities) {
len++;
}
for (var i in quantities) {
if ((c == (len - 2)) && (endOfSentence)) {
gram = " & ";
} else if (c == (len - 1)) {
gram = "";
} else {
gram = ", ";
}
if (quantities[i] == 1) {
tString = tString + (((((fOpen + _global.ammounts[quantities[i]]) + " ") + i) + fClose) + gram);
} else {
tString = tString + ((((((fOpen + _global.ammounts[quantities[i]]) + " ") + i) + "s") + fClose) + gram);
}
c++;
}
if (endOfSentence) {
tString = tString + ". ";
} else {
tString = tString + ", ";
}
return(tString);
};
Group.prototype.pickDrinks = function () {
_global.objs.game.objs.hint.displayHint("afterFirstOrder");
this.resetWaitInterval();
var tString = "Hello, can we have: ";
var whoToPickWith = [];
var i = 0;
while (i < this.members.length) {
whoToPickWith.push(i);
i++;
}
var quantities = this.selectDrinks(whoToPickWith);
tString = tString + this.buildQuantitiesSentence(quantities, true);
tString = tString + "Thanks!";
this.conversation.addSentence(tString);
this.conversation.activate(false, false);
this.playerRef.takenDrinksOrder();
};
Group.prototype.checkDrinksOrder = function () {
var whoToCheckWith = [];
var i = 0;
while (i < this.members.length) {
whoToCheckWith.push(i);
i++;
}
var ref = this.checkDrinks(whoToCheckWith);
var orderDone = ref[0];
var quantities = ref[1];
var tString;
if (orderDone == this.memberCount) {
_global.objs.game.objs.sound.playAPos();
this.resetWaitInterval();
this.conversation.addSentence("Thanks, for the drinks. We'll look at the food menu for a few of momments!");
this.conversation.activate(false, false);
this.state = "waitingForFoodOrder";
} else if (this.wrongOrder()) {
var remainder = (this.memberCount - orderDone);
tString = "We are still waiting for: ";
tString = tString + this.buildQuantitiesSentence(quantities, true);
tString = tString + "thanks!";
this.conversation.addSentence(tString);
this.conversation.activate(false, false);
_global.objs.game.objs.sound.playANeg();
} else {
this.doLeaveTalk();
}
};
Group.prototype.pickFood = function () {
_global.objs.game.objs.hint.displayHint("afterFirstFoodOrder");
this.resetWaitInterval();
var tString = "Thanks for the drinks, we'd like to order some food, can we have: ";
var whoToPickWith = [];
var i = 0;
while (i < this.members.length) {
whoToPickWith.push(i);
i++;
}
var quantities = this.selectFood(whoToPickWith);
tString = tString + this.buildQuantitiesSentence(quantities, true);
tString = tString + "Thanks! ";
this.conversation.addSentence(tString);
this.conversation.activate(false, false);
this.state = "waitingFood";
};
Group.prototype.checkFoodOrder = function () {
var whoToCheckWith = [];
var i = 0;
while (i < this.members.length) {
whoToCheckWith.push(i);
i++;
}
var ref = this.checkFood(whoToCheckWith);
var orderDone = ref[0];
var quantities = ref[1];
var tString;
if (orderDone == this.memberCount) {
this.cancelWaitInterval();
this.resetTimer();
this.conversation.addSentence("Thanks, for the food. ");
_global.objs.game.objs.sound.playAPos();
this.conversation.activate(false, false);
this.state = "eatingFood";
} else if (this.wrongOrder()) {
var remainder = (this.memberCount - orderDone);
tString = "We are still waiting for: ";
tString = tString + this.buildQuantitiesSentence(quantities, true);
tString = tString + "Thanks! ";
this.conversation.addSentence(tString);
this.conversation.activate(false, false);
_global.objs.game.objs.sound.playANeg();
} else {
this.doLeaveTalk();
}
};
Group.prototype.pickFoodAndDrinks = function () {
var tString;
tString = "Hello, can we have: ";
var howManyForDrinks = _global.fn.randomRange(1, this.members.length - 1);
var howManyForFood = (this.members.length - howManyForDrinks);
var whoToPickWith = [];
var i = 0;
while (i < howManyForDrinks) {
whoToPickWith.push(i);
i++;
}
var drinksQuantities = this.selectDrinks(whoToPickWith);
tString = tString + this.buildQuantitiesSentence(drinksQuantities, false);
whoToPickWith = [];
var i = howManyForDrinks;
while (i < this.members.length) {
whoToPickWith.push(i);
i++;
}
var foodQuantities = this.selectFood(whoToPickWith);
tString = tString + this.buildQuantitiesSentence(foodQuantities, true);
tString = tString + "Thanks! ";
this.conversation.addSentence(tString);
this.conversation.activate(false, false);
this.playerRef.takenFoodAndDrinksOrder();
};
Group.prototype.checkFoodAndDrinksOrder = function () {
var drinksWaiting = [];
var foodWaiting = [];
var i = 0;
while (i < this.members.length) {
if (this.members[i].orderWaitType == "drink") {
drinksWaiting.push(i);
} else if (this.members[i].orderWaitType == "food") {
foodWaiting.push(i);
}
i++;
}
if (drinksWaiting.length > 0) {
var ref = this.checkDrinks(drinksWaiting);
var orderDoneDrink = ref[0];
var quantitiesDrink = ref[1];
}
if (foodWaiting.length > 0) {
var ref = this.checkFood(foodWaiting);
var orderDoneFood = ref[0];
var quantitiesFood = ref[1];
}
var tString;
if ((orderDoneDrink + orderDoneFood) == this.memberCount) {
this.cancelWaitInterval();
this.resetTimer();
this.conversation.addSentence("Thanks, for the order! ");
_global.objs.game.objs.sound.playAPos();
this.conversation.activate(false, false);
this.state = "eatingFood";
} else if (this.wrongOrder()) {
var remainder = (this.memberCount - (orderDoneDrink + orderDoneFood));
tString = "We are still waiting for: ";
tString = tString + this.buildQuantitiesSentence(quantitiesDrink, false);
tString = tString + this.buildQuantitiesSentence(quantitiesFood, true);
tString = tString + "Thanks! ";
this.conversation.addSentence(tString);
this.conversation.activate(false, false);
_global.objs.game.objs.sound.playANeg();
} else {
this.doLeaveTalk();
}
};
Group.prototype.selectDrinks = function (theMembers) {
var quantities = {};
var i = 0;
while (i < theMembers.length) {
this.members[theMembers[i]].drinksOrder.order = this.menuRef.pickARandomDrink();
this.members[theMembers[i]].orderWaitType = "drink";
if (quantities[this.members[theMembers[i]].drinksOrder.order] == null) {
quantities[this.members[theMembers[i]].drinksOrder.order] = 1;
} else {
quantities[this.members[theMembers[i]].drinksOrder.order]++;
}
i++;
}
return(quantities);
};
Group.prototype.checkDrinks = function (theMembers) {
var quantities = {};
var orderDone = 0;
var pass = true;
while (pass == true) {
var theDrink = this.playerRef.tray.getNextItem();
if (theDrink == false) {
pass = false;
} else {
var i = 0;
while (i < theMembers.length) {
if (this.members[theMembers[i]].orderWaitType == "drink") {
if (this.members[theMembers[i]].drinksOrder.order == theDrink) {
if (this.members[theMembers[i]].drinksOrder.complete == false) {
this.members[theMembers[i]].drinksOrder.complete = true;
this.members[theMembers[i]].mood = this.members[theMembers[i]].mood + 1;
this.playerRef.tray.markCurrentItemForRemoval();
_global.objs.game.doPosScore();
_global.objs.game.doPosSat();
trace("thanks!");
break;
}
}
}
i++;
}
}
}
var i = 0;
while (i < theMembers.length) {
if (this.members[theMembers[i]].orderWaitType == "drink") {
if (!this.members[theMembers[i]].drinksOrder.complete) {
this.members[theMembers[i]].mood = this.members[theMembers[i]].mood - 1;
_root.debug(3000);
_global.objs.game.doNegSat();
if (quantities[this.members[theMembers[i]].drinksOrder.order] == null) {
quantities[this.members[theMembers[i]].drinksOrder.order] = 1;
} else {
quantities[this.members[theMembers[i]].drinksOrder.order]++;
}
} else {
this.members[theMembers[i]].table.glasses_mc[this.members[theMembers[i]].plateIndex + "_mc"]._visible = true;
orderDone++;
}
}
i++;
}
return([orderDone, quantities]);
};
Group.prototype.selectFood = function (theMembers) {
var quantities = {};
var i = 0;
while (i < theMembers.length) {
this.members[theMembers[i]].foodOrder.order = this.menuRef.pickARandomFood();
this.members[theMembers[i]].orderWaitType = "food";
if (quantities[this.members[theMembers[i]].foodOrder.order] == null) {
quantities[this.members[theMembers[i]].foodOrder.order] = 1;
} else {
quantities[this.members[theMembers[i]].foodOrder.order]++;
}
i++;
}
return(quantities);
};
Group.prototype.checkFood = function (theMembers) {
var quantities = {};
var orderDone = 0;
var pass = true;
while (pass == true) {
var theFood = this.playerRef.tray.getNextItem();
if (theFood == false) {
pass = false;
} else {
var i = 0;
while (i < theMembers.length) {
if (this.members[theMembers[i]].orderWaitType == "food") {
if (this.members[theMembers[i]].foodOrder.order == theFood) {
if (this.members[theMembers[i]].foodOrder.complete == false) {
this.members[theMembers[i]].foodOrder.complete = true;
this.members[theMembers[i]].mood = this.members[theMembers[i]].mood + 1;
this.playerRef.tray.markCurrentItemForRemoval();
_global.objs.game.doPosScore();
_global.objs.game.doPosSat();
break;
}
}
}
i++;
}
}
}
var i = 0;
while (i < theMembers.length) {
if (this.members[theMembers[i]].orderWaitType == "food") {
if (!this.members[theMembers[i]].foodOrder.complete) {
this.members[theMembers[i]].mood = this.members[theMembers[i]].mood - 1;
_root.debug(3000);
_global.objs.game.doNegSat();
if (quantities[this.members[theMembers[i]].foodOrder.order] == null) {
quantities[this.members[theMembers[i]].foodOrder.order] = 1;
} else {
quantities[this.members[theMembers[i]].foodOrder.order]++;
}
}
}
i++;
}
var i = 0;
while (i < this.members.length) {
if (this.members[theMembers[i]].orderWaitType == "food") {
if (!this.members[theMembers[i]].foodOrder.complete) {
} else {
orderDone++;
this.members[theMembers[i]].table.plateHolder_mc[this.members[theMembers[i]].plateIndex + "_mc"]._visible = true;
}
}
i++;
}
return([orderDone, quantities]);
};
Group.prototype.clearLeaveInterval = function () {
clearInterval(this.leaveID);
};
Group.prototype.leave = function () {
trace("LEAVE");
this.cancelWaitInterval();
this.clearLeaveInterval();
this.hidePeople();
var pass = false;
for (var i in this.members) {
if (this.members[i].drinksOrder.complete || (this.members[i].foodOrder.complete)) {
pass = true;
break;
}
}
if (pass) {
_global.objs.game.objs.hint.displayHint("clearGlasses");
this.state = "dirtyPlates";
this.groupManager.addDirtyTable(this);
} else {
this.cleanUp("clean");
}
this.workOutBonus();
};
Group.prototype.workoutBonus = function () {
trace("BONUS fired STATE:" + this.state);
if (((this.state != "angryLeave") && (!this.orderLateLeave)) && (!this.orderWrongLeave)) {
var timeTaken = int(new Date().getTime() - this.arriveTime);
var bonus = (int((this.targetFinish - timeTaken) / 1000) * this.pointsPersecond);
trace((("BONUS:" + bonus) + " STATE:") + this.state);
_global.objs.game.changeScore(bonus);
_global.objs.game.objs.sound.playAPos();
}
};
Group.prototype.hidePeople = function () {
if (this.clips.top != undefined) {
var i = 1;
while (i <= 4) {
if (this.clips["top_chair" + i] != null) {
this.clips["top_chair" + i].person_mc._visible = false;
}
i++;
}
}
if (this.clips.bottom != undefined) {
var i = 1;
while (i <= 4) {
if (this.clips["bottom_chair" + i] != null) {
this.clips["bottom_chair" + i].person_mc._visible = false;
}
i++;
}
}
};
Group.prototype.cleanUp = function (theType) {
this.cancelTimeOuts();
this.unlinkTableTiles();
this.clearPlates();
this.groupManager.removeGroup(this, theType);
};
Group.prototype.cancelTimeOuts = function () {
this.clearLeaveInterval();
this.cancelWaitInterval();
};
Group.prototype.clearPlates = function () {
if (this.state == "dirtyPlates") {
var i = 0;
while (i < this.members.length) {
this.members[i].table.plateHolder_mc[this.members[i].plateIndex + "_mc"]._visible = false;
this.members[i].table.glasses_mc[this.members[i].plateIndex + "_mc"]._visible = false;
i++;
}
_global.objs.game.objs.sound.playAPos();
}
};
DoubleTable.prototype = new Group();
DoubleTable.prototype.linkTableTiles = function () {
var topTile = this.iso.tiles[(("t_" + this.table.tableTiles.top.y) + "_") + this.table.tableTiles.top.x];
var botTile = this.iso.tiles[(("t_" + this.table.tableTiles.bottom.y) + "_") + this.table.tableTiles.bottom.x];
var chair1 = this.iso.tiles[(("t_" + this.table.chairTiles.top[0].y) + "_") + this.table.chairTiles.top[0].x];
var chair2 = this.iso.tiles[(("t_" + this.table.chairTiles.top[1].y) + "_") + this.table.chairTiles.top[1].x];
var chair3 = this.iso.tiles[(("t_" + this.table.chairTiles.bottom[0].y) + "_") + this.table.chairTiles.bottom[0].x];
var chair4 = this.iso.tiles[(("t_" + this.table.chairTiles.bottom[1].y) + "_") + this.table.chairTiles.bottom[1].x];
topTile.obj = this;
botTile.obj = this;
chair1.obj = this;
chair2.obj = this;
chair3.obj = this;
chair4.obj = this;
this.clips.top = topTile.clip;
this.clips.top_chair1 = chair1.clip;
this.clips.top_chair2 = chair2.clip;
this.clips.bottom = botTile.clip;
this.clips.bottom_chair1 = chair3.clip;
this.clips.bottom_chair2 = chair4.clip;
};
DoubleTable.prototype.setHiliteVisible = function (tVis) {
_global.objs.game.objs.hint.displayHint("firstTableVisit");
this.clips.top.hilite_mc._visible = tVis;
this.clips.bottom.hilite_mc._visible = tVis;
};
DoubleTable.prototype.unlinkTableTiles = function () {
this.iso.tiles[(("t_" + this.table.tableTiles.top.y) + "_") + this.table.tableTiles.top.x].obj = null;
this.iso.tiles[(("t_" + this.table.tableTiles.bottom.y) + "_") + this.table.tableTiles.bottom.x].obj = null;
this.iso.tiles[(("t_" + this.table.chairTiles.top[0].y) + "_") + this.table.chairTiles.top[0].x].obj = null;
this.iso.tiles[(("t_" + this.table.chairTiles.top[1].y) + "_") + this.table.chairTiles.top[1].x].obj = null;
this.iso.tiles[(("t_" + this.table.chairTiles.bottom[0].y) + "_") + this.table.chairTiles.bottom[0].x].obj = null;
this.iso.tiles[(("t_" + this.table.chairTiles.bottom[1].y) + "_") + this.table.chairTiles.bottom[1].x].obj = null;
};
DoubleTable.prototype.setTableClip = function () {
var peopleFrames = this.generatePeopleFrames(this.clips.top_chair1.person_mc._totalframes);
var flip = Boolean(_global.fn.randomRange(0, 1));
var c = this.memberCount;
if (flip) {
this.startTable = "top";
if (c <= 2) {
trace(c + " people at the top table");
var i = 1;
while (i <= c) {
this.clips["top_chair" + i].person_mc._visible = true;
this.clips["top_chair" + i].person_mc.gotoAndStop(peopleFrames[i]);
this.clips["top_chair" + i].person_mc.ani_mc.gotoAndPlay(2);
this.linkMembersWithClips(i - 1, i, this.clips.top, this.clips["top_chair" + i]);
i++;
}
} else {
var i = 1;
while (i <= 2) {
this.clips["top_chair" + i].person_mc._visible = true;
this.clips["top_chair" + i].person_mc.gotoAndStop(peopleFrames[i]);
this.clips["top_chair" + i].person_mc.ani_mc.gotoAndPlay(2);
this.linkMembersWithClips(i - 1, i, this.clips.top, this.clips["top_chair" + i]);
i++;
}
var i = 2;
while (i <= (this.memberCount - 1)) {
this.clips["bottom_chair" + (i - 1)].person_mc._visible = true;
this.clips["bottom_chair" + (i - 1)].person_mc.gotoAndStop(peopleFrames[i]);
this.clips["bottom_chair" + (i - 1)].person_mc.ani_mc.gotoAndPlay(2);
this.linkMembersWithClips(i, i - 1, this.clips.bottom, this.clips["bottom_chair" + (i - 1)]);
trace("bottom_chair" + (i - 1));
i++;
}
}
this.conversation.attatchClip(this.clips.top.speechHolder_mc);
} else {
this.startTable = "bottom";
if (c <= 2) {
trace(c + " people at the bottom table");
var i = 1;
while (i <= c) {
this.clips["bottom_chair" + i].person_mc._visible = true;
this.clips["bottom_chair" + i].person_mc.gotoAndStop(peopleFrames[i]);
this.clips["bottom_chair" + i].person_mc.ani_mc.gotoAndPlay(2);
this.linkMembersWithClips(i - 1, i, this.clips.bottom, this.clips["bottom_chair" + i]);
i++;
}
} else {
var i = 1;
while (i <= 2) {
this.clips["bottom_chair" + i].person_mc._visible = true;
this.clips["bottom_chair" + i].person_mc.gotoAndStop(peopleFrames[i]);
this.clips["bottom_chair" + i].person_mc.ani_mc.gotoAndPlay(2);
this.linkMembersWithClips(i - 1, i, this.clips.bottom, this.clips["bottom_chair" + i]);
i++;
}
var i = 2;
while (i <= (this.memberCount - 1)) {
this.clips["top_chair" + (i - 1)].person_mc._visible = true;
this.clips["top_chair" + (i - 1)].person_mc.gotoAndStop(peopleFrames[i]);
this.clips["top_chair" + (i - 1)].person_mc.ani_mc.gotoAndPlay(2);
this.linkMembersWithClips(i, i - 1, this.clips.top, this.clips["top_chair" + (i - 1)]);
i++;
}
}
this.conversation.attatchClip(this.clips.bottom.speechHolder_mc);
}
};
DoubleTable.prototype.toggleTimer = function (val) {
this.clips.bottom.timer_mc._visible = val;
};
DoubleTable.prototype.resetTimer = function () {
this.toggleTimer(false);
this.clips.bottom.timer_mc.gotoAndStop(1);
};
DoubleTable.prototype.setTimer = function (tFrame) {
this.toggleTimer(true);
this.clips.bottom.timer_mc.gotoAndStop(tFrame);
};
SingleTable.prototype = new Group();
SingleTable.prototype.setHiliteVisible = function (tVis) {
_global.objs.game.objs.hint.displayHint("firstTableVisit");
this.clips.top.hilite_mc._visible = tVis;
};
SingleTable.prototype.toggleTimer = function (val) {
this.clips.top.timer_mc._visible = val;
};
SingleTable.prototype.resetTimer = function () {
this.toggleTimer(false);
this.clips.top.timer_mc.gotoAndStop(1);
};
SingleTable.prototype.setTimer = function (tFrame) {
this.toggleTimer(true);
this.clips.top.timer_mc.gotoAndStop(tFrame);
};
SingleTable.prototype.linkTableTiles = function () {
var topTile = this.iso.tiles[(("t_" + this.table.tableTiles.top.y) + "_") + this.table.tableTiles.top.x];
topTile.obj = this;
this.clips.top = topTile.clip;
var i = 0;
while (i < this.memberCount) {
var tChair = this.iso.tiles[(("t_" + this.table.chairTiles.top[i].y) + "_") + this.table.chairTiles.top[i].x];
tChair.obj = this;
var chairNum = (i + 1);
this.clips["top_chair" + chairNum] = tChair.clip;
i++;
}
};
SingleTable.prototype.unlinkTableTiles = function () {
this.iso.tiles[(("t_" + this.table.tableTiles.top.y) + "_") + this.table.tableTiles.top.x].obj = null;
for (var i in this.table.chairTiles.top) {
this.iso.tiles[(("t_" + this.table.chairTiles.top[i].y) + "_") + this.table.chairTiles.top[i].x].obj = null;
}
};
SingleTable.prototype.setTableClip = function () {
var peopleFrames = this.generatePeopleFrames(this.clips.top_chair1.person_mc._totalframes);
var flip = Boolean(_global.fn.randomRange(0, 1));
var c = this.memberCount;
var i = 1;
while (i <= c) {
this.clips["top_chair" + i].person_mc._visible = true;
this.linkMembersWithClips(i - 1, i, this.clips.top, this.clips["top_chair" + i]);
this.clips["top_chair" + i].person_mc.gotoAndStop(peopleFrames[i]);
this.clips["top_chair" + i].person_mc.ani_mc.gotoAndPlay(2);
i++;
}
this.conversation.attatchClip(this.clips.top.speechHolder_mc);
};
GroupManager.prototype.setTimeBar = function () {
if ((this.totalGameTime != undefined) && (this.gameStartTime != undefined)) {
var elapsed = (new Date().getTime() - this.gameStartTime);
var tFrame = Math.max(0, 100 - int((this.totalGameTime - elapsed) * this.gameTimeScale));
_root.frontPannel_mc.statusPannel_mc.timer_mc.gotoAndStop(tFrame + 1);
}
};
GroupManager.prototype.doLoop = function () {
this.setTimeBar();
var curTime = new Date().getTime();
if ((curTime - this.arriveStartTime) > this.difficulty[this.difficultyPos].groupArriveDelay) {
this.newGroup();
trace("NEW GROUP");
} else if (this.usedTables.length == 0) {
this.newGroup();
trace("NEW GROUP");
}
if ((curTime - this.difficultyStartTime) > this.difficulty[this.difficultyPos].nextLevelDelay) {
this.nextDifficulty();
trace("NEXT DIFFICULTY");
}
};
GroupManager.prototype.nextDifficulty = function () {
this.difficultyStartTime = new Date().getTime();
this.difficultyPos++;
if (this.difficultyPos >= this.difficulty.length) {
trace("GAME OVER");
this.gameOver();
} else {
this.difficultyStartTime = new Date().getTime();
trace("!- next difficulty -!");
trace("maxPeople:" + this.difficulty[this.difficultyPos].maxPeople);
trace("groupArriveDelay:" + this.difficulty[this.difficultyPos].groupArriveDelay);
trace("nextLevelDelay:" + this.difficulty[this.difficultyPos].nextLevelDelay);
trace("maxPeople:" + this.difficulty[this.difficultyPos].maxPeople);
trace("mode:" + this.difficulty[this.difficultyPos].mode);
}
};
GroupManager.prototype.gameOver = function () {
_global.objs.game.workOutFinalScore();
_global.objs.game.enterFrameUnSubscribe(this);
_global.objs.game.shutdown();
_root.frontPannel_mc.gameOverMask_mc._visible = true;
};
GroupManager.prototype.cleanUp = function () {
clearInterval(this.newGroupID);
clearInterval(this.difficultyIntID);
for (var i in this.groups) {
this.groups[i].cancelWaitInterval();
this.groups[i].clearLeaveInterval();
}
};
GroupManager.prototype.initFreeTables = function () {
var i = 0;
while (i < this.tables.length) {
this.freeTables.push(this.tables[i].id);
i++;
}
};
GroupManager.prototype.setupTables = function () {
this.tables[0] = {id:0, maxPeople:4, type:"DOUBLE", direction:"RL", tableTiles:{top:{x:2, y:15}, bottom:{x:3, y:15}}, chairTiles:{top:[{x:2, y:16}, {x:2, y:14}], bottom:[{x:3, y:16}, {x:3, y:14}]}};
this.tables[1] = {id:1, maxPeople:4, type:"DOUBLE", direction:"RL", tableTiles:{top:{x:6, y:15}, bottom:{x:7, y:15}}, chairTiles:{top:[{x:6, y:16}, {x:6, y:14}], bottom:[{x:7, y:16}, {x:7, y:14}]}};
this.tables[2] = {id:2, maxPeople:4, type:"DOUBLE", direction:"RL", tableTiles:{top:{x:10, y:15}, bottom:{x:11, y:15}}, chairTiles:{top:[{x:10, y:16}, {x:10, y:14}], bottom:[{x:11, y:16}, {x:11, y:14}]}};
this.tables[3] = {id:3, maxPeople:4, type:"DOUBLE", direction:"RL", tableTiles:{top:{x:14, y:15}, bottom:{x:15, y:15}}, chairTiles:{top:[{x:14, y:16}, {x:14, y:14}], bottom:[{x:15, y:16}, {x:15, y:14}]}};
this.tables[4] = {id:4, maxPeople:4, type:"DOUBLE", direction:"RL", tableTiles:{top:{x:6, y:11}, bottom:{x:7, y:11}}, chairTiles:{top:[{x:6, y:12}, {x:6, y:10}], bottom:[{x:7, y:12}, {x:7, y:10}]}};
this.tables[5] = {id:5, maxPeople:3, type:"SINGLE", direction:"RL", tableTiles:{top:{x:10, y:11}}, chairTiles:{top:[{x:9, y:11}, {x:11, y:11}, {x:10, y:10}]}};
this.tables[6] = {id:6, maxPeople:2, type:"SINGLE", direction:"RL", tableTiles:{top:{x:13, y:11}}, chairTiles:{top:[{x:13, y:10}, {x:13, y:12}]}};
};
GroupManager.prototype.newGroup = function () {
if ((this.freeTables.length > 0) && (this.usedTables.length < this.difficulty[this.difficultyPos].maxGroups)) {
var tableNum = _global.fn.randomRange(0, this.freeTables.length - 1);
this.arriveStartTime = new Date().getTime();
if (this.tables[this.freeTables[tableNum]].type == "DOUBLE") {
this.groups.push(new DoubleTable(this.iso, this, this.tables[this.freeTables[tableNum]], tableNum, this.playerRef, this.difficulty[this.difficultyPos].maxPeople, _global.fn.randomRange(60000, 60000), this.difficulty[this.difficultyPos].gMode));
} else if (this.tables[this.freeTables[tableNum]].type == "SINGLE") {
this.groups.push(new SingleTable(this.iso, this, this.tables[this.freeTables[tableNum]], tableNum, this.playerRef, this.difficulty[this.difficultyPos].maxPeople, _global.fn.randomRange(60000, 60000), this.difficulty[this.difficultyPos].gMode));
}
this.groups[this.groups.length - 1].init();
var tableToUse = this.freeTables.splice(tableNum, 1);
this.usedTables.push(tableToUse[0]);
} else {
return(false);
}
};
GroupManager.prototype.addDirtyTable = function (theGroup) {
var id = theGroup.table.id;
this.dirtyTables.push(id);
var i = 0;
while (i < this.usedTables.length) {
if (this.usedTables[i] == id) {
this.usedTables.splice(i, 1);
return;
}
i++;
}
};
GroupManager.prototype.removeGroup = function (theGroup, theType) {
var tToFind = theGroup.table.id;
var arr;
if (theType == "clean") {
arr = this.usedTables;
} else if (theType == "dirty") {
arr = this.dirtyTables;
}
var i = 0;
while (i < arr.length) {
if (arr[i] == tToFind) {
arr.splice(i, 1);
break;
}
i++;
}
this.freeTables.push(tToFind);
var i = 0;
while (i < this.groups.length) {
if (this.groups[i] == theGroup) {
this.groups[i].cancelTimeOuts();
this.groups[i] = null;
this.groups.splice(i, 1);
break;
}
i++;
}
if (this.groups.length == 0) {
this.arriveStartTime = new Date().getTime();
}
};
Chef.prototype.__proto__ = new ObjTile();
Chef.prototype.setClip = function (theClip) {
this.clips.push(theClip);
};
Chef.prototype.setHiliteVisible = function (tVis) {
for (var i in this.clips) {
this.clips[i].hilite_mc._visible = tVis;
}
};
Chef.prototype.doKeyAction = function () {
this.playerRef.pause();
_global.objs.game.objs.theMenu.initClip(this, "food", this.playerRef.tray.getItems());
};
Chef.prototype.menuClosed = function (theOrder) {
if (theOrder.length > 0) {
this.playerRef.tray.setItems(theOrder);
this.playerRef.carrying();
}
this.playerRef.resume();
};
BarMan.prototype.__proto__ = new ObjTile();
BarMan.prototype.setClip = function (theClip) {
this.clips.push(theClip);
};
BarMan.prototype.setHiliteVisible = function (tVis) {
_global.objs.game.objs.hint.displayHint("openBarMenu");
for (var i in this.clips) {
this.clips[i].hilite_mc._visible = tVis;
}
};
BarMan.prototype.doKeyAction = function () {
_root.debug(1E48);
this.playerRef.pause();
_global.objs.game.objs.theMenu.initClip(this, "drink", this.playerRef.tray.getItems());
};
BarMan.prototype.menuClosed = function (theOrder) {
this.playerRef.tray.setItems(theOrder);
this.playerRef.carrying();
this.playerRef.resume();
};
Worker.prototype.activate = function () {
};
Worker.prototype.takeOrder = function () {
};
Drinker.prototype.__proto__ = new IsoSprite();
Drinker.prototype.cleanUp = function () {
this.paused = true;
this.clearWayPointInterval();
this.clip.char_mc.stop();
};
Drinker.prototype.setupPath = function () {
if (this.path != null) {
var dir = this.path[this.pathIndex][0];
switch (dir) {
case "L" :
this.changeDir(-1, 0);
this.clip.char_mc.gotoAndPlay(1);
this.targetSqX = this.x - this.path[this.pathIndex][1];
this.targetSqY = this.y;
this.clip.char_mc.play();
break;
case "R" :
this.changeDir(1, 0);
this.clip.char_mc.gotoAndPlay(1);
this.targetSqX = this.x + this.path[this.pathIndex][1];
this.targetSqY = this.y;
this.clip.char_mc.play();
break;
case "U" :
this.changeDir(0, -1);
this.clip.char_mc.gotoAndPlay(1);
this.targetSqX = this.x;
this.targetSqY = this.y - this.path[this.pathIndex][1];
break;
case "D" :
this.changeDir(0, 1);
this.clip.char_mc.gotoAndPlay(1);
this.targetSqX = this.x;
this.targetSqY = this.y + this.path[this.pathIndex][1];
break;
}
} else {
this.clip.char_mc.gotoAndStop(17);
this.changeDir(0, 0);
}
};
Drinker.prototype.checkPlayerCollisions = function () {
var thisBounds = _global.fn.workOutObjBounds(this, true);
var playerBounds = _global.fn.workOutObjBounds(_global.objs.game.objs.player);
if (_global.fn.rectangularCollision(thisBounds, playerBounds)) {
} else {
this.clip.char_mc.gotoAndStop(17);
return(false);
}
if (this.drinkerCol) {
var drinkBounds;
var drinkRef;
for (var i in _global.objs.game.objs.drinkers) {
drinkRef = _global.objs.game.objs.drinkers[i];
if (drinkRef != this) {
drinkBounds = _global.fn.workOutObjBounds(drinkRef);
if (_global.fn.rectangularCollision(thisBounds, drinkBounds)) {
if (this.intervalID == null) {
this.clip.char_mc.play();
}
} else {
this.clip.char_mc.gotoAndStop(17);
return(false);
}
}
}
}
return(true);
};
Drinker.prototype.playerHitMe = function () {
if (!this.playerColide) {
trace("player bumped into me");
this.playerColide = true;
this.clip.speech_mc.play();
_global.objs.game.doCharBump();
}
};
Drinker.prototype.playersNotHittingMe = function () {
this.playerColide = false;
};
Drinker.prototype.calcHesitation = function () {
this.changeDir(0, 0);
this.clip.char_mc.gotoAndStop(17);
var delay = Math.max(1000, (Math.random() * this.hesitence) * _global.maxDrinkerWaypointDelay);
if (delay != 0) {
this.clip.char_mc.gotoAndStop(17);
var thresh = _global.fn.randomRange(1, 10);
if (thresh >= 4) {
this.clip.char_mc.ani_mc.gotoAndStop(1);
}
this.intervalID = setInterval(this, "nextWayPoint", delay);
} else {
this.intervalID = null;
this.nextWayPoint();
}
};
Drinker.prototype.clearWayPointInterval = function () {
clearInterval(this.intervalID);
};
Drinker.prototype.nextWayPoint = function () {
this.clearWayPointInterval();
this.intervalID = null;
this.pathIndex++;
if (this.pathIndex == this.path.length) {
this.pathIndex = 0;
}
this.setupPath();
};
Drinker.prototype.doLoop = function () {
this.oldXtile = this.x;
this.oldYtile = this.y;
this.changeDir(this.xDir, this.yDir);
if (this.checkPlayerCollisions()) {
if (this.path != null) {
if (this.intervalID == null) {
if (this.xDir == -1) {
if (this.x <= this.targetSqX) {
this.x == this.targetSqX;
if (this.path[this.pathIndex][2]) {
this.calcHesitation();
} else {
this.nextWayPoint();
}
}
} else if (this.xDir == 1) {
if (this.x >= this.targetSqX) {
this.x == this.targetSqX;
if (this.path[this.pathIndex][2]) {
this.calcHesitation();
} else {
this.nextWayPoint();
}
}
} else if (this.yDir == -1) {
if (this.y <= this.targetSqY) {
this.y == this.targetSqY;
if (this.path[this.pathIndex][2]) {
this.calcHesitation();
} else {
this.nextWayPoint();
}
}
} else if (this.yDir == 1) {
if (this.y >= this.targetSqY) {
this.y == this.targetSqY;
if (this.path[this.pathIndex][2]) {
this.calcHesitation();
} else {
this.nextWayPoint();
}
}
}
}
this.doMove(false);
}
}
};
Drinker.prototype.postLoop = function () {
};
Drinker.prototype.invertXdir = function () {
this.xDir = this.xDir * -1;
};
Drinker.prototype.invertYdir = function () {
this.yDir = this.yDir * -1;
};
MenuObj.prototype.initClip = function (theRef, foodType, theItems) {
this.callBack = theRef;
this.currentType = foodType;
this.orderedItems = theItems;
if (this.clip.getDepth() != 510100) {
this.clip.swapDepths(510100);
}
this.clip.gotoAndStop(2);
this.clip.close_mc.callBack = this;
this.clip.close_mc.onRelease = function () {
this.callBack.closeMenu();
};
_root.debug(200);
this.renderTrayItems();
var tArr = this[foodType];
this.clip.location_mc.gotoAndStop(foodType);
var itemSpacing = 3;
var startX = -2;
var tDepth = 50;
var i = 0;
while (i < tArr.length) {
this.clip.menuItemHolder_mc.attachMovie("menuItem", tArr[i] + "_mc", tDepth++);
var tClip = this.clip.menuItemHolder_mc[tArr[i] + "_mc"];
tClip.labeltxt = tArr[i];
tClip.label_tf.text = "<< " + tClip.labeltxt;
tClip.onRelease = function () {
_global.objs.game.objs.theMenu.pickItem(this.labeltxt);
trace("clicked the menu button");
};
tClip.onRollOver = function () {
this.rollover_mc.gotoAndPlay(2);
this.oldTfCol = this.label_tf.textColor;
this.label_tf.textColor = 0;
};
tClip.onRollOut = (tClip.onReleaseOutside = function () {
this.label_tf.textColor = this.oldTfCol;
});
_root.debug(200);
if (this.currentType != "food") {
tClip.info_mc._visible = false;
} else {
this.clip.menuItemHolder_mc.attachMovie("info_button", ("info_" + i) + "_mc", tDepth++, {_x:163, _y:startX + 5});
var infoMc = this.clip.menuItemHolder_mc[("info_" + i) + "_mc"];
infoMc.onRelease = function () {
return(false);
};
infoMc._label = this.foodInfo[i];
}
tClip._y = startX;
startX = startX + (12 + itemSpacing);
i++;
}
};
MenuObj.prototype.cleanUp = function () {
this.closeMenu();
};
MenuObj.prototype.initTrayBuild = function () {
this.trayBuild = {itemSpacing:10, startX:0, depth:0};
};
MenuObj.prototype.renderTrayItems = function () {
this.initTrayBuild();
this.clearTrayItems();
this.buildTrayItems();
};
MenuObj.prototype.clearTrayItems = function () {
for (var i in this.trayItemClips) {
this.trayItemClips[i].removeMovieClip();
}
this.trayItemClips = [];
};
MenuObj.prototype.buildTrayItems = function () {
this.initTrayBuild();
var itemSpacing = 3;
var startX = -2;
var tDepth = 0;
var i = 0;
while (i < this.orderedItems.length) {
this.clip.trayItemHolder_mc.attachMovie("menuTrayItem", ("menuTray_" + i) + "_mc", tDepth++);
var tClip = this.clip.trayItemHolder_mc[("menuTray_" + i) + "_mc"];
tClip.labeltxt = this.orderedItems[i][0];
tClip.label_tf.text = ">> " + tClip.labeltxt;
tClip.itemIndex = i;
this.trayItemClips.push(tClip);
tClip.onRelease = function () {
_root.debug(5000);
_global.objs.game.objs.theMenu.removeTrayItem(this.itemIndex);
};
tClip.onRollOver = function () {
this.rollover_mc.gotoAndPlay(2);
this.oldTfCol = this.label_tf.textColor;
this.label_tf.textColor = 0;
};
tClip.onRollOut = (tClip.onReleaseOutside = function () {
this.label_tf.textColor = this.oldTfCol;
});
tClip._y = startX;
startX = startX + (12 + itemSpacing);
i++;
}
};
MenuObj.prototype.removeTrayItem = function (theIndex) {
_global.objs.game.doNegScore();
this.orderedItems.splice(theIndex, 1);
this.renderTrayItems();
_global.objs.game.objs.sound.playANeg();
};
MenuObj.prototype.pickItem = function (theItem) {
if (this.orderedItems.length < _global.trayItemLimit) {
this.orderedItems.push([theItem, this.currentType]);
this.renderTrayItems();
}
if (this.orderedItems.length >= _global.trayItemLimit) {
}
};
MenuObj.prototype.closeMenu = function () {
this.callBack.menuClosed(this.orderedItems);
this.clip.gotoAndStop(1);
};
MenuObj.prototype.pickARandomFood = function () {
return(this.food[_global.fn.randomRange(0, this.food.length - 1)]);
};
MenuObj.prototype.pickARandomDrink = function () {
return(this.drink[_global.fn.randomRange(0, this.drink.length - 1)]);
};
Tray.prototype.setItems = function (theItems) {
_root.debug(50);
this.container = theItems;
this.holding = true;
this.setTrayItems();
};
Tray.prototype.getItems = function () {
return(this.container);
};
Tray.prototype.removeItems = function () {
_root.debug(50);
var tObj = this.container;
this.container = {};
this.holding = false;
this.setTrayItems();
return(tObj);
};
Tray.prototype.setClip = function (theClip) {
this.clip = theClip;
this.setTrayItems();
};
Tray.prototype.setTrayItems = function () {
var glassPass = false;
var platePass = false;
for (var i in this.container) {
if (this.container[i][1] == "drink") {
glassPass = true;
} else if (this.container[i][1] == "food") {
platePass = true;
}
}
if (platePass == true) {
this.clip.plate_mc._visible = true;
} else {
this.clip.plate_mc._visible = false;
}
if (glassPass == true) {
this.clip.glass_mc._visible = true;
} else {
this.clip.glass_mc._visible = false;
}
};
Tray.prototype.markCurrentItemForRemoval = function () {
this.itemsToRemove.push(this.container[this.itemIndex - 1]);
};
Tray.prototype.getNextItem = function () {
_root.debug(50);
if (this.itemIndex < this.container.length) {
var tItem = this.container[this.itemIndex][0];
this.itemIndex++;
return(tItem);
}
var i = 0;
while (i < this.itemsToRemove.length) {
var j = 0;
while (j < this.container.length) {
if (this.container[j] == this.itemsToRemove[i]) {
this.container.splice(j, 1);
j--;
break;
}
j++;
}
i++;
}
this.itemsToRemove = [];
this.itemIndex = 0;
this.setTrayItems();
return(false);
};
Tray.prototype.isFull = function () {
return(this.holding);
};
Hint.prototype.setupHints = function () {
this.hints.startGame = ["walk to the table until it highlights and press the space bar", false];
this.hints.openKitchenMenu = ["press the spacebar to open the food menu", false];
this.hints.firstTableVisit = ["press the spacebar to take the customers order", false];
this.hints.afterFirstOrder = ["now go to the bar to collect the drinks", false];
this.hints.afterFirstFoodOrder = ["now go to the kitchen to collect the food", false];
this.hints.openBarMenu = ["press the spacebar to open the drinks menu", false];
this.hints.clearGlasses = ["walk to the table & press the spacebar to clear it", false];
};
Hint.prototype.cleanUp = function () {
this.cancelInterval();
};
Hint.prototype.displayHint = function (theHint) {
if (!this.hints[theHint][1]) {
this.removeHint(false);
this.clip.hint = new String(this.hints[theHint][0]).toUpperCase();
this.clip.gotoAndPlay(2);
this.hints[theHint][1] = true;
this.hintRemoveID = setInterval(this, "removeHint", 6000);
}
};
Hint.prototype.removeHint = function (tPlay) {
if (tPlay == undefined) {
this.clip.play();
}
this.cancelInterval();
};
Hint.prototype.cancelInterval = function () {
clearInterval(this.hintRemoveID);
};
soundObject.prototype.doLoop = function () {
var t = getTimer();
for (var i in this.fadeList) {
if (this.fadeSound(this.fadeList[i])) {
delete this.fadeList[i];
}
}
if (this.fallPlaying) {
if (this.sounds.fall.getVolume() == 0) {
this.fallPlaying = false;
this.stop_sound("fall");
}
}
};
soundObject.prototype.setupSounds = function () {
var sound_array = new Array("instructionsMusic", "music", "positive", "negative");
var i = 0;
while (i < sound_array.length) {
var thelink = sound_array[i];
this.sounds[thelink] = new Sound(this.soundHolder[theLink]);
this.sounds[thelink].attachSound(thelink);
trace(">>>>>>>> sound duration is " + this.sounds[thelink].duration);
i++;
}
};
soundObject.prototype.cleanUp = function () {
};
soundObject.prototype.play_sound = function (linkname, loop) {
if (this.playFlag) {
if (loop == undefined) {
loop = 0;
}
this.sounds[linkname].start(0, loop);
}
};
soundObject.prototype.stop_sound = function (linkname) {
if (this.playFlag) {
this.sounds[linkname].stop(linkname);
}
};
soundObject.prototype.setNewVolume = function (theVol_num, linkname) {
if (linkname == undefined) {
for (var i in this.sounds) {
trace("set volume " + theVol_num);
this.sounds[i].setVolume(theVol_num);
}
} else {
this.sounds[linkname].setVolume(theVol_num);
}
};
soundObject.prototype.fadeSound = function (obj) {
obj.curVol = obj.curVol + obj.volInc;
if (obj.volInc < 0) {
if (obj.curVol <= obj.fadeTo) {
this.setNewVolume(obj.fadeTo, obj.linkName);
obj = null;
return(true);
}
this.setNewVolume(obj.curVol, obj.linkName);
return(false);
}
if (obj.volInc > 0) {
if (obj.curVol >= obj.fadeTo) {
this.setNewVolume(obj.fadeTo, obj.linkName);
obj = null;
return(true);
}
this.setNewVolume(obj.curVol, obj.linkName);
return(false);
}
obj = null;
return(true);
};
soundObject.prototype.setSoundState = function (flag) {
this.playFlag = flag;
if (this.playFlag) {
this.setNewVolume(100);
} else {
this.setNewVolume(0);
}
};
soundObject.prototype.playInstructionsMusic = function () {
this.play_sound("instructionsMusic", 9999);
};
soundObject.prototype.fadeInInstructionsMusic = function () {
this.setNewVolume(0, "instructionsMusic");
this.setupAfade("instructionsMusic", 100, 4);
this.playInstructionsMusic();
};
soundObject.prototype.fadeOutInstructionsMusic = function () {
this.setupAfade("instructionsMusic", 0, -4);
};
soundObject.prototype.playMusic = function () {
this.play_sound("music", 9999);
};
soundObject.prototype.fadeInMusic = function () {
this.setNewVolume(0, "music");
this.setupAfade("music", 100, 4);
this.playMusic();
};
soundObject.prototype.fadeOutMusic = function () {
this.setupAfade("music", 0, -4);
};
soundObject.prototype.fadeOutAllSounds = function () {
for (var i in this.sounds) {
this.setupAfade(i, 0, -25);
}
};
soundObject.prototype.setupAfade = function (linkName, fadeTo, inc) {
this.fadeList[linkName] = {linkName:linkName, curVol:this.sounds[linkName].getVolume(), volInc:inc, fadeTo:fadeTo};
};
soundObject.prototype.playAPos = function () {
this.setNewVolume(50, "positive");
this.play_sound("positive");
};
soundObject.prototype.playANeg = function () {
this.setNewVolume(30, "negative");
this.play_sound("negative");
};
Conversation.prototype.setCallBack = function (tCB) {
this.callBack = tCB;
};
Conversation.prototype.addSentence = function (theText) {
this.speech.push(theText);
};
Conversation.prototype.clearSentences = function () {
this.speechIndex = 0;
this.speech = [];
};
Conversation.prototype.getNextSentence = function () {
if (this.speechIndex == this.speech.length) {
return(false);
}
var tRet = this.speech[this.speechIndex];
this.speechIndex++;
return(tRet);
};
Conversation.prototype.pausePlayer = function () {
this.callBack.playerRef.pause();
};
Conversation.prototype.conversationFinished = function () {
this.clearSentences();
this.callback.conversationFinished();
};
Conversation.prototype.getActive = function () {
return(this.speechBubble.getActive());
};
Conversation.prototype.attatchClip = function (parentClip) {
this.speechBubble.attatchClip(parentClip);
};
Conversation.prototype.activate = function (pausePlayer, blocking) {
this.speechBubble.activate(pausePlayer, blocking);
};
Conversation.prototype.deActivate = function (pausePlayer) {
this.speechBubble.deActivate();
};
SpeechBubble.prototype.attatchClip = function (parentClip) {
var tDepth = (_global.nextAttachDepth++);
var tName = ("bubble_" + tDepth);
parentClip.attachMovie("speechBubble", tName, tDepth);
this.clip = parentClip[tName];
this.clip.speech_tf.autoSize = "center";
this.clip.speech_tf.multiline = true;
this.clip.speech_tf.wordWrap = true;
this.clip._visible = false;
this.clip.cb = this;
this.clip.onRelease = function () {
this.cb.doOnRelease();
};
};
SpeechBubble.prototype.doOnRelease = function () {
clearInterval(this.nextSentenceIntID);
this.nextSentenceIntID = setInterval(this, "doOnRelease", 3000);
if (this.setText()) {
} else {
this.deactivate();
}
};
SpeechBubble.prototype.activate = function (pausePlayer, blocking) {
this.active = blocking;
this.clip._visible = true;
if (pausePlayer) {
this.conversationRef.pausePlayer();
}
this.setText();
this.nextSentenceIntID = setInterval(this, "doOnRelease", 6000);
};
SpeechBubble.prototype.deactivate = function () {
this.clip._visible = false;
this.active = false;
clearInterval(this.nextSentenceIntID);
this.conversationRef.conversationFinished();
};
SpeechBubble.prototype.getActive = function () {
return(this.active);
};
SpeechBubble.prototype.destroy = function () {
this.clip.removeMovieClip();
};
SpeechBubble.prototype.setText = function () {
var sentence = this.conversationRef.getNextSentence();
if (sentence != false) {
this.clip.speech_tf.htmlText = new String(sentence).toUpperCase();
this.resizeClip();
return(true);
}
return(false);
};
SpeechBubble.prototype.resizeClip = function () {
var overLap = (this.clip.top_mc._height - 6);
var tfHeight = 16;
var tfOffset = (this.clip.speech_tf._y - this.clip.top_mc._y);
this.clip.middle_mc._height = Math.max(1, this.clip.speech_tf._height - int(overLap * 2));
this.clip.middle_mc._y = this.clip.bottom_mc._y - this.clip.middle_mc._height;
this.clip.top_mc._y = this.clip.middle_mc._y - this.clip.top_mc._height;
this.clip.speech_tf._y = int(this.clip.top_mc._y + tfOffset);
};
ObjTile.prototype.doHilite = function () {
this.setHiliteVisible(true);
_global.objs.game.hiliteTile = this;
};
ObjTile.prototype.undoHilite = function () {
this.setHiliteVisible(false);
};
_global.fn = {};
_global.fn.setupGame = function () {
_global.objs = {};
_global.objs.game = new Game();
_global.objs.game.config();
};
_global.fn.randomRange = function (from, to) {
return(Math.round(Math.random() * (to - from)) + from);
};
_global.fn.workOutObjBounds = function (tObj, useSpeed) {
var tBottom = (tObj.y + tObj.height);
var tLeft = tObj.x;
var tTop = tObj.y;
var tRight = (tObj.x + tObj.width);
if (useSpeed) {
tLeft = tLeft + (tObj.speed * tObj.xDir);
tBottom = tBottom + (tObj.speed * tObj.yDir);
tTop = tTop + (tObj.speed * tObj.yDir);
tRight = tRight + (tObj.speed * tObj.xDir);
}
return({l:tLeft, t:tTop, r:tRight, b:tBottom});
};
_global.fn.rectangularCollision = function (rect1, rect2) {
if ((rect1.l < rect2.r) && (rect1.r > rect2.l)) {
if ((rect1.t < rect2.b) && (rect1.b > rect2.t)) {
return(false);
}
return(true);
}
return(true);
};
bgButton_mc.onRelease = function () {
return(false);
};
bgButton_mc.useHandCursor = false;
_global.depths = [];
_global.dNames = [];
_global.tl = this;
_global.fn.setupGame();
stop();
Instance of Symbol 3 MovieClip [empty] "controller" in Frame 9
/* no clip actions */
Instance of Symbol 712 MovieClip "topLight_mc" in Frame 9
onClipEvent (load) {
this.swapDepths(500000);
}
Instance of Symbol 721 MovieClip "mute_mc" in Frame 9
onClipEvent (load) {
this.setup = function () {
this.state = _root.soundPlayFlag;
if (this.state) {
this.gotoAndStop("play");
} else {
this.gotoAndStop("mute");
}
};
this.onRelease = function () {
this.state = !this.state;
_root.soundPlayFlag = this.state;
if (this.state) {
this.gotoAndStop("play");
} else {
this.gotoAndStop("mute");
}
_global.objs.game.objs.sound.setSoundState(this.state);
};
this.setup();
}
Instance of Symbol 727 MovieClip "soundHolder_mc" in Frame 9
onClipEvent (enterFrame) {
_global.objs.game.objs.sound.doLoop();
}
Symbol 9 Button
on (release) {
getURL ("http://www.hahaonline.co.uk", "_blank");
}
Symbol 17 MovieClip Frame 1
stop();
Symbol 59 MovieClip Frame 1
stop();
Symbol 68 MovieClip Frame 1
stop();
Symbol 69 MovieClip Frame 1
stop();
Symbol 69 MovieClip Frame 2
trace("mood clips mood is " + this.mood);
this.mood_mc.gotoAndStop(this.mood);
Symbol 168 MovieClip Frame 1
stop();
Symbol 168 MovieClip Frame 100
stop();
Symbol 174 MovieClip Frame 1
stop();
Symbol 174 MovieClip Frame 2
play();
Symbol 174 MovieClip Frame 50
stop();
Symbol 177 MovieClip Frame 1
stop();
Symbol 177 MovieClip Frame 2
play();
Symbol 177 MovieClip Frame 50
stop();
Symbol 180 MovieClip Frame 1
stop();
Symbol 180 MovieClip Frame 2
play();
Symbol 180 MovieClip Frame 50
stop();
Symbol 183 MovieClip Frame 1
stop();
Symbol 183 MovieClip Frame 2
play();
Symbol 183 MovieClip Frame 50
stop();
Symbol 186 MovieClip Frame 1
stop();
Symbol 186 MovieClip Frame 2
play();
Symbol 186 MovieClip Frame 50
stop();
Symbol 187 MovieClip Frame 1
stop();
Symbol 198 MovieClip Frame 1
stop();
Symbol 198 MovieClip Frame 2
play();
Symbol 198 MovieClip Frame 50
stop();
Symbol 201 MovieClip Frame 1
stop();
Symbol 201 MovieClip Frame 2
play();
Symbol 201 MovieClip Frame 50
stop();
Symbol 204 MovieClip Frame 1
stop();
Symbol 204 MovieClip Frame 2
play();
Symbol 204 MovieClip Frame 50
stop();
Symbol 211 MovieClip Frame 1
stop();
Symbol 211 MovieClip Frame 2
play();
Symbol 211 MovieClip Frame 50
stop();
Symbol 218 MovieClip Frame 1
stop();
Symbol 218 MovieClip Frame 2
play();
Symbol 218 MovieClip Frame 50
stop();
Symbol 219 MovieClip Frame 1
stop();
Symbol 293 MovieClip Frame 1
stop();
Symbol 301 MovieClip Frame 1
stop();
Symbol 320 MovieClip Frame 16
gotoAndPlay (1);
Symbol 324 MovieClip Frame 1
stop();
Symbol 334 MovieClip Frame 16
gotoAndPlay (1);
Symbol 335 MovieClip [drinker2] Frame 1
stop();
Symbol 345 MovieClip Frame 16
gotoAndPlay (1);
Symbol 355 MovieClip Frame 16
gotoAndPlay (1);
Symbol 356 MovieClip [drinker3] Frame 1
stop();
Symbol 366 MovieClip Frame 16
gotoAndPlay (1);
Symbol 377 MovieClip Frame 16
gotoAndPlay (1);
Symbol 378 MovieClip [drinker] Frame 1
stop();
Symbol 381 MovieClip Frame 1
stop();
Symbol 381 MovieClip Frame 2
play();
Symbol 393 MovieClip [speechBubble] Frame 1
stop();
Symbol 399 MovieClip Frame 16
gotoAndPlay (1);
Symbol 406 MovieClip Frame 16
gotoAndPlay (1);
Symbol 407 MovieClip [barman] Frame 1
stop();
Symbol 413 MovieClip Frame 16
gotoAndPlay (1);
Symbol 419 MovieClip Frame 16
gotoAndPlay (1);
Symbol 422 MovieClip Frame 1
if (_parent.runAni == undefined) {
_parent.char_mc._visible = false;
this.char_mc.stop();
_global.objs.game.objs.player.pause();
} else {
this._visible = false;
stop();
}
Symbol 422 MovieClip Frame 60
_parent.char_mc._visible = true;
this._visible = false;
_parent.runAni = true;
_global.objs.game.objs.player.resume();
stop();
Symbol 423 MovieClip [char] Frame 1
stop();
Symbol 429 MovieClip Frame 16
gotoAndPlay (1);
Symbol 436 MovieClip Frame 16
gotoAndPlay (1);
Symbol 437 MovieClip [chef] Frame 1
stop();
Symbol 438 MovieClip [drinker1] Frame 1
stop();
Symbol 446 MovieClip Frame 16
gotoAndPlay (1);
Symbol 452 MovieClip Frame 16
gotoAndPlay (1);
Symbol 453 MovieClip Frame 1
if (_parent.runAni == undefined) {
_parent.char_mc._visible = false;
this.char_mc.stop();
_global.objs.game.objs.player.pause();
} else {
this._visible = false;
stop();
}
Symbol 453 MovieClip Frame 60
_parent.char_mc._visible = true;
this._visible = false;
_parent.runAni = true;
_global.objs.game.objs.player.resume();
stop();
Symbol 454 MovieClip [chargirl] Frame 1
stop();
Symbol 465 MovieClip Frame 16
gotoAndPlay (1);
Symbol 476 MovieClip Frame 16
gotoAndPlay (1);
Symbol 477 MovieClip [drinker4] Frame 1
stop();
Symbol 488 MovieClip Frame 16
gotoAndPlay (1);
Symbol 499 MovieClip Frame 16
gotoAndPlay (1);
Symbol 500 MovieClip [drinker5] Frame 1
stop();
Symbol 511 MovieClip Frame 16
gotoAndPlay (1);
Symbol 522 MovieClip Frame 16
gotoAndPlay (1);
Symbol 523 MovieClip [drinker6] Frame 1
stop();
Symbol 535 MovieClip [info_button] Frame 1
stop();
Symbol 543 MovieClip Frame 15
stop();
Symbol 544 MovieClip Frame 1
stop();
Symbol 547 Button
on (release) {
getURL ("http://www.hahaonline.co.uk/game-tc.asp", "_blank");
}
Symbol 555 MovieClip Frame 1
stop();
Symbol 575 MovieClip Frame 1
this.loader = new LoadVars();
this.loader.cb = this;
this.loader.onLoad = function (success) {
if (success) {
for (var i in this) {
this.cb[i] = this[i];
}
this.cb.gotoAndStop("scores");
} else {
trace("failed to load");
}
};
if (_root._url.indexOf("file://") == -1) {
var cb = ("?cb=" + Math.round(Math.random() * 100000));
this.loader.load((_global.hahaURL + "returnScores.asp") + cb);
} else {
var cb = ("?cb=" + Math.round(Math.random() * 100000));
this.loader.load((_global.hahaURL + "returnScores.asp") + cb);
}
stop();
Symbol 575 MovieClip Frame 10
var i = 1;
while (i <= 10) {
if (this["character" + i] == "boy") {
this[("head" + i) + "_mc"].gotoAndStop("boy");
} else {
this[("head" + i) + "_mc"].gotoAndStop("girl");
}
i++;
}
stop();
Symbol 580 MovieClip Frame 1
stop();
Symbol 598 MovieClip Frame 51
stop();
Symbol 613 MovieClip Frame 1
stop();
Symbol 614 MovieClip Frame 1
continue_mc.label = "play";
continue_mc.onRelease = function () {
_root.gotoAndStop("char_select");
};
_currentpage = 1;
prevPage = function () {
_currentPage = Math.max(1, _currentpage - 1);
buttonVisibility();
setFrame();
};
nextPage = function () {
_currentPage = Math.min(content_mc._totalframes, _currentpage + 1);
buttonVisibility();
setFrame();
};
buttonVisibility = function () {
if (_currentpage != 1) {
prev_mc._visible = true;
} else {
prev_mc._visible = false;
}
if (_currentpage != content_mc._totalframes) {
next_mc._visible = true;
} else {
next_mc._visible = false;
}
};
setFrame = function () {
content_mc.gotoAndStop(_currentPage);
};
prev_mc.onRelease = function () {
prevPage();
};
next_mc.onRelease = function () {
nextPage();
};
buttonVisibility();
stop();
Symbol 621 MovieClip Frame 1
stop();
Symbol 622 MovieClip Frame 1
_root.charLink = "char";
boy_mc.onRelease = function () {
highlight_mc.gotoAndStop(1);
_root.charLink = "char";
};
girl_mc.onRelease = function () {
highlight_mc.gotoAndStop(2);
_root.charLink = "chargirl";
};
stop();
Symbol 624 MovieClip Frame 1
start_mc.label = "start";
start_mc.onRelease = function () {
trace("fire");
this.onRelease = null;
_root.gotoAndStop("init");
};
stop();
Symbol 627 MovieClip Frame 1
stop();
Symbol 627 MovieClip Frame 37
stop();
Symbol 634 MovieClip Frame 1
stop();
Symbol 640 MovieClip Frame 1
stop();
Symbol 641 MovieClip Frame 1
stop();
Symbol 653 MovieClip Frame 1
stop();
Symbol 676 MovieClip Frame 1
stop();
Symbol 681 MovieClip Frame 1
cancel_mc.label = "cancel";
submit_mc.label = "submit";
cancel_mc.onRelease = function () {
this._parent._parent.gotoAndPlay("out");
};
submit_mc.onRelease = function () {
this.friendLoad = new LoadVars();
var pass = false;
var tfv = ["friend_1", "friend_2", "friend_3", "friend_4", "friend_5"];
var friendCount = 1;
var i = 0;
while (i < tfv.length) {
var val = this._parent[tfv[i]];
if (((val.indexOf("@") != -1) && (val != "")) && (val != undefined)) {
this.friendLoad["friend_" + (friendCount++)] = val;
pass = true;
}
i++;
}
trace(fromFriend);
if ((fromFriend != "") && (fromFriend != undefined)) {
this.friendLoad.fromFriend = fromFriend;
} else {
this.friendLoad.fromFriend = "Ha! Ha! Bar & Canteen";
}
this._parent._parent.gotoAndPlay("out");
this.friendLoad.onLoad = function () {
trace("loaded send to a friend");
};
if (pass) {
var cb = ("?cb=" + Math.round(Math.random() * 100000));
var tUrl = (_global.hahaURL + "emailFriend.asp");
this.friendLoad.sendAndLoad(tUrl, this.friendLoad, "POST");
this._parent.gotoAndStop("submit");
}
};
stop();
Symbol 681 MovieClip Frame 2
stop();
Symbol 682 MovieClip Frame 1
stop();
Symbol 682 MovieClip Frame 10
stop();
Symbol 682 MovieClip Frame 20
stop();
Symbol 687 MovieClip Frame 1
stop();
Symbol 688 MovieClip Frame 1
gameOverMask_mc._visible = false;
sendToFriend_mc.label = "send to friends >>";
viewMenu_mc.label = "view xmas menu >>";
viewMenu_mc.onRelease = function () {
getURL ("http://www.hahaonline.co.uk/pdf/haha_xmas.pdf", "_blank");
};
statusPannel_mc.big_mc.gotoAndStop(_root.charLink);
sendToFriend_mc.onRelease = function () {
trace(send_mc);
send_mc.gotoAndPlay(2);
};
Symbol 700 MovieClip Frame 1
stop();
Symbol 700 MovieClip Frame 10
submitBut_mc.label = "submit";
submitBut_mc.onRelease = function () {
if (emailAddress.indexOf("@") != -1) {
sendScore(emailAddress);
} else {
trace("invalid email address");
}
};
this.scoreSubmit = new LoadVars();
this.scoreSubmit.onLoad = function () {
trace("doneLoading score");
};
this.scoreSubmit.playerName = _root.name;
this.scoreSubmit.score = _root.finalScore;
this.sendScore = function (tEmail) {
var cb = ("?cb=" + Math.round(Math.random() * 10000));
var url = ((_global.hahaURL + "insertScore.asp") + cb);
this.scoreSubmit.email = tEmail.toLowerCase();
if (_root.charLink == "char") {
this.scoreSubmit.character = "boy";
} else {
this.scoreSubmit.character = "girl";
}
this.scoreSubmit.sendAndLoad(url, this.scoreSubmit, "POST");
this.gotoAndStop("submit");
};
stop();
Symbol 700 MovieClip Frame 18
stop();
Symbol 701 MovieClip Frame 1
stop();
Symbol 701 MovieClip Frame 4
big_mc.gotoAndStop(_root.charLink);
_root.gameOver_mc.oldDepth = _root.gameOver_mc.getDepth();
this.loader = new LoadVars();
this.loader.cb = this;
this.loader.onLoad = function (success) {
if (success) {
_root.minScore = Number(this.minScore);
this.cb.gotoAndStop("result");
} else {
_root.minScore = null;
}
};
trace(_root.URL);
var url = (_global.hahaURL + "minScore.asp");
var cb = ("?cb=" + Math.round(Math.random() * 10000));
if (_root._url.indexOf("file://") == -1) {
url = url + cb;
this.loader.load(url);
} else {
url = url + cb;
this.loader.load(url);
}
stop();
Symbol 701 MovieClip Frame 10
sat_mc.gotoAndStop(_root.satFrame);
restart_mc.label = "play again";
restart_mc.onRelease = function () {
_root.topLight_mc.swapDepths(_root.topLight_mc.oldDepth);
_root.topLight_mc.removeMovieClip();
_root.tiles.removeMovieClip();
_root.gameOver_mc.swapDepths(_root.gameOver_mc.oldDepth);
_root.frontPannel_mc.swapDepths(_root.frontPannel_mc.oldDepth);
_root.frontPannel_mc.removeMovieClip();
_root.gotoAndStop("startScreen");
_root.gameOver_mc.removeMovieClip();
};
if (_root.score > _root.minScore) {
submit_mc.gotoAndStop("highscore");
}
stop();
Instance of Symbol 712 MovieClip in Symbol 713 MovieClip Frame 1
onClipEvent (load) {
this.swapDepths(1E16);
}
Symbol 721 MovieClip Frame 1
stop();