Section 1
//arrowmc_129 (cakemania_fla.arrowmc_129)
package cakemania_fla {
import flash.display.*;
public dynamic class arrowmc_129 extends MovieClip {
public function arrowmc_129(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package cakemania_fla
Section 2
//begin_screen_textmc_133 (cakemania_fla.begin_screen_textmc_133)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class begin_screen_textmc_133 extends MovieClip {
public var baker_goal_txt:TextField;
public var level_starts_txt:TextField;
public var beginscreen_text1:TextField;
public var text_month:TextField;
}
}//package cakemania_fla
Section 3
//btn_116 (cakemania_fla.btn_116)
package cakemania_fla {
import flash.display.*;
public dynamic class btn_116 extends MovieClip {
public function btn_116(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package cakemania_fla
Section 4
//btn_ljud_2 (cakemania_fla.btn_ljud_2)
package cakemania_fla {
import flash.display.*;
public dynamic class btn_ljud_2 extends MovieClip {
public function btn_ljud_2(){
addFrameScript(0, frame1, 4, frame5);
}
function frame1(){
stop();
}
function frame5(){
stop();
}
}
}//package cakemania_fla
Section 5
//button_down_109 (cakemania_fla.button_down_109)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class button_down_109 extends MovieClip {
public var button_text:TextField;
}
}//package cakemania_fla
Section 6
//button_down_134 (cakemania_fla.button_down_134)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class button_down_134 extends MovieClip {
public var button_text:TextField;
}
}//package cakemania_fla
Section 7
//button_mc_110 (cakemania_fla.button_mc_110)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class button_mc_110 extends MovieClip {
public var button_text:TextField;
public function button_mc_110(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package cakemania_fla
Section 8
//button_up_135 (cakemania_fla.button_up_135)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class button_up_135 extends MovieClip {
public var button_text:TextField;
}
}//package cakemania_fla
Section 9
//calendar_shifting_66 (cakemania_fla.calendar_shifting_66)
package cakemania_fla {
import flash.display.*;
public dynamic class calendar_shifting_66 extends MovieClip {
public var paper_back:MovieClip;
public var paper_front:MovieClip;
public function calendar_shifting_66(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package cakemania_fla
Section 10
//calendarmc_65 (cakemania_fla.calendarmc_65)
package cakemania_fla {
import flash.display.*;
public dynamic class calendarmc_65 extends MovieClip {
public var timebar:MovieClip;
public var shifting:MovieClip;
}
}//package cakemania_fla
Section 11
//calendarpaper_68 (cakemania_fla.calendarpaper_68)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class calendarpaper_68 extends MovieClip {
public var CalendarTextMonth1:TextField;
public var CalendarTextDate1:TextField;
}
}//package cakemania_fla
Section 12
//calendarpaperstill_67 (cakemania_fla.calendarpaperstill_67)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class calendarpaperstill_67 extends MovieClip {
public var CalendarTextMonth2:TextField;
public var CalendarTextDate2:TextField;
}
}//package cakemania_fla
Section 13
//compcake_9 (cakemania_fla.compcake_9)
package cakemania_fla {
import flash.display.*;
import source.*;
public dynamic class compcake_9 extends MovieClip {
public var decoration_mc:Decoration;
public var frosting_mc:Frosting;
public var cake_mc:Cakes;
}
}//package cakemania_fla
Section 14
//coven_buttons_17 (cakemania_fla.coven_buttons_17)
package cakemania_fla {
import flash.display.*;
public dynamic class coven_buttons_17 extends MovieClip {
public var flower_mc:MovieClip;
public var leaf_mc:MovieClip;
public var heart_mc:MovieClip;
public var triangle_mc:MovieClip;
public var circle_mc:MovieClip;
public var moon_mc:MovieClip;
public var star_mc:MovieClip;
public var rect_mc:MovieClip;
public var fish_mc:MovieClip;
}
}//package cakemania_fla
Section 15
//decorationbuttons_36 (cakemania_fla.decorationbuttons_36)
package cakemania_fla {
import flash.display.*;
public dynamic class decorationbuttons_36 extends MovieClip {
public var cat_mc:MovieClip;
public var palm_mc:MovieClip;
public var mask_mc:MovieClip;
public var horseshoe_mc:MovieClip;
}
}//package cakemania_fla
Section 16
//Exit_4 (cakemania_fla.Exit_4)
package cakemania_fla {
import flash.display.*;
public dynamic class Exit_4 extends MovieClip {
public var Symbol_mc:MovieClip;
public var Text_mc:MovieClip;
}
}//package cakemania_fla
Section 17
//Exitgame_6 (cakemania_fla.Exitgame_6)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Exitgame_6 extends MovieClip {
public var exitGame:TextField;
}
}//package cakemania_fla
Section 18
//froster_buttons_59 (cakemania_fla.froster_buttons_59)
package cakemania_fla {
import flash.display.*;
public dynamic class froster_buttons_59 extends MovieClip {
public var brown_mc:Frost_choc;
public var yellow_mc:MovieClip;
public var violet_mc:Frost_violet;
public var white_mc:Frost_white;
public var prick_mc:Frost_dark_choc;
}
}//package cakemania_fla
Section 19
//froster_glow_off_123 (cakemania_fla.froster_glow_off_123)
package cakemania_fla {
import flash.display.*;
public dynamic class froster_glow_off_123 extends MovieClip {
public function froster_glow_off_123(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package cakemania_fla
Section 20
//frostermc_58 (cakemania_fla.frostermc_58)
package cakemania_fla {
import flash.display.*;
public dynamic class frostermc_58 extends MovieClip {
public var readyCircle_mc:ReadyCircle;
public var Marker2_mc:MovieClip;
public var button1:MovieClip;
public var button3:MovieClip;
public var button2:MovieClip;
public var button4:MovieClip;
public var Marker3_mc:MovieClip;
public var FrosterMachineBody:Froster_level0;
public var cream:MovieClip;
public var Marker5_mc:MovieClip;
public var Marker1_mc:MovieClip;
public var progressbar:MovieClip;
public var Marker4_mc:MovieClip;
public var cake_mc:MovieClip;
}
}//package cakemania_fla
Section 21
//HR_trash_hr_55 (cakemania_fla.HR_trash_hr_55)
package cakemania_fla {
import flash.display.*;
public dynamic class HR_trash_hr_55 extends MovieClip {
public var Marker1_mc:MovieClip;
}
}//package cakemania_fla
Section 22
//instruction_text_1_115 (cakemania_fla.instruction_text_1_115)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class instruction_text_1_115 extends MovieClip {
public var Instruction_text_long:TextField;
}
}//package cakemania_fla
Section 23
//instruction_text_2_114 (cakemania_fla.instruction_text_2_114)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class instruction_text_2_114 extends MovieClip {
public var Instruction_text_long:TextField;
}
}//package cakemania_fla
Section 24
//instruction_text_3_113 (cakemania_fla.instruction_text_3_113)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class instruction_text_3_113 extends MovieClip {
public var Instruction_text_long:TextField;
}
}//package cakemania_fla
Section 25
//instruction_text_4_112 (cakemania_fla.instruction_text_4_112)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class instruction_text_4_112 extends MovieClip {
public var Instruction_text_long:TextField;
}
}//package cakemania_fla
Section 26
//money_glow_off_126 (cakemania_fla.money_glow_off_126)
package cakemania_fla {
import flash.display.*;
public dynamic class money_glow_off_126 extends MovieClip {
public function money_glow_off_126(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package cakemania_fla
Section 27
//oven_glow_off_120 (cakemania_fla.oven_glow_off_120)
package cakemania_fla {
import flash.display.*;
public dynamic class oven_glow_off_120 extends MovieClip {
public function oven_glow_off_120(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package cakemania_fla
Section 28
//pratbubbla_glow_off_117 (cakemania_fla.pratbubbla_glow_off_117)
package cakemania_fla {
import flash.display.*;
public dynamic class pratbubbla_glow_off_117 extends MovieClip {
public function pratbubbla_glow_off_117(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package cakemania_fla
Section 29
//result_screenmc_98 (cakemania_fla.result_screenmc_98)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class result_screenmc_98 extends MovieClip {
public var success_txt:TextField;
public var failed_txt:TextField;
public var texts1_mc:MovieClip;
public var texts2_mc:MovieClip;
public var jill_mc:MovieClip;
}
}//package cakemania_fla
Section 30
//Sound_1 (cakemania_fla.Sound_1)
package cakemania_fla {
import flash.display.*;
public dynamic class Sound_1 extends MovieClip {
public var Symbol_mc:MovieClip;
public var Text_mc:MovieClip;
}
}//package cakemania_fla
Section 31
//soundon_3 (cakemania_fla.soundon_3)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class soundon_3 extends MovieClip {
public var soundOn:TextField;
public var soundOff:TextField;
public function soundon_3(){
addFrameScript(0, frame1, 4, frame5);
}
function frame1(){
stop();
}
function frame5(){
stop();
}
}
}//package cakemania_fla
Section 32
//text_menu_bar_mc_64 (cakemania_fla.text_menu_bar_mc_64)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class text_menu_bar_mc_64 extends MovieClip {
public var cash_sum_text:TextField;
public var baker_goal_sum_text:TextField;
public var cash_text:TextField;
public var baker_goal_text:TextField;
}
}//package cakemania_fla
Section 33
//text1mc_102 (cakemania_fla.text1mc_102)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class text1mc_102 extends MovieClip {
public var text6a:TextField;
public var text7a:TextField;
public var level_starts_txt:TextField;
public var text2b:TextField;
public var text2a:TextField;
public var text3a:TextField;
public var text3b:TextField;
public var text4a:TextField;
public var text1:TextField;
public var text4b:TextField;
public var text5b:TextField;
public var text5a:TextField;
public var text6b:TextField;
public var text7b:TextField;
public function text1mc_102(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package cakemania_fla
Section 34
//text2mc_101 (cakemania_fla.text2mc_101)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class text2mc_101 extends MovieClip {
public var text6a:TextField;
public var text7a:TextField;
public var text2b:TextField;
public var text2a:TextField;
public var text3a:TextField;
public var text3b:TextField;
public var text4a:TextField;
public var text1:TextField;
public var game_ends_in_txt:TextField;
public var text4b:TextField;
public var text5b:TextField;
public var text5a:TextField;
public var text6b:TextField;
public var text7b:TextField;
public function text2mc_101(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package cakemania_fla
Section 35
//the_sum_93 (cakemania_fla.the_sum_93)
package cakemania_fla {
import flash.display.*;
import flash.text.*;
public dynamic class the_sum_93 extends MovieClip {
public var sum1_txt:TextField;
public var sum2_txt:TextField;
public function the_sum_93(){
addFrameScript(1, frame2);
}
function frame2(){
stop();
}
}
}//package cakemania_fla
Section 36
//BakerGoal (com.king.cakemania.BakerGoal)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class BakerGoal extends BaseObject {
private var alphaValue:Number;
private var timerCounter:int;
public static var SHOW_TIME_FRAMES:int = 50;
function BakerGoal(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Function, _arg6:Counter){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
timerCounter = SHOW_TIME_FRAMES;
alphaValue = 1;
}
override protected function createClip():void{
clip = new baker_goal();
clip.scaleX = 0.75;
clip.scaleY = 0.75;
clip.x = posX;
clip.y = posY;
clip.baker_goal_reached.text = TextProperties.GOAL_REACHED;
parentClip.addChild(clip);
}
override public function render(_arg1:Number){
super.render(_arg1);
clip.alpha = alphaValue;
}
override public function tick(){
super.tick();
timerCounter--;
if (timerCounter <= 1){
visible = false;
toBeRemoved = true;
};
if (timerCounter <= 10){
alphaValue = (timerCounter / 10);
};
}
}
}//package com.king.cakemania
Section 37
//BaseObject (com.king.cakemania.BaseObject)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class BaseObject {
public var posX:Number;
public var posY:Number;
public var collisionObject:CollisionObject;// = null
protected var parentClip:MovieClip;
protected var oldRenderAngle:Number;
public var instanceNr:int;
protected var oldRenderPosX:Number;
protected var oldRenderPosY:Number;
public var clip:MovieClip;
public var angle:Number;
protected var newObjects:Array;
protected var collisionObjectOffsetY:int;
protected var collisionObjectOffsetX:int;
protected var animFrame:Number;
public var collidable:Boolean;
public var toBeRemoved:Boolean;
public var visible:Boolean;
protected var messageCallback:Function;
private var counter:Counter;
function BaseObject(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Function, _arg6:Counter){
collisionObject = null;
super();
this.parentClip = _arg1;
this.newObjects = _arg4;
this.messageCallback = _arg5;
this.counter = _arg6;
collisionObjectOffsetX = 0;
collisionObjectOffsetY = 0;
initialize(_arg2, _arg3);
createClip();
createCollisionObject();
instanceNr = _arg6.nr;
_arg6.nr++;
}
protected function initialize(_arg1:Number, _arg2:Number){
this.posX = _arg1;
this.posY = _arg2;
angle = 0;
animFrame = 1;
visible = true;
collidable = true;
toBeRemoved = false;
}
public function render(_arg1:Number){
if (((((!((posX == oldRenderPosX))) || (!((posY == oldRenderPosY))))) || (!((angle == oldRenderAngle))))){
clip.x = posX;
clip.y = posY;
clip.rotation = angle;
};
clip.gotoAndStop(animFrame);
if (visible){
clip.visible = true;
} else {
clip.visible = false;
};
oldRenderPosX = posX;
oldRenderPosY = posY;
oldRenderAngle = angle;
if (collisionObject){
collisionObject.render();
};
}
public function tick(){
if (collisionObject != null){
collisionObject.setPos((posX + collisionObjectOffsetX), (posY + collisionObjectOffsetY));
};
}
public function setToBeRemoved(){
visible = false;
collidable = false;
toBeRemoved = true;
}
public function setPosition(_arg1:Number, _arg2:Number){
this.posX = _arg1;
this.posY = _arg2;
}
public function deleting(){
parentClip.removeChild(clip);
clip = null;
if (collisionObject){
collisionObject.deleteClip();
};
collisionObject = null;
}
public function collisionTest(_arg1:BaseObject):Boolean{
if (((((((!((collisionObject == null))) && (!((_arg1.collisionObject == null))))) && (collidable))) && (_arg1.collidable))){
if (collisionObject.collisionTest(_arg1.collisionObject)){
return (true);
};
};
return (false);
}
protected function createClip():void{
clip = null;
}
protected function createCollisionObject():void{
collisionObject = null;
}
public function collisionReaction(_arg1:BaseObject){
}
}
}//package com.king.cakemania
Section 38
//Bubble (com.king.cakemania.Bubble)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class Bubble extends BaseObject {
private var waiterFrostingType:int;
private var showQuestion:Boolean;
private var decorationChance:int;
private var sameAsDisplayProcent:int;
private var waiterIsBuzzy:Boolean;
private var moneyAnimFrame:int;
private var timerCounter2:int;
private var moneyBlingSwitchAt:int;
private var displayFrostingType:int;
private var cakeTypes:Array;
private var takedDecorationType:int;
private var coreGame:CoreGame;
private var cake:Cake;
private var type:int;
private var forceBubbleBlink:Boolean;
private var blingMoney:Boolean;
private var showHearts:Boolean;
private var takedFrostingType:int;
private var parentClip2:MovieClip;
private var moneyBlingCounter:int;
private var boxingAnimFrame:int;
private var customerXOffset:int;
private var heartsAnimFrame:int;
private var displayCakeType:int;
private var takedCakeType:int;
private var bubbleNr:int;
private var frostingTypes:Array;
private var smoke:Smoke;
private var timeLeft:int;
private var waiterDecorationType:int;
private var showBox:Boolean;
private var state:int;
private var showMarker:Boolean;
private var waiterCakeType:int;
private var angry:Boolean;
private var waiterGotCake:Boolean;
private var displayDecorationType:int;
private var decorationTypes:Array;
private var customerYOffset:int;
private var baseObjectCounter:Counter;
private var smokeXOffset:int;
private var bubbleAnimFrame:int;
private var showMoney:Boolean;
private var displayGotCake:Boolean;
private var input:Input;
public var customerDecideTime:int;
private var random:Random;
private var version:int;
public var customerCueTime:int;
private var showBubble:Boolean;
private var customer:Customer;
private var waiterHere:Boolean;
private var timerCounter:int;
private var showMenu:Boolean;
private var smokeYOffset:int;
private var timerCouterLevel:int;
public static var STATE_POSITIVE_END:int = 6;
public static var HR_CUSTOMER_Y_OFFSET:int = 100;
public static var WATER_SMOKE_X_OFFSET:int = 85;
public static var FUTURE_CUSTOMER_Y_OFFSET:int = 100;
public static var FUTURE_CUSTOMER_X_OFFSET:int = 85;
public static var FUTURE_SMOKE_Y_OFFSET:int = 20;
public static var HR_SMOKE_X_OFFSET:int = -85;
public static var SHOW_FROSTING_DELAY_TIME:int = 10;
public static var HR_CUSTOMER_X_OFFSET:int = -85;
public static var WATER_CUSTOMER_Y_OFFSET:int = 100;
public static var STATE_WRONG_CAKE:int = 3;
public static var STATE_NEGATIVE_END:int = 7;
public static var WRONG_CAKE_TIME = 25;
public static var FUTURE_SMOKE_X_OFFSET:int = 85;
public static var END_TIME:int = 25;
public static var STATE_MONEY:int = 5;
public static var WATER_CUSTOMER_X_OFFSET:int = 85;
public static var SHOW_DECORATION_DELAY_TIME:int = 10;
public static var STATE_BOX:int = 4;
public static var BOX_TIME:int = 75;
public static var STATE_ORDER:int = 2;
public static var STATE_MENU:int = 0;
public static var DECIDE_TIME2:int = 75;
public static var DECIDE_TIME3:int = 75;
public static var WATER_SMOKE_Y_OFFSET:int = 20;
public static var STATE_DECIDE:int = 1;
public static var BLING_SWITCH_STEP:int = 8;
public static var HR_SMOKE_Y_OFFSET:int = 20;
function Bubble(_arg1:int, _arg2:MovieClip, _arg3:MovieClip, _arg4:Number, _arg5:Number, _arg6:Array, _arg7:Function, _arg8:int, _arg9:Array, _arg10:Array, _arg11:Array, _arg12:int, _arg13:int, _arg14:int, _arg15:int, _arg16:Counter, _arg17:Random, _arg18:Input, _arg19:CoreGame){
super(_arg2, _arg4, _arg5, _arg6, _arg7, _arg16);
this.baseObjectCounter = _arg16;
this.random = _arg17;
this.input = _arg18;
this.parentClip2 = _arg3;
this.bubbleNr = _arg8;
this.cakeTypes = _arg9;
this.frostingTypes = _arg10;
this.decorationTypes = _arg11;
this.decorationTypes = _arg11;
this.customerCueTime = _arg12;
this.customerDecideTime = _arg13;
this.decorationChance = _arg14;
this.sameAsDisplayProcent = _arg15;
this.version = _arg1;
this.coreGame = _arg19;
createClip2();
switch (this.version){
case CakeMania.HR_VERSION:
customerXOffset = HR_CUSTOMER_X_OFFSET;
customerYOffset = HR_CUSTOMER_Y_OFFSET;
smokeXOffset = HR_SMOKE_X_OFFSET;
smokeYOffset = HR_SMOKE_Y_OFFSET;
break;
case CakeMania.WATER_VERSION:
customerXOffset = WATER_CUSTOMER_X_OFFSET;
customerYOffset = WATER_CUSTOMER_Y_OFFSET;
smokeXOffset = WATER_SMOKE_X_OFFSET;
smokeYOffset = WATER_SMOKE_Y_OFFSET;
break;
case CakeMania.FUTURE_VERSION:
customerXOffset = FUTURE_CUSTOMER_X_OFFSET;
customerYOffset = FUTURE_CUSTOMER_Y_OFFSET;
smokeXOffset = FUTURE_SMOKE_X_OFFSET;
smokeYOffset = FUTURE_SMOKE_Y_OFFSET;
break;
};
type = _arg17.nextInt(3);
cake = new BubbleCake(clip, clip.cake_mc.x, clip.cake_mc.y, _arg6, _arg7, clip.cake_mc, true, _arg16, _arg17);
_arg6.push(cake);
customer = new Customer(_arg1, this.parentClip2, (_arg4 + customerXOffset), (_arg5 + customerYOffset), _arg6, _arg7, type, _arg16);
_arg6.push(customer);
init();
SoundManager.playCustomerArrive();
state = STATE_MENU;
}
public function waiterIsHere(_arg1:Boolean){
this.waiterHere = _arg1;
}
private function createSmoke(_arg1:Boolean){
smoke = new Smoke(parentClip2, (posX + smokeXOffset), (posY + smokeYOffset), newObjects, messageCallback, _arg1, baseObjectCounter);
newObjects.push(smoke);
}
public function waiterLeave(){
waiterHere = false;
}
public function setDisplayCaseInfo(_arg1:Boolean, _arg2:int, _arg3:int, _arg4:int){
displayGotCake = _arg1;
displayCakeType = _arg2;
displayFrostingType = _arg3;
displayDecorationType = _arg4;
}
private function setRemoval(){
visible = true;
toBeRemoved = true;
smoke.visible = true;
smoke.toBeRemoved = true;
customer.visible = true;
customer.toBeRemoved = true;
cake.visible = false;
cake.toBeRemoved = true;
}
public function marked():Boolean{
return (showMarker);
}
private function init(){
cake.visible = false;
waiterHere = false;
waiterGotCake = false;
showMarker = false;
showQuestion = false;
showHearts = true;
showMenu = true;
showBubble = true;
showMoney = false;
showBox = false;
heartsAnimFrame = 1;
bubbleAnimFrame = 1;
boxingAnimFrame = 1;
forceBubbleBlink = false;
timerCounter = 0;
timerCounter2 = 0;
timerCouterLevel = 1;
timerCounter = int((customerCueTime / 5));
angry = false;
customer.setIdleState();
state = STATE_MENU;
}
public function setWaiterCake(_arg1:Boolean, _arg2:int, _arg3:int, _arg4:int){
waiterGotCake = _arg1;
waiterCakeType = _arg2;
waiterFrostingType = _arg3;
waiterDecorationType = _arg4;
}
protected function createClip2():void{
clip = new BubbleClip();
switch (version){
case CakeMania.HR_VERSION:
clip.hearts.scaleX = -1;
clip.bubble.scaleX = -1;
break;
case CakeMania.WATER_VERSION:
break;
case CakeMania.FUTURE_VERSION:
break;
};
parentClip.addChildAt(clip, 1);
}
public function waiterBuzzy(){
waiterIsBuzzy = true;
}
private function toStateWrongCake(){
showMarker = false;
timerCounter2 = 0;
forceBubbleBlink = true;
state = STATE_WRONG_CAKE;
SoundManager.playCantPlace();
}
public function waiterArrive(_arg1:Boolean){
waiterHere = true;
}
override protected function createCollisionObject():void{
collisionObject = new CollisionObject(0, 0, 60);
}
override public function collisionReaction(_arg1:BaseObject){
var _local2:InfoData;
var _local3:Boolean;
messageCallback("collision", null);
bubbleAnimFrame = 2;
if (((input.mouseIsPressed) && (!(showMarker)))){
_local2 = new InfoData();
messageCallback("has waiter cake?", _local2);
_local3 = cake.equalTypes(waiterCakeType, waiterFrostingType, waiterDecorationType);
waiterIsBuzzy = false;
messageCallback("is waiter buzzy?", _local2);
if ((((((((state == STATE_MENU)) || ((((((state == STATE_ORDER)) && (waiterGotCake))) && (_local3))))) || ((((state == STATE_ORDER)) && (waiterIsBuzzy))))) || ((state == STATE_MONEY)))){
showMarker = true;
_local2 = new InfoData();
_local2.data1 = bubbleNr;
messageCallback("bubble button checked", _local2);
} else {
if ((((((state == STATE_ORDER)) && (waiterGotCake))) && (!(_local3)))){
toStateWrongCake();
};
};
};
if (forceBubbleBlink){
bubbleAnimFrame = 5;
};
}
override public function render(_arg1:Number){
super.render(_arg1);
if (showQuestion){
clip.question.visible = true;
} else {
clip.question.visible = false;
};
if (showMarker){
clip.Marker_mc.visible = true;
} else {
clip.Marker_mc.visible = false;
};
if (showQuestion){
clip.question.visible = true;
} else {
clip.question.visible = false;
};
if (showHearts){
clip.hearts.visible = true;
clip.hearts.gotoAndStop(heartsAnimFrame);
} else {
clip.hearts.visible = false;
};
if (showMenu){
clip.bubble_menu.visible = true;
} else {
clip.bubble_menu.visible = false;
};
if (showBubble){
clip.bubble.visible = true;
clip.bubble.gotoAndStop(bubbleAnimFrame);
} else {
clip.bubble.visible = false;
};
if (showMoney){
clip.money_mc.visible = true;
clip.money_mc.gotoAndStop(moneyAnimFrame);
} else {
clip.money_mc.visible = false;
};
if (showBox){
clip.box_front_mc.visible = true;
clip.box_back_mc.visible = true;
clip.box_front_mc.gotoAndStop(boxingAnimFrame);
clip.box_back_mc.gotoAndStop(boxingAnimFrame);
} else {
clip.box_front_mc.visible = false;
clip.box_back_mc.visible = false;
};
}
override public function tick(){
var _local1:InfoData;
var _local2:int;
var _local3:Boolean;
var _local4:int;
_local1 = new InfoData();
messageCallback("waiter node position", _local1);
super.tick();
switch (state){
case STATE_MENU:
if (((showMarker) && (waiterHere))){
showMarker = false;
showMenu = false;
showQuestion = true;
timerCounter2 = 0;
messageCallback("request display cake info", null);
if (((displayGotCake) && (!((displayFrostingType == 0))))){
_local2 = random.nextInt(100);
if ((((_local2 <= sameAsDisplayProcent)) && (!((sameAsDisplayProcent == 0))))){
cake.setTypes(displayCakeType, displayFrostingType, displayDecorationType);
} else {
randomCake();
};
} else {
randomCake();
};
state = STATE_DECIDE;
customer.setReadState();
timerCounter = (timerCounter - int((customerCueTime / 5)));
SoundManager.playSelect();
Communicator.sendPlayData3(62, coreGame.currentTick, cake.getCakeType(), cake.getFrostingType(), cake.getDecorationType());
};
break;
case STATE_DECIDE:
if (timerCounter2 == ((customerDecideTime - SHOW_FROSTING_DELAY_TIME) - SHOW_DECORATION_DELAY_TIME)){
showQuestion = false;
cake.visible = true;
cake.hideCakeFrosting();
cake.hideCakeDecoration();
};
if (timerCounter2 == (customerDecideTime - SHOW_FROSTING_DELAY_TIME)){
cake.showCakeFrosting();
};
if (timerCounter2 == customerDecideTime){
cake.showCakeDecoration();
state = STATE_ORDER;
customer.setIdleState();
};
break;
case STATE_ORDER:
_local1 = new InfoData();
messageCallback("has waiter cake?", _local1);
if (((((showMarker) && (waiterHere))) && (waiterGotCake))){
_local3 = cake.equalTypes(waiterCakeType, waiterFrostingType, waiterDecorationType);
if (_local3){
showMarker = false;
timerCounter2 = 0;
boxingAnimFrame = 1;
showBubble = false;
showHearts = false;
showBox = true;
state = STATE_BOX;
customer.setHappyState();
timeLeft = (customerCueTime - timerCounter);
takedCakeType = waiterCakeType;
takedFrostingType = waiterFrostingType;
takedDecorationType = waiterDecorationType;
_local1 = new InfoData();
_local1.data1 = 1;
messageCallback("waiter leave cake", _local1);
SoundManager.playWrapSound();
} else {
toStateWrongCake();
};
} else {
if (((((showMarker) && (waiterHere))) && (!(waiterGotCake)))){
toStateWrongCake();
};
};
break;
case STATE_WRONG_CAKE:
if (timerCounter2 < int((WRONG_CAKE_TIME / 4))){
forceBubbleBlink = true;
} else {
if (timerCounter2 < int(((WRONG_CAKE_TIME * 2) / 4))){
forceBubbleBlink = false;
} else {
if (timerCounter2 < int(((WRONG_CAKE_TIME * 3) / 4))){
forceBubbleBlink = true;
};
};
};
if (timerCounter2 >= int(WRONG_CAKE_TIME)){
forceBubbleBlink = false;
};
if (timerCounter2 == WRONG_CAKE_TIME){
timerCounter2 = 0;
state = STATE_ORDER;
};
break;
case STATE_BOX:
boxingAnimFrame = int(((timerCounter2 / (BOX_TIME / 33)) + 1));
if (boxingAnimFrame > 33){
boxingAnimFrame = 33;
};
if (boxingAnimFrame == 20){
cake.visible = false;
moneyAnimFrame = 1;
moneyBlingCounter = 0;
moneyBlingSwitchAt = BLING_SWITCH_STEP;
showMoney = true;
};
if (timerCounter2 == 50){
customer.hide();
createSmoke(true);
SoundManager.playHappyLeavingSound();
};
if (timerCounter2 == BOX_TIME){
showBox = false;
state = STATE_MONEY;
};
break;
case STATE_MONEY:
if (moneyBlingCounter == moneyBlingSwitchAt){
moneyBlingSwitchAt = (moneyBlingSwitchAt + BLING_SWITCH_STEP);
if (moneyAnimFrame == 1){
moneyAnimFrame = 2;
} else {
moneyAnimFrame = 1;
};
};
moneyBlingCounter++;
if (((showMarker) && (waiterHere))){
showMarker = false;
showMoney = false;
timerCounter2 = 0;
state = STATE_POSITIVE_END;
_local1 = new InfoData();
_local1.data1 = bubbleNr;
_local4 = 0;
if (takedFrostingType != 0){
_local4 = 1;
};
if (takedDecorationType != 0){
_local4 = 2;
};
_local1.data2 = _local4;
_local1.data3 = posX;
_local1.data4 = posY;
_local1.data5 = timeLeft;
messageCallback("waiter take money", _local1);
setRemoval();
SoundManager.playCash();
};
break;
case STATE_POSITIVE_END:
break;
case STATE_NEGATIVE_END:
if (timerCounter2 == END_TIME){
_local1 = new InfoData();
_local1.data1 = bubbleNr;
_local1.data2 = posX;
_local1.data3 = posY;
messageCallback("customer up in smoke", _local1);
setRemoval();
};
break;
};
timerCounter++;
timerCounter2++;
timerCouterLevel = (int((timerCounter / (customerCueTime / 5))) + 1);
if (((((!((state == STATE_MONEY))) && (!((state == STATE_NEGATIVE_END))))) && (!((state == STATE_POSITIVE_END))))){
if (((!((state == STATE_NEGATIVE_END))) && ((timerCouterLevel >= 6)))){
timerCouterLevel = 6;
timerCounter2 = 0;
state = STATE_NEGATIVE_END;
showBubble = false;
showHearts = false;
showMenu = false;
showBubble = false;
showQuestion = false;
showMarker = false;
cake.visible = false;
customer.hide();
createSmoke(false);
SoundManager.playCustomerLeaveUnhappySound();
};
};
if ((((((timerCouterLevel == 5)) && (!(angry)))) && (!((state == STATE_MONEY))))){
angry = true;
customer.setAngryState();
SoundManager.playCustomerRunHappy();
};
heartsAnimFrame = timerCouterLevel;
if (state == STATE_WRONG_CAKE){
bubbleAnimFrame = 4;
} else {
if (angry){
bubbleAnimFrame = 3;
} else {
bubbleAnimFrame = 1;
};
};
if (forceBubbleBlink){
bubbleAnimFrame = 5;
};
}
override public function setPosition(_arg1:Number, _arg2:Number){
super.setPosition(_arg1, _arg2);
customer.setPosition((_arg1 + customerXOffset), (_arg2 + customerYOffset));
}
private function randomCake(){
cake.generateCake(cakeTypes, frostingTypes, decorationTypes, decorationChance);
}
public function setBubbleNr(_arg1:int){
this.bubbleNr = _arg1;
}
}
}//package com.king.cakemania
Section 39
//BubbleCake (com.king.cakemania.BubbleCake)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class BubbleCake extends Cake {
function BubbleCake(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Function, _arg6:MovieClip, _arg7:Boolean, _arg8:Counter, _arg9:Random){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
}
}
}//package com.king.cakemania
Section 40
//BubbleManager (com.king.cakemania.BubbleManager)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class BubbleManager {
private var decorationChance:int;
private var sameAsDisplayProcent:int;
public var FUTURE_POS_X:Array;
public var FUTURE_POS_Y:Array;
public var HR_POS_X:Array;
public var HR_POS_Y:Array;
private var parentClip:MovieClip;
private var cakeTypes:Array;
private var decorationTypes:Array;
private var coreGame:CoreGame;
private var random:Random;
public var WATER_POS_X:Array;
public var WATER_POS_Y:Array;
private var input:Input;
public var positionX:Array;
public var customerDecideTime:int;// = 50
private var newObjects:Array;
private var spawningOn:Boolean;
public var positionY:Array;
private var parentClip2:MovieClip;
public var customerCueTime:int;// = 50
public var maxBubbles:int;// = 4
private var bubbles:Array;
public var spawnTime:int;// = 100
private var messageCallback:Function;
private var timeCounter:int;
private var version:int;
private var baseObjectCounter:Counter;
private var frostingTypes:Array;
function BubbleManager(_arg1:int, _arg2:MovieClip, _arg3:MovieClip, _arg4:Array, _arg5:Function, _arg6:int, _arg7:int, _arg8:Counter, _arg9:Random, _arg10:Input, _arg11:CoreGame){
var _local12:*;
HR_POS_X = [160, 180, 208, 240];
HR_POS_Y = [280, 230, 180, 138];
WATER_POS_X = [434, 422, 391, 357];
WATER_POS_Y = [299, 242, 190, 138];
FUTURE_POS_X = [487, 444, 397, 353];
FUTURE_POS_Y = [258, 211, 166, 120];
maxBubbles = 4;
spawnTime = (4 * 25);
customerCueTime = 50;
customerDecideTime = 50;
cakeTypes = [1, 2, 3, 4, 5];
frostingTypes = [1, 2, 4, 6];
decorationTypes = [1, 2, 3, 4];
super();
this.version = _arg1;
this.parentClip = _arg2;
this.parentClip2 = _arg3;
this.newObjects = _arg4;
this.messageCallback = _arg5;
this.maxBubbles = _arg6;
this.spawnTime = _arg7;
this.decorationChance = 100;
this.sameAsDisplayProcent = 100;
this.baseObjectCounter = _arg8;
this.random = _arg9;
this.input = _arg10;
this.coreGame = _arg11;
bubbles = new Array(_arg6);
_local12 = 0;
while (_local12 < _arg6) {
bubbles[_local12] = null;
_local12++;
};
timeCounter = 0;
switch (this.version){
case CakeMania.HR_VERSION:
positionX = HR_POS_X;
positionY = HR_POS_Y;
break;
case CakeMania.WATER_VERSION:
positionX = WATER_POS_X;
positionY = WATER_POS_Y;
break;
case CakeMania.FUTURE_VERSION:
positionX = FUTURE_POS_X;
positionY = FUTURE_POS_Y;
break;
};
}
public function bubbleChecked():int{
var _local1:*;
_local1 = 0;
while (_local1 < bubbles.length) {
if (bubbles[_local1] != null){
if (bubbles[_local1].marked()){
return (_local1);
};
};
_local1++;
};
return (-1);
}
private function adjustBubbles(){
var _local1:*;
var _local2:*;
_local1 = 1;
while (_local1 < bubbles.length) {
if (bubbles[_local1] != null){
_local2 = (_local1 - 1);
while (_local2 >= 0) {
if (bubbles[_local2] == null){
bubbles[_local2] = bubbles[_local1];
bubbles[_local1] = null;
bubbles[_local2].setPosition(positionX[_local2], positionY[_local2]);
bubbles[_local2].setBubbleNr(_local2);
_local1 = -1;
break;
};
_local2--;
};
};
_local1++;
};
}
public function init(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:Array, _arg6:Array, _arg7:Array, _arg8:int, _arg9:int){
var _local10:*;
this.spawnTime = _arg2;
this.maxBubbles = _arg1;
this.customerCueTime = _arg3;
this.customerDecideTime = _arg4;
this.cakeTypes = _arg5;
this.frostingTypes = _arg6;
this.decorationTypes = _arg7;
this.decorationChance = _arg8;
this.sameAsDisplayProcent = _arg9;
bubbles = new Array(this.maxBubbles);
_local10 = 0;
while (_local10 < this.maxBubbles) {
bubbles[_local10] = null;
_local10++;
};
timeCounter = (this.spawnTime - 25);
turnOnSpawinig();
}
public function tick(){
if ((((timeCounter == spawnTime)) && (spawningOn))){
createBubble();
timeCounter = 0;
};
timeCounter++;
}
public function turnOffSpawining(){
spawningOn = false;
}
public function activeBubbles():int{
var _local1:int;
var _local2:*;
_local1 = 0;
_local2 = 0;
while (_local2 < bubbles.length) {
if (bubbles[_local2] != null){
_local1++;
};
_local2++;
};
return (_local1);
}
public function setDisplayCaseInfo(_arg1:Boolean, _arg2:int, _arg3:int, _arg4:int){
var _local5:*;
_local5 = 0;
while (_local5 < bubbles.length) {
if (bubbles[_local5] != null){
bubbles[_local5].setDisplayCaseInfo(_arg1, _arg2, _arg3, _arg4);
};
_local5++;
};
}
private function createBubble():Boolean{
var _local1:*;
_local1 = 0;
while (_local1 < bubbles.length) {
if (bubbles[_local1] == null){
bubbles[_local1] = new Bubble(version, parentClip, parentClip2, positionX[_local1], positionY[_local1], newObjects, messageCallback, _local1, cakeTypes, frostingTypes, decorationTypes, customerCueTime, customerDecideTime, decorationChance, sameAsDisplayProcent, baseObjectCounter, random, input, coreGame);
newObjects.push(bubbles[_local1]);
return (true);
};
_local1++;
};
return (false);
}
public function turnOnSpawinig(){
spawningOn = true;
}
public function setWaiterCake(_arg1:Boolean, _arg2:int, _arg3:int, _arg4:int){
var _local5:*;
_local5 = 0;
while (_local5 < bubbles.length) {
if (bubbles[_local5] != null){
bubbles[_local5].setWaiterCake(_arg1, _arg2, _arg3, _arg4);
};
_local5++;
};
}
public function removeBubble(_arg1:int){
bubbles[_arg1] = null;
adjustBubbles();
}
public function waiterBuzzy(){
var _local1:*;
_local1 = 0;
while (_local1 < bubbles.length) {
if (bubbles[_local1] != null){
bubbles[_local1].waiterBuzzy();
};
_local1++;
};
}
public function waiterArrive(_arg1:int, _arg2:Boolean){
if (_arg1 < maxBubbles){
if (bubbles[_arg1] != null){
bubbles[_arg1].waiterArrive(_arg2);
};
};
}
public function waiterAtBubble(_arg1:int, _arg2:Boolean){
if (_arg1 < maxBubbles){
if (bubbles[_arg1] != null){
bubbles[_arg1].waiterIsHere(_arg2);
};
};
}
public function removeAllBubblePointers(){
var _local1:*;
_local1 = 1;
while (_local1 < bubbles.length) {
bubbles[_local1] = null;
_local1++;
};
}
public function waiterLeave(){
var _local1:*;
_local1 = 0;
while (_local1 < bubbles.length) {
if (bubbles[_local1] != null){
bubbles[_local1].waiterLeave();
};
_local1++;
};
}
}
}//package com.king.cakemania
Section 41
//Cake (com.king.cakemania.Cake)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class Cake extends BaseObject {
private var showDecoration:Boolean;
private var cakeType:int;
private var clipFrosting:MovieClip;
private var normalSize:Boolean;
private var decorationType:int;
private var clipCake:MovieClip;
private var frostingTypeOffset:int;
private var showFrosting:Boolean;
private var random:Random;
private var cakeTypeOffset:int;
private var clipDecoration:MovieClip;
private var frostingType:int;
function Cake(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Function, _arg6:MovieClip, _arg7:Boolean, _arg8:Counter, _arg9:Random){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg8);
clip = _arg6;
clip.visible = false;
this.normalSize = _arg7;
this.random = _arg9;
if (_arg7){
cakeTypeOffset = 0;
frostingTypeOffset = 0;
} else {
cakeTypeOffset = 9;
frostingTypeOffset = 54;
};
clipCake = clip.cake_mc;
clipFrosting = clip.frosting_mc;
clipDecoration = clip.decoration_mc;
setTypes(1, 0, 0);
showCakeFrosting();
showCakeDecoration();
}
public function getDecorationType():int{
return (decorationType);
}
public function setDecorationType(_arg1:int){
this.decorationType = _arg1;
}
public function showCakeFrosting(){
showFrosting = true;
}
override public function render(_arg1:Number){
super.render(_arg1);
clipCake.gotoAndStop((cakeType + cakeTypeOffset));
if (((showFrosting) && (!((frostingType == 0))))){
clipFrosting.visible = true;
clipFrosting.gotoAndStop(((((cakeType - 1) * 6) + frostingType) + frostingTypeOffset));
} else {
clipFrosting.visible = false;
};
if (((showDecoration) && (!((decorationType == 0))))){
clipDecoration.visible = true;
clipDecoration.gotoAndStop(decorationType);
} else {
clipDecoration.visible = false;
};
}
public function setCakeType(_arg1:int){
this.cakeType = _arg1;
}
override public function tick(){
super.tick();
}
public function equalTypes(_arg1:int, _arg2:int, _arg3:int):Boolean{
if ((((((this.cakeType == _arg1)) && ((this.frostingType == _arg2)))) && ((this.decorationType == _arg3)))){
return (true);
};
return (false);
}
public function getCakeType():int{
return (cakeType);
}
public function setTypes(_arg1:int, _arg2:int, _arg3:int){
setCakeType(_arg1);
setFrostingType(_arg2);
setDecorationType(_arg3);
}
public function hideCakeFrosting(){
showFrosting = false;
}
public function showCakeDecoration(){
showDecoration = true;
}
public function hideCakeDecoration(){
showDecoration = false;
}
public function getFrostingType():int{
return (frostingType);
}
public function generateCake(_arg1:Array, _arg2:Array, _arg3:Array, _arg4:int){
var _local5:int;
var _local6:Boolean;
var _local7:Boolean;
var _local8:Boolean;
var _local9:Boolean;
var _local10:Boolean;
var _local11:int;
_local6 = true;
_local7 = true;
_local8 = true;
_local9 = true;
_local10 = false;
_local11 = random.nextInt(100);
if ((((_local11 <= _arg4)) && (!((_arg4 == 0))))){
_local10 = true;
};
if (_arg1.length == 0){
_local6 = false;
};
if ((((_arg2.length == 0)) || (!(_local9)))){
_local7 = false;
};
if ((((_arg3.length == 0)) || (!(_local10)))){
_local8 = false;
};
cakeType = 0;
frostingType = 0;
decorationType = 0;
if (_local6){
_local5 = random.nextInt(_arg1.length);
cakeType = _arg1[_local5];
if (_local7){
_local5 = random.nextInt(_arg2.length);
frostingType = _arg2[_local5];
if (_local8){
_local5 = random.nextInt(_arg3.length);
decorationType = _arg3[_local5];
};
};
};
}
public function setFrostingType(_arg1:int){
this.frostingType = _arg1;
}
}
}//package com.king.cakemania
Section 42
//CakeMania (com.king.cakemania.CakeMania)
package com.king.cakemania {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
import flash.xml.*;
import flash.external.*;
public class CakeMania extends MovieClip {
private var version:int;
private var turorialForwardButtonClicked:Boolean;
private var tickFPS:Number;
private var localCounter:Counter;
private var tickStartTime:Number;
public var Exit_mc:MovieClip;
private var pointer:Pointer;
public var timer:Timer;
private var soundOn:Boolean;
private var renderStartTime:Number;
private var state:int;
private var startButtonClicked:Boolean;
private var exitShown:Boolean;
public var debugFPS:TextField;
private var tickCounter:int;// = 0
private var doOnce:Boolean;// = true
private var tickCounter2:int;
private var random:Random;
private var input:Input;
private var exitOnce:Boolean;
private var renderFPS:Number;
public var Sound_mc:MovieClip;
private var gameHandler:GameHandler;
public static var HR_VERSION:int = 0;
public static var STATE_GAME:int = 2;
public static var TITLE_SHOWING_FRAMES:int = 125;
public static var LOAD_GAME_XML:Boolean = false;
public static var DEBUG_MODE:Boolean = false;
public static var WATER_VERSION:int = 1;
public static var MONEY_GAME:Boolean = true;
public static var STATE_INSTRUCTIONS:int = 1;
private static var GAME_DATA:String = (((((((((((((((((((((((((((((((((((((((("<gamedata randomseed=\"3\" timelimit=\"660\" lang=\"de\">" + "<text id=\"level_sign_text1\">AIn the first level, we start off with just one oven and one froster</text>") + "<text id=\"level_sign_text2\">ANow we’re getting down to business with two ovens and frosters!</text>") + "<text id=\"level_sign_text3\">AOur final challenge includes 2 ovens, 2 frosters, and decorations!</text>") + "<text id=\"level_sign_january\">AJANUARY</text>") + "<text id=\"level_sign_february\">AFEBRUARY</text>") + "<text id=\"level_sign_mars\">AMARS</text>") + "<text id=\"level_sign_baker_goal\">ABaker Goal:</text>") + "<text id=\"level_sign_play_button\">ALet´s Play!</text>") + "<text id=\"level_starts_in\">AThe level starts in</text>") + "<text id=\"sound_on\">ASound on</text>") + "<text id=\"sound_off\">ASound off</text>") + "<text id=\"exit_game\">AExit game</text>") + "<text id=\"gui_cash\">ACash $</text>") + "<text id=\"gui_baker_goal\">ABaker Goal $</text>") + "<text id=\"gui_calendar_jan\">AJan</text>") + "<text id=\"gui_calendar_feb\">AFeb</text>") + "<text id=\"gui_calendar_mar\">AMar</text>") + "<text id=\"closed_sign\">Closed</text>") + "<text id=\"instruction_heading\">AINSTRUCTIONS</text>") + "<text id=\"instruction_text_1\">AWhen the customers enter, make sure that you supply them with a menu right away!</text>") + "<text id=\"instruction_text_2\">AWhen they have placed their order, click the right symbol on the oven to start baking.</text>") + "<text id=\"instruction_text_3\">AWhen the cake is baked, take it to the froster and click the desired frosting.</text>") + "<text id=\"instruction_text_4\">AWhen the frosting is done, give the customer the cake and pick up the money.</text>") + "<text id=\"game_starts_in\">AThe game starts in</text>") + "<text id=\"instruction_button\">AStart!</text>") + "<text id=\"result_sign_success_heading\">ASuccess!</text>") + "<text id=\"result_sign_fail_heading\">AFailed!</text>") + "<text id=\"result_sign_success_text\">AYou made it! You bake cakes like no other!</text>") + "<text id=\"result_sign_fail_text\">AYou didn’t make enough money to cover your costs. Game over.</text>") + "<text id=\"result_sign_cake_sales\">ACakes Sales:</text>") + "<text id=\"result_sign_cake_losses\">ACake Losses:</text>") + "<text id=\"result_sign_bonus\">ABonus:</text>") + "<text id=\"result_sign_tips_earned\">ATips Earned:</text>") + "<text id=\"result_sign_level_revenue\">ALevel Revenue:</text>") + "<text id=\"result_sign_total_score\">ATotal Score:</text>") + "<text id=\"game_ends_in\">AGame ends in</text>") + "<text id=\"goal_reached\">ABaker Goal\nReached!</text>") + "<text id=\"free_game_text\">ASignup to play the full game</text>") + "<userType id=\"0\">1</userType>") + "</gamedata>");
public static var STATE_TITLE:int = 0;
public static var FUTURE_VERSION:int = 2;
public static var TICKS_PER_SECOND:Number = 25;
public function CakeMania(){
var _local1:int;
version = HR_VERSION;
tickCounter = 0;
doOnce = true;
super();
Mouse.hide();
localCounter = new Counter();
References.init(this);
if (LOAD_GAME_XML){
GameXMLLoader.load();
};
Communicator.setMoneyGame(MONEY_GAME);
if (!DEBUG_MODE){
getGameData();
};
Communicator.parseGameData(GAME_DATA);
_local1 = Communicator.randomSeed;
random = new Random(_local1);
exitShown = false;
ScreenPlayer.hideExitButton();
ScreenPlayer.setupScreens();
pointer = new Pointer(References.mainClip, 100, 100, null, localCounter);
input = new Input();
input.init();
gameHandler = new GameHandler(version, random, input, pointer, messageReciver);
soundOn = true;
startButtonClicked = false;
turorialForwardButtonClicked = false;
addEventListener("enterFrame", advanceTime);
timer = new Timer(TICKS_PER_SECOND);
this.addEventListener(MouseEvent.MOUSE_DOWN, mousePressed);
this.addEventListener(MouseEvent.MOUSE_UP, mouseReleased);
exitOnce = true;
tickFPS = 0;
renderFPS = 0;
TextProperties.setStaticTexts();
toStateTitle();
SoundManager.playIntroLoop();
}
public function mouseReleased(_arg1:MouseEvent){
if (state == STATE_GAME){
input.mouseReleased();
};
}
public function messageReciver(_arg1:String){
if (_arg1 == "game ended"){
onGameEnded();
};
}
private function toStateTitle(){
tickCounter2 = 0;
state = STATE_TITLE;
}
private function advanceTime(_arg1:Event):void{
var _local2:*;
var _local3:*;
_local2 = timer.advanceTime();
_local3 = 0;
while (_local3 < _local2) {
tick();
tickCounter++;
_local3++;
};
render(timer.alpha);
}
private function tick():void{
var _local1:int;
var _local2:Boolean;
var _local3:Boolean;
var _local4:XML;
var _local5:int;
var _local6:Number;
input.setMousePos(this.mouseX, this.mouseY);
_local1 = ScreenPlayer.buttonStates((input.xMouse + 35), (input.yMouse + 32));
_local2 = false;
if ((((_local1 == 1)) && ((state == STATE_INSTRUCTIONS)))){
_local2 = true;
} else {
if ((((_local1 == 5)) && ((state == STATE_INSTRUCTIONS)))){
_local2 = true;
} else {
if ((((((_local1 == 2)) && ((state == STATE_GAME)))) && (gameHandler.showingBeginSign()))){
_local2 = true;
} else {
if ((_local1 == 3)){
_local2 = true;
} else {
if ((((_local1 == 4)) && (exitShown))){
_local2 = true;
};
};
};
};
};
_local3 = false;
if ((((((state == STATE_INSTRUCTIONS)) && ((_local1 == 1)))) && (input.mouseIsPressed))){
startButtonClicked = true;
_local3 = true;
} else {
if ((((((state == STATE_INSTRUCTIONS)) && ((_local1 == 5)))) && (input.mouseIsPressed))){
turorialForwardButtonClicked = true;
_local3 = true;
} else {
if ((((((((state == STATE_GAME)) && (gameHandler.showingBeginSign()))) && ((_local1 == 2)))) && (input.mouseIsPressed))){
gameHandler.buttonClick();
_local3 = true;
} else {
if ((((_local1 == 3)) && (input.mouseIsPressed))){
if (soundOn){
soundOn = false;
SoundManager.soundOff();
ScreenPlayer.showSoundOff();
} else {
soundOn = true;
if (gameHandler.isPlaying()){
SoundManager.soundOn(false, true);
} else {
SoundManager.soundOn(true, false);
};
ScreenPlayer.showSoundOn();
};
input.reset();
} else {
if ((((((((_local1 == 4)) && (input.mouseIsPressed))) && (exitOnce))) && (exitShown))){
exitOnce = false;
exitShown = false;
ScreenPlayer.hideExitButton();
gameHandler.endGame();
input.reset();
};
};
};
};
};
pointer.update(input.xMouse, input.yMouse, !(_local2), input.mouseIsPressed, input.mouseIsReleased);
if (((GameXMLLoader.loadingFinished()) && (doOnce))){
GameXML.gameXML = GameXMLLoader.loadedXML;
_local4 = GameXML.gameXML;
_local5 = int(_local4.debug_seed[0].@nr);
doOnce = false;
};
switch (state){
case STATE_TITLE:
SoundManager.introInUpdate();
if (tickCounter2 >= TITLE_SHOWING_FRAMES){
toStateInstructions();
};
break;
case STATE_INSTRUCTIONS:
if (tickCounter2 < 5){
startButtonClicked = false;
};
ScreenPlayer.updateTime(tickCounter2);
if ((((tickCounter2 >= (20 * 24))) || (startButtonClicked))){
ScreenPlayer.hideTutorial();
toStateGame();
};
ScreenPlayer.updateTutorial(turorialForwardButtonClicked);
break;
case STATE_GAME:
gameHandler.tick();
break;
};
turorialForwardButtonClicked = false;
if (tickFPS == 0){
tickStartTime = getTimer();
} else {
_local6 = ((getTimer() - tickStartTime) / 1000);
if (_local6 >= 1){
tickFPS = -1;
};
};
input.reset();
tickCounter2++;
tickFPS++;
}
private function toStateInstructions(){
ScreenPlayer.showTutorial();
ScreenPlayer.hideStartScreen();
tickCounter2 = 0;
ScreenPlayer.updateTime(tickCounter2);
state = STATE_INSTRUCTIONS;
}
private function onGameEnded(){
exitShown = false;
ScreenPlayer.hideExitButton();
}
private function render(_arg1:Number):void{
var _local2:Number;
pointer.render(_arg1);
gameHandler.render(_arg1);
if (renderFPS == 0){
renderStartTime = getTimer();
} else {
_local2 = ((getTimer() - renderStartTime) / 1000);
if (_local2 >= 1){
References.mainClip.debugFPS.text = ("FPS " + String(renderFPS));
renderFPS = -1;
};
};
renderFPS++;
}
public function mousePressed(_arg1:MouseEvent){
if (state == STATE_TITLE){
toStateInstructions();
};
input.mousePressed();
}
private function getGameData(){
var _local1:Object;
_local1 = ExternalInterface.call("getGameData");
if ((((_local1 == null)) || (!(_local1.success)))){
} else {
GAME_DATA = _local1.message;
};
}
private function toStateGame(){
state = STATE_GAME;
exitShown = true;
ScreenPlayer.showExitButton();
}
}
}//package com.king.cakemania
Section 43
//Circle (com.king.cakemania.Circle)
package com.king.cakemania {
public class Circle {
public var posX:Number;
public var posY:Number;
public var diameter:Number;
}
}//package com.king.cakemania
Section 44
//CollisionObject (com.king.cakemania.CollisionObject)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class CollisionObject {
private var circle:Circle;
private var clip:Shape;
private var parentClip:MovieClip;
public static var COLLISION_RENDER:Boolean = true;
function CollisionObject(_arg1:Number, _arg2:Number, _arg3:Number):void{
circle = new Circle();
circle.diameter = _arg3;
setPos(_arg1, _arg2);
parentClip = References.debugClip;
}
public function set(_arg1:Number, _arg2:Number, _arg3:Number):void{
circle.diameter = _arg3;
circle.posX = (_arg1 - (circle.diameter / 2));
circle.posY = (_arg2 - (circle.diameter / 2));
}
private function createClipAndDrawCircles():void{
clip = new Shape();
parentClip.addChild(clip);
clip.graphics.lineStyle(1, 0xFF0000);
clip.graphics.drawCircle((circle.diameter / 2), (circle.diameter / 2), (circle.diameter / 2));
}
public function collisionTest(_arg1:CollisionObject):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = ((circle.posX + (circle.diameter / 2)) - (_arg1.circle.posX + (_arg1.circle.diameter / 2)));
_local3 = ((circle.posY + (circle.diameter / 2)) - (_arg1.circle.posY + (_arg1.circle.diameter / 2)));
_local4 = ((_local2 * _local2) + (_local3 * _local3));
if (_local4 <= (((circle.diameter / 2) + (_arg1.circle.diameter / 2)) * ((circle.diameter / 2) + (_arg1.circle.diameter / 2)))){
return (true);
};
return (false);
}
public function setPos(_arg1:Number, _arg2:Number):void{
circle.posX = (_arg1 - (circle.diameter / 2));
circle.posY = (_arg2 - (circle.diameter / 2));
}
public function render():void{
if (COLLISION_RENDER){
deleteClip();
createClipAndDrawCircles();
clip.x = circle.posX;
clip.y = circle.posY;
};
}
public function deleteClip(){
if (clip){
parentClip.removeChild(clip);
};
clip = null;
}
}
}//package com.king.cakemania
Section 45
//Communicator (com.king.cakemania.Communicator)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.system.*;
import flash.xml.*;
class Communicator {
private static var NORMAL:Boolean = true;
private static var moneyGame:Boolean = true;
public static var randomSeed:Number;
public static var lang;
private static var freeGame:Boolean = false;
public static function gameQuit(){
if (NORMAL){
fscommand("gameQuit");
};
}
public static function sendPlayData(_arg1:int, _arg2:int, _arg3:int){
if (moneyGame){
fscommand("playData", (((((_arg1 + ",") + _arg2) + ",") + _arg3) + ",0=0"));
};
}
public static function gameEnd(_arg1){
if (NORMAL){
fscommand("gameEnd", _arg1);
};
}
private static function fixStr(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("\r\n").join("\n");
return (_local2);
}
public static function sendPlayData2(_arg1:int, _arg2:int, _arg3:int, _arg4:int){
if (moneyGame){
fscommand("playData", (((((((_arg1 + ",") + _arg2) + ",") + _arg3) + ",") + _arg4) + ",0=0"));
};
}
public static function sendPlayData3(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int){
if (moneyGame){
fscommand("playData", (((((((((_arg1 + ",") + _arg2) + ",") + _arg3) + ",") + _arg4) + ",") + _arg5) + ",0=0"));
};
}
public static function isFreeGame():Boolean{
return (freeGame);
}
public static function setMoneyGame(_arg1:Boolean){
moneyGame = _arg1;
}
public static function parseGameData(_arg1:String){
var _local2:XMLDocument;
var _local3:*;
var _local4:*;
var _local5:String;
var _local6:String;
_local2 = new XMLDocument(_arg1);
_local3 = _local2.childNodes[0].childNodes;
randomSeed = new Number(_local2.childNodes[0].attributes.randomseed).valueOf();
lang = _local2.childNodes[0].attributes.lang.valueOf();
_local4 = 0;
while (_local4 < _local3.length) {
if (_local3[_local4].nodeName == "text"){
if (_local3[_local4].attributes.id == "level_sign_text1"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.LEVEL_SIGN_TEXT_1 = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "level_sign_text2"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.LEVEL_SIGN_TEXT_2 = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "level_sign_text3"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.LEVEL_SIGN_TEXT_3 = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "level_sign_january"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.LEVEL_SIGN_MONTH_1 = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "level_sign_february"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.LEVEL_SIGN_MONTH_2 = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "level_sign_mars"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.LEVEL_SIGN_MONTH_3 = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "level_sign_baker_goal"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.LEVEL_SIGN_BAKER_GOAL = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "level_sign_play_button"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.LEVEL_SIGN_PLAY_BUTTON = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "level_starts_in"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.LEVEL_STARTS_IN = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "sound_on"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.SOUND_ON = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "sound_off"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.SOUND_OFF = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "exit_game"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.EXIT_GAME = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "gui_cash"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.GUI_CASH = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "gui_baker_goal"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.GUI_BAKER_GOAL = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "gui_calendar_jan"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.GUI_CALENDAR_JAN = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "gui_calendar_feb"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.GUI_CALENDAR_FEB = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "gui_calendar_mar"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.GUI_CALENDAR_MAR = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "closed_sign"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.CLOSED_SIGN = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "instruction_heading"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.INSTRUCTION_HEADING = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "instruction_text_1"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.INSTRUCTION_TEXT1 = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "instruction_text_2"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.INSTRUCTION_TEXT2 = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "instruction_text_3"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.INSTRUCTION_TEXT3 = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "instruction_text_4"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.INSTRUCTION_TEXT4 = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "game_starts_in"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.GAME_STARTS_IN = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "instruction_button"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.INSTRUCTION_BUTTON = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "result_sign_success_heading"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.RESULT_SIGN_SUCCESS_HEADING = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "result_sign_fail_heading"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.RESULT_SIGN_FAIL_HEADING = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "result_sign_success_text"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.RESULT_SIGN_SUCCESS_TEXT = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "result_sign_fail_text"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.RESULT_SIGN_FAIL_TEXT = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "result_sign_cake_sales"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.RESULT_SIGN_CAKE_SALES = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "result_sign_tips_earned"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.RESULT_SIGN_TIPS_EARNED = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "result_sign_bonus"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.RESULT_SIGN_BONUS = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "result_sign_cake_losses"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.RESULT_SIGN_CAKE_LOSSES = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "result_sign_level_revenue"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.RESULT_SIGN_LEVEL_REVENUE = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "result_sign_total_score"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.RESULT_SIGN_TOTAL_SCORE = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "game_ends_in"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.GAME_ENDS_IN = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "goal_reached"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.GOAL_REACHED = fixStr(_local5);
} else {
if (_local3[_local4].attributes.id == "free_game_text"){
_local5 = new String(_local3[_local4].firstChild.nodeValue);
TextProperties.FREE_GAME_TEXT = fixStr(_local5);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
if (_local3[_local4].nodeName == "userType"){
_local6 = new String(_local3[_local4].firstChild.nodeValue);
if (_local6 == "0"){
freeGame = true;
} else {
freeGame = false;
};
};
_local4++;
};
}
public static function gameStarted(){
if (NORMAL){
fscommand("gameStart");
};
}
public static function sendPlayDataMouse(_arg1:int, _arg2:int, _arg3:int, _arg4:int){
if (moneyGame){
fscommand("playData", (((((((_arg1 + ",") + _arg2) + ",") + _arg3) + ",") + _arg4) + ",0=0"));
};
}
}
}//package com.king.cakemania
Section 46
//CoreGame (com.king.cakemania.CoreGame)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
import flash.ui.*;
import flash.system.*;
class CoreGame {
private var baseObjects:Array;
public var scoreCustomerLeave:int;
private var displayCase:DisplayCase;
private var levelScoreLosses:int;
private var collidedWithObject:Boolean;
private var levelScoreCakeSale:int;
public var scoreThrowFrosting:int;
private var pointer:Pointer;
private var newBaseObjects:Array;
public var scoreThrowDecoration:int;
public var scoreTipPerSecond:int;
public var scoreFrosting:int;
private var decorator1:Decorator;
private var decorator2:Decorator;
private var timeBonus:int;
private var oven1:Oven;
private var oven2:Oven;
private var levelGoalIsDone:Boolean;
private var baseObjectCounter:Counter;
private var levelScore:int;
private var messageCallback:Function;
private var levelScoreCakeLosses:int;
private var levelTimeFrames:int;
private var levelManager:LevelManager;
private var state:int;
private var score:int;
private var trashcan:Trashcan;
private var bubbleManager:BubbleManager;
private var levelTimeTickCounter:int;
private var levelGoalDoneAtTick:int;
public var currentTick:int;
private var levelGoal:int;
public var timeBonusPerSecond:int;
private var levelScoreTips:int;
private var input:Input;
private var levelManagerData:LevelManagerData;
private var froster1:Froster;
private var froster2:Froster;
public var scoreDecoration:int;
private var gameGUI:GameGUI;
private var waiter:Waiter;
public static var STATE_PLAY:int = 1;
public static var STATE_PAUSE:int = 0;
public static var WARNING_TIME:int = 250;
public static var SCORE_CAKE_NOTHING:int = 0;
public static var CLOSE_TIME:int = 250;
public static var SCORE_THROW_CAKE_WITH_NOTHING:int = 0;
function CoreGame(_arg1:int, _arg2:Function, _arg3:Random, _arg4:Input, _arg5:Pointer){
this.messageCallback = _arg2;
this.input = _arg4;
this.pointer = _arg5;
baseObjects = new Array();
newBaseObjects = new Array();
baseObjectCounter = new Counter();
levelManagerData = new LevelManagerData();
levelManager = new LevelManager(_arg1, levelManagerData, baseObjects, messageReciver, baseObjectCounter, _arg3, _arg4, this);
levelGoalIsDone = false;
levelGoalDoneAtTick = 0;
score = 0;
state = STATE_PAUSE;
setup();
}
public function getLevelGoal():int{
return (levelGoal);
}
private function onOvenButtonChecked(_arg1:InfoData){
var _local2:int;
_local2 = int(_arg1.data1);
if (_local2 == 1){
waiter.gotoOven1();
} else {
if (_local2 == 2){
waiter.gotoOven2();
};
};
}
private function onTrashcanChecked(_arg1:InfoData){
waiter.gotoTrashcan();
}
private function moveWaiter(){
if (!collidedWithObject){
if (((input.mouseIsPressed) && (waiter.nothingToDo()))){
waiter.gotoNearestNode(input.xMouse, input.yMouse);
};
};
collidedWithObject = false;
}
private function onRequestDisplayCakeInfo(){
var _local1:Boolean;
var _local2:int;
var _local3:int;
var _local4:int;
_local1 = displayCase.caseGotCake();
_local2 = displayCase.getCakeType();
_local3 = displayCase.getFrostingType();
_local4 = displayCase.getDecorationType();
bubbleManager.setDisplayCaseInfo(_local1, _local2, _local3, _local4);
}
private function onIsWaiterBuzzy(){
var _local1:Boolean;
_local1 = !(waiter.nothingToDo());
if (_local1){
bubbleManager.waiterBuzzy();
oven1.waiterBuzzy();
oven2.waiterBuzzy();
};
}
public function messageReciver(_arg1:String, _arg2:InfoData){
if (_arg1 == "Test Msg"){
onTestMsg(_arg2);
} else {
if (_arg1 == "oven button checked"){
onOvenButtonChecked(_arg2);
} else {
if (_arg1 == "bubble button checked"){
onBubbleButtonChecked(_arg2);
} else {
if (_arg1 == "froster button checked"){
onFrosterButtonChecked(_arg2);
} else {
if (_arg1 == "decorator button checked"){
onDecorationButtonChecked(_arg2);
} else {
if (_arg1 == "trashcan checked"){
onTrashcanChecked(_arg2);
} else {
if (_arg1 == "display case checked"){
onDisplayCaseChecked(_arg2);
} else {
if (_arg1 == "waiter reach node"){
onWaiterReachNode(_arg2);
} else {
if (_arg1 == "waiter leave node"){
onWaiterLeaveNode(_arg2);
} else {
if (_arg1 == "give waiter cake"){
onGiveWaiterCake(_arg2);
} else {
if (_arg1 == "waiter leave cake"){
onWaiterLeaveCake(_arg2);
} else {
if (_arg1 == "has waiter cake?"){
onHasWaiterCake(_arg2);
} else {
if (_arg1 == "waiter take money"){
onWaiterTakeMoney(_arg2);
} else {
if (_arg1 == "customer up in smoke"){
onCustomerUpInSmoke(_arg2);
} else {
if (_arg1 == "waiter throw cake"){
onWaiterThrowCake(_arg2);
} else {
if (_arg1 == "waiter burn cake"){
onWaiterBurnCake(_arg2);
} else {
if (_arg1 == "is waiter buzzy?"){
onIsWaiterBuzzy();
} else {
if (_arg1 == "collision"){
collidedWithObject = true;
} else {
if (_arg1 == "waiter node position"){
onWaiterNodePosition();
} else {
if (_arg1 == "request display cake info"){
onRequestDisplayCakeInfo();
} else {
if (_arg1 == "oven baked cake"){
onOvenBakedCake(_arg2);
} else {
if (_arg1 == "oven burn and baked cake"){
onOvenBurnAndBakedCake(_arg2);
} else {
if (_arg1 == "frosting finished"){
onFrostingFinished(_arg2);
} else {
if (_arg1 == "decorating finished"){
onDecorationFinished(_arg2);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
}
private function sendInput(){
if (input.mouseIsPressed){
Communicator.sendPlayDataMouse(20, currentTick, input.xMouse, input.yMouse);
};
}
private function onFrostingFinished(_arg1:InfoData){
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = int(_arg1.data1);
_local3 = int(_arg1.data2);
_local4 = int(_arg1.data3);
Communicator.sendPlayData3(64, currentTick, _local2, _local3, _local4);
}
private function levelFinish(){
var _local1:InfoData;
addScore(timeBonus);
removeBakersGoal();
state = STATE_PAUSE;
score = (score + levelScore);
_local1 = new InfoData();
if (levelGoalIsDone){
_local1.data1 = 1;
} else {
_local1.data1 = 0;
};
_local1.data2 = levelScore;
_local1.data3 = levelScoreCakeSale;
_local1.data4 = levelScoreTips;
_local1.data5 = levelScoreCakeLosses;
_local1.data6 = timeBonus;
_local1.data7 = score;
_local1.data8 = levelScoreLosses;
SoundManager.stopTimerLoop();
gameGUI.render();
messageCallback("level finished", _local1);
}
public function startLevel(){
state = STATE_PLAY;
}
private function updating(){
var _local1:*;
_local1 = 0;
while (_local1 < baseObjects.length) {
baseObjects[_local1].tick();
_local1++;
};
_local1 = 0;
while (_local1 < newBaseObjects.length) {
newBaseObjects[_local1].tick();
baseObjects.push(newBaseObjects[_local1]);
_local1++;
};
while (newBaseObjects.length > 0) {
newBaseObjects.pop();
};
}
private function onOvenBurnAndBakedCake(_arg1:InfoData){
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = int(_arg1.data1);
_local3 = int(_arg1.data2);
_local4 = int(_arg1.data3);
Communicator.sendPlayData3(66, currentTick, _local2, _local3, _local4);
}
public function initLevel(_arg1:int){
if (_arg1 > 1){
bubbleManager.removeAllBubblePointers();
removeAllExcept();
};
levelManager.initLevel(_arg1);
levelTimeFrames = levelManager.getTimeLimit();
levelGoal = levelManager.getScoreLimit();
gameGUI.setGoalScore(levelGoal);
scoreCustomerLeave = levelManager.getScoreCustomerLeave();
scoreFrosting = levelManager.getScoreFrosted();
scoreDecoration = levelManager.getScoreDecorated();
scoreThrowFrosting = levelManager.getScoreThrowFrosted();
scoreThrowDecoration = levelManager.getScoreThrowDecorated();
scoreTipPerSecond = levelManager.getTipPerSec();
timeBonusPerSecond = levelManager.getTimeBonusPerSecond();
levelGoalIsDone = false;
levelGoalDoneAtTick = 0;
levelTimeTickCounter = 0;
levelScore = 0;
levelScoreCakeSale = 0;
levelScoreTips = 0;
levelScoreCakeLosses = 0;
levelScoreLosses = 0;
timeBonus = 0;
gameGUI.setScore(levelScore);
gameGUI.init();
gameGUI.setupTime((levelTimeFrames - CLOSE_TIME), _arg1);
}
private function onDecorationButtonChecked(_arg1:InfoData){
var _local2:int;
_local2 = int(_arg1.data1);
if (_local2 == 1){
waiter.gotoDecorator1();
} else {
if (_local2 == 2){
waiter.gotoDecorator2();
};
};
}
private function onWaiterBurnCake(_arg1:InfoData){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:Popup;
_local2 = int(_arg1.data1);
_local3 = int(_arg1.data2);
_local4 = int(_arg1.data3);
_local5 = true;
_local6 = SCORE_THROW_CAKE_WITH_NOTHING;
if (_local2 == 1){
_local5 = true;
_local6 = scoreThrowFrosting;
} else {
if (_local2 == 2){
_local5 = true;
_local6 = scoreThrowDecoration;
} else {
_local5 = true;
_local6 = -2000;
};
};
levelScoreCakeLosses = (levelScoreCakeLosses + _local6);
addScore(_local6);
if (_local5){
_local7 = new Popup(References.popupClip, _local3, _local4, newBaseObjects, messageCallback, _local6, baseObjectCounter);
newBaseObjects.push(_local7);
};
}
public function getLevelScore():int{
return (levelScore);
}
public function endGame(){
gameGUI.showClosedSign();
bubbleManager.turnOffSpawining();
levelTimeTickCounter = levelTimeFrames;
levelFinish();
}
private function addScore(_arg1:int){
Communicator.sendPlayData2(40, currentTick, _arg1, levelScore);
if (_arg1 < 0){
if ((levelScore + _arg1) < 0){
_arg1 = (_arg1 - (levelScore + _arg1));
};
levelScoreLosses = (levelScoreLosses + _arg1);
};
levelScore = (levelScore + _arg1);
gameGUI.setScore(levelScore);
}
private function onDisplayCaseChecked(_arg1:InfoData){
waiter.gotoDisplayCase();
}
public function setup(){
var _local1:MovieClip;
levelTimeTickCounter = 0;
_local1 = levelManager.createProperties();
bubbleManager = levelManagerData.bubbleManager;
waiter = levelManagerData.waiter;
oven1 = levelManagerData.oven1;
oven2 = levelManagerData.oven2;
froster1 = levelManagerData.froster1;
froster2 = levelManagerData.froster2;
decorator1 = levelManagerData.decorator1;
decorator2 = levelManagerData.decorator2;
trashcan = levelManagerData.trashcan;
displayCase = levelManagerData.displayCase;
gameGUI = new GameGUI(_local1);
levelScore = 0;
levelScoreCakeSale = 0;
levelScoreTips = 0;
levelScoreCakeLosses = 0;
levelScoreLosses = 0;
gameGUI.setScore(levelScore);
gameGUI.setGoalScore(0);
timeBonus = 0;
collidedWithObject = false;
}
private function onWaiterReachNode(_arg1:InfoData){
var _local2:int;
_local2 = int(_arg1.data1);
switch (_local2){
case References.NODE_INDEX_OVEN1:
oven1.waiterArrive();
break;
case References.NODE_INDEX_OVEN2:
oven2.waiterArrive();
break;
case References.NODE_INDEX_BUBBLE1:
bubbleManager.waiterArrive(0, waiter.hasCake());
break;
case References.NODE_INDEX_BUBBLE2:
bubbleManager.waiterArrive(1, waiter.hasCake());
break;
case References.NODE_INDEX_BUBBLE3:
bubbleManager.waiterArrive(2, waiter.hasCake());
break;
case References.NODE_INDEX_BUBBLE4:
bubbleManager.waiterArrive(3, waiter.hasCake());
break;
case References.NODE_INDEX_FROSTER1:
froster1.waiterArrive();
break;
case References.NODE_INDEX_FROSTER2:
froster2.waiterArrive();
break;
case References.NODE_INDEX_DECORATOR1:
decorator1.waiterArrive();
break;
case References.NODE_INDEX_DECORATOR2:
decorator2.waiterArrive();
break;
case References.NODE_INDEX_TRASHCAN:
trashcan.waiterArrive();
case References.NODE_INDEX_DISPLAYCASE:
displayCase.waiterArrive();
break;
default:
break;
};
}
private function updatePointer1(){
pointer.update1(input.xMouse, input.yMouse);
}
private function onBubbleButtonChecked(_arg1:InfoData){
var _local2:int;
_local2 = int(_arg1.data1);
if (_local2 == 0){
waiter.gotoBubble1();
} else {
if (_local2 == 1){
waiter.gotoBubble2();
} else {
if (_local2 == 2){
waiter.gotoBubble3();
} else {
if (_local2 == 3){
waiter.gotoBubble4();
};
};
};
};
}
private function updatePointer2(){
pointer.update2(!(collidedWithObject), input.mouseIsPressed, input.mouseIsReleased);
}
private function onWaiterNodePosition(){
var _local1:int;
var _local2:*;
_local1 = waiter.getWaiterNodeIndex();
_local2 = 0;
while (_local2 < 3) {
bubbleManager.waiterAtBubble(0, false);
_local2++;
};
if ((((_local1 >= 0)) && ((_local1 <= 3)))){
bubbleManager.waiterAtBubble(_local1, true);
};
}
public function render(_arg1:Number):void{
var _local2:*;
pointer.render(_arg1);
_local2 = 0;
while (_local2 < baseObjects.length) {
baseObjects[_local2].render(_arg1);
_local2++;
};
gameGUI.render();
}
public function tick(_arg1:Number):void{
var _local2:BakerGoal;
currentTick = _arg1;
switch (state){
case STATE_PAUSE:
break;
case STATE_PLAY:
sendInput();
SoundManager.updateOvenRunningSound();
SoundManager.updateDecorationSound();
updatePointer1();
bubbleManager.tick();
updating();
collisions();
removeObjects();
updatePointer2();
moveWaiter();
if ((((levelScore >= levelGoal)) && (!(levelGoalIsDone)))){
levelGoalIsDone = true;
levelGoalDoneAtTick = levelTimeTickCounter;
timeBonus = int(((levelTimeFrames - levelGoalDoneAtTick) * timeBonusPerSecond));
timeBonus = roundScore(timeBonus);
_local2 = new BakerGoal(References.popupClip, 300, 225, newBaseObjects, messageCallback, baseObjectCounter);
newBaseObjects.push(_local2);
SoundManager.playBakerGoalReached();
};
if (levelTimeTickCounter >= levelTimeFrames){
levelFinish();
} else {
if (levelTimeTickCounter >= (levelTimeFrames - CLOSE_TIME)){
if (bubbleManager.activeBubbles() == 0){
levelFinish();
};
};
};
if (levelTimeTickCounter == (levelTimeFrames - CLOSE_TIME)){
gameGUI.showClosedSign();
SoundManager.playClosed();
bubbleManager.turnOffSpawining();
};
if (levelTimeTickCounter == (levelTimeFrames - WARNING_TIME)){
SoundManager.playTimerLoop();
};
levelTimeTickCounter++;
break;
};
gameGUI.tick();
}
private function onFrosterButtonChecked(_arg1:InfoData){
var _local2:int;
_local2 = int(_arg1.data1);
if (_local2 == 1){
waiter.gotoFroster1();
} else {
if (_local2 == 2){
waiter.gotoFroster2();
};
};
}
private function sortBaseObjects(){
baseObjects.sortOn("instanceNr", Array.NUMERIC);
}
private function onTestMsg(_arg1:InfoData){
}
private function removeAllNewObjects(){
var _local1:Number;
var _local2:BaseObject;
var _local3:*;
_local1 = 0;
while (_local1 < newBaseObjects.length) {
if (_local1 == (newBaseObjects.length - 1)){
_local2 = newBaseObjects.pop();
_local2.deleting();
_local2 = null;
} else {
_local3 = newBaseObjects.pop();
_local2 = newBaseObjects[_local1];
_local2.deleting();
_local2 = null;
newBaseObjects[_local1] = _local3;
_local1--;
};
_local1++;
};
}
private function onWaiterThrowCake(_arg1:InfoData){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:Popup;
_local2 = int(_arg1.data1);
_local3 = int(_arg1.data2);
_local4 = int(_arg1.data3);
_local5 = true;
_local6 = SCORE_THROW_CAKE_WITH_NOTHING;
if (_local2 == 1){
_local5 = true;
_local6 = scoreThrowFrosting;
} else {
if (_local2 == 2){
_local5 = true;
_local6 = scoreThrowDecoration;
} else {
_local5 = true;
_local6 = -2000;
};
};
levelScoreCakeLosses = (levelScoreCakeLosses + _local6);
addScore(_local6);
if (_local5){
_local7 = new Popup(References.popupClip, _local3, _local4, newBaseObjects, messageCallback, _local6, baseObjectCounter);
newBaseObjects.push(_local7);
};
SoundManager.playTrash();
}
private function onWaiterLeaveNode(_arg1:InfoData){
oven1.waiterLeave();
oven2.waiterLeave();
bubbleManager.waiterLeave();
froster1.waiterLeave();
froster2.waiterLeave();
decorator1.waiterLeave();
decorator2.waiterLeave();
trashcan.waiterLeave();
displayCase.waiterLeave();
}
private function onDecorationFinished(_arg1:InfoData){
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = int(_arg1.data1);
_local3 = int(_arg1.data2);
_local4 = int(_arg1.data3);
Communicator.sendPlayData3(65, currentTick, _local2, _local3, _local4);
}
private function collisions(){
var _local1:*;
_local1 = 0;
while (_local1 < baseObjects.length) {
if (pointer.collisionTest(baseObjects[_local1])){
pointer.collisionReaction(baseObjects[_local1]);
baseObjects[_local1].collisionReaction(pointer);
};
_local1++;
};
}
private function fixMissedCheckedOnBubbles(){
var _local1:int;
if (waiter.emptyBuffer()){
_local1 = bubbleManager.bubbleChecked();
if (_local1 == 0){
waiter.gotoBubble1();
} else {
if (_local1 == 1){
waiter.gotoBubble2();
} else {
if (_local1 == 2){
waiter.gotoBubble3();
} else {
if (_local1 == 3){
waiter.gotoBubble4();
};
};
};
};
};
}
private function onHasWaiterCake(_arg1:InfoData){
var _local2:Boolean;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = waiter.hasCake();
_local3 = waiter.getCakeType();
_local4 = waiter.getFrostingType();
_local5 = waiter.getDecorationType();
oven1.setWaiterCake(_local2, _local3, _local4, _local5);
oven2.setWaiterCake(_local2, _local3, _local4, _local5);
bubbleManager.setWaiterCake(_local2, _local3, _local4, _local5);
froster1.setWaiterCake(_local2, _local3, _local4, _local5);
froster2.setWaiterCake(_local2, _local3, _local4, _local5);
decorator1.setWaiterCake(_local2, _local3, _local4, _local5);
decorator2.setWaiterCake(_local2, _local3, _local4, _local5);
trashcan.setWaiterCake(_local2, _local3, _local4, _local5);
displayCase.setWaiterCake(_local2, _local3, _local4, _local5);
}
private function onCustomerUpInSmoke(_arg1:InfoData){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Popup;
_local2 = int(_arg1.data1);
_local3 = int(_arg1.data2);
_local4 = int(_arg1.data3);
bubbleManager.removeBubble(_local2);
removeWaiterBubbleBuffered(_local2);
waiter.adjustBuffred(_local2);
fixMissedCheckedOnBubbles();
addScore(scoreCustomerLeave);
_local5 = new Popup(References.popupClip, _local3, _local4, newBaseObjects, messageCallback, scoreCustomerLeave, baseObjectCounter);
newBaseObjects.push(_local5);
}
public function getScore():int{
return (score);
}
private function removeBakersGoal(){
var _local1:int;
_local1 = 0;
while (_local1 < baseObjects.length) {
if ((baseObjects[_local1] is BakerGoal)){
baseObjects[_local1].setToBeRemoved();
baseObjects[_local1].visible = false;
break;
};
_local1++;
};
sortBaseObjects();
_local1 = 0;
while (_local1 < newBaseObjects.length) {
if ((newBaseObjects[_local1] is BakerGoal)){
newBaseObjects[_local1].setToBeRemoved();
newBaseObjects[_local1].visible = false;
break;
};
_local1++;
};
sortNewBaseObjects();
}
private function sortNewBaseObjects(){
newBaseObjects.sortOn("instanceNr", Array.NUMERIC);
}
private function onWaiterTakeMoney(_arg1:InfoData){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:Popup;
_local2 = int(_arg1.data1);
_local3 = int(_arg1.data2);
_local4 = int(_arg1.data3);
_local5 = int(_arg1.data4);
_local6 = int(_arg1.data5);
bubbleManager.removeBubble(_local2);
removeWaiterBubbleBuffered(_local2);
waiter.adjustBuffred(_local2);
fixMissedCheckedOnBubbles();
_local7 = SCORE_CAKE_NOTHING;
if (_local3 == 1){
_local7 = scoreFrosting;
} else {
if (_local3 == 2){
_local7 = scoreDecoration;
};
};
_local7 = roundScore(_local7);
_local8 = int(((_local6 / 2.5) * scoreTipPerSecond));
_local8 = roundScore(_local8);
levelScoreTips = (levelScoreTips + _local8);
levelScoreCakeSale = (levelScoreCakeSale + _local7);
_local7 = (_local7 + _local8);
addScore(_local7);
_local9 = new Popup(References.popupClip, _local4, _local5, newBaseObjects, messageCallback, _local7, baseObjectCounter);
newBaseObjects.push(_local9);
}
private function onGiveWaiterCake(_arg1:InfoData){
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = int(_arg1.data1);
_local3 = int(_arg1.data2);
_local4 = int(_arg1.data3);
waiter.setCake(_local2, _local3, _local4);
SoundManager.playPickup();
Communicator.sendPlayData3(61, currentTick, _local2, _local3, _local4);
}
private function removeObjects(){
var _local1:int;
var _local2:BaseObject;
var _local3:*;
_local1 = 0;
while (_local1 < baseObjects.length) {
if (baseObjects[_local1].toBeRemoved){
if (_local1 == (baseObjects.length - 1)){
_local2 = baseObjects.pop();
_local2.deleting();
_local2 = null;
} else {
_local3 = baseObjects.pop();
_local2 = baseObjects[_local1];
_local2.deleting();
_local2 = null;
baseObjects[_local1] = _local3;
_local1--;
};
};
_local1++;
};
sortBaseObjects();
}
private function onOvenBakedCake(_arg1:InfoData){
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = int(_arg1.data1);
_local3 = int(_arg1.data2);
_local4 = int(_arg1.data3);
Communicator.sendPlayData3(63, currentTick, _local2, _local3, _local4);
}
private function removeAllExcept(){
var _local1:Number;
var _local2:BaseObject;
var _local3:*;
_local1 = 0;
while (_local1 < baseObjects.length) {
if ((((((((((((baseObjects[_local1] is Popup)) || ((baseObjects[_local1] is BakerGoal)))) || ((baseObjects[_local1] is Bubble)))) || ((baseObjects[_local1] is Smoke)))) || ((baseObjects[_local1] is Customer)))) || ((baseObjects[_local1] is BubbleCake)))){
if (_local1 == (baseObjects.length - 1)){
_local2 = baseObjects.pop();
_local2.deleting();
_local2 = null;
} else {
_local3 = baseObjects.pop();
_local2 = baseObjects[_local1];
_local2.deleting();
_local2 = null;
baseObjects[_local1] = _local3;
_local1--;
};
};
_local1++;
};
sortBaseObjects();
removeAllNewObjects();
}
private function removeWaiterBubbleBuffered(_arg1:int){
var _local2:int;
_local2 = -1;
switch (_arg1){
case References.NODE_INDEX_BUBBLE1:
_local2 = 0;
break;
case References.NODE_INDEX_BUBBLE2:
_local2 = 1;
break;
case References.NODE_INDEX_BUBBLE3:
_local2 = 2;
break;
case References.NODE_INDEX_BUBBLE4:
_local2 = 3;
break;
};
waiter.removeBuffred(_local2);
}
private function onWaiterLeaveCake(_arg1:InfoData){
waiter.leaveCake();
SoundManager.playPlaceDown();
}
public static function roundScore(_arg1:int):int{
var _local2:int;
_local2 = int((int(((_arg1 / 100) + 0.5)) * 100));
return (_local2);
}
}
}//package com.king.cakemania
Section 47
//Counter (com.king.cakemania.Counter)
package com.king.cakemania {
public class Counter {
public var nr:int;// = 0
public function Counter(){
nr = 0;
super();
}
}
}//package com.king.cakemania
Section 48
//Customer (com.king.cakemania.Customer)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
import flash.filters.*;
class Customer extends BaseObject {
private var PINGVIN_IDLE_END:int;// = 12
private var KID_READ_END:int;// = 12
private var PINGVIN_HAPPY_START:int;// = 1
private var PINGVIN_ANGRY_START:int;// = 15
private var POLICE_READ_START:int;// = 11
private var AGENT_ANGRY_END:int;// = 24
private var ROCK_HAPPY_START:int;// = 1
private var ROCK_ANGRY_START:int;// = 14
private var ROCK_READ_END:int;// = 13
private var ASTRO_IDLE_START:int;// = 14
private var PUNK_READ_START:int;// = 17
private var happyEndAnimFrame:int;// = 10
private var ROCK_HAPPY_END:int;// = 9
private var POLICE_ANGRY_START:int;// = 13
private var ALIEN_IDLE_END:int;// = 23
private var POLICE_HAPPY_START:int;// = 1
private var KID_HAPPY_END:int;// = 8
private var ALIEN_HAPPY_START:int;// = 1
private var animationTime:int;
private var ASTRO_READ_START:int;// = 16
private var ALIEN_ANGRY_START:int;// = 26
private var state:int;
private var POLICE_READ_END:int;// = 12
private var idleStartAnimFrame:int;// = 11
private var idleLoop:Boolean;// = true
private var happyStartAnimFrame:int;// = 1
private var ASTRO_HAPPY_END:int;// = 13
private var ROCK_ANGRY_END:int;// = 24
private var KID_ANGRY_END:int;// = 23
private var AGENT_READ_END:int;// = 14
private var ALIEN_IDLE_START:int;// = 22
private var ASTRO_READ_END:int;// = 17
private var PINGVIN_READ_END:int;// = 14
private var PINGVIN_IDLE_START:int;// = 11
private var animationStartFrame:int;
private var READ_ANIM_TIME:int;// = 75
private var readStartAnimFrame:int;// = 13
private var POLICE_HAPPY_END:int;// = 8
private var ASTRO_ANGRY_END:int;// = 27
private var DOCTOR_HAPPY_START:int;// = 5
private var DOCTOR_ANGRY_START:int;// = 12
private var version:int;
private var PUNK_IDLE_END:int;// = 16
private var DOCTOR_IDLE_END:int;// = 2
private var ALIEN_READ_START:int;// = 24
private var animationEndFrame:int;
private var timerCounter:int;
private var ANGRY_ANIM_TIME:int;// = 75
private var PINGVIN_READ_START:int;// = 13
private var POLICE_ANGRY_END:int;// = 23
private var ALIEN_READ_END:int;// = 25
private var ALIEN_HAPPY_END:int;// = 21
private var switchAtFrame:int;
private var ROCK_IDLE_START:int;// = 10
private var idleEndAnimFrame:int;// = 12
private var DOCTOR_IDLE_START:int;// = 1
private var type:int;
private var PUNK_HAPPY_END:int;// = 14
private var ANGRY_SWITCH_STEP:int;// = 10
private var KID_IDLE_END:int;// = 10
private var animationFrames:int;
private var PINGVIN_HAPPY_END:int;// = 10
private var KID_IDLE_START:int;// = 9
private var readLoop:Boolean;// = true
private var angryRed:Boolean;
private var ROCK_IDLE_END:int;// = 11
private var ALIEN_ANGRY_END:int;// = 42
private var loopAnimation:Boolean;
private var ROCK_READ_START:int;// = 12
private var DOCTOR_READ_START:int;// = 3
private var HAPPY_ANIM_TIME:int;// = 50
private var PUNK_ANGRY_END:int;// = 31
private var PINGVIN_ANGRY_END:int;// = 24
private var angryEndAnimFrame:int;// = 24
private var KID_READ_START:int;// = 11
private var IDLE_ANIM_TIME:int;// = 75
private var angryStartAnimFrame:int;// = 15
private var DOCTOR_HAPPY_END:int;// = 11
private var AGENT_HAPPY_START:int;// = 1
private var AGENT_IDLE_START:int;// = 11
private var DOCTOR_READ_END:int;// = 4
private var happyLoop:Boolean;// = false
private var AGENT_ANGRY_START:int;// = 15
private var PUNK_READ_END:int;// = 18
private var PUNK_ANGRY_START:int;// = 19
private var POLICE_IDLE_END:int;// = 10
private var POLICE_IDLE_START:int;// = 9
private var DOCTOR_ANGRY_END:int;// = 20
private var PUNK_HAPPY_START:int;// = 1
private var ASTRO_HAPPY_START:int;// = 1
private var ASTRO_ANGRY_START:int;// = 18
private var angryLoop:Boolean;// = false
private var AGENT_HAPPY_END:int;// = 10
private var AGENT_IDLE_END:int;// = 12
private var KID_ANGRY_START:int;// = 13
private var ASTRO_IDLE_END:int;// = 15
private var KID_HAPPY_START:int;// = 1
private var AGENT_READ_START:int;// = 13
private var PUNK_IDLE_START:int;// = 15
private var readEndAnimFrame:int;// = 14
public static var STATE_HAPPY:int = 1;
public static var STATE_IDLE:int = 0;
public static var STATE_READ:int = 2;
public static var STATE_ANGRY:int = 3;
function Customer(_arg1:int, _arg2:MovieClip, _arg3:Number, _arg4:Number, _arg5:Array, _arg6:Function, _arg7, _arg8:Counter){
HAPPY_ANIM_TIME = (2 * 25);
IDLE_ANIM_TIME = (3 * 25);
READ_ANIM_TIME = (3 * 25);
ANGRY_ANIM_TIME = (3 * 25);
ANGRY_SWITCH_STEP = 10;
AGENT_HAPPY_START = 1;
AGENT_HAPPY_END = 10;
AGENT_IDLE_START = 11;
AGENT_IDLE_END = 12;
AGENT_READ_START = 13;
AGENT_READ_END = 14;
AGENT_ANGRY_START = 15;
AGENT_ANGRY_END = 24;
ROCK_HAPPY_START = 1;
ROCK_HAPPY_END = 9;
ROCK_IDLE_START = 10;
ROCK_IDLE_END = 11;
ROCK_READ_START = 12;
ROCK_READ_END = 13;
ROCK_ANGRY_START = 14;
ROCK_ANGRY_END = 24;
POLICE_HAPPY_START = 1;
POLICE_HAPPY_END = 8;
POLICE_IDLE_START = 9;
POLICE_IDLE_END = 10;
POLICE_READ_START = 11;
POLICE_READ_END = 12;
POLICE_ANGRY_START = 13;
POLICE_ANGRY_END = 23;
PINGVIN_HAPPY_START = 1;
PINGVIN_HAPPY_END = 10;
PINGVIN_IDLE_START = 11;
PINGVIN_IDLE_END = 12;
PINGVIN_READ_START = 13;
PINGVIN_READ_END = 14;
PINGVIN_ANGRY_START = 15;
PINGVIN_ANGRY_END = 24;
KID_HAPPY_START = 1;
KID_HAPPY_END = 8;
KID_IDLE_START = 9;
KID_IDLE_END = 10;
KID_READ_START = 11;
KID_READ_END = 12;
KID_ANGRY_START = 13;
KID_ANGRY_END = 23;
DOCTOR_HAPPY_START = 5;
DOCTOR_HAPPY_END = 11;
DOCTOR_IDLE_START = 1;
DOCTOR_IDLE_END = 2;
DOCTOR_READ_START = 3;
DOCTOR_READ_END = 4;
DOCTOR_ANGRY_START = 12;
DOCTOR_ANGRY_END = 20;
PUNK_HAPPY_START = 1;
PUNK_HAPPY_END = 14;
PUNK_IDLE_START = 15;
PUNK_IDLE_END = 16;
PUNK_READ_START = 17;
PUNK_READ_END = 18;
PUNK_ANGRY_START = 19;
PUNK_ANGRY_END = 31;
ASTRO_HAPPY_START = 1;
ASTRO_HAPPY_END = 13;
ASTRO_IDLE_START = 14;
ASTRO_IDLE_END = 15;
ASTRO_READ_START = 16;
ASTRO_READ_END = 17;
ASTRO_ANGRY_START = 18;
ASTRO_ANGRY_END = 27;
ALIEN_HAPPY_START = 1;
ALIEN_HAPPY_END = 21;
ALIEN_IDLE_START = 22;
ALIEN_IDLE_END = 23;
ALIEN_READ_START = 24;
ALIEN_READ_END = 25;
ALIEN_ANGRY_START = 26;
ALIEN_ANGRY_END = 42;
happyLoop = false;
happyStartAnimFrame = 1;
happyEndAnimFrame = 10;
idleLoop = true;
idleStartAnimFrame = 11;
idleEndAnimFrame = 12;
readLoop = true;
readStartAnimFrame = 13;
readEndAnimFrame = 14;
angryLoop = false;
angryStartAnimFrame = 15;
angryEndAnimFrame = 24;
super(_arg2, _arg3, _arg4, _arg5, _arg6, _arg8);
this.type = _arg7;
this.version = _arg1;
createClip2();
}
public function setReadState(){
clip.filters = [];
animationTime = READ_ANIM_TIME;
loopAnimation = readLoop;
animationStartFrame = readStartAnimFrame;
animationEndFrame = readEndAnimFrame;
animationFrames = (animationEndFrame - animationStartFrame);
timerCounter = 0;
visible = true;
state = STATE_READ;
}
public function setIdleState(){
clip.filters = [];
animationTime = IDLE_ANIM_TIME;
loopAnimation = idleLoop;
animationStartFrame = idleStartAnimFrame;
animationEndFrame = idleEndAnimFrame;
animationFrames = (animationEndFrame - animationStartFrame);
timerCounter = 0;
visible = true;
state = STATE_IDLE;
}
public function hide(){
visible = false;
}
protected function createClip2():void{
switch (type){
case 0:
switch (version){
case CakeMania.HR_VERSION:
happyStartAnimFrame = AGENT_HAPPY_START;
happyEndAnimFrame = AGENT_HAPPY_END;
idleStartAnimFrame = AGENT_IDLE_START;
idleEndAnimFrame = AGENT_IDLE_END;
readStartAnimFrame = AGENT_READ_START;
readEndAnimFrame = AGENT_READ_END;
angryStartAnimFrame = AGENT_ANGRY_START;
angryEndAnimFrame = AGENT_ANGRY_END;
clip = new agent();
break;
case CakeMania.WATER_VERSION:
happyStartAnimFrame = PINGVIN_HAPPY_START;
happyEndAnimFrame = PINGVIN_HAPPY_END;
idleStartAnimFrame = PINGVIN_IDLE_START;
idleEndAnimFrame = PINGVIN_IDLE_END;
readStartAnimFrame = PINGVIN_READ_START;
readEndAnimFrame = PINGVIN_READ_END;
angryStartAnimFrame = PINGVIN_ANGRY_START;
angryEndAnimFrame = PINGVIN_ANGRY_END;
clip = new pingvin();
break;
case CakeMania.FUTURE_VERSION:
happyStartAnimFrame = PUNK_HAPPY_START;
happyEndAnimFrame = PUNK_HAPPY_END;
idleStartAnimFrame = PUNK_IDLE_START;
idleEndAnimFrame = PUNK_IDLE_END;
readStartAnimFrame = PUNK_READ_START;
readEndAnimFrame = PUNK_READ_END;
angryStartAnimFrame = PUNK_ANGRY_START;
angryEndAnimFrame = PUNK_ANGRY_END;
clip = new punk();
break;
};
break;
case 1:
switch (version){
case CakeMania.HR_VERSION:
happyStartAnimFrame = ROCK_HAPPY_START;
happyEndAnimFrame = ROCK_HAPPY_END;
idleStartAnimFrame = ROCK_IDLE_START;
idleEndAnimFrame = ROCK_IDLE_END;
readStartAnimFrame = ROCK_READ_START;
readEndAnimFrame = ROCK_READ_END;
angryStartAnimFrame = ROCK_ANGRY_START;
angryEndAnimFrame = ROCK_ANGRY_END;
clip = new rock();
break;
case CakeMania.WATER_VERSION:
happyStartAnimFrame = KID_HAPPY_START;
happyEndAnimFrame = KID_HAPPY_END;
idleStartAnimFrame = KID_IDLE_START;
idleEndAnimFrame = KID_IDLE_END;
readStartAnimFrame = KID_READ_START;
readEndAnimFrame = KID_READ_END;
angryStartAnimFrame = KID_ANGRY_START;
angryEndAnimFrame = KID_ANGRY_END;
clip = new kid();
break;
case CakeMania.FUTURE_VERSION:
happyStartAnimFrame = ASTRO_HAPPY_START;
happyEndAnimFrame = ASTRO_HAPPY_END;
idleStartAnimFrame = ASTRO_IDLE_START;
idleEndAnimFrame = ASTRO_IDLE_END;
readStartAnimFrame = ASTRO_READ_START;
readEndAnimFrame = ASTRO_READ_END;
angryStartAnimFrame = ASTRO_ANGRY_START;
angryEndAnimFrame = ASTRO_ANGRY_END;
clip = new astro();
break;
};
break;
case 2:
switch (version){
case CakeMania.HR_VERSION:
happyStartAnimFrame = POLICE_HAPPY_START;
happyEndAnimFrame = POLICE_HAPPY_END;
idleStartAnimFrame = POLICE_IDLE_START;
idleEndAnimFrame = POLICE_IDLE_END;
readStartAnimFrame = POLICE_READ_START;
readEndAnimFrame = POLICE_READ_END;
angryStartAnimFrame = POLICE_ANGRY_START;
angryEndAnimFrame = POLICE_ANGRY_END;
clip = new police();
break;
case CakeMania.WATER_VERSION:
happyStartAnimFrame = DOCTOR_HAPPY_START;
happyEndAnimFrame = DOCTOR_HAPPY_END;
idleStartAnimFrame = DOCTOR_IDLE_START;
idleEndAnimFrame = DOCTOR_IDLE_END;
readStartAnimFrame = DOCTOR_READ_START;
readEndAnimFrame = DOCTOR_READ_END;
angryStartAnimFrame = DOCTOR_ANGRY_START;
angryEndAnimFrame = DOCTOR_ANGRY_END;
clip = new doctor();
break;
case CakeMania.FUTURE_VERSION:
happyStartAnimFrame = ALIEN_HAPPY_START;
happyEndAnimFrame = ALIEN_HAPPY_END;
idleStartAnimFrame = ALIEN_IDLE_START;
idleEndAnimFrame = ALIEN_IDLE_END;
readStartAnimFrame = ALIEN_READ_START;
readEndAnimFrame = ALIEN_READ_END;
angryStartAnimFrame = ALIEN_ANGRY_START;
angryEndAnimFrame = ALIEN_ANGRY_END;
clip = new alien();
break;
};
break;
};
switch (version){
case CakeMania.HR_VERSION:
clip.scaleX = 1;
break;
case CakeMania.WATER_VERSION:
clip.scaleX = -1;
break;
case CakeMania.FUTURE_VERSION:
clip.scaleX = 1;
break;
};
animationTime = HAPPY_ANIM_TIME;
loopAnimation = happyLoop;
animationStartFrame = happyStartAnimFrame;
animationEndFrame = happyEndAnimFrame;
animationFrames = (animationEndFrame - animationStartFrame);
clip.x = posX;
clip.y = posY;
parentClip.addChildAt(clip, 1);
}
public function setAngryState(){
animationTime = ANGRY_ANIM_TIME;
loopAnimation = angryLoop;
animationStartFrame = angryStartAnimFrame;
animationEndFrame = angryEndAnimFrame;
animationFrames = (animationEndFrame - animationStartFrame);
timerCounter = 0;
visible = true;
state = STATE_ANGRY;
angryRed = false;
switchAtFrame = 1;
}
public function setHappyState(){
clip.filters = [];
animationTime = HAPPY_ANIM_TIME;
loopAnimation = happyLoop;
animationStartFrame = happyStartAnimFrame;
animationEndFrame = happyEndAnimFrame;
animationFrames = (animationEndFrame - animationStartFrame);
timerCounter = 0;
visible = true;
state = STATE_HAPPY;
}
override public function tick(){
var _local1:GlowFilter;
super.tick();
timerCounter++;
animFrame = (animationStartFrame + int((timerCounter / (animationTime / animationFrames))));
if (animFrame > animationEndFrame){
if (loopAnimation){
animFrame = animationStartFrame;
timerCounter = 0;
} else {
animFrame = animationEndFrame;
timerCounter = animationTime;
};
};
if (state == STATE_ANGRY){
if (animFrame == animationEndFrame){
clip.filters = [];
} else {
if ((((timerCounter == switchAtFrame)) && (!(angryRed)))){
switchAtFrame = (switchAtFrame + ANGRY_SWITCH_STEP);
angryRed = true;
_local1 = new GlowFilter(0xFE1D00, 1, 7, 7, 0xFF, BitmapFilterQuality.LOW, false, false);
clip.filters = [_local1];
} else {
if ((((timerCounter == switchAtFrame)) && (angryRed))){
switchAtFrame = (switchAtFrame + ANGRY_SWITCH_STEP);
angryRed = false;
clip.filters = [];
};
};
};
};
}
}
}//package com.king.cakemania
Section 49
//Decorator (com.king.cakemania.Decorator)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class Decorator extends BaseObject {
private var cakeButtoneChecked:Boolean;
private var buttonChecked:Array;
private var timerAnimFrame:int;
private var decorationType:int;
private var buttonOver:Array;
var button1Clip:MovieClip;
var button3Clip:MovieClip;
private var cake:Cake;
private var showTimer:Boolean;
private var checkedIndex:int;
private var showProgressBar:Boolean;
private var workTime:int;
private var buttonType:Array;
private var state:int;
private var waiterDecorationType:int;
private var waiterGotCake:Boolean;
private var waiterCakeType:int;
private var showWork:Boolean;
var button2Clip:MovieClip;
var button4Clip:MovieClip;
var input:Input;
var nr:int;
private var buttonAnimFrame:Array;
private var workAnimFrame:int;
private var progressBarAnimFrame:int;
private var gotCake:Boolean;
private var collisionButtons:Array;
private var waiterHere:Boolean;
private var timerCounter:int;
private var waiterFrostingType:int;
public static var STATE_IDLE:int = 0;
public static var STATE_WORKING:int = 1;
function Decorator(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Function, _arg6:MovieClip, _arg7:int, _arg8:Counter, _arg9:Random, _arg10:Input){
buttonOver = [false, false, false, false];
buttonChecked = [false, false, false, false];
buttonAnimFrame = [1, 1, 1, 1];
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg8);
clip = _arg6;
this.nr = _arg7;
this.input = _arg10;
cake = new Cake(clip, clip.cake_mc.x, clip.cake_mc.y, _arg4, _arg5, clip.cake_mc, true, _arg8, _arg9);
_arg4.push(cake);
collisionButtons = new Array(4);
collisionButtons[0] = new CollisionObject(((_arg2 - 32) - 10), (_arg3 - 12), 24);
collisionButtons[1] = new CollisionObject(((_arg2 - 32) + 6), (_arg3 + 15), 24);
collisionButtons[2] = new CollisionObject(((_arg2 + 32) - 10), (_arg3 + 15), 24);
collisionButtons[3] = new CollisionObject(((_arg2 + 32) + 10), (_arg3 - 12), 24);
init(999, [1, 1, 1, 1]);
}
public function init(_arg1:int, _arg2:Array){
this.workTime = _arg1;
this.buttonType = _arg2;
cakeButtoneChecked = false;
showProgressBar = false;
showWork = false;
showTimer = false;
gotCake = false;
cake.visible = false;
waiterHere = false;
waiterGotCake = false;
checkedIndex = -1;
progressBarAnimFrame = 1;
workAnimFrame = 1;
timerAnimFrame = 1;
setupButtons();
buttonOver = [false, false, false, false];
buttonChecked = [false, false, false, false];
buttonAnimFrame = [1, 1, 1, 1];
createCollisionObject();
state = STATE_IDLE;
}
private function setDecorationType(_arg1:int){
switch (_arg1){
case 0:
decorationType = buttonType[0];
break;
case 1:
decorationType = buttonType[1];
break;
case 2:
decorationType = buttonType[2];
break;
case 3:
decorationType = buttonType[3];
break;
};
}
public function setWaiterCake(_arg1:Boolean, _arg2:int, _arg3:int, _arg4:int){
waiterGotCake = _arg1;
waiterCakeType = _arg2;
waiterFrostingType = _arg3;
waiterDecorationType = _arg4;
}
private function setupButtons(){
clip.button1.cat_mc.visible = false;
clip.button1.mask_mc.visible = false;
clip.button1.palm_mc.visible = false;
clip.button1.horseshoe_mc.visible = false;
switch (buttonType[0]){
case 1:
button1Clip = clip.button1.palm_mc;
break;
case 2:
button1Clip = clip.button1.cat_mc;
break;
case 3:
button1Clip = clip.button1.horseshoe_mc;
break;
case 4:
button1Clip = clip.button1.mask_mc;
break;
};
button1Clip.visible = true;
clip.button2.cat_mc.visible = false;
clip.button2.mask_mc.visible = false;
clip.button2.palm_mc.visible = false;
clip.button2.horseshoe_mc.visible = false;
switch (buttonType[1]){
case 1:
button2Clip = clip.button2.palm_mc;
break;
case 2:
button2Clip = clip.button2.cat_mc;
break;
case 3:
button2Clip = clip.button2.horseshoe_mc;
break;
case 4:
button2Clip = clip.button2.mask_mc;
break;
};
button2Clip.visible = true;
clip.button3.cat_mc.visible = false;
clip.button3.mask_mc.visible = false;
clip.button3.palm_mc.visible = false;
clip.button3.horseshoe_mc.visible = false;
switch (buttonType[2]){
case 1:
button3Clip = clip.button3.palm_mc;
break;
case 2:
button3Clip = clip.button3.cat_mc;
break;
case 3:
button3Clip = clip.button3.horseshoe_mc;
break;
case 4:
button3Clip = clip.button3.mask_mc;
break;
};
button3Clip.visible = true;
clip.button4.cat_mc.visible = false;
clip.button4.mask_mc.visible = false;
clip.button4.palm_mc.visible = false;
clip.button4.horseshoe_mc.visible = false;
switch (buttonType[3]){
case 1:
button4Clip = clip.button4.palm_mc;
break;
case 2:
button4Clip = clip.button4.cat_mc;
break;
case 3:
button4Clip = clip.button4.horseshoe_mc;
break;
case 4:
button4Clip = clip.button4.mask_mc;
break;
};
button4Clip.visible = true;
}
public function waiterArrive(){
waiterHere = true;
}
public function clickCheck(_arg1:BaseObject){
var _local2:Boolean;
var _local3:Boolean;
var _local4:*;
var _local5:Boolean;
var _local6:InfoData;
_local2 = false;
_local3 = false;
_local4 = 0;
while (_local4 < 4) {
if (buttonChecked[_local4]){
_local3 = true;
break;
};
_local4++;
};
_local5 = false;
_local4 = 0;
while (_local4 < 4) {
if (_arg1.collisionObject.collisionTest(collisionButtons[_local4])){
_local2 = true;
if (_local3){
if (buttonChecked[_local4]){
buttonChecked[_local4] = false;
checkedIndex = -1;
};
} else {
buttonChecked[_local4] = true;
_local5 = true;
checkedIndex = _local4;
};
};
_local4++;
};
if (_local5){
_local6 = new InfoData();
_local6.data1 = nr;
messageCallback("decorator button checked", _local6);
};
if (!_local2){
if (cakeButtoneChecked){
cakeButtoneChecked = false;
} else {
cakeButtoneChecked = true;
_local6 = new InfoData();
_local6.data1 = nr;
messageCallback("decorator button checked", _local6);
};
};
}
override protected function createCollisionObject():void{
collisionObject = new CollisionObject(0, 0, 100);
}
override public function collisionReaction(_arg1:BaseObject){
messageCallback("collision", null);
overCheck(_arg1);
if ((((state == STATE_IDLE)) && (input.mouseIsPressed))){
clickCheck(_arg1);
};
}
override public function render(_arg1:Number){
super.render(_arg1);
button1Clip.gotoAndStop(buttonAnimFrame[0]);
button2Clip.gotoAndStop(buttonAnimFrame[1]);
button3Clip.gotoAndStop(buttonAnimFrame[2]);
button4Clip.gotoAndStop(buttonAnimFrame[3]);
clip.Marker1_mc.visible = buttonChecked[0];
clip.Marker2_mc.visible = buttonChecked[1];
clip.Marker3_mc.visible = buttonChecked[2];
clip.Marker4_mc.visible = buttonChecked[3];
clip.Marker5_mc.visible = cakeButtoneChecked;
if (showProgressBar){
clip.progressbar.visible = true;
clip.progressbar.gotoAndStop(progressBarAnimFrame);
} else {
clip.progressbar.visible = false;
};
if (showWork){
clip.cream.visible = true;
clip.cream.gotoAndStop(workAnimFrame);
} else {
clip.cream.visible = false;
};
if (showTimer){
clip.readyCircle_mc.visible = true;
clip.readyCircle_mc.gotoAndStop(workAnimFrame);
} else {
clip.readyCircle_mc.visible = false;
};
}
override public function tick(){
var _local1:*;
var _local2:InfoData;
super.tick();
_local1 = 0;
while (_local1 < 4) {
if (buttonOver[_local1]){
buttonAnimFrame[_local1] = 2;
buttonOver[_local1] = false;
} else {
buttonAnimFrame[_local1] = 1;
};
_local1++;
};
switch (state){
case STATE_IDLE:
if (((cakeButtoneChecked) && (waiterHere))){
_local2 = new InfoData();
messageCallback("has waiter cake?", _local2);
if (((gotCake) && (!(waiterGotCake)))){
cakeButtoneChecked = false;
cake.visible = false;
gotCake = false;
_local2 = new InfoData();
_local2.data1 = cake.getCakeType();
_local2.data2 = cake.getFrostingType();
_local2.data3 = cake.getDecorationType();
messageCallback("give waiter cake", _local2);
} else {
if (((!(gotCake)) && (waiterGotCake))){
cakeButtoneChecked = false;
waiterGotCake = false;
gotCake = true;
cake.visible = true;
cake.setTypes(waiterCakeType, waiterFrostingType, waiterDecorationType);
_local2 = new InfoData();
messageCallback("waiter leave cake", _local2);
} else {
cakeButtoneChecked = false;
};
};
};
_local2 = new InfoData();
messageCallback("has waiter cake?", _local2);
if (((((((((waiterHere) && (!((checkedIndex == -1))))) && (gotCake))) && (!((cake.getFrostingType() == 0))))) && ((cake.getDecorationType() == 0)))){
setDecorationType(checkedIndex);
buttonChecked[checkedIndex] = false;
checkedIndex = -1;
timerCounter = 0;
showProgressBar = true;
showWork = true;
showTimer = true;
state = STATE_WORKING;
SoundManager.playDecorationRunningSound(workTime);
} else {
if (((((((waiterHere) && (!((checkedIndex == -1))))) && (!(gotCake)))) && (waiterGotCake))){
waiterGotCake = false;
gotCake = true;
cake.visible = true;
cake.setTypes(waiterCakeType, waiterFrostingType, waiterDecorationType);
_local2 = new InfoData();
messageCallback("waiter leave cake", _local2);
if ((((waiterFrostingType == 0)) || (!((waiterDecorationType == 0))))){
buttonChecked[checkedIndex] = false;
checkedIndex = -1;
} else {
setDecorationType(checkedIndex);
buttonChecked[checkedIndex] = false;
checkedIndex = -1;
timerCounter = 0;
showProgressBar = true;
showWork = true;
showTimer = true;
state = STATE_WORKING;
SoundManager.playDecorationRunningSound(workTime);
};
} else {
if (((waiterHere) && (!((checkedIndex == -1))))){
buttonChecked[checkedIndex] = false;
checkedIndex = -1;
};
};
};
break;
case STATE_WORKING:
timerCounter++;
progressBarAnimFrame = int(((timerCounter / (workTime / 7)) + 1));
if (progressBarAnimFrame > 7){
progressBarAnimFrame = 7;
};
workAnimFrame = int(((timerCounter / (workTime / 15)) + 1));
if (workAnimFrame > 15){
workAnimFrame = 15;
};
timerAnimFrame = int(((timerCounter / (workTime / 16)) + 1));
if (timerAnimFrame > 16){
timerAnimFrame = 16;
};
if (timerCounter == workTime){
showProgressBar = false;
showWork = false;
showTimer = false;
setDecoration();
state = STATE_IDLE;
_local2 = new InfoData();
_local2.data1 = cake.getCakeType();
_local2.data2 = cake.getFrostingType();
_local2.data3 = cake.getDecorationType();
messageCallback("decorating finished", _local2);
};
break;
};
}
public function overCheck(_arg1:BaseObject){
if (_arg1.collisionObject.collisionTest(collisionButtons[0])){
buttonOver[0] = true;
} else {
if (_arg1.collisionObject.collisionTest(collisionButtons[1])){
buttonOver[1] = true;
} else {
if (_arg1.collisionObject.collisionTest(collisionButtons[2])){
buttonOver[2] = true;
} else {
if (_arg1.collisionObject.collisionTest(collisionButtons[3])){
buttonOver[3] = true;
};
};
};
};
}
private function setDecoration(){
cake.setDecorationType(decorationType);
}
public function waiterLeave(){
waiterHere = false;
}
}
}//package com.king.cakemania
Section 50
//DisplayCase (com.king.cakemania.DisplayCase)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class DisplayCase extends BaseObject {
private var gotCake:Boolean;
private var waiterDecorationType:int;
private var waiterHere:Boolean;
private var buttonChecked:Boolean;
private var decorationType:int;
private var waiterCakeType:int;
private var waiterGotCake:Boolean;
private var cake:Cake;
private var input:Input;
private var waiterFrostingType:int;
function DisplayCase(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Function, _arg6:MovieClip, _arg7:Counter, _arg8:Random, _arg9:Input){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg7);
clip = _arg6;
this.input = _arg9;
cake = new Cake(clip, clip.cake_mc.x, clip.cake_mc.y, _arg4, _arg5, clip.cake_mc, true, _arg7, _arg8);
_arg4.push(cake);
init();
}
public function getDecorationType():int{
if (gotCake){
return (cake.getDecorationType());
};
return (-1);
}
public function waiterLeave(){
waiterHere = false;
}
override public function render(_arg1:Number){
super.render(_arg1);
clip.Marker1_mc.visible = buttonChecked;
}
public function init(){
buttonChecked = false;
gotCake = false;
cake.visible = false;
waiterHere = false;
waiterGotCake = false;
createCollisionObject();
}
override public function tick(){
var _local1:InfoData;
super.tick();
if (((buttonChecked) && (waiterHere))){
_local1 = new InfoData();
messageCallback("has waiter cake?", _local1);
if (((gotCake) && (!(waiterGotCake)))){
buttonChecked = false;
cake.visible = false;
gotCake = false;
_local1 = new InfoData();
_local1.data1 = cake.getCakeType();
_local1.data2 = cake.getFrostingType();
_local1.data3 = cake.getDecorationType();
messageCallback("give waiter cake", _local1);
} else {
if (((!(gotCake)) && (waiterGotCake))){
buttonChecked = false;
waiterGotCake = false;
gotCake = true;
cake.visible = true;
cake.setTypes(waiterCakeType, waiterFrostingType, waiterDecorationType);
_local1 = new InfoData();
messageCallback("waiter leave cake", _local1);
} else {
buttonChecked = false;
};
};
};
}
public function getCakeType():int{
if (gotCake){
return (cake.getCakeType());
};
return (-1);
}
public function setWaiterCake(_arg1:Boolean, _arg2:int, _arg3:int, _arg4:int){
waiterGotCake = _arg1;
waiterCakeType = _arg2;
waiterFrostingType = _arg3;
waiterDecorationType = _arg4;
}
public function caseGotCake():Boolean{
return (gotCake);
}
public function waiterArrive(){
waiterHere = true;
}
private function clickCheck(){
var _local1:InfoData;
if (buttonChecked){
buttonChecked = false;
} else {
buttonChecked = true;
_local1 = new InfoData();
messageCallback("display case checked", _local1);
};
}
public function getFrostingType():int{
if (gotCake){
return (cake.getFrostingType());
};
return (-1);
}
override protected function createCollisionObject():void{
collisionObject = new CollisionObject(0, 0, 55);
}
override public function collisionReaction(_arg1:BaseObject){
messageCallback("collision", null);
if (input.mouseIsPressed){
clickCheck();
};
}
}
}//package com.king.cakemania
Section 51
//Froster (com.king.cakemania.Froster)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class Froster extends BaseObject {
private var cakeButtoneChecked:Boolean;
private var buttonChecked:Array;
private var timerAnimFrame:int;
private var buttonOver:Array;
var button1Clip:MovieClip;
var button3Clip:MovieClip;
private var cake:Cake;
private var showTimer:Boolean;
private var checkedIndex:int;
private var showProgressBar:Boolean;
private var workTime:int;
private var buttonType:Array;
private var state:int;
private var waiterDecorationType:int;
private var waiterGotCake:Boolean;
private var waiterCakeType:int;
private var showWork:Boolean;
var button2Clip:MovieClip;
var button4Clip:MovieClip;
private var input:Input;
var nr:int;
private var buttonAnimFrame:Array;
private var workAnimFrame:int;
private var progressBarAnimFrame:int;
private var gotCake:Boolean;
private var collisionButtons:Array;
private var waiterHere:Boolean;
private var timerCounter:int;
private var frostingType:int;
private var waiterFrostingType:int;
public static var STATE_IDLE:int = 0;
public static var STATE_WORKING:int = 1;
function Froster(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Function, _arg6:MovieClip, _arg7:int, _arg8:Counter, _arg9:Random, _arg10:Input){
buttonOver = [false, false, false, false];
buttonChecked = [false, false, false, false];
buttonAnimFrame = [1, 1, 1, 1];
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg8);
clip = _arg6;
this.nr = _arg7;
this.input = _arg10;
cake = new Cake(clip, clip.cake_mc.x, clip.cake_mc.y, _arg4, _arg5, clip.cake_mc, true, _arg8, _arg9);
_arg4.push(cake);
collisionButtons = new Array(4);
collisionButtons[0] = new CollisionObject((((_arg2 - 32) - 10) + 3), ((_arg3 - 12) + 1), 24);
collisionButtons[1] = new CollisionObject(((_arg2 - 32) + 2), ((_arg3 + 15) - 2), 24);
collisionButtons[2] = new CollisionObject((_arg2 + 32), ((_arg3 + 15) - 2), 24);
collisionButtons[3] = new CollisionObject((((_arg2 + 32) + 10) - 4), (_arg3 - 12), 24);
init(999, [1, 1, 1, 1]);
}
public function init(_arg1:int, _arg2:Array){
this.workTime = _arg1;
this.buttonType = _arg2;
setupButtons();
cakeButtoneChecked = false;
showProgressBar = false;
showWork = false;
showTimer = false;
gotCake = false;
cake.visible = false;
waiterHere = false;
waiterGotCake = false;
checkedIndex = -1;
progressBarAnimFrame = 1;
workAnimFrame = 1;
timerAnimFrame = 1;
setupButtons();
buttonOver = [false, false, false, false];
buttonChecked = [false, false, false, false];
buttonAnimFrame = [1, 1, 1, 1];
createCollisionObject();
state = STATE_IDLE;
}
private function setFrosting(){
cake.setFrostingType(frostingType);
}
public function setWaiterCake(_arg1:Boolean, _arg2:int, _arg3:int, _arg4:int){
waiterGotCake = _arg1;
waiterCakeType = _arg2;
waiterFrostingType = _arg3;
waiterDecorationType = _arg4;
}
private function setupButtons(){
clip.button1.white_mc.visible = false;
clip.button1.prick_mc.visible = false;
clip.button1.violet_mc.visible = false;
clip.button1.brown_mc.visible = false;
clip.button1.yellow_mc.visible = false;
switch (buttonType[0]){
case 4:
button1Clip = clip.button1.white_mc;
break;
case 6:
button1Clip = clip.button1.prick_mc;
break;
case 1:
button1Clip = clip.button1.violet_mc;
break;
case 2:
button1Clip = clip.button1.brown_mc;
break;
case 5:
button1Clip = clip.button1.yellow_mc;
break;
};
button1Clip.visible = true;
clip.button2.white_mc.visible = false;
clip.button2.prick_mc.visible = false;
clip.button2.violet_mc.visible = false;
clip.button2.brown_mc.visible = false;
clip.button2.yellow_mc.visible = false;
switch (buttonType[1]){
case 4:
button2Clip = clip.button2.white_mc;
break;
case 6:
button2Clip = clip.button2.prick_mc;
break;
case 1:
button2Clip = clip.button2.violet_mc;
break;
case 2:
button2Clip = clip.button2.brown_mc;
break;
case 5:
button2Clip = clip.button2.yellow_mc;
break;
};
button2Clip.visible = true;
clip.button3.white_mc.visible = false;
clip.button3.prick_mc.visible = false;
clip.button3.violet_mc.visible = false;
clip.button3.brown_mc.visible = false;
clip.button3.yellow_mc.visible = false;
switch (buttonType[2]){
case 4:
button3Clip = clip.button3.white_mc;
break;
case 6:
button3Clip = clip.button3.prick_mc;
break;
case 1:
button3Clip = clip.button3.violet_mc;
break;
case 2:
button3Clip = clip.button3.brown_mc;
break;
case 5:
button3Clip = clip.button3.yellow_mc;
break;
};
button3Clip.visible = true;
clip.button4.white_mc.visible = false;
clip.button4.prick_mc.visible = false;
clip.button4.violet_mc.visible = false;
clip.button4.brown_mc.visible = false;
clip.button4.yellow_mc.visible = false;
switch (buttonType[3]){
case 4:
button4Clip = clip.button4.white_mc;
break;
case 6:
button4Clip = clip.button4.prick_mc;
break;
case 1:
button4Clip = clip.button4.violet_mc;
break;
case 2:
button4Clip = clip.button4.brown_mc;
break;
case 5:
button4Clip = clip.button4.yellow_mc;
break;
};
button4Clip.visible = true;
}
public function waiterArrive(){
waiterHere = true;
}
public function clickCheck(_arg1:BaseObject){
var _local2:Boolean;
var _local3:Boolean;
var _local4:*;
var _local5:Boolean;
var _local6:InfoData;
_local2 = false;
_local3 = false;
_local4 = 0;
while (_local4 < 4) {
if (buttonChecked[_local4]){
_local3 = true;
break;
};
_local4++;
};
_local5 = false;
_local4 = 0;
while (_local4 < 4) {
if (_arg1.collisionObject.collisionTest(collisionButtons[_local4])){
_local2 = true;
if (_local3){
if (buttonChecked[_local4]){
buttonChecked[_local4] = false;
checkedIndex = -1;
};
} else {
buttonChecked[_local4] = true;
_local5 = true;
checkedIndex = _local4;
};
};
_local4++;
};
if (_local5){
_local6 = new InfoData();
_local6.data1 = nr;
messageCallback("froster button checked", _local6);
};
if (!_local2){
if (cakeButtoneChecked){
cakeButtoneChecked = false;
} else {
cakeButtoneChecked = true;
_local6 = new InfoData();
_local6.data1 = nr;
messageCallback("froster button checked", _local6);
};
};
}
override protected function createCollisionObject():void{
collisionObject = new CollisionObject(0, 0, 100);
}
private function setFrostingType(_arg1:int){
switch (_arg1){
case 0:
frostingType = buttonType[0];
break;
case 1:
frostingType = buttonType[1];
break;
case 2:
frostingType = buttonType[2];
break;
case 3:
frostingType = buttonType[3];
break;
};
}
override public function collisionReaction(_arg1:BaseObject){
messageCallback("collision", null);
overCheck(_arg1);
if ((((state == STATE_IDLE)) && (input.mouseIsPressed))){
clickCheck(_arg1);
};
}
override public function render(_arg1:Number){
super.render(_arg1);
button1Clip.gotoAndStop(buttonAnimFrame[0]);
button2Clip.gotoAndStop(buttonAnimFrame[1]);
button3Clip.gotoAndStop(buttonAnimFrame[2]);
button4Clip.gotoAndStop(buttonAnimFrame[3]);
clip.Marker1_mc.visible = buttonChecked[0];
clip.Marker2_mc.visible = buttonChecked[1];
clip.Marker3_mc.visible = buttonChecked[2];
clip.Marker4_mc.visible = buttonChecked[3];
clip.Marker5_mc.visible = cakeButtoneChecked;
if (showProgressBar){
clip.progressbar.visible = true;
clip.progressbar.gotoAndStop(progressBarAnimFrame);
} else {
clip.progressbar.visible = false;
};
if (showWork){
clip.cream.visible = true;
clip.cream.gotoAndStop(workAnimFrame);
} else {
clip.cream.visible = false;
};
if (showTimer){
clip.readyCircle_mc.visible = true;
clip.readyCircle_mc.gotoAndStop(workAnimFrame);
} else {
clip.readyCircle_mc.visible = false;
};
}
override public function tick(){
var _local1:*;
var _local2:InfoData;
super.tick();
_local1 = 0;
while (_local1 < 4) {
if (buttonOver[_local1]){
buttonAnimFrame[_local1] = 2;
buttonOver[_local1] = false;
} else {
buttonAnimFrame[_local1] = 1;
};
_local1++;
};
switch (state){
case STATE_IDLE:
if (((cakeButtoneChecked) && (waiterHere))){
_local2 = new InfoData();
messageCallback("has waiter cake?", _local2);
if (((gotCake) && (!(waiterGotCake)))){
cakeButtoneChecked = false;
cake.visible = false;
gotCake = false;
_local2 = new InfoData();
_local2.data1 = cake.getCakeType();
_local2.data2 = cake.getFrostingType();
_local2.data3 = cake.getDecorationType();
messageCallback("give waiter cake", _local2);
} else {
if (((!(gotCake)) && (waiterGotCake))){
cakeButtoneChecked = false;
waiterGotCake = false;
gotCake = true;
cake.visible = true;
cake.setTypes(waiterCakeType, waiterFrostingType, waiterDecorationType);
_local2 = new InfoData();
messageCallback("waiter leave cake", _local2);
} else {
cakeButtoneChecked = false;
};
};
};
_local2 = new InfoData();
messageCallback("has waiter cake?", _local2);
if (((((((waiterHere) && (!((checkedIndex == -1))))) && (gotCake))) && ((cake.getFrostingType() == 0)))){
setFrostingType(checkedIndex);
buttonChecked[checkedIndex] = false;
checkedIndex = -1;
timerCounter = 0;
showProgressBar = true;
showWork = true;
showTimer = true;
state = STATE_WORKING;
SoundManager.playFrostingSound();
} else {
if (((((((waiterHere) && (!((checkedIndex == -1))))) && (!(gotCake)))) && (waiterGotCake))){
waiterGotCake = false;
gotCake = true;
cake.visible = true;
cake.setTypes(waiterCakeType, waiterFrostingType, waiterDecorationType);
_local2 = new InfoData();
messageCallback("waiter leave cake", _local2);
if (waiterFrostingType != 0){
buttonChecked[checkedIndex] = false;
checkedIndex = -1;
} else {
setFrostingType(checkedIndex);
buttonChecked[checkedIndex] = false;
checkedIndex = -1;
timerCounter = 0;
showProgressBar = true;
showWork = true;
showTimer = true;
state = STATE_WORKING;
SoundManager.playFrostingSound();
};
} else {
if (((waiterHere) && (!((checkedIndex == -1))))){
buttonChecked[checkedIndex] = false;
checkedIndex = -1;
};
};
};
break;
case STATE_WORKING:
timerCounter++;
progressBarAnimFrame = int(((timerCounter / (workTime / 7)) + 1));
if (progressBarAnimFrame > 7){
progressBarAnimFrame = 7;
};
workAnimFrame = int(((timerCounter / (workTime / 15)) + 1));
if (workAnimFrame > 15){
workAnimFrame = 15;
};
timerAnimFrame = int(((timerCounter / (workTime / 16)) + 1));
if (timerAnimFrame > 16){
timerAnimFrame = 16;
};
if (timerCounter == workTime){
showProgressBar = false;
showWork = false;
showTimer = false;
setFrosting();
state = STATE_IDLE;
_local2 = new InfoData();
_local2.data1 = cake.getCakeType();
_local2.data2 = cake.getFrostingType();
_local2.data3 = cake.getDecorationType();
messageCallback("frosting finished", _local2);
};
break;
};
}
public function overCheck(_arg1:BaseObject){
if (_arg1.collisionObject.collisionTest(collisionButtons[0])){
buttonOver[0] = true;
} else {
if (_arg1.collisionObject.collisionTest(collisionButtons[1])){
buttonOver[1] = true;
} else {
if (_arg1.collisionObject.collisionTest(collisionButtons[2])){
buttonOver[2] = true;
} else {
if (_arg1.collisionObject.collisionTest(collisionButtons[3])){
buttonOver[3] = true;
};
};
};
};
}
public function waiterLeave(){
waiterHere = false;
}
}
}//package com.king.cakemania
Section 52
//GameGUI (com.king.cakemania.GameGUI)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class GameGUI {
private var month:String;
private var switchDay:Boolean;
private var timeOn:Boolean;
private var calandarFrontDay:int;
private var clip:MovieClip;
private var frameCounter:int;
private var maxDays:int;
private var timeMaxFrames:int;
private var calandarBackDay:int;
private var calendarSwitchAnimFrame:int;
private var oldDay:int;
private var timerCounter:int;
private var timeBarAnimFrame:int;
private var calendarSwitchTime:int;// = 10
function GameGUI(_arg1:MovieClip){
calendarSwitchTime = 10;
super();
this.clip = _arg1;
init();
}
public function setTimeBar(_arg1:int, _arg2:int){
timeBarAnimFrame = int(((100 * _arg1) / _arg2));
if (timeBarAnimFrame > 100){
timeBarAnimFrame = 100;
};
}
public function setCalendar(_arg1:int, _arg2, _arg3:int){
var _local4:Number;
var _local5:int;
_local4 = ((1 * _arg1) / _arg2);
if (_local4 >= 1){
_local4 = 1;
};
_local5 = (int(((_arg3 * 1) * _local4)) + 1);
calandarBackDay = _local5;
if (oldDay != _local5){
switchDay = true;
timerCounter = 0;
};
if (((switchDay) && ((_local5 <= _arg3)))){
timerCounter++;
calendarSwitchAnimFrame = int(((timerCounter / (calendarSwitchTime / 15)) + 1));
if (calendarSwitchAnimFrame >= 15){
calendarSwitchAnimFrame = 1;
calandarFrontDay = _local5;
switchDay = false;
};
};
if (calandarFrontDay > _arg3){
calandarFrontDay = _arg3;
};
if (calandarBackDay > _arg3){
calandarBackDay = _arg3;
};
oldDay = _local5;
}
public function setGoalScore(_arg1:int){
var _local2:String;
_local2 = ScreenPlayer.scoreToDollarString(_arg1);
clip.menuTexts.baker_goal_sum_text.text = _local2;
}
public function init(){
hideClosedSign();
setTimeBar(0, 100);
calendarSwitchAnimFrame = 1;
oldDay = 0;
switchDay = false;
timeOn = false;
frameCounter = 0;
}
public function tick(){
if (timeOn){
frameCounter++;
setTimeBar(frameCounter, timeMaxFrames);
setCalendar(frameCounter, timeMaxFrames, maxDays);
};
}
public function render(){
clip.calendar.timebar.gotoAndStop(timeBarAnimFrame);
clip.calendar.shifting.gotoAndStop(calendarSwitchAnimFrame);
clip.calendar.shifting.paper_front.CalendarTextDate1.text = calandarFrontDay;
clip.calendar.shifting.paper_back.CalendarTextDate2.text = calandarBackDay;
clip.calendar.shifting.paper_front.CalendarTextMonth1.text = month;
clip.calendar.shifting.paper_back.CalendarTextMonth2.text = month;
}
public function showClosedSign(){
clip.closed.visible = true;
clip.calendar.shifting.paper_front.visible = false;
}
public function setScore(_arg1:int){
var _local2:String;
_local2 = ScreenPlayer.scoreToDollarString(_arg1);
clip.menuTexts.cash_sum_text.text = _local2;
}
public function hideClosedSign(){
clip.closed.visible = false;
clip.calendar.shifting.paper_front.visible = true;
}
public function setTotalScore(_arg1:int){
var _local2:String;
_local2 = ScreenPlayer.scoreToDollarString(_arg1);
clip.menuTexts.total_cash_sum_text.text = _local2;
}
public function setupTime(_arg1:int, _arg2:int){
switch (_arg2){
case 1:
this.maxDays = 31;
month = TextProperties.GUI_CALENDAR_JAN;
break;
case 2:
this.maxDays = 28;
month = TextProperties.GUI_CALENDAR_FEB;
break;
case 3:
this.maxDays = 31;
month = TextProperties.GUI_CALENDAR_MAR;
break;
case 1:
default:
this.maxDays = 30;
month = "Apr";
break;
};
this.timeMaxFrames = _arg1;
timeOn = true;
calandarFrontDay = 1;
oldDay = 1;
}
}
}//package com.king.cakemania
Section 53
//GameHandler (com.king.cakemania.GameHandler)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.ui.*;
class GameHandler {
private var adjustSound:Boolean;
private var level:int;
private var input:Input;
private var levelTick:int;
private var startButtonClicked:Boolean;
private var tickCounter:int;
private var totalScore:int;
private var ghState:int;
private var coreGame:CoreGame;
private var tickCounter2:int;
private var currentTick:int;
private var messageCallback:Function;
private var pointer:Pointer;
public static var END_LEVEL:int = 3;
public static var INIT_GAME:int = 0;
public static var GAME_OVER:int = 4;
public static var GAME_OVER_FREE:int = 5;
public static var PRE_LEVEL:int = 1;
public static var END:int = 6;
public static var PLAY:int = 2;
public static var LAST_LEVEL:int = 3;
function GameHandler(_arg1:int, _arg2:Random, _arg3:Input, _arg4:Pointer, _arg5:Function){
this.input = _arg3;
this.messageCallback = _arg5;
this.pointer = _arg4;
coreGame = new CoreGame(_arg1, messageReciver, _arg2, _arg3, _arg4);
startButtonClicked = false;
currentTick = 0;
level = 1;
adjustSound = false;
ghState = INIT_GAME;
}
private function onTestMessage(){
}
private function toGameOverFree(){
var _local1:int;
messageCallback("game ended");
_local1 = int((totalScore / 100));
Communicator.gameEnd(_local1);
ScreenPlayer.showFreeSign();
tickCounter2 = 0;
ScreenPlayer.updateFreeSignTime(tickCounter2);
ghState = GAME_OVER_FREE;
}
public function buttonClick(){
startButtonClicked = true;
}
public function render(_arg1:Number):void{
switch (ghState){
case INIT_GAME:
break;
case PRE_LEVEL:
coreGame.render(_arg1);
break;
case PLAY:
coreGame.render(_arg1);
break;
case END_LEVEL:
break;
case GAME_OVER:
break;
case GAME_OVER_FREE:
break;
case END:
break;
};
}
public function showingBeginSign():Boolean{
if (ghState == PRE_LEVEL){
return (true);
};
return (false);
}
public function tick():void{
switch (ghState){
case INIT_GAME:
Communicator.gameStarted();
toPreLevel();
break;
case PRE_LEVEL:
ScreenPlayer.updateBeginLevelTime(tickCounter2);
SoundManager.introOutSlowUpdate();
if ((((tickCounter2 >= 200)) || (startButtonClicked))){
startButtonClicked = false;
toPlay();
};
break;
case PLAY:
if (tickCounter2 < SoundManager.INTRO_OUT_FRAMES){
SoundManager.introOutUpdate();
} else {
if (tickCounter2 == SoundManager.INTRO_OUT_FRAMES){
SoundManager.playGameLoop();
} else {
if ((((tickCounter2 > SoundManager.INTRO_OUT_FRAMES)) && ((tickCounter2 <= (SoundManager.INTRO_OUT_FRAMES + SoundManager.INTRO_OUT_FRAMES))))){
SoundManager.gameInUpdate();
} else {
tickCounter2 = 1000;
};
};
};
coreGame.tick(currentTick);
if (((((Communicator.isFreeGame()) && ((levelTick == (4 * 25))))) && ((level == 2)))){
toGameOverFree();
};
tickCounter++;
currentTick++;
levelTick++;
break;
case END_LEVEL:
ScreenPlayer.updateResultTime(false, tickCounter2);
if (tickCounter2 < SoundManager.GAME_LOOP_OUT_FRAMES){
SoundManager.gameOutUpdate();
} else {
if (tickCounter2 == SoundManager.GAME_LOOP_OUT_FRAMES){
SoundManager.playIntroLoop();
} else {
SoundManager.introInUpdate();
};
};
if ((((tickCounter2 == 200)) || (((input.mouseIsPressed) && ((tickCounter2 > 10)))))){
startButtonClicked = false;
ScreenPlayer.hideResult();
level++;
toPreLevel();
};
break;
case GAME_OVER:
ScreenPlayer.updateResultTime(true, tickCounter2);
if (adjustSound){
SoundManager.adjustIntroLoopVolume(0.75);
} else {
if (tickCounter2 < SoundManager.GAME_LOOP_OUT_FRAMES){
SoundManager.gameOutUpdate();
} else {
if (tickCounter2 == SoundManager.GAME_LOOP_OUT_FRAMES){
SoundManager.playIntroLoop();
} else {
SoundManager.introInUpdate();
};
};
};
if ((((tickCounter2 >= (8 * 25))) || ((((tickCounter2 >= (3 * 25))) && (input.mouseIsPressed))))){
pointer.visible = false;
pointer.clip.visible = false;
Mouse.show();
Communicator.gameQuit();
ghState = END;
};
break;
case GAME_OVER_FREE:
ScreenPlayer.updateFreeSignTime(tickCounter2);
if (tickCounter2 == (8 * 25)){
pointer.visible = false;
pointer.clip.visible = false;
Mouse.show();
Communicator.gameQuit();
ghState = END;
};
break;
case END:
break;
};
tickCounter2++;
}
private function toPlay(){
ScreenPlayer.hideBegin();
tickCounter2 = 0;
coreGame.startLevel();
ghState = PLAY;
levelTick = 0;
}
public function getScore():int{
return (totalScore);
}
public function isPlaying():Boolean{
if (ghState == PLAY){
return (true);
};
return (false);
}
public function messageReciver(_arg1:String, _arg2:InfoData){
if (_arg1 == "test message"){
onTestMessage();
};
if (_arg1 == "level finished"){
onLevelFinished(_arg2);
};
}
public function endGame(){
var _local1:int;
Communicator.sendPlayData(34, currentTick, coreGame.getScore());
if ((((ghState == END_LEVEL)) || ((ghState == GAME_OVER)))){
ghState = GAME_OVER;
_local1 = int((totalScore / 100));
Communicator.gameEnd(_local1);
} else {
level = LAST_LEVEL;
if (ghState != PLAY){
toPlay();
adjustSound = true;
};
coreGame.endGame();
};
}
private function onLevelFinished(_arg1:InfoData){
var _local2:*;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:Boolean;
var _local10:int;
_local2 = int(_arg1.data1);
_local3 = int(_arg1.data2);
_local4 = int(_arg1.data3);
_local5 = int(_arg1.data4);
_local6 = int(_arg1.data5);
_local7 = int(_arg1.data6);
totalScore = int(_arg1.data7);
_local8 = int(_arg1.data8);
Communicator.sendPlayData(51, currentTick, _local4);
Communicator.sendPlayData(52, currentTick, _local5);
Communicator.sendPlayData(53, currentTick, _local8);
Communicator.sendPlayData(54, currentTick, _local7);
Communicator.sendPlayData(30, currentTick, _local3);
Communicator.sendPlayData(50, currentTick, totalScore);
Communicator.sendPlayData(60, currentTick, Random.nr);
if (_local2 == 1){
_local9 = true;
} else {
_local9 = false;
};
ScreenPlayer.showResult((level == LAST_LEVEL), _local9, _local3, _local4, _local5, _local8, _local7, totalScore);
SoundManager.stopGameSounds();
tickCounter2 = 0;
if ((((level == LAST_LEVEL)) || (!(_local9)))){
Communicator.sendPlayData(32, currentTick, totalScore);
ghState = GAME_OVER;
_local10 = int((totalScore / 100));
Communicator.gameEnd(_local10);
messageCallback("game ended");
} else {
ghState = END_LEVEL;
};
}
private function toPreLevel(){
Communicator.sendPlayData(10, currentTick, level);
coreGame.initLevel(level);
tickCounter2 = 0;
ScreenPlayer.showBegin(coreGame.getLevelGoal(), level);
ScreenPlayer.updateBeginLevelTime(tickCounter2);
ghState = PRE_LEVEL;
}
}
}//package com.king.cakemania
Section 54
//GameXML (com.king.cakemania.GameXML)
package com.king.cakemania {
class GameXML {
public static var gameXML:XML = <gamexml>
<debug_seed nr="777"></debug_seed>
<level nr="1">
<time_limit time="2250"></time_limit>
<score_limit score="15000"></score_limit>
<scoring frosted="3000" decorated="4000" trow_frosted="-3000" throw_decorated="-4000"></scoring>
<more_scoring tip_per_sec="2" bonus_per_sek_left="5" customer_leave="-2000"></more_scoring>
<timeBonusPerSecond bonus="77"></timeBonusPerSecond>
<waiter speed="7.0"></waiter>
<display_case_effect procent="25"></display_case_effect>
// decoration procent could be between 0-100
<decoration_chance procent="0"></decoration_chance>
// decide_time should be 25 or more
<customers nr="3" spawnTime="300" cue_time="2000" decide_time="75"></customers>
// customer cake type could be skipped or any of these:
// circle, heart, fish, leaf, flower, star, rect, moon, triangle
<customer_cake type="heart"></customer_cake>
<customer_cake type="flower"></customer_cake>
<customer_cake type="rect"></customer_cake>
<customer_cake type="star"></customer_cake>
// customer cake frosting type could be any of these:
// violet, brown, white, special, yellow
<customer_frosting type="violet"></customer_frosting>
<customer_frosting type="brown"></customer_frosting>
<customer_frosting type="white"></customer_frosting>
<customer_frosting type="special"></customer_frosting>
// customer cake decoration type could be skipped or any of these:
// palm, cat, horseshoe, mask
<oven1 on="yes" bake_time="125"></oven1>
<oven2 on="no" bake_time="125"></oven2>
<froster1 on="yes" work_time="100"></froster1>
<froster2 on="no" work_time="100"></froster2>
<decorator1 on="no" work_time="100"></decorator1>
<decorator2 on="no" work_time="100"></decorator2>
<display_case on="yes"></display_case>
// possible oven buttons: circle, heart, fish, leaf, flower, star, rect, moon, triangle
<oven1_buttons b1="heart" b2="flower" b3="rect" b4="star"></oven1_buttons>
<oven2_buttons b1="triangle" b2="flower" b3="rect" b4="circle"></oven2_buttons>
// possible froster buttons: violet, brown, white, special
// !!! ONLY THIS COMBINATION WORKS white, special, violet, brown
// !!! OR THIS COMBINATION WORKS yellow, special, violet, brown
<froster1_buttons b1="white" b2="special" b3="violet" b4="brown"></froster1_buttons>
<froster2_buttons b1="yellow" b2="special" b3="violet" b4="brown"></froster2_buttons>
// possible decorator buttons: palm, cat, horseshoe, mask
<decorator1_buttons b1="palm" b2="cat" b3="horseshoe" b4="mask"></decorator1_buttons>
<decorator2_buttons b1="palm" b2="mask" b3="horseshoe" b4="mask"></decorator2_buttons>
</level>
<level nr="2">
<time_limit time="2250"></time_limit>
<score_limit score="17500"></score_limit>
<scoring frosted="3000" decorated="4000" trow_frosted="-3000" throw_decorated="-4000"></scoring>
<more_scoring tip_per_sec="2" bonus_per_sek_left="5" customer_leave="-2000"></more_scoring>
<timeBonusPerSecond bonus="77"></timeBonusPerSecond>
<waiter speed="7.0"></waiter>
<display_case_effect procent="25"></display_case_effect>
// decoration procent could be between 0-100
<decoration_chance procent="0"></decoration_chance>
// decide_time should be 25 or more
<customers nr="4" spawnTime="100" cue_time="1750" decide_time="75"></customers>
// customer cake type could be skipped or any of these:
// circle, heart, fish, leaf, flower, star, rect, moon, triangle
<customer_cake type="heart"></customer_cake>
<customer_cake type="flower"></customer_cake>
<customer_cake type="rect"></customer_cake>
<customer_cake type="star"></customer_cake>
<customer_cake type="circle"></customer_cake>
<customer_cake type="triangle"></customer_cake>
// customer cake frosting type could be skipped or any of these:
// violet, brown, white, special
<customer_frosting type="white"></customer_frosting>
<customer_frosting type="special"></customer_frosting>
<customer_frosting type="violet"></customer_frosting>
<customer_frosting type="brown"></customer_frosting>
<customer_frosting type="yellow"></customer_frosting>
// customer cake decoration type could be skipped or any of these:
// palm, cat, horseshoe, mask
<customer_decoration type="palm"></customer_decoration>
<customer_decoration type="cat"></customer_decoration>
<customer_decoration type="horseshoe"></customer_decoration>
<customer_decoration type="mask"></customer_decoration>
<oven1 on="yes" bake_time="125"></oven1>
<oven2 on="yes" bake_time="125"></oven2>
<froster1 on="yes" work_time="100"></froster1>
<froster2 on="yes" work_time="100"></froster2>
<decorator1 on="no" work_time="100"></decorator1>
<decorator2 on="no" work_time="100"></decorator2>
<display_case on="yes"></display_case>
// possible oven buttons: circle, heart, fish, leaf, flower, star, rect, moon, triangle
<oven1_buttons b1="heart" b2="flower" b3="rect" b4="star"></oven1_buttons>
<oven2_buttons b1="triangle" b2="flower" b3="rect" b4="circle"></oven2_buttons>
// possible froster buttons: violet, brown, white, yellow, special
// !!! ONLY THIS COMBINATION WORKS white, special, violet, brown
// !!! OR THIS COMBINATION WORKS yellow, special, violet, brown
<froster1_buttons b1="white" b2="special" b3="violet" b4="brown"></froster1_buttons>
<froster2_buttons b1="yellow" b2="special" b3="violet" b4="brown"></froster2_buttons>
// possible decorator buttons: palm, cat, horseshoe, mask
<decorator1_buttons b1="palm" b2="cat" b3="horseshoe" b4="mask"></decorator1_buttons>
<decorator2_buttons b1="palm" b2="mask" b3="horseshoe" b4="mask"></decorator2_buttons>
</level>
<level nr="3">
<time_limit time="2500"></time_limit>
<score_limit score="20000"></score_limit>
<scoring frosted="3000" decorated="4000" trow_frosted="-3000" throw_decorated="-4000"></scoring>
<more_scoring tip_per_sec="3" bonus_per_sek_left="5" customer_leave="-2000"></more_scoring>
<timeBonusPerSecond bonus="77"></timeBonusPerSecond>
<waiter speed="7.0"></waiter>
<display_case_effect procent="25"></display_case_effect>
// decoration procent could be between 0-100
<decoration_chance procent="25"></decoration_chance>
// decide_time should be 25 or more
<customers nr="4" spawnTime="100" cue_time="1500" decide_time="60"></customers>
// customer cake type could be skipped or any of these:
// circle, heart, fish, leaf, flower, star, rect, moon, triangle
<customer_cake type="heart"></customer_cake>
<customer_cake type="flower"></customer_cake>
<customer_cake type="rect"></customer_cake>
<customer_cake type="star"></customer_cake>
<customer_cake type="circle"></customer_cake>
<customer_cake type="triangle"></customer_cake>
// customer cake frosting type could be skipped or any of these:
// violet, brown, white, special
<customer_frosting type="white"></customer_frosting>
<customer_frosting type="special"></customer_frosting>
<customer_frosting type="violet"></customer_frosting>
<customer_frosting type="brown"></customer_frosting>
<customer_frosting type="yellow"></customer_frosting>
// customer cake decoration type could be skipped or any of these:
// palm, cat, horseshoe, mask
<customer_decoration type="palm"></customer_decoration>
<customer_decoration type="cat"></customer_decoration>
<customer_decoration type="horseshoe"></customer_decoration>
<customer_decoration type="mask"></customer_decoration>
<oven1 on="yes" bake_time="125"></oven1>
<oven2 on="yes" bake_time="125"></oven2>
<froster1 on="yes" work_time="100"></froster1>
<froster2 on="yes" work_time="100"></froster2>
<decorator1 on="yes" work_time="100"></decorator1>
<decorator2 on="no" work_time="100"></decorator2>
<display_case on="yes"></display_case>
// possible oven buttons: circle, heart, fish, leaf, flower, star, rect, moon, triangle
<oven1_buttons b1="heart" b2="flower" b3="rect" b4="star"></oven1_buttons>
<oven2_buttons b1="triangle" b2="flower" b3="rect" b4="circle"></oven2_buttons>
// possible froster buttons: violet, brown, white, special
// !!! ONLY THIS COMBINATION WORKS white, special, violet, brown
// !!! OR THIS COMBINATION WORKS yellow, special, violet, brown
<froster1_buttons b1="white" b2="special" b3="violet" b4="brown"></froster1_buttons>
<froster2_buttons b1="yellow" b2="special" b3="violet" b4="brown"></froster2_buttons>
// possible decorator buttons: palm, cat, horseshoe, mask
<decorator1_buttons b1="palm" b2="cat" b3="horseshoe" b4="mask"></decorator1_buttons>
<decorator2_buttons b1="palm" b2="cat" b3="horseshoe" b4="mask"></decorator2_buttons>
</level>
</gamexml>
;
}
}//package com.king.cakemania
Section 55
//GameXMLLoader (com.king.cakemania.GameXMLLoader)
package com.king.cakemania {
import flash.events.*;
import flash.net.*;
class GameXMLLoader {
public static var loadedXML:XML;
private static var loader:URLLoader;
private static var xmlLoaded:Boolean = false;
private static function onLoadError(_arg1:IOErrorEvent):void{
xmlLoaded = false;
}
public static function load(){
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.load(new URLRequest("cakemania.xml"));
}
public static function loadingFinished():Boolean{
return (xmlLoaded);
}
private static function onComplete(_arg1:Event):void{
var event = _arg1;
try {
loadedXML = new XML(loader.data);
} catch(e:Error) {
return;
};
xmlLoaded = true;
}
}
}//package com.king.cakemania
Section 56
//InfoData (com.king.cakemania.InfoData)
package com.king.cakemania {
class InfoData {
public var data2:Number;
public var data3:Number;
public var data4:Number;
public var data5:Number;
public var data6:Number;
public var data7:Number;
public var data1:Number;
public var data8:Number;
}
}//package com.king.cakemania
Section 57
//Input (com.king.cakemania.Input)
package com.king.cakemania {
class Input {
public var mouseIsReleased:Boolean;
public var xMouse:int;
public var mouseIsPressed:Boolean;
public var yMouse:int;
public function mouseReleased(){
mouseIsReleased = true;
}
public function printInput(){
}
public function init(){
reset();
}
public function setMousePos(_arg1:Number, _arg2:Number){
xMouse = (_arg1 - 35);
yMouse = (_arg2 - 32);
}
public function reset(){
mouseIsPressed = false;
mouseIsReleased = false;
}
public function mousePressed(){
mouseIsPressed = true;
}
}
}//package com.king.cakemania
Section 58
//Integer64 (com.king.cakemania.Integer64)
package com.king.cakemania {
class Integer64 {
private var p:Array;
private var r:Array;
private var s:Array;
function Integer64(_arg1){
r = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]];
p = [0, 0, 0, 0, 0];
s = [0, 0, 0];
if (_arg1){
merge(_arg1);
};
}
public function binaryShiftRight(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local2 = ((_arg1 / 15) >> 0);
_local3 = (_arg1 - (_local2 * 15));
_local4 = (p.length - 1);
while (_local4 > 0) {
_local5 = 0;
while (_local5 < _local2) {
p[_local5] = p[(_local5 + 1)];
_local5++;
};
var _temp1 = _local4;
_local4 = (_local4 - 1);
var _local7 = _temp1;
p[_local7] = 0;
};
if (_local3 > 0){
_local6 = 0;
while (_local6 < _local3) {
shr();
_local6++;
};
};
}
public function mul32(_arg1:Number):void{
mul64(new Integer64(_arg1));
}
private function merge(_arg1:Number):Number{
var _local2:*;
_local2 = 0;
while (_local2 < 3) {
p[_local2] = (p[_local2] + (_arg1 & 32767));
_arg1 = (_arg1 >>> 15);
_local2++;
};
return (_arg1);
}
public function binaryShiftLeft(_arg1:Number):void{
var _local2:*;
_local2 = 0;
while (_local2 < _arg1) {
shl();
_local2++;
};
}
public function mul64(_arg1:Integer64):void{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = 0;
_local3 = 0;
while (_local3 < 5) {
_local4 = _arg1.p[_local3];
_local2 = (_local4 * p[0]);
r[_local3][0] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[1]));
r[_local3][1] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[2]));
r[_local3][2] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[3]));
r[_local3][3] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[4]));
r[_local3][4] = (_local2 & 32767);
_local3++;
};
_local2 = r[0][0];
p[0] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (r[0][1] + r[1][0]));
p[1] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + ((r[0][2] + r[1][1]) + r[2][0]));
p[2] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (((r[0][3] + r[1][2]) + r[2][1]) + r[3][0]));
p[3] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + ((((r[0][4] + r[1][3]) + r[2][2]) + r[3][1]) + r[4][0]));
p[4] = (_local2 & 7);
}
private function shr():void{
var _local1:*;
var _local2:*;
var _local3:*;
_local1 = 0;
_local2 = 0;
_local3 = (p.length - 1);
while (_local3 >= 0) {
_local1 = ((p[_local3] & 1) << 14);
p[_local3] = (p[_local3] >> 1);
p[_local3] = ((p[_local3] | _local2) & 32767);
_local3--;
_local2 = _local1;
};
}
public function init32(_arg1:Number):void{
p[0] = (_arg1 & 32767);
_arg1 = (_arg1 >>> 15);
p[1] = (_arg1 & 32767);
_arg1 = (_arg1 >>> 15);
p[2] = (_arg1 & 3);
p[3] = 0;
p[4] = 0;
}
public function init(_arg1:Integer64):void{
var _local2:*;
_local2 = 0;
while (_local2 < p.length) {
p[_local2] = _arg1.p[_local2];
_local2++;
};
}
public function add32(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local2 = 0;
_local3 = (_arg1 & 32767);
_arg1 = (_arg1 >> 15);
_local4 = (_arg1 & 32767);
_arg1 = (_arg1 >> 15);
_local5 = (_arg1 & 3);
_local2 = (_local2 + (p[0] + _local3));
p[0] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (p[1] + _local4));
p[1] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (p[2] + _local5));
p[2] = (_local2 & 32767);
}
public function binaryNot(_arg1:Integer64):void{
p[0] = (p[0] ^ _arg1.p[0]);
p[1] = (p[1] ^ _arg1.p[1]);
p[2] = (p[2] ^ _arg1.p[2]);
p[3] = (p[3] ^ _arg1.p[3]);
p[4] = (p[4] ^ _arg1.p[4]);
}
public function get lsb():Number{
return (((p[0] | (p[1] << 15)) | ((p[2] & 3) << 30)));
}
public function get msb():Number{
return (((((p[2] >> 2) | ((p[3] << 15) >> 2)) | ((p[4] << (15 * 2)) >> 2)) & 2147483647));
}
public function mulu32(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = 0;
s[0] = (_arg1 & 32767);
_arg1 = (_arg1 >>> 15);
s[1] = (_arg1 & 32767);
_arg1 = (_arg1 >>> 15);
s[2] = (_arg1 & 3);
_local3 = 0;
while (_local3 < 3) {
_local4 = s[_local3];
_local2 = (_local4 * p[0]);
r[_local3][0] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[1]));
r[_local3][1] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (_local4 * p[2]));
r[_local3][2] = (_local2 & 3);
_local3++;
};
_local2 = r[0][0];
p[0] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + (r[0][1] + r[1][0]));
p[1] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local2 = (_local2 + ((r[0][2] + r[1][1]) + r[2][0]));
p[2] = (_local2 & 3);
p[3] = 0;
p[4] = 0;
}
private function shl():void{
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
_local1 = 0;
_local2 = 0;
_local3 = 0;
_local4 = p.length;
while (_local3 < _local4) {
_local1 = ((p[_local3] & 0x4000) >> 14);
p[_local3] = (p[_local3] << 1);
p[_local3] = ((p[_local3] | _local2) & 32767);
_local3++;
_local2 = _local1;
};
}
public function add64(_arg1:Integer64):void{
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = 0;
_local3 = 1;
_local4 = 0;
while ((((_local3 < p.length)) && (!((_arg1.p[_local4] == 0))))) {
_local3++;
};
_local4 = 0;
while (_local4 < _local3) {
_local2 = (_local2 + (p[_local4] + _arg1.p[_local4]));
p[_local4] = (_local2 & 32767);
_local2 = (_local2 >> 15);
_local4++;
};
}
}
}//package com.king.cakemania
Section 59
//LevelManager (com.king.cakemania.LevelManager)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.events.*;
import flash.display.*;
import flash.system.*;
import flash.xml.*;
class LevelManager {
public var oven2WorkTime:int;
public var decorationChance:int;
private var hr:MovieClip;
public var sameAsDisplayProcent:int;
public var scoreCustomerLeave:int;
public var oven1On:Boolean;
private var coreGame:CoreGame;
private var customerFrostingTypes:Array;
private var newBaseObjects:Array;
public var scoreLimit:int;
public var decorator2ButtonType:Array;
public var froster2ButtonType:Array;
public var scoreThrowFrosted:int;
private var baseObjectCounter:Counter;
public var tipPerSec:int;
public var scoreFrosted:int;
private var messageCallback:Function;
public var froster1WorkTime:int;
public var froster2WorkTime:int;
private var lm:LevelManagerData;
public var decorator1ButtonType:Array;
public var scoreDecorated:int;
public var waiterSpeed:Number;
public var oven2ButtonType:Array;
public var displayCaseOn:Boolean;
public var froster1ButtonType:Array;
public var decorator2On:Boolean;
public var froster2On:Boolean;
public var timeBonusPerSecond:int;
private var random:Random;
private var gameXML:XML;
private var input:Input;
public var scoreThrowCake:int;
public var oven1ButtonType:Array;
public var customerDecideTime:int;
public var decorator1On:Boolean;
public var froster1On:Boolean;
public var oven2On:Boolean;
public var scoreThrowDecorated:int;
private var version:int;
public var spawnTime:int;
public var customerCueTime:int;
private var customerDecorationTypes:Array;
public var timeLimit:int;
public var decorator1WorkTime:int;
public var decorator2WorkTime:int;
public var customersNr:int;
private var customerCakeTypes:Array;
public var oven1WorkTime:int;
function LevelManager(_arg1:int, _arg2:LevelManagerData, _arg3:Array, _arg4:Function, _arg5:Counter, _arg6:Random, _arg7:Input, _arg8:CoreGame){
this.lm = _arg2;
this.newBaseObjects = _arg3;
this.messageCallback = _arg4;
this.version = _arg1;
this.baseObjectCounter = _arg5;
this.random = _arg6;
this.input = _arg7;
this.coreGame = _arg8;
switch (this.version){
case CakeMania.HR_VERSION:
hr = new HighRiseScene();
break;
case CakeMania.WATER_VERSION:
hr = new UnderWater();
break;
case CakeMania.FUTURE_VERSION:
hr = new Future();
break;
};
References.gameClip.addChild(hr);
References.gameClipChild = hr;
hr.oven1.visible = false;
hr.oven2.visible = false;
hr.froster1.visible = false;
hr.froster2.visible = false;
hr.decorator1.visible = false;
hr.decorator2.visible = false;
hr.display_case_mc.visible = false;
}
private function frosterButtonNr(_arg1:String):int{
var _local2:int;
_local2 = 1;
if (_arg1 == "violet"){
_local2 = 1;
} else {
if (_arg1 == "brown"){
_local2 = 2;
} else {
if (_arg1 == "white"){
_local2 = 4;
} else {
if (_arg1 == "yellow"){
_local2 = 5;
} else {
if (_arg1 == "special"){
_local2 = 6;
};
};
};
};
};
return (_local2);
}
public function getTimeLimit():int{
return (timeLimit);
}
public function getScoreLimit():int{
return (scoreLimit);
}
public function initLevel(_arg1:int){
var _local2:int;
var _local3:XML;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:XML;
var _local10:*;
var _local11:int;
var _local12:*;
var _local13:int;
var _local14:*;
var _local15:int;
gameXML = GameXML.gameXML;
_local2 = int(gameXML.debug_seed[0].@nr);
for each (_local3 in gameXML.level) {
if (_local3.@nr == String(_arg1)){
timeLimit = int(_local3.time_limit[0].@time);
scoreLimit = int(_local3.score_limit[0].@score);
scoreFrosted = int(_local3.scoring[0].@frosted);
scoreDecorated = int(_local3.scoring[0].@decorated);
scoreThrowFrosted = int(_local3.scoring[0].@trow_frosted);
scoreThrowDecorated = int(_local3.scoring[0].@throw_decorated);
tipPerSec = int(_local3.more_scoring[0].@tip_per_sec);
timeBonusPerSecond = int(_local3.more_scoring[0].@bonus_per_sek_left);
scoreCustomerLeave = int(_local3.more_scoring[0].@customer_leave);
waiterSpeed = Number(_local3.waiter[0].@speed);
sameAsDisplayProcent = int(_local3.display_case_effect.@procent);
decorationChance = Number(_local3.decoration_chance[0].@procent);
customersNr = int(_local3.customers[0].@nr);
spawnTime = int(_local3.customers[0].@spawnTime);
customerCueTime = int(_local3.customers[0].@cue_time);
customerDecideTime = int(_local3.customers[0].@decide_time);
if (String(_local3.oven1[0].@on) == "yes"){
oven1On = true;
} else {
oven1On = false;
};
oven1WorkTime = int(_local3.oven1[0].@bake_time);
if (String(_local3.oven2[0].@on) == "yes"){
oven2On = true;
} else {
oven2On = false;
};
oven2WorkTime = int(_local3.oven2[0].@bake_time);
if (String(_local3.froster1[0].@on) == "yes"){
froster1On = true;
} else {
froster1On = false;
};
froster1WorkTime = int(_local3.froster1[0].@work_time);
if (String(_local3.froster2[0].@on) == "yes"){
froster2On = true;
} else {
froster2On = false;
};
froster2WorkTime = int(_local3.froster2[0].@work_time);
if (String(_local3.decorator1[0].@on) == "yes"){
decorator1On = true;
} else {
decorator1On = false;
};
decorator1WorkTime = int(_local3.decorator1[0].@work_time);
if (String(_local3.decorator2[0].@on) == "yes"){
decorator2On = true;
} else {
decorator2On = false;
};
decorator2WorkTime = int(_local3.decorator2[0].@work_time);
if (String(_local3.display_case[0].@on) == "yes"){
displayCaseOn = true;
} else {
displayCaseOn = false;
};
_local4 = String(_local3.oven1_buttons[0].@b1);
_local5 = ovenButtonNr(_local4);
_local4 = String(_local3.oven1_buttons[0].@b2);
_local6 = ovenButtonNr(_local4);
_local4 = String(_local3.oven1_buttons[0].@b3);
_local7 = ovenButtonNr(_local4);
_local4 = String(_local3.oven1_buttons[0].@b4);
_local8 = ovenButtonNr(_local4);
oven1ButtonType = new Array(_local5, _local6, _local7, _local8);
_local4 = String(_local3.oven2_buttons[0].@b1);
_local5 = ovenButtonNr(_local4);
_local4 = String(_local3.oven2_buttons[0].@b2);
_local6 = ovenButtonNr(_local4);
_local4 = String(_local3.oven2_buttons[0].@b3);
_local7 = ovenButtonNr(_local4);
_local4 = String(_local3.oven2_buttons[0].@b4);
_local8 = ovenButtonNr(_local4);
oven2ButtonType = new Array(_local5, _local6, _local7, _local8);
_local4 = String(_local3.froster1_buttons[0].@b1);
_local5 = frosterButtonNr(_local4);
_local4 = String(_local3.froster1_buttons[0].@b2);
_local6 = frosterButtonNr(_local4);
_local4 = String(_local3.froster1_buttons[0].@b3);
_local7 = frosterButtonNr(_local4);
_local4 = String(_local3.froster1_buttons[0].@b4);
_local8 = frosterButtonNr(_local4);
froster1ButtonType = new Array(_local5, _local6, _local7, _local8);
_local4 = String(_local3.froster2_buttons[0].@b1);
_local5 = frosterButtonNr(_local4);
_local4 = String(_local3.froster2_buttons[0].@b2);
_local6 = frosterButtonNr(_local4);
_local4 = String(_local3.froster2_buttons[0].@b3);
_local7 = frosterButtonNr(_local4);
_local4 = String(_local3.froster2_buttons[0].@b4);
_local8 = frosterButtonNr(_local4);
froster2ButtonType = new Array(_local5, _local6, _local7, _local8);
_local4 = String(_local3.decorator1_buttons[0].@b1);
_local5 = decoratorButtonNr(_local4);
_local4 = String(_local3.decorator1_buttons[0].@b2);
_local6 = decoratorButtonNr(_local4);
_local4 = String(_local3.decorator1_buttons[0].@b3);
_local7 = decoratorButtonNr(_local4);
_local4 = String(_local3.decorator1_buttons[0].@b4);
_local8 = decoratorButtonNr(_local4);
decorator1ButtonType = new Array(_local5, _local6, _local7, _local8);
_local4 = String(_local3.decorator2_buttons[0].@b1);
_local5 = decoratorButtonNr(_local4);
_local4 = String(_local3.decorator2_buttons[0].@b2);
_local6 = decoratorButtonNr(_local4);
_local4 = String(_local3.decorator2_buttons[0].@b3);
_local7 = decoratorButtonNr(_local4);
_local4 = String(_local3.decorator2_buttons[0].@b4);
_local8 = decoratorButtonNr(_local4);
decorator2ButtonType = new Array(_local5, _local6, _local7, _local8);
customerCakeTypes = new Array();
for each (_local9 in _local3.customer_cake) {
_local10 = _local9.@type;
_local11 = ovenButtonNr(_local10);
customerCakeTypes.push(_local11);
};
customerFrostingTypes = new Array();
for each (_local9 in _local3.customer_frosting) {
_local12 = _local9.@type;
_local13 = frosterButtonNr(_local12);
customerFrostingTypes.push(_local13);
};
customerDecorationTypes = new Array();
for each (_local9 in _local3.customer_decoration) {
_local14 = _local9.@type;
_local15 = decoratorButtonNr(_local14);
customerDecorationTypes.push(_local15);
};
};
};
initGameObjects();
}
public function createProperties():MovieClip{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
switch (version){
case CakeMania.HR_VERSION:
_local1 = 341;
_local2 = 83;
_local3 = 445;
_local4 = 83;
_local5 = 296;
_local6 = 377;
_local7 = 431;
_local8 = 377;
_local9 = 547;
_local10 = 224;
_local11 = 548;
_local12 = 297;
_local13 = 366;
_local14 = 288;
_local15 = 369;
_local16 = 218;
break;
case CakeMania.WATER_VERSION:
_local1 = 265;
_local2 = 86;
_local3 = 161;
_local4 = 86;
_local5 = 189;
_local6 = 382;
_local7 = 315;
_local8 = 382;
_local9 = 69;
_local10 = 231;
_local11 = 65;
_local12 = 302;
_local13 = 246.9;
_local14 = 269.9;
_local15 = 244;
_local16 = 219;
break;
case CakeMania.FUTURE_VERSION:
_local1 = 62;
_local2 = 243.3;
_local3 = 93;
_local4 = 162.3;
_local5 = 144.2;
_local6 = 382;
_local7 = 273;
_local8 = 385;
_local9 = 230;
_local10 = 93;
_local11 = 403.4;
_local12 = 381;
_local13 = 248.4;
_local14 = 293.4;
_local15 = 248.8;
_local16 = 228.9;
break;
};
lm.oven1 = new Oven(hr, _local1, _local2, newBaseObjects, messageCallback, hr.oven1, 1, baseObjectCounter, random, input);
newBaseObjects.push(lm.oven1);
lm.oven2 = new Oven(hr, _local3, _local4, newBaseObjects, messageCallback, hr.oven2, 2, baseObjectCounter, random, input);
newBaseObjects.push(lm.oven2);
lm.froster1 = new Froster(hr, _local5, _local6, newBaseObjects, messageCallback, hr.froster1, 1, baseObjectCounter, random, input);
newBaseObjects.push(lm.froster1);
lm.froster2 = new Froster(hr, _local7, _local8, newBaseObjects, messageCallback, hr.froster2, 2, baseObjectCounter, random, input);
newBaseObjects.push(lm.froster2);
lm.decorator1 = new Decorator(hr, _local9, _local10, newBaseObjects, messageCallback, hr.decorator1, 1, baseObjectCounter, random, input);
newBaseObjects.push(lm.decorator1);
lm.decorator2 = new Decorator(hr, _local11, _local12, newBaseObjects, messageCallback, hr.decorator2, 2, baseObjectCounter, random, input);
newBaseObjects.push(lm.decorator2);
lm.trashcan = new Trashcan(hr, _local13, _local14, newBaseObjects, messageCallback, hr.trashcan, baseObjectCounter, input);
newBaseObjects.push(lm.trashcan);
lm.displayCase = new DisplayCase(hr, _local15, _local16, newBaseObjects, messageCallback, hr.display_case_mc, baseObjectCounter, random, input);
newBaseObjects.push(lm.displayCase);
lm.bubbleManager = new BubbleManager(version, hr.bubbles_holder_mc, hr.customers_holder_mc, newBaseObjects, messageCallback, 4, 100, baseObjectCounter, random, input, coreGame);
lm.waiter = new Waiter(version, hr, hr.waiter_holder_mc, hr.waiter_holder_back_mc, 400, 400, newBaseObjects, messageCallback, baseObjectCounter, random);
newBaseObjects.push(lm.waiter);
return (hr);
}
public function getScoreDecorated():int{
return (scoreDecorated);
}
public function getScoreThrowFrosted():int{
return (scoreThrowFrosted);
}
private function ovenButtonNr(_arg1:String):Number{
var _local2:int;
_local2 = 1;
if (_arg1 == "circle"){
_local2 = 1;
} else {
if (_arg1 == "heart"){
_local2 = 2;
} else {
if (_arg1 == "fish"){
_local2 = 3;
} else {
if (_arg1 == "leaf"){
_local2 = 4;
} else {
if (_arg1 == "flower"){
_local2 = 5;
} else {
if (_arg1 == "star"){
_local2 = 6;
} else {
if (_arg1 == "rect"){
_local2 = 7;
} else {
if (_arg1 == "moon"){
_local2 = 8;
} else {
if (_arg1 == "triangle"){
_local2 = 9;
};
};
};
};
};
};
};
};
};
switch (this.version){
case CakeMania.HR_VERSION:
break;
case CakeMania.WATER_VERSION:
if (_local2 == 5){
_local2 = 3;
};
if (_local2 == 9){
_local2 = 4;
};
break;
case CakeMania.FUTURE_VERSION:
if (_local2 == 5){
_local2 = 8;
};
break;
};
return (_local2);
}
public function getScoreThrowDecorated():int{
return (scoreThrowDecorated);
}
private function initGameObjects(){
lm.oven1.init(oven1WorkTime, oven1ButtonType);
if (!oven1On){
lm.oven1.visible = false;
lm.oven1.collisionObject = null;
} else {
lm.oven1.visible = true;
};
lm.oven2.init(oven2WorkTime, oven2ButtonType);
if (!oven2On){
lm.oven2.visible = false;
lm.oven2.collisionObject = null;
} else {
lm.oven2.visible = true;
};
lm.froster1.init(froster1WorkTime, froster1ButtonType);
if (!froster1On){
lm.froster1.visible = false;
lm.froster1.collisionObject = null;
} else {
lm.froster1.visible = true;
};
lm.froster2.init(froster2WorkTime, froster2ButtonType);
if (!froster2On){
lm.froster2.visible = false;
lm.froster2.collisionObject = null;
} else {
lm.froster2.visible = true;
};
lm.decorator1.init(decorator1WorkTime, decorator1ButtonType);
if (!decorator1On){
lm.decorator1.visible = false;
lm.decorator1.collisionObject = null;
} else {
lm.decorator1.visible = true;
};
lm.decorator2.init(decorator2WorkTime, decorator2ButtonType);
if (!decorator2On){
lm.decorator2.visible = false;
lm.decorator2.collisionObject = null;
} else {
lm.decorator2.visible = true;
};
lm.displayCase.init();
if (!displayCaseOn){
lm.displayCase.visible = false;
lm.displayCase.collisionObject = null;
} else {
lm.displayCase.visible = true;
};
lm.bubbleManager.init(customersNr, spawnTime, customerCueTime, customerDecideTime, customerCakeTypes, customerFrostingTypes, customerDecorationTypes, decorationChance, sameAsDisplayProcent);
lm.waiter.init(waiterSpeed);
lm.trashcan.init();
}
public function getTimeBonusPerSecond():int{
return (timeBonusPerSecond);
}
public function getTipPerSec():int{
return (tipPerSec);
}
public function getScoreThrowCake():int{
return (scoreThrowCake);
}
private function decoratorButtonNr(_arg1:String):int{
var _local2:int;
_local2 = 1;
if (_arg1 == "palm"){
_local2 = 1;
} else {
if (_arg1 == "cat"){
_local2 = 2;
} else {
if (_arg1 == "horseshoe"){
_local2 = 3;
} else {
if (_arg1 == "mask"){
_local2 = 4;
};
};
};
};
return (_local2);
}
public function getScoreFrosted():int{
return (scoreFrosted);
}
public function getScoreCustomerLeave():int{
return (scoreCustomerLeave);
}
}
}//package com.king.cakemania
Section 60
//LevelManagerData (com.king.cakemania.LevelManagerData)
package com.king.cakemania {
class LevelManagerData {
public var froster1:Froster;
public var oven1:Oven;
public var bubbleManager:BubbleManager;
public var waiter:Waiter;
public var displayCase:DisplayCase;
public var decorator1:Decorator;
public var decorator2:Decorator;
public var froster2:Froster;
public var oven2:Oven;
public var trashcan:Trashcan;
}
}//package com.king.cakemania
Section 61
//Oven (com.king.cakemania.Oven)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class Oven extends BaseObject {
private var cakeButtoneChecked:Boolean;
private var buttonChecked:Array;
private var buttonOver:Array;
var button1Clip:MovieClip;
var button3Clip:MovieClip;
private var cake:Cake;
private var bakeTime:int;
private var trayAnimFrame:int;
private var fireAnimFrame:int;
private var checkedIndex:int;
private var showProgressBar:Boolean;
private var bakedCake:Boolean;
private var once:Boolean;
private var buttonType:Array;
private var state:int;
private var waiterDecorationType:int;
private var burnCakeType:int;
private var waiterCakeType:int;
private var waiterGotCake:Boolean;
private var showWork:Boolean;
var button2Clip:MovieClip;
var button4Clip:MovieClip;
private var ovenNr:int;
private var waiterIsBuzzy:Boolean;
private var bakingType:int;
private var buttonAnimFrame:Array;
private var input:Input;
private var showFire:Boolean;
private var progressBarAnimFrame:int;
private var showTray:Boolean;
private var collisionButtons:Array;
private var waiterHere:Boolean;
private var timerCounter:int;
private var waiterFrostingType:int;
public static var MOVE_UP_TIME:int = 12;
public static var STATE_BAKING:int = 1;
public static var STATE_IDLE:int = 0;
public static var STATE_MOVE_DOWN:int = 3;
public static var STATE_BURN:int = 4;
public static var TRAY_TIME:int = 25;
public static var STATE_MOVE_UP:int = 5;
public static var MOVE_DOWN_TIME:int = 12;
public static var BURN_TIME:int = 25;
public static var STATE_UPDATE_TRAY:int = 2;
function Oven(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Function, _arg6:MovieClip, _arg7:int, _arg8:Counter, _arg9:Random, _arg10:Input){
buttonOver = [false, false, false, false];
buttonChecked = [false, false, false, false];
buttonAnimFrame = [1, 1, 1, 1];
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg8);
clip = _arg6;
this.ovenNr = _arg7;
this.input = _arg10;
cake = new Cake(clip, clip.cake_mc.x, -53, _arg4, _arg5, clip.cake_mc, true, _arg8, _arg9);
_arg4.push(cake);
collisionButtons = new Array(4);
collisionButtons[0] = new CollisionObject((_arg2 - 35), (_arg3 - 10), 20);
collisionButtons[1] = new CollisionObject((_arg2 - 13), (_arg3 - 0), 20);
collisionButtons[2] = new CollisionObject((_arg2 + 11), (_arg3 - 0), 20);
collisionButtons[3] = new CollisionObject((_arg2 + 33), (_arg3 - 8), 20);
init(999, [1, 1, 1, 1]);
}
private function setBurnCakeType(){
burnCakeType = 0;
if (cake.getFrostingType() != 0){
burnCakeType = 1;
};
if (cake.getDecorationType() != 0){
burnCakeType = 2;
};
}
public function init(_arg1:int, _arg2:Array){
cakeButtoneChecked = false;
waiterHere = false;
waiterGotCake = false;
checkedIndex = -1;
showProgressBar = false;
showWork = false;
showTray = true;
showFire = false;
bakedCake = false;
cake.visible = false;
progressBarAnimFrame = 1;
trayAnimFrame = 1;
fireAnimFrame = 1;
state = 0;
buttonOver = [false, false, false, false];
buttonChecked = [false, false, false, false];
buttonAnimFrame = [1, 1, 1, 1];
this.bakeTime = _arg1;
this.buttonType = _arg2;
setupButtons();
createCollisionObject();
}
private function setCakeType(){
cake.setTypes(bakingType, 0, 0);
}
public function setWaiterCake(_arg1:Boolean, _arg2:int, _arg3:int, _arg4:int){
waiterGotCake = _arg1;
waiterCakeType = _arg2;
waiterFrostingType = _arg3;
waiterDecorationType = _arg4;
}
private function setupButtons(){
clip.button1.heart_mc.visible = false;
clip.button1.fish_mc.visible = false;
clip.button1.leaf_mc.visible = false;
clip.button1.circle_mc.visible = false;
clip.button1.flower_mc.visible = false;
clip.button1.rect_mc.visible = false;
clip.button1.star_mc.visible = false;
clip.button1.moon_mc.visible = false;
clip.button1.triangle_mc.visible = false;
switch (buttonType[0]){
case 1:
button1Clip = clip.button1.circle_mc;
break;
case 2:
button1Clip = clip.button1.heart_mc;
break;
case 3:
button1Clip = clip.button1.fish_mc;
break;
case 4:
button1Clip = clip.button1.leaf_mc;
break;
case 5:
button1Clip = clip.button1.flower_mc;
break;
case 6:
button1Clip = clip.button1.star_mc;
break;
case 7:
button1Clip = clip.button1.rect_mc;
break;
case 8:
button1Clip = clip.button1.moon_mc;
break;
case 9:
button1Clip = clip.button1.triangle_mc;
break;
};
button1Clip.visible = true;
clip.button2.heart_mc.visible = false;
clip.button2.fish_mc.visible = false;
clip.button2.leaf_mc.visible = false;
clip.button2.circle_mc.visible = false;
clip.button2.flower_mc.visible = false;
clip.button2.rect_mc.visible = false;
clip.button2.star_mc.visible = false;
clip.button2.moon_mc.visible = false;
clip.button2.triangle_mc.visible = false;
switch (buttonType[1]){
case 1:
button2Clip = clip.button2.circle_mc;
break;
case 2:
button2Clip = clip.button2.heart_mc;
break;
case 3:
button2Clip = clip.button2.fish_mc;
break;
case 4:
button2Clip = clip.button2.leaf_mc;
break;
case 5:
button2Clip = clip.button2.flower_mc;
break;
case 6:
button2Clip = clip.button2.star_mc;
break;
case 7:
button2Clip = clip.button2.rect_mc;
break;
case 8:
button2Clip = clip.button2.moon_mc;
break;
case 9:
button2Clip = clip.button2.triangle_mc;
break;
};
button2Clip.visible = true;
clip.button3.heart_mc.visible = false;
clip.button3.fish_mc.visible = false;
clip.button3.leaf_mc.visible = false;
clip.button3.circle_mc.visible = false;
clip.button3.flower_mc.visible = false;
clip.button3.rect_mc.visible = false;
clip.button3.star_mc.visible = false;
clip.button3.moon_mc.visible = false;
clip.button3.triangle_mc.visible = false;
switch (buttonType[2]){
case 1:
button3Clip = clip.button3.circle_mc;
break;
case 2:
button3Clip = clip.button3.heart_mc;
break;
case 3:
button3Clip = clip.button3.fish_mc;
break;
case 4:
button3Clip = clip.button3.leaf_mc;
break;
case 5:
button3Clip = clip.button3.flower_mc;
break;
case 6:
button3Clip = clip.button3.star_mc;
break;
case 7:
button3Clip = clip.button3.rect_mc;
break;
case 8:
button3Clip = clip.button3.moon_mc;
break;
case 9:
button3Clip = clip.button3.triangle_mc;
break;
};
button3Clip.visible = true;
clip.button4.heart_mc.visible = false;
clip.button4.fish_mc.visible = false;
clip.button4.leaf_mc.visible = false;
clip.button4.circle_mc.visible = false;
clip.button4.flower_mc.visible = false;
clip.button4.rect_mc.visible = false;
clip.button4.star_mc.visible = false;
clip.button4.moon_mc.visible = false;
clip.button4.triangle_mc.visible = false;
switch (buttonType[3]){
case 1:
button4Clip = clip.button4.circle_mc;
break;
case 2:
button4Clip = clip.button4.heart_mc;
break;
case 3:
button4Clip = clip.button4.fish_mc;
break;
case 4:
button4Clip = clip.button4.leaf_mc;
break;
case 5:
button4Clip = clip.button4.flower_mc;
break;
case 6:
button4Clip = clip.button4.star_mc;
break;
case 7:
button4Clip = clip.button4.rect_mc;
break;
case 8:
button4Clip = clip.button4.moon_mc;
break;
case 9:
button4Clip = clip.button4.triangle_mc;
break;
};
button4Clip.visible = true;
}
public function waiterBuzzy(){
waiterIsBuzzy = true;
}
public function waiterArrive(){
waiterHere = true;
}
public function clickCheck(_arg1:BaseObject){
var _local2:Boolean;
var _local3:Boolean;
var _local4:*;
var _local5:Boolean;
var _local6:InfoData;
_local2 = false;
if (state == STATE_IDLE){
_local3 = false;
_local4 = 0;
while (_local4 < 4) {
if (buttonChecked[_local4]){
_local3 = true;
break;
};
_local4++;
};
_local5 = false;
_local4 = 0;
while (_local4 < 4) {
if (_arg1.collisionObject.collisionTest(collisionButtons[_local4])){
_local2 = true;
if (_local3){
if (buttonChecked[_local4]){
buttonChecked[_local4] = false;
checkedIndex = -1;
};
} else {
buttonChecked[_local4] = true;
_local5 = true;
checkedIndex = _local4;
};
};
_local4++;
};
if (_local5){
_local6 = new InfoData();
_local6.data1 = ovenNr;
messageCallback("oven button checked", _local6);
};
};
if (!_local2){
_local6 = new InfoData();
messageCallback("has waiter cake?", _local6);
waiterIsBuzzy = false;
messageCallback("is waiter buzzy?", _local6);
if (((((((((bakedCake) && (!(waiterGotCake)))) || (((((!(bakedCake)) && (waiterGotCake))) && ((state == STATE_IDLE)))))) || (((((!(bakedCake)) && (!(waiterGotCake)))) && ((state == STATE_IDLE)))))) || (((waiterIsBuzzy) && ((state == STATE_IDLE)))))){
if (cakeButtoneChecked){
cakeButtoneChecked = false;
} else {
cakeButtoneChecked = true;
_local6 = new InfoData();
_local6.data1 = ovenNr;
messageCallback("oven button checked", _local6);
};
};
};
}
override protected function createCollisionObject():void{
collisionObjectOffsetY = -10;
collisionObject = new CollisionObject(0, 0, 103);
}
override public function collisionReaction(_arg1:BaseObject){
messageCallback("collision", null);
overCheck(_arg1);
if ((((((state == STATE_IDLE)) || ((state == STATE_BAKING)))) && (input.mouseIsPressed))){
clickCheck(_arg1);
};
}
override public function render(_arg1:Number){
var _local2:*;
super.render(_arg1);
button1Clip.gotoAndStop(buttonAnimFrame[0]);
button2Clip.gotoAndStop(buttonAnimFrame[1]);
button3Clip.gotoAndStop(buttonAnimFrame[2]);
button4Clip.gotoAndStop(buttonAnimFrame[3]);
clip.Marker1_mc.visible = buttonChecked[0];
clip.Marker2_mc.visible = buttonChecked[1];
clip.Marker3_mc.visible = buttonChecked[2];
clip.Marker4_mc.visible = buttonChecked[3];
clip.Marker5_mc.visible = cakeButtoneChecked;
if (showProgressBar){
clip.progressbar.visible = true;
clip.progressbar.gotoAndStop(progressBarAnimFrame);
} else {
clip.progressbar.visible = false;
};
if (showWork){
clip.work.visible = true;
} else {
clip.work.visible = false;
};
if (showTray){
clip.topTray.visible = true;
clip.topTray.gotoAndStop(trayAnimFrame);
clip.tray.visible = true;
clip.tray.gotoAndStop(trayAnimFrame);
} else {
clip.tray.visible = false;
};
if (showFire){
clip.fire.visible = true;
clip.fire.gotoAndStop(fireAnimFrame);
} else {
clip.fire.visible = false;
};
if (visible){
_local2 = 0;
while (_local2 < collisionButtons.length) {
collisionButtons[_local2].render();
_local2++;
};
};
}
override public function tick(){
var _local1:*;
var _local2:InfoData;
super.tick();
_local1 = 0;
while (_local1 < 4) {
if (buttonOver[_local1]){
buttonAnimFrame[_local1] = 2;
buttonOver[_local1] = false;
} else {
buttonAnimFrame[_local1] = 1;
};
_local1++;
};
switch (state){
case STATE_IDLE:
if (((!((checkedIndex == -1))) && (waiterHere))){
setBakingType(checkedIndex);
buttonChecked[checkedIndex] = false;
checkedIndex = -1;
timerCounter = 0;
showProgressBar = true;
showWork = true;
state = STATE_BAKING;
SoundManager.playOvenRunningSound(bakeTime);
};
break;
case STATE_BAKING:
timerCounter++;
progressBarAnimFrame = ((timerCounter / (bakeTime / 6)) + 1);
if (progressBarAnimFrame > 6){
progressBarAnimFrame = 6;
};
if (timerCounter == bakeTime){
showProgressBar = false;
showWork = false;
if (bakedCake){
bakedCake = false;
timerCounter = MOVE_DOWN_TIME;
state = STATE_MOVE_DOWN;
} else {
setCakeType();
cake.posY = -43;
timerCounter = 0;
state = STATE_UPDATE_TRAY;
SoundManager.playCakeOvenOpen();
};
};
break;
case STATE_UPDATE_TRAY:
timerCounter++;
trayAnimFrame = int(((timerCounter / (TRAY_TIME / 6)) + 1));
if (trayAnimFrame > 1){
cake.visible = true;
};
if ((((trayAnimFrame >= 2)) && ((trayAnimFrame <= 4)))){
cake.posY = (cake.posY - (10 / (TRAY_TIME / 2)));
} else {
if (trayAnimFrame >= 6){
cake.posY = -53;
trayAnimFrame = 1;
bakedCake = true;
state = STATE_IDLE;
_local2 = new InfoData();
_local2.data1 = cake.getCakeType();
_local2.data2 = cake.getFrostingType();
_local2.data3 = cake.getDecorationType();
messageCallback("oven baked cake", _local2);
};
};
break;
case STATE_MOVE_DOWN:
timerCounter--;
trayAnimFrame = int(((timerCounter / (MOVE_DOWN_TIME / 6)) + 1));
if (trayAnimFrame < 3){
once = true;
trayAnimFrame = 3;
timerCounter = 0;
state = STATE_BURN;
setBurnCakeType();
SoundManager.playFireOvenSound();
};
break;
case STATE_BURN:
timerCounter++;
showFire = true;
fireAnimFrame = int(((timerCounter / (BURN_TIME / 11)) + 1));
if (fireAnimFrame > 11){
fireAnimFrame = 11;
showFire = false;
timerCounter = int((3 * ((MOVE_UP_TIME / 6) + 0)));
state = STATE_MOVE_UP;
SoundManager.playCakeOvenOpen();
_local2 = new InfoData();
_local2.data1 = burnCakeType;
_local2.data2 = (posX + 10);
_local2.data3 = posY;
messageCallback("waiter burn cake", _local2);
};
if ((((fireAnimFrame == 5)) && (once))){
setCakeType();
cake.posY = -43;
once = false;
};
break;
case STATE_MOVE_UP:
timerCounter++;
trayAnimFrame = int(((timerCounter / (MOVE_UP_TIME / 6)) + 0));
if (trayAnimFrame >= 6){
};
if ((((trayAnimFrame >= 3)) && ((trayAnimFrame <= 4)))){
cake.posY = (cake.posY - (10 / (MOVE_UP_TIME / 2)));
} else {
if (trayAnimFrame >= 6){
cake.posY = -53;
trayAnimFrame = 1;
bakedCake = true;
state = STATE_IDLE;
_local2 = new InfoData();
_local2.data1 = cake.getCakeType();
_local2.data2 = cake.getFrostingType();
_local2.data3 = cake.getDecorationType();
messageCallback("oven burn and baked cake", _local2);
};
};
break;
};
if (((cakeButtoneChecked) && (waiterHere))){
_local2 = new InfoData();
messageCallback("has waiter cake?", _local2);
if (((bakedCake) && (!(waiterGotCake)))){
cakeButtoneChecked = false;
cake.visible = false;
bakedCake = false;
_local2 = new InfoData();
_local2.data1 = cake.getCakeType();
_local2.data2 = cake.getFrostingType();
_local2.data3 = cake.getDecorationType();
messageCallback("give waiter cake", _local2);
} else {
if (((!(bakedCake)) && (waiterGotCake))){
cakeButtoneChecked = false;
waiterGotCake = false;
bakedCake = true;
cake.visible = true;
cake.setTypes(waiterCakeType, waiterFrostingType, waiterDecorationType);
_local2 = new InfoData();
messageCallback("waiter leave cake", _local2);
} else {
cakeButtoneChecked = false;
};
};
};
}
public function overCheck(_arg1:BaseObject){
if (_arg1.collisionObject.collisionTest(collisionButtons[0])){
buttonOver[0] = true;
} else {
if (_arg1.collisionObject.collisionTest(collisionButtons[1])){
buttonOver[1] = true;
} else {
if (_arg1.collisionObject.collisionTest(collisionButtons[2])){
buttonOver[2] = true;
} else {
if (_arg1.collisionObject.collisionTest(collisionButtons[3])){
buttonOver[3] = true;
};
};
};
};
}
override public function deleting(){
parentClip.removeChild(clip);
clip = null;
if (collisionObject){
collisionObject.deleteClip();
};
collisionObject = null;
super.deleting();
}
private function setBakingType(_arg1:int){
switch (_arg1){
case 0:
bakingType = buttonType[0];
break;
case 1:
bakingType = buttonType[1];
break;
case 2:
bakingType = buttonType[2];
break;
case 3:
bakingType = buttonType[3];
break;
};
}
public function waiterLeave(){
waiterHere = false;
}
}
}//package com.king.cakemania
Section 62
//Pointer (com.king.cakemania.Pointer)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class Pointer extends BaseObject {
private var down:Boolean;
function Pointer(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Function, _arg5:Counter){
super(_arg1, _arg2, _arg3, null, _arg4, _arg5);
}
public function update2(_arg1:Boolean, _arg2:Boolean, _arg3:Boolean){
if (_arg1){
animFrame = 1;
down = false;
} else {
if (((!(_arg1)) && (_arg3))){
down = false;
} else {
if (((!(_arg1)) && (_arg2))){
down = true;
};
};
};
if (((!(_arg1)) && (!(down)))){
animFrame = 2;
} else {
if (((!(_arg1)) && (down))){
animFrame = 3;
};
};
}
override protected function createClip():void{
clip = new Pointers();
parentClip.addChild(clip);
}
public function update1(_arg1:Number, _arg2:Number){
this.posX = (_arg1 + 35);
this.posY = (_arg2 + 35);
super.tick();
}
public function reset(){
animFrame = 1;
down = false;
}
override protected function createCollisionObject():void{
collisionObject = new CollisionObject(0, 0, 1);
}
public function update(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Boolean, _arg5:Boolean){
this.posX = (_arg1 + 35);
this.posY = (_arg2 + 35);
if (_arg3){
animFrame = 1;
down = false;
} else {
if (((!(_arg3)) && (_arg5))){
down = false;
} else {
if (((!(_arg3)) && (_arg4))){
down = true;
};
};
};
if (((!(_arg3)) && (!(down)))){
animFrame = 2;
} else {
if (((!(_arg3)) && (down))){
animFrame = 3;
};
};
super.tick();
}
}
}//package com.king.cakemania
Section 63
//Popup (com.king.cakemania.Popup)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
import flash.text.*;
class Popup extends BaseObject {
private var SHOW_TIME_FRAMES:int;// = 50
private var timerCounter:int;
function Popup(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Function, _arg6, _arg7:Counter){
SHOW_TIME_FRAMES = (2 * 25);
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg7);
setValueAndColor(_arg6);
}
override protected function createClip():void{
clip = new SumAnimation();
clip.x = posX;
clip.y = posY;
parentClip.addChild(clip);
}
private function setValueAndColor(_arg1:int){
var _local2:Number;
var _local3:TextFormat;
_local2 = (_arg1 / 100);
if (_arg1 > 0){
clip.sum.gotoAndStop(1);
_local3 = clip.sum.sum1_txt.getTextFormat();
_local3.color = 3595336;
clip.sum.sum1_txt.defaultTextFormat = _local3;
clip.sum.sum1_txt.text = ("$" + _local2);
} else {
clip.sum.gotoAndStop(1);
_local3 = clip.sum.sum1_txt.getTextFormat();
_local3.color = 13906217;
clip.sum.sum1_txt.defaultTextFormat = _local3;
clip.sum.sum1_txt.text = ("$" + _local2);
};
}
override public function tick(){
super.tick();
timerCounter++;
animFrame = int(((timerCounter / (SHOW_TIME_FRAMES / 24)) + 1));
if (animFrame > 24){
animFrame = 24;
visible = false;
toBeRemoved = true;
};
}
}
}//package com.king.cakemania
Section 64
//Random (com.king.cakemania.Random)
package com.king.cakemania {
import flash.utils.*;
public class Random {
private var mti:Number;
private var lastSeed:Number;
private var mta:Array;
private static var MATRIX_A:Number = 2567483615;
public static var nr:int = 0;
private static var UPPER_MASK:Number = 2147483648;
private static var LOWER_MASK:Number = 2147483647;
private static var M:Number = 397;
private static var N:Number = 624;
private static var mag01:Array = [0, 2567483615];
public function Random(_arg1:Number){
mta = new Array(N);
mti = (N + 1);
if (_arg1){
init_genrand(_arg1);
};
}
private function init_genrand(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:Number;
var _local6:*;
_arg1 = int(_arg1);
_local2 = getTimer();
lastSeed = _arg1;
mta[0] = _arg1;
_local3 = _arg1;
_local4 = new Integer64(null);
_local5 = N;
mti = 1;
while (mti < _local5) {
_local4.init32(((_local3 >>> 30) ^ _local3));
_local4.mulu32(1812433253);
_local3 = (mta[mti] = int((_local4.lsb + mti)));
mti++;
};
_local6 = getTimer();
}
public function set seed(_arg1:Number){
init_genrand(_arg1);
}
public function nextDouble(){
return ((next(24) / (1 << 24)));
}
public function nextFloat(){
return ((next(24) / (1 << 24)));
}
public function get seed():Number{
return (lastSeed);
}
public function next(_arg1:Number){
if (_arg1 < 32){
return ((genrand_int32() & ((1 << _arg1) - 1)));
};
return (genrand_int32());
}
public function nextInt(_arg1:Number){
nr++;
return (((genrand_int32() & 2147483647) % _arg1));
}
private function genrand_int32(){
var _local1:Number;
var _local2:Number;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
_local1 = N;
_local2 = 0;
if (mti >= _local1){
if (mti == (_local1 + 1)){
init_genrand(5489);
};
_local3 = M;
_local4 = UPPER_MASK;
_local5 = LOWER_MASK;
_local6 = mag01;
_local7 = getTimer();
_local8 = 0;
_local9 = (_local1 - _local3);
_local10 = (_local3 - _local1);
_local8 = 0;
while (_local8 < _local9) {
_local2 = ((mta[_local8] & _local4) | (mta[(_local8 + 1)] & _local5));
mta[_local8] = ((mta[(_local8 + _local3)] ^ (_local2 >>> 1)) ^ _local6[(_local2 & 1)]);
_local8++;
};
_local9 = (_local1 - 1);
while (_local8 < _local9) {
_local2 = ((mta[_local8] & _local4) | (mta[(_local8 + 1)] & _local5));
mta[_local8] = ((mta[(_local8 + _local10)] ^ (_local2 >>> 1)) ^ _local6[(_local2 & 1)]);
_local8++;
};
_local2 = ((mta[(_local1 - 1)] & _local4) | (mta[0] & _local5));
mta[(_local1 - 1)] = ((mta[(_local3 - 1)] ^ (_local2 >>> 1)) ^ _local6[(_local2 & 1)]);
mti = 0;
_local11 = getTimer();
};
_local2 = mta[mti++];
_local2 = (_local2 ^ (_local2 >>> 11));
_local2 = (_local2 ^ ((_local2 << 7) & 2636928640));
_local2 = (_local2 ^ ((_local2 << 15) & 4022730752));
_local2 = (_local2 ^ (_local2 >>> 18));
return (_local2);
}
}
}//package com.king.cakemania
Section 65
//References (com.king.cakemania.References)
package com.king.cakemania {
import flash.display.*;
public class References {
public static var NODE_INDEX_DECORATOR1:int = 8;
public static var NODE_INDEX_DECORATOR2:int = 9;
public static var debugClip:MovieClip;
public static var NODE_INDEX_DISPLAYCASE:int = 11;
public static var NODE_INDEX_FROSTER1:int = 4;
public static var NODE_INDEX_FROSTER2:int = 5;
public static var gameClip:MovieClip;
public static var NODE_INDEX_OVEN1:int = 6;
public static var NODE_INDEX_OVEN2:int = 7;
public static var NODE_INDEX_BUBBLE1:int = 0;
public static var NODE_INDEX_BUBBLE2:int = 1;
public static var NODE_INDEX_BUBBLE3:int = 2;
public static var NODE_INDEX_BUBBLE4:int = 3;
public static var gameClipChild:MovieClip;
public static var DEBUG_RENDER:Boolean = false;
public static var popupClip:MovieClip;
public static var guiClip:MovieClip;
public static var pointerClip:MovieClip;
public static var mainClip:MovieClip;
public static var NODE_INDEX_TRASHCAN:int = 10;
public static var pointer:Pointer;
public static function init(_arg1:MovieClip){
mainClip = _arg1;
gameClip = new MovieClip();
mainClip.addChild(gameClip);
popupClip = new MovieClip();
mainClip.addChild(popupClip);
guiClip = new MovieClip();
mainClip.addChild(guiClip);
debugClip = new MovieClip();
mainClip.addChild(debugClip);
pointerClip = new MovieClip();
mainClip.addChild(pointerClip);
if (!DEBUG_RENDER){
debugClip.visible = false;
};
}
}
}//package com.king.cakemania
Section 66
//ScreenPlayer (com.king.cakemania.ScreenPlayer)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
import flash.ui.*;
import flash.system.*;
class ScreenPlayer {
public static var tutorialClip:MovieClip;
private static var arrowAnimFrame:int;
public static var resultClip:MovieClip;
public static var beginClip:MovieClip;
public static var freeClip:MovieClip;
private static var tutorialAnimFrame:int;
public static var startScreen:MovieClip;
public static function hideTutorial(){
tutorialClip.visible = false;
}
public static function scoreToDollarString(_arg1:int):String{
var _local2:Boolean;
var _local3:int;
var _local4:String;
var _local5:String;
_local2 = false;
if (_arg1 < 0){
_arg1 = -(_arg1);
_local2 = true;
};
_local3 = (_arg1 % 100);
_arg1 = int((_arg1 / 100));
if (_local3 == 0){
_local4 = "00";
} else {
if (_local3 < 10){
_local4 = (String(_local3) + "0");
} else {
_local4 = String(_local3);
};
};
_local5 = "";
if (_local2){
_local5 = (_local5 + "-");
};
_local5 = (_local5 + String(_arg1));
return (_local5);
}
public static function hideFreeSign(){
freeClip.visible = false;
}
public static function updateTutorial(_arg1:Boolean){
tutorialClip.instruction_heading_txt.text = TextProperties.INSTRUCTION_HEADING;
tutorialAnimFrame = (tutorialAnimFrame + 1);
if (tutorialAnimFrame >= 499){
tutorialAnimFrame = 1;
};
if (_arg1){
if (tutorialAnimFrame >= 374){
tutorialAnimFrame = 1;
} else {
if (tutorialAnimFrame >= 248){
tutorialAnimFrame = 374;
} else {
if (tutorialAnimFrame >= 125){
tutorialAnimFrame = 248;
} else {
tutorialAnimFrame = 125;
};
};
};
};
tutorialClip.gotoAndStop(tutorialAnimFrame);
if (tutorialAnimFrame == 1){
tutorialClip.text1.visible = true;
tutorialClip.text2.visible = false;
tutorialClip.text3.visible = false;
tutorialClip.text4.visible = false;
} else {
if (tutorialAnimFrame == 125){
tutorialClip.text1.visible = false;
tutorialClip.text2.visible = true;
tutorialClip.text3.visible = false;
tutorialClip.text4.visible = false;
} else {
if (tutorialAnimFrame == 248){
tutorialClip.text1.visible = false;
tutorialClip.text2.visible = false;
tutorialClip.text3.visible = true;
tutorialClip.text4.visible = false;
} else {
if (tutorialAnimFrame == 374){
tutorialClip.text1.visible = false;
tutorialClip.text2.visible = false;
tutorialClip.text3.visible = false;
tutorialClip.text4.visible = true;
};
};
};
};
if (tutorialAnimFrame > 1){
arrowAnimFrame++;
if (arrowAnimFrame > 30){
arrowAnimFrame = 0;
};
tutorialClip.arrow_mc.gotoAndStop(arrowAnimFrame);
};
}
public static function updateBeginLevelTime(_arg1:int){
var _local2:int;
var _local3:String;
_local2 = int((9 - (_arg1 / 25)));
_local3 = String(_local2);
beginClip.texts_mc.level_starts_txt.text = ((TextProperties.LEVEL_STARTS_IN + " ") + _local3);
}
public static function setupScreens(){
References.mainClip.Sound_mc.Text_mc.soundOn.text = TextProperties.SOUND_ON;
tutorialClip = new Tutorial();
tutorialClip.text1.Instruction_text_long.text = TextProperties.INSTRUCTION_TEXT1;
tutorialClip.text2.Instruction_text_long.text = TextProperties.INSTRUCTION_TEXT2;
tutorialClip.text3.Instruction_text_long.text = TextProperties.INSTRUCTION_TEXT3;
tutorialClip.text4.Instruction_text_long.text = TextProperties.INSTRUCTION_TEXT4;
tutorialClip.text1.visible = true;
tutorialClip.text2.visible = false;
tutorialClip.text3.visible = false;
tutorialClip.text4.visible = false;
References.mainClip.addChild(tutorialClip);
tutorialClip.x = 300;
tutorialClip.y = 225;
hideTutorial();
startScreen = new StartScreen();
References.mainClip.addChild(startScreen);
beginClip = new begin_screen();
References.mainClip.addChild(beginClip);
hideBegin();
resultClip = new Result();
References.mainClip.addChild(resultClip);
hideResult();
freeClip = new endfree();
References.mainClip.addChild(freeClip);
hideFreeSign();
tutorialAnimFrame = 1;
arrowAnimFrame = 0;
}
public static function hideStartScreen(){
startScreen.visible = false;
}
public static function showExitButton(){
References.mainClip.Exit_mc.visible = true;
}
public static function showSoundOn(){
References.mainClip.Sound_mc.Symbol_mc.gotoAndStop(1);
References.mainClip.Sound_mc.Text_mc.gotoAndStop(1);
References.mainClip.Sound_mc.Text_mc.soundOn.text = TextProperties.SOUND_ON;
}
public static function hideExitButton(){
References.mainClip.Exit_mc.visible = false;
}
public static function hideBegin(){
beginClip.visible = false;
}
public static function buttonStates(_arg1:int, _arg2:int):int{
var _local3:int;
var _local4:Boolean;
var _local5:Boolean;
var _local6:Boolean;
var _local7:Boolean;
var _local8:Boolean;
_local3 = 0;
_local4 = tutorialClip.Start_btn.hitTestPoint(_arg1, _arg2);
if (_local4){
_local3 = 1;
tutorialClip.Start_down_btn.button_text.text = TextProperties.INSTRUCTION_BUTTON;
tutorialClip.Start_btn.visible = false;
tutorialClip.Start_down_btn.visible = true;
} else {
tutorialClip.Start_btn.button_text.text = TextProperties.INSTRUCTION_BUTTON;
tutorialClip.Start_btn.visible = true;
tutorialClip.Start_down_btn.visible = true;
};
_local5 = beginClip.Start_btn.hitTestPoint(_arg1, _arg2);
if (_local5){
_local3 = 2;
beginClip.Start_btn.button_text.text = TextProperties.LEVEL_SIGN_PLAY_BUTTON;
beginClip.Start_btn.visible = false;
beginClip.Start_down_btn.visible = true;
} else {
beginClip.Start_down_btn.button_text.text = TextProperties.LEVEL_SIGN_PLAY_BUTTON;
beginClip.Start_btn.visible = true;
beginClip.Start_down_btn.visible = false;
};
_local6 = References.mainClip.Sound_mc.hitTestPoint(_arg1, _arg2);
if (_local6){
_local3 = 3;
};
_local7 = References.mainClip.Exit_mc.hitTestPoint(_arg1, _arg2);
if (_local7){
_local3 = 4;
};
_local8 = tutorialClip.btn_forward.hitTestPoint(_arg1, _arg2);
if (_local8){
_local3 = 5;
tutorialClip.btn_forward.gotoAndStop(2);
tutorialClip.gotoAndStop("oven");
} else {
tutorialClip.btn_forward.gotoAndStop(1);
tutorialClip.gotoAndStop("money");
};
return (_local3);
}
public static function updateFreeSignTime(_arg1:int){
var _local2:int;
var _local3:String;
_local2 = int((8 - (_arg1 / 25)));
if (_local2 < 1){
_local2 = 1;
};
_local3 = String(_local2);
freeClip.gameEndsIn_txt.text = ((TextProperties.GAME_ENDS_IN + " ") + _local3);
}
public static function showBegin(_arg1:int, _arg2:int){
switch (_arg2){
case 1:
beginClip.texts_mc.beginscreen_text1.text = TextProperties.LEVEL_SIGN_TEXT_1;
beginClip.texts_mc.text_month.text = TextProperties.LEVEL_SIGN_MONTH_1;
break;
case 2:
beginClip.texts_mc.beginscreen_text1.text = TextProperties.LEVEL_SIGN_TEXT_2;
beginClip.texts_mc.text_month.text = TextProperties.LEVEL_SIGN_MONTH_2;
break;
case 3:
beginClip.texts_mc.beginscreen_text1.text = TextProperties.LEVEL_SIGN_TEXT_3;
beginClip.texts_mc.text_month.text = TextProperties.LEVEL_SIGN_MONTH_3;
break;
};
beginClip.texts_mc.baker_goal_txt.text = ((TextProperties.LEVEL_SIGN_BAKER_GOAL + " $") + scoreToDollarString(_arg1));
beginClip.visible = true;
updateBeginLevelTime(0);
}
public static function showFreeSign(){
freeClip.free_txt.text = TextProperties.FREE_GAME_TEXT;
freeClip.gameEndsIn_txt.text = (TextProperties.GAME_ENDS_IN + " 8");
freeClip.visible = true;
}
public static function showStartScreen(){
startScreen.visible = true;
}
public static function updateResultTime(_arg1:Boolean, _arg2:int){
var _local3:int;
var _local4:String;
var _local5:String;
_local3 = int((9 - (_arg2 / 25)));
if (_local3 < 1){
_local3 = 1;
};
_local4 = String(_local3);
_local5 = String((_local3 + 8));
if (_arg1){
resultClip.result_screen_mc.texts1_mc.level_starts_txt.text = ((TextProperties.GAME_ENDS_IN + " ") + _local4);
resultClip.result_screen_mc.texts2_mc.game_ends_in_txt.text = ((TextProperties.GAME_ENDS_IN + " ") + _local4);
} else {
resultClip.result_screen_mc.texts1_mc.level_starts_txt.text = ((TextProperties.LEVEL_STARTS_IN + " ") + _local5);
resultClip.result_screen_mc.texts2_mc.game_ends_in_txt.text = ((TextProperties.GAME_ENDS_IN + " ") + _local5);
};
}
public static function updateTime(_arg1:int){
var _local2:int;
var _local3:String;
_local2 = int((20 - (_arg1 / 25)));
_local3 = String(_local2);
tutorialClip.time_starts_txt.text = ((TextProperties.GAME_STARTS_IN + " ") + _local3);
}
public static function showResult(_arg1:Boolean, _arg2:Boolean, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int){
var _local9:String;
var _local10:String;
var _local11:String;
var _local12:String;
var _local13:String;
var _local14:String;
var _local15:int;
_local9 = scoreToDollarString(_arg3);
_local10 = scoreToDollarString(_arg4);
_local11 = scoreToDollarString(_arg5);
_local12 = scoreToDollarString(_arg6);
_local13 = scoreToDollarString(_arg7);
_local14 = scoreToDollarString(_arg8);
resultClip.result_screen_mc.texts1_mc.text2b.text = _local10;
resultClip.result_screen_mc.texts1_mc.text3b.text = _local11;
resultClip.result_screen_mc.texts1_mc.text4b.text = _local12;
resultClip.result_screen_mc.texts1_mc.text5b.text = _local9;
resultClip.result_screen_mc.texts1_mc.text6b.text = _local13;
resultClip.result_screen_mc.texts1_mc.text7b.text = _local14;
resultClip.result_screen_mc.texts1_mc.text1.text = TextProperties.RESULT_SIGN_SUCCESS_TEXT;
resultClip.result_screen_mc.texts1_mc.text2a.text = TextProperties.RESULT_SIGN_CAKE_SALES;
resultClip.result_screen_mc.texts1_mc.text3a.text = TextProperties.RESULT_SIGN_TIPS_EARNED;
resultClip.result_screen_mc.texts1_mc.text4a.text = TextProperties.RESULT_SIGN_CAKE_LOSSES;
resultClip.result_screen_mc.texts1_mc.text5a.text = TextProperties.RESULT_SIGN_LEVEL_REVENUE;
resultClip.result_screen_mc.texts1_mc.text6a.text = TextProperties.RESULT_SIGN_BONUS;
resultClip.result_screen_mc.texts1_mc.text7a.text = TextProperties.RESULT_SIGN_TOTAL_SCORE;
resultClip.result_screen_mc.texts1_mc.level_starts_txt.text = TextProperties.LEVEL_STARTS_IN;
resultClip.result_screen_mc.texts2_mc.text2b.text = _local10;
resultClip.result_screen_mc.texts2_mc.text3b.text = _local11;
resultClip.result_screen_mc.texts2_mc.text4b.text = _local12;
resultClip.result_screen_mc.texts2_mc.text5b.text = _local9;
resultClip.result_screen_mc.texts2_mc.text6b.text = _local13;
resultClip.result_screen_mc.texts2_mc.text7b.text = _local14;
resultClip.result_screen_mc.texts2_mc.text1.text = TextProperties.RESULT_SIGN_FAIL_TEXT;
resultClip.result_screen_mc.texts2_mc.text2a.text = TextProperties.RESULT_SIGN_CAKE_SALES;
resultClip.result_screen_mc.texts2_mc.text3a.text = TextProperties.RESULT_SIGN_TIPS_EARNED;
resultClip.result_screen_mc.texts2_mc.text4a.text = TextProperties.RESULT_SIGN_CAKE_LOSSES;
resultClip.result_screen_mc.texts2_mc.text5a.text = TextProperties.RESULT_SIGN_LEVEL_REVENUE;
resultClip.result_screen_mc.texts2_mc.text6a.text = TextProperties.RESULT_SIGN_BONUS;
resultClip.result_screen_mc.texts2_mc.text7a.text = TextProperties.RESULT_SIGN_TOTAL_SCORE;
resultClip.result_screen_mc.texts2_mc.game_ends_in_txt.text = TextProperties.GAME_ENDS_IN;
resultClip.result_screen_mc.success_txt.text = TextProperties.RESULT_SIGN_SUCCESS_HEADING;
resultClip.result_screen_mc.failed_txt.text = TextProperties.RESULT_SIGN_FAIL_HEADING;
resultClip.visible = true;
if (_arg2){
_local15 = 1;
resultClip.result_screen_mc.success_txt.visible = true;
resultClip.result_screen_mc.failed_txt.visible = false;
} else {
_local15 = 2;
resultClip.result_screen_mc.success_txt.visible = false;
resultClip.result_screen_mc.failed_txt.visible = true;
};
if (!_arg2){
resultClip.result_screen_mc.texts1_mc.visible = false;
resultClip.result_screen_mc.texts2_mc.visible = true;
} else {
resultClip.result_screen_mc.texts1_mc.visible = true;
resultClip.result_screen_mc.texts2_mc.visible = false;
};
if (_arg1){
resultClip.result_screen_mc.texts1_mc.level_starts_txt.text = TextProperties.GAME_ENDS_IN;
resultClip.result_screen_mc.texts2_mc.game_ends_in_txt.text = TextProperties.GAME_ENDS_IN;
} else {
resultClip.result_screen_mc.texts1_mc.level_starts_txt.text = TextProperties.LEVEL_STARTS_IN;
resultClip.result_screen_mc.texts2_mc.game_ends_in_txt.text = TextProperties.LEVEL_STARTS_IN;
};
resultClip.result_screen_mc.jill_mc.gotoAndStop(_local15);
}
public static function showTutorial(){
tutorialClip.visible = true;
}
public static function showSoundOff(){
References.mainClip.Sound_mc.Symbol_mc.gotoAndStop(1);
References.mainClip.Sound_mc.Text_mc.gotoAndStop(1);
References.mainClip.Sound_mc.Text_mc.soundOn.text = TextProperties.SOUND_OFF;
}
public static function hideResult(){
resultClip.visible = false;
}
}
}//package com.king.cakemania
Section 67
//Smoke (com.king.cakemania.Smoke)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class Smoke extends BaseObject {
private var SMOKE_TIME:int;// = 15
private var timerCounter:int;
function Smoke(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Function, _arg6:Boolean, _arg7:Counter){
SMOKE_TIME = 15;
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg7);
newCreateClip(_arg6);
timerCounter = 0;
}
override public function tick(){
super.tick();
animFrame = int(((timerCounter / (SMOKE_TIME / 5)) + 1));
if (animFrame > 5){
animFrame = 5;
visible = false;
toBeRemoved = true;
};
timerCounter++;
}
private function newCreateClip(_arg1:Boolean):void{
if (_arg1){
clip = new PuffHappy();
} else {
clip = new PuffAngry();
};
clip.x = posX;
clip.y = posY;
parentClip.addChild(clip);
}
}
}//package com.king.cakemania
Section 68
//SoundManager (com.king.cakemania.SoundManager)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.media.*;
class SoundManager {
private static var closedSound:Sound = new closed();
public static var GAME_LOOP_OUT_FRAMES:int = 6;
private static var timerLoopSound:Sound = new timervarning();
private static var decorationsSound = new decorationsmall();
private static var happySound:Sound = new happy();
public static var GAME_LOOP_IN_FRAMES:int = 12;
private static var cantPlaceSound:Sound = new cantplace();
private static var frosterSound = new frosterspray();
public static var INTRO_OUT_SLOW_FRAMES:int = 200;
private static var introLoop:Sound = new mainmenu_mix_short();
private static var ovenRunningChannel:SoundChannel = null;
private static var timerLoopChannel:SoundChannel = null;
private static var ovenRunningSoundFrames:int;
private static var placeDownSound:Sound = new placedown();
private static var frosterChannel:SoundChannel = null;
public static var isBGSoundOn:Boolean = true;
private static var frosterSoundFrames:int;
private static var bakerGoalReachedSound:Sound = new bakergoalreached();
private static var gameLoopChannel:SoundChannel = null;
private static var selectSound:Sound = new select();
private static var ovenRunningSound = new ovenrunning();
private static var customerLeaveUnhappySound:Sound = new customerleavesunhappy();
private static var gasPoof1:Sound = null;
private static var fireOvenSound:Sound = new fireoven();
private static var cashSound:Sound = new cash();
private static var cakeOvenOpenSound:Sound = new cakeovenopen();
private static var introVolume:Number;
public static var INTRO_OUT_FRAMES:int = 6;
private static var gameVolume:Number;
private static var gameLoop:Sound = new game_loop1();
private static var trashSound:Sound = new trash();
private static var introLoopChannel:SoundChannel = null;
private static var happyLeavingSound:Sound = new happyleaving();
private static var customerRunHappySound:Sound = new customerunhappy();
private static var decorationsChannel:SoundChannel = null;
public static var isSoundOn:Boolean = true;
public static var INTRO_IN_FRAMES:int = 12;
private static var decorationsSoundFrames:int;
private static var wrapSound:Sound = new wrap();
private static var customerArrivesSound:Sound = new customerarrives();
private static var introLoopFrames:int;
private static var pickupSound:Sound = new pickup();
public static function stopDecorationRunningSound(){
if (decorationsChannel){
decorationsChannel.stop();
decorationsChannel = null;
};
}
public static function playGameLoop(){
if (isBGSoundOn){
gameLoopChannel = gameLoop.play(0, 9999, new SoundTransform(0));
gameVolume = 0;
adjustGameLoopVolume(gameVolume);
};
}
public static function adjustOvenRunningSoundVolume(_arg1:Number){
if (ovenRunningChannel){
ovenRunningChannel.soundTransform = new SoundTransform(_arg1);
};
}
public static function introOutSlowUpdate(){
introVolume = (introVolume - (0.75 / INTRO_OUT_SLOW_FRAMES));
if (introVolume <= 0){
introVolume = 0;
stopIntroLoop();
};
if (introLoopChannel){
adjustIntroLoopVolume(introVolume);
};
}
public static function stopFrostingSound(){
if (frosterChannel){
frosterChannel.stop();
frosterChannel = null;
};
}
public static function playWrapSound(){
if (isSoundOn){
wrapSound.play();
};
}
public static function updateDecorationSound(){
if (!decorationsChannel){
return;
};
decorationsSoundFrames--;
if (decorationsSoundFrames <= 0){
decorationsSoundFrames = 0;
decorationsChannel.stop();
} else {
if (decorationsSoundFrames < 5){
adjustDecorationSoundVolume((decorationsSoundFrames / 25));
};
};
}
public static function playHappy(){
if (isSoundOn){
happySound.play();
};
}
public static function playFrostingSound(){
if (!isSoundOn){
return;
};
if (frosterChannel){
frosterChannel.stop();
};
frosterChannel = frosterSound.play(0, 0, new SoundTransform(1));
}
public static function soundOn(_arg1:Boolean, _arg2:Boolean){
isSoundOn = true;
isBGSoundOn = true;
if (_arg1){
restartIntroLoop();
};
if (_arg2){
restartGameLoop();
};
}
public static function playSelect(){
if (isSoundOn){
selectSound.play();
};
}
public static function stopIntroLoop(){
if (introLoopChannel != null){
introLoopChannel.stop();
introLoopChannel = null;
};
}
public static function playIntroLoop(){
if (isBGSoundOn){
introLoopChannel = introLoop.play(0, 9999, new SoundTransform(0));
introVolume = 0;
adjustIntroLoopVolume(introVolume);
};
}
public static function gameInUpdate(){
gameVolume = (gameVolume + (0.75 / GAME_LOOP_IN_FRAMES));
if (gameVolume >= 0.75){
gameVolume = 0.75;
};
adjustGameLoopVolume(gameVolume);
}
public static function playTrash(){
if (isSoundOn){
trashSound.play();
};
}
public static function updateOvenRunningSound(){
if (!ovenRunningChannel){
return;
};
ovenRunningSoundFrames--;
if (ovenRunningSoundFrames <= 0){
ovenRunningSoundFrames = 0;
ovenRunningChannel.stop();
} else {
if (ovenRunningSoundFrames < 5){
adjustOvenRunningSoundVolume((ovenRunningSoundFrames / 25));
};
};
}
public static function playPlaceDown(){
if (isSoundOn){
placeDownSound.play();
};
}
public static function stopGameSounds(){
stopOvenRunningSound();
stopFrostingSound();
stopDecorationRunningSound();
}
public static function playCash(){
if (isSoundOn){
cashSound.play();
};
}
public static function playCustomerRunHappy(){
if (isSoundOn){
customerRunHappySound.play();
};
}
public static function playBakerGoalReached(){
if (isSoundOn){
bakerGoalReachedSound.play();
};
}
public static function stopOvenRunningSound(){
if (ovenRunningChannel){
ovenRunningChannel.stop();
ovenRunningChannel = null;
};
}
public static function stopTimerLoop(){
if (timerLoopChannel != null){
timerLoopChannel.stop();
timerLoopChannel = null;
};
}
public static function playCustomerArrive(){
if (isSoundOn){
customerArrivesSound.play();
};
}
public static function introOutUpdate(){
introVolume = (introVolume - (0.75 / INTRO_OUT_FRAMES));
if (introVolume <= 0){
introVolume = 0;
stopIntroLoop();
};
if (introLoopChannel){
adjustIntroLoopVolume(introVolume);
};
}
public static function playCustomerLeaveUnhappySound(){
if (isSoundOn){
customerLeaveUnhappySound.play();
};
}
public static function playDecorationRunningSound(_arg1:int){
if (!isSoundOn){
return;
};
if (decorationsChannel){
decorationsChannel.stop();
};
decorationsSoundFrames = _arg1;
if (isSoundOn){
decorationsChannel = decorationsSound.play(0, 99, new SoundTransform(1));
adjustDecorationSoundVolume(1);
};
}
public static function playTimerLoop(){
if (isSoundOn){
timerLoopChannel = timerLoopSound.play(0, 9999, new SoundTransform(1));
};
}
public static function playClosed(){
if (isSoundOn){
closedSound.play();
};
}
public static function playPickup(){
if (isSoundOn){
pickupSound.play();
};
}
public static function playOvenRunningSound(_arg1:int){
if (!isSoundOn){
return;
};
if (ovenRunningChannel){
ovenRunningChannel.stop();
};
ovenRunningSoundFrames = _arg1;
if (isSoundOn){
ovenRunningChannel = ovenRunningSound.play(0, 1, new SoundTransform(1));
adjustOvenRunningSoundVolume(1);
};
}
public static function playGasPoof1(){
if (isSoundOn){
gasPoof1.play();
};
}
public static function playFireOvenSound(){
if (isSoundOn){
fireOvenSound.play();
};
}
public static function stopGameLoop(){
if (gameLoopChannel != null){
gameLoopChannel.stop();
gameLoopChannel = null;
};
}
public static function adjustIntroLoopVolume(_arg1:Number){
if (introLoopChannel){
introLoopChannel.soundTransform = new SoundTransform(_arg1);
};
}
public static function adjustGameLoopVolume(_arg1:Number){
if (gameLoopChannel){
gameLoopChannel.soundTransform = new SoundTransform(_arg1);
};
}
public static function soundOff(){
stopGameLoop();
stopIntroLoop();
stopGameSounds();
stopTimerLoop();
isSoundOn = false;
isBGSoundOn = false;
}
public static function introInUpdate(){
introVolume = (introVolume + (0.75 / INTRO_IN_FRAMES));
if (introVolume >= 0.75){
introVolume = 0.75;
};
adjustIntroLoopVolume(introVolume);
}
public static function gameOutUpdate(){
gameVolume = (gameVolume - (0.75 / GAME_LOOP_OUT_FRAMES));
if (gameVolume <= 0){
gameVolume = 0;
stopGameLoop();
};
if (gameLoopChannel){
adjustGameLoopVolume(gameVolume);
};
}
public static function playHappyLeavingSound(){
if (isSoundOn){
happyLeavingSound.play();
};
}
public static function restartIntroLoop(){
if (((isBGSoundOn) && (!(introLoopChannel)))){
introLoopChannel = introLoop.play(0, 9999, new SoundTransform(0.75));
introVolume = 0.75;
adjustIntroLoopVolume(introVolume);
};
}
public static function adjustDecorationSoundVolume(_arg1:Number){
if (decorationsChannel){
decorationsChannel.soundTransform = new SoundTransform(_arg1);
};
}
public static function playCantPlace(){
if (isSoundOn){
cantPlaceSound.play();
};
}
public static function restartGameLoop(){
if (((isBGSoundOn) && (!(gameLoopChannel)))){
gameLoopChannel = gameLoop.play(0, 9999, new SoundTransform(0.75));
gameVolume = 0.75;
adjustGameLoopVolume(gameVolume);
};
}
public static function playCakeOvenOpen(){
if (isSoundOn){
cakeOvenOpenSound.play();
};
}
}
}//package com.king.cakemania
Section 69
//TextProperties (com.king.cakemania.TextProperties)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class TextProperties {
public static var RESULT_SIGN_LEVEL_REVENUE:String = "result_sign_level_revenue";
public static var LEVEL_SIGN_TEXT_1:String = "In the first level, we start off with just one oven and one froster";
public static var LEVEL_SIGN_TEXT_2:String = "Now we’re getting down to business with two ovens and frosters!";
public static var LEVEL_SIGN_TEXT_3:String = "Our final challenge includes 2 ovens, 2 frosters, and decorations!";
public static var LEVEL_SIGN_MONTH_1:String = "JANUARY";
public static var LEVEL_SIGN_MONTH_3:String = "MARS";
public static var INSTRUCTION_HEADING:String = "instruction_heading";
public static var LEVEL_SIGN_MONTH_2:String = "FEBRUARY";
public static var INSTRUCTION_TEXT2:String = "instruction_text_2";
public static var GUI_CALENDAR_FEB:String = "gui_calendar_feb";
public static var GAME_ENDS_IN:String = "Game_ends_in";
public static var INSTRUCTION_TEXT3:String = "instruction_text_3";
public static var LEVEL_SIGN_PLAY_BUTTON:String = "level_sign_play_button";
public static var GOAL_REACHED:String = "goal_reached";
public static var GUI_CALENDAR_JAN:String = "gui_calendar_jan";
public static var INSTRUCTION_BUTTON:String = "instruction_button";
public static var INSTRUCTION_TEXT4:String = "instruction_text_4";
public static var INSTRUCTION_TEXT1:String = "instruction_text_1";
public static var GUI_BAKER_GOAL:String = "gui_baker_goal";
public static var SOUND_ON:String = "sound_on";
public static var CLOSED_SIGN:String = "closed_sign";
public static var LEVEL_STARTS_IN:String = "level_starts_in";
public static var RESULT_SIGN_SUCCESS_TEXT:String = "result_sign_success_text";
public static var RESULT_SIGN_CAKE_SALES:String = "result_sign_cake_sales";
public static var RESULT_SIGN_FAIL_TEXT:String = "result_sign_fail_text";
public static var GAME_STARTS_IN:String = "game_starts_in";
public static var FREE_GAME_TEXT:String = "Free_game_text";
public static var GUI_CASH:String = "gui_cash";
public static var RESULT_SIGN_CAKE_LOSSES:String = "result_sign_cake_losses";
public static var RESULT_SIGN_BONUS:String = "result_sign_bonus";
public static var LEVEL_SIGN_BAKER_GOAL:String = "level_sign_baker_goal";
public static var GUI_CALENDAR_MAR:String = "gui_calendar_mar";
public static var RESULT_SIGN_FAIL_HEADING:String = "result_sign_fail_heading";
public static var RESULT_SIGN_TIPS_EARNED:String = "result_sign_tips_earned";
public static var RESULT_SIGN_SUCCESS_HEADING:String = "result_sign_success_heading";
public static var EXIT_GAME:String = "exit_game";
public static var RESULT_SIGN_TOTAL_SCORE:String = "result_sign_total_score";
public static var SOUND_OFF:String = "sound_off";
public static function setStaticTexts(){
References.mainClip.Exit_mc.Text_mc.exitGame.text = EXIT_GAME;
References.gameClipChild.menuTexts.cash_text.text = GUI_CASH;
References.gameClipChild.menuTexts.baker_goal_text.text = GUI_BAKER_GOAL;
}
}
}//package com.king.cakemania
Section 70
//Timer (com.king.cakemania.Timer)
package com.king.cakemania {
import flash.utils.*;
public class Timer {
private var unprocessedTime:Number;// = 0
private var lastTime:Number;// = -1
public var passedTime:Number;// = 0
private var msPerTick:Number;
private var ticksPerSecond:Number;
public var timeScale:Number;// = 1
public var alpha:Number;// = 0
public static var currentTime:Number = 0;
public function Timer(_arg1){
lastTime = -1;
unprocessedTime = 0;
alpha = 0;
timeScale = 1;
passedTime = 0;
super();
this.ticksPerSecond = _arg1;
msPerTick = (1000 / _arg1);
}
public function advanceTime(){
var _local1:*;
var _local2:int;
if (lastTime == -1){
lastTime = getTimer();
};
_local1 = getTimer();
passedTime = (_local1 - lastTime);
passedTime = (passedTime * timeScale);
currentTime = (currentTime + passedTime);
lastTime = _local1;
unprocessedTime = (unprocessedTime + passedTime);
_local2 = int((unprocessedTime / msPerTick));
unprocessedTime = (unprocessedTime - (_local2 * msPerTick));
alpha = (unprocessedTime / msPerTick);
return (_local2);
}
}
}//package com.king.cakemania
Section 71
//Trashcan (com.king.cakemania.Trashcan)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
class Trashcan extends BaseObject {
private var waiterDecorationType:int;
private var waiterHere:Boolean;
private var buttonChecked:Boolean;
private var waiterCakeType:int;
private var waiterGotCake:Boolean;
var state:int;
var input:Input;
private var timerCounter:int;
private var waiterFrostingType:int;
private var gotCake:Boolean;
public static var STATE_IDLE:int = 0;
public static var STATE_OPEN:int = 1;
public static var STATE_CLOSE:int = 2;
public static var WORK_TIME:int = 6;
function Trashcan(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Function, _arg6:MovieClip, _arg7:Counter, _arg8:Input){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg7);
clip = _arg6;
this.input = _arg8;
init();
}
public function waiterLeave(){
waiterHere = false;
}
override public function render(_arg1:Number){
super.render(_arg1);
clip.Marker1_mc.visible = buttonChecked;
}
public function init(){
waiterHere = false;
waiterGotCake = false;
buttonChecked = false;
animFrame = 1;
createCollisionObject();
state = STATE_IDLE;
}
override public function tick(){
var _local1:InfoData;
var _local2:int;
super.tick();
if (((buttonChecked) && (waiterHere))){
_local1 = new InfoData();
messageCallback("has waiter cake?", _local1);
if (waiterGotCake){
buttonChecked = false;
timerCounter = 0;
state = STATE_OPEN;
_local1 = new InfoData();
messageCallback("waiter leave cake", _local1);
_local2 = 0;
if (waiterFrostingType != 0){
_local2 = 1;
};
if (waiterDecorationType != 0){
_local2 = 2;
};
_local1.data1 = _local2;
_local1.data2 = posX;
_local1.data3 = posY;
messageCallback("waiter throw cake", _local1);
} else {
buttonChecked = false;
};
};
switch (state){
case STATE_IDLE:
animFrame = 1;
break;
case STATE_OPEN:
timerCounter++;
animFrame = int(((timerCounter / (WORK_TIME / 3)) + 1));
if (animFrame >= 3){
animFrame = 3;
timerCounter = WORK_TIME;
state = STATE_CLOSE;
};
break;
case STATE_CLOSE:
timerCounter--;
animFrame = int(((timerCounter / (WORK_TIME / 3)) + 1));
if (animFrame <= 1){
animFrame = 1;
state = STATE_IDLE;
};
break;
};
}
public function setWaiterCake(_arg1:Boolean, _arg2:int, _arg3:int, _arg4:int){
waiterGotCake = _arg1;
waiterCakeType = _arg2;
waiterFrostingType = _arg3;
waiterDecorationType = _arg4;
}
public function waiterArrive(){
waiterHere = true;
}
private function clickCheck(){
var _local1:InfoData;
if (buttonChecked){
buttonChecked = false;
} else {
buttonChecked = true;
_local1 = new InfoData();
messageCallback("trashcan checked", _local1);
};
}
override protected function createCollisionObject():void{
collisionObjectOffsetY = 0;
collisionObject = new CollisionObject(0, 0, 50);
}
override public function collisionReaction(_arg1:BaseObject){
messageCallback("collision", null);
if (input.mouseIsPressed){
clickCheck();
};
}
}
}//package com.king.cakemania
Section 72
//Waiter (com.king.cakemania.Waiter)
package com.king.cakemania {
import com.king.cakemania.*;
import flash.display.*;
import source.pathfinding.*;
class Waiter extends BaseObject {
private var currentNode:MyNode;
private var oldShowCake:Boolean;
private var oldAnimation:int;
private var parentClipBack:MovieClip;
private var path:Array;
private var targetNode:MyNode;
private var cake:Cake;
private var endAnimFrame:int;
private var oldPosX:Number;
private var oldPosY:Number;
private var scale:Number;
public var currentPathNode:MyNode;
private var parentParentClip:MovieClip;
private var idleAnimate:Boolean;
public var runSpeed:Number;
private var runAnimationSpeed:Number;
private var state:int;
private var animation:int;
private var startAnimFrame:int;
private var WAIT_BEFORE_IDLE_ANIM_FRAMES:int;// = 50
private var runBuffer:Array;
private var IDLE_ANIM_SPEED:Number;// = 0.6
private var nodeNetwork:NodeNetwork;
private var animFrameDouble:Number;
private var frameCounter:int;
private var inFrontOff:Boolean;
private var showCake:Boolean;
public static const ANIMATION_RIGHT_DOWN:int = 1;
public static const ANIMATION_RIGHT:int = 0;
public static const ANIMATION_IDLE_CAKE:int = 9;
public static const ANIMATION_LEFT:int = 4;
public static const STATE_IDLE:int = 0;
public static const STATE_RUNNING:int = 1;
public static const ANIMATION_IDLE_EMPTY:int = 8;
public static const ANIMATION_UP:int = 6;
public static const ANIMATION_LEFT_UP:int = 5;
public static const ANIMATION_RIGHT_UP:int = 7;
public static const ANIMATION_DOWN:int = 2;
public static const ANIMATION_LEFT_DOWN:int = 3;
function Waiter(_arg1:int, _arg2:MovieClip, _arg3:MovieClip, _arg4:MovieClip, _arg5:Number, _arg6:Number, _arg7:Array, _arg8:Function, _arg9:Counter, _arg10:Random){
IDLE_ANIM_SPEED = 0.6;
WAIT_BEFORE_IDLE_ANIM_FRAMES = 50;
super(_arg3, _arg5, _arg6, _arg7, _arg8, _arg9);
this.parentParentClip = _arg2;
this.parentClipBack = _arg4;
nodeNetwork = new NodeNetwork(_arg1, References.debugClip);
cake = new Cake(clip, clip.plateAndCake.x, clip.plateAndCake.y, _arg7, _arg8, clip.cake_mc, false, _arg9, _arg10);
_arg7.push(cake);
inFrontOff = true;
init(999);
}
public function getDecorationType():int{
return (cake.getDecorationType());
}
public function init(_arg1:Number){
runSpeed = _arg1;
runAnimationSpeed = (runSpeed / 8);
setStartPos(0);
showCake = false;
oldPosX = posX;
oldPosY = posY;
animation = ANIMATION_IDLE_EMPTY;
oldAnimation = ANIMATION_IDLE_EMPTY;
animFrameDouble = 0;
chooseAnimation(0, -1);
runBuffer = new Array();
scale = 1;
}
private function setStartPos(_arg1:int){
setCurrentNode(nodeNetwork.getNode(_arg1));
posX = nodeNetwork.getNodePosX(_arg1);
posY = nodeNetwork.getNodePosY(_arg1);
state = STATE_IDLE;
idleAnimate = false;
}
public function gotoDecorator1(){
runBuffer.unshift(References.NODE_INDEX_DECORATOR1);
}
public function getCakeType():int{
return (cake.getCakeType());
}
public function gotoNearestNode(_arg1:int, _arg2:int){
var _local3:int;
_local3 = nodeNetwork.getClosestNodeIndex(_arg1, _arg2);
runBuffer.unshift(_local3);
}
public function gotoTrashcan(){
runBuffer.unshift(References.NODE_INDEX_TRASHCAN);
}
private function chooseAnimation(_arg1, _arg2){
var _local3:int;
if ((((_arg1 == 0)) && ((_arg2 == 0)))){
return;
};
_local3 = int(((XPMath.atan2(_arg2, _arg1) / 3.14) * 180));
_local3 = (_local3 - 22);
if (_local3 < 0){
_local3 = (_local3 + 360);
};
if ((((_local3 >= 1)) && ((_local3 < 45)))){
animation = ANIMATION_LEFT_UP;
} else {
if ((((_local3 >= 45)) && ((_local3 < 90)))){
animation = ANIMATION_UP;
} else {
if ((((_local3 >= 90)) && ((_local3 < 135)))){
animation = ANIMATION_RIGHT_UP;
} else {
if ((((_local3 >= 135)) && ((_local3 < 180)))){
animation = ANIMATION_RIGHT;
} else {
if ((((_local3 >= 180)) && ((_local3 < 215)))){
animation = ANIMATION_RIGHT_DOWN;
} else {
if ((((_local3 >= 215)) && ((_local3 < 270)))){
animation = ANIMATION_DOWN;
} else {
if ((((_local3 >= 270)) && ((_local3 < 315)))){
animation = ANIMATION_LEFT_DOWN;
} else {
if ((((_local3 >= 315)) && ((_local3 < 360)))){
animation = ANIMATION_LEFT;
};
};
};
};
};
};
};
};
if (animation != oldAnimation){
changeRunningAnimation();
};
}
public function gotoDecorator2(){
runBuffer.unshift(References.NODE_INDEX_DECORATOR2);
}
private function setScale(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = 200;
_local2 = 400;
_local3 = 0.18;
_local4 = (_local2 - _local1);
_local5 = (posY - _local1);
_local6 = (_local5 / _local4);
_local6 = (1 - _local6);
_local7 = (0.18 * _local6);
scale = (1 - _local7);
}
public function gotoBubble2(){
runBuffer.unshift(References.NODE_INDEX_BUBBLE2);
}
public function gotoBubble3(){
runBuffer.unshift(References.NODE_INDEX_BUBBLE3);
}
public function gotoBubble4(){
runBuffer.unshift(References.NODE_INDEX_BUBBLE4);
}
public function walkToNode(_arg1):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:*;
_local2 = (_arg1.x - posX);
_local3 = (_arg1.y - posY);
_local4 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
if (_local4 < runSpeed){
posX = _arg1.x;
posY = _arg1.y;
return (true);
};
_local2 = (_local2 * (runSpeed / _local4));
_local3 = (_local3 * (runSpeed / _local4));
posX = (posX + _local2);
posY = (posY + _local3);
return (false);
}
public function gotoBubble1(){
runBuffer.unshift(References.NODE_INDEX_BUBBLE1);
}
public function removeBuffred(_arg1:int){
var _local2:int;
_local2 = 0;
while (_local2 < runBuffer.length) {
if (runBuffer[_local2] == _arg1){
runBuffer.splice(_local2, 1);
};
_local2++;
};
}
private function findPathToNode(_arg1:MyNode, _arg2:MyNode){
path = nodeNetwork.nodeManager.getOptimalPath(_arg1, _arg2);
}
public function setCurrentNode(_arg1:MyNode){
currentNode = _arg1;
posX = currentNode.x;
posY = currentNode.y;
}
private function changeRunningAnimation(){
if (animation == ANIMATION_RIGHT){
startAnimFrame = 1;
endAnimFrame = 12;
} else {
if (animation == ANIMATION_RIGHT_DOWN){
startAnimFrame = 13;
endAnimFrame = 24;
} else {
if (animation == ANIMATION_DOWN){
startAnimFrame = 25;
endAnimFrame = 36;
} else {
if (animation == ANIMATION_LEFT_DOWN){
startAnimFrame = 37;
endAnimFrame = 48;
} else {
if (animation == ANIMATION_LEFT){
startAnimFrame = 49;
endAnimFrame = 60;
} else {
if (animation == ANIMATION_LEFT_UP){
startAnimFrame = 61;
endAnimFrame = 72;
} else {
if (animation == ANIMATION_UP){
startAnimFrame = 73;
endAnimFrame = 82;
} else {
if (animation == ANIMATION_RIGHT_UP){
startAnimFrame = 83;
endAnimFrame = 94;
};
};
};
};
};
};
};
};
animFrameDouble = startAnimFrame;
}
public function gotoFroster1(){
runBuffer.unshift(References.NODE_INDEX_FROSTER1);
}
public function gotoFroster2(){
runBuffer.unshift(References.NODE_INDEX_FROSTER2);
}
override protected function createClip():void{
clip = new Jill();
parentClip.addChild(clip);
}
public function getFrostingType():int{
return (cake.getFrostingType());
}
private function followPath(){
var _local1:*;
var _local2:Number;
var _local3:Number;
if (path.length > 0){
currentPathNode = path[(path.length - 1)];
if (walkToNode(currentPathNode)){
if (path.length > 1){
_local1 = path[(path.length - 2)];
_local2 = (_local1.x - currentPathNode.x);
_local3 = (_local1.y - currentPathNode.y);
path.pop();
} else {
currentNode = currentPathNode;
path.pop();
return (true);
};
};
return (false);
};
}
private function printRunBuffer(){
var _local1:int;
_local1 = 0;
while (_local1 < runBuffer.length) {
_local1++;
};
}
public function leaveCake(){
showCake = false;
}
override public function render(_arg1:Number){
super.render(_arg1);
cake.setPosition((clip.plateAndCake.x - 4), (clip.plateAndCake.y - 4));
if (showCake){
cake.visible = true;
} else {
cake.visible = false;
};
clip.scaleX = scale;
clip.scaleY = scale;
}
override public function tick(){
var _local1:InfoData;
var _local2:int;
var _local3:int;
super.tick();
switch (state){
case STATE_IDLE:
if (runBuffer.length != 0){
gotoNearestIndexNode(runBuffer.pop());
};
if (showCake != oldShowCake){
idleAnimate = false;
};
if (!idleAnimate){
if (showCake){
animation = ANIMATION_IDLE_CAKE;
startAnimFrame = 130;
endAnimFrame = 156;
} else {
animation = ANIMATION_IDLE_EMPTY;
startAnimFrame = 95;
endAnimFrame = 129;
};
animFrameDouble = startAnimFrame;
animFrame = int(animFrameDouble);
frameCounter = 0;
idleAnimate = true;
} else {
frameCounter++;
if (frameCounter > WAIT_BEFORE_IDLE_ANIM_FRAMES){
animFrameDouble = (animFrameDouble + IDLE_ANIM_SPEED);
animFrame = int(animFrameDouble);
if (animFrame == endAnimFrame){
animFrameDouble = startAnimFrame;
frameCounter = 0;
};
};
};
oldShowCake = showCake;
break;
case STATE_RUNNING:
if (followPath()){
setCurrentNode(targetNode);
state = STATE_IDLE;
idleAnimate = false;
_local1 = new InfoData();
_local1.data1 = targetNode.id;
state = STATE_IDLE;
idleAnimate = false;
if (showCake){
animation = ANIMATION_IDLE_CAKE;
} else {
animation = ANIMATION_IDLE_EMPTY;
};
messageCallback("waiter reach node", _local1);
} else {
_local2 = (oldPosX - posX);
_local3 = (oldPosY - posY);
chooseAnimation(_local2, _local3);
};
animFrameDouble = (animFrameDouble + runAnimationSpeed);
animFrame = int(animFrameDouble);
if (animFrame == endAnimFrame){
animFrameDouble = startAnimFrame;
};
break;
};
if ((((posY <= 280)) && (inFrontOff))){
inFrontOff = false;
parentParentClip.swapChildren(parentClip, parentClipBack);
} else {
if ((((posY > 280)) && (!(inFrontOff)))){
inFrontOff = true;
parentParentClip.swapChildren(parentClip, parentClipBack);
};
};
oldPosX = posX;
oldPosY = posY;
oldAnimation = animation;
setScale();
}
public function gotoDisplayCase(){
runBuffer.unshift(References.NODE_INDEX_DISPLAYCASE);
}
private function gotoNearestIndexNode(_arg1:int){
var _local2:InfoData;
_local2 = new InfoData();
_local2.data1 = currentNode.id;
messageCallback("waiter leave node", _local2);
targetNode = nodeNetwork.getNode(_arg1);
findPathToNode(currentNode, targetNode);
state = STATE_RUNNING;
}
public function setCake(_arg1:int, _arg2:int, _arg3:int){
showCake = true;
cake.setTypes(_arg1, _arg2, _arg3);
}
public function gotoOven1(){
runBuffer.unshift(References.NODE_INDEX_OVEN1);
}
public function gotoOven2(){
runBuffer.unshift(References.NODE_INDEX_OVEN2);
}
public function adjustBuffred(_arg1:int){
var _local2:int;
var _local3:int;
_local2 = (_arg1 + 1);
while (_local2 <= 3) {
_local3 = 0;
while (_local3 < runBuffer.length) {
if (runBuffer[_local3] == _local2){
runBuffer[_local3] = (_local2 - 1);
};
_local3++;
};
_local2++;
};
}
public function nothingToDo():Boolean{
if ((((state == STATE_IDLE)) && ((runBuffer.length == 0)))){
return (true);
};
return (false);
}
public function hasCake():Boolean{
return (showCake);
}
public function emptyBuffer():Boolean{
if (runBuffer.length == 0){
return (true);
};
return (false);
}
public function getWaiterNodeIndex():int{
if (state == STATE_IDLE){
return (currentNode.id);
};
return (-1);
}
}
}//package com.king.cakemania
Section 73
//XPMath (com.king.cakemania.XPMath)
package com.king.cakemania {
class XPMath {
public static function atan(_arg1:Number):Number{
var _local2:Number;
var _local3:*;
_local2 = 0;
if (_arg1 < -2.41421356237309){
_local3 = (1 / _arg1);
_local2 = (-1.5707963267949 - (_local3 * (1 - ((_local3 * _local3) * ((1 / 3) - ((_local3 * _local3) / 5))))));
} else {
if (_arg1 < -1){
_local3 = ((1 + (_arg1 * 0.414213562373095)) / (0.414213562373095 - _arg1));
_local2 = ((-1.5707963267949 + (_local3 * (1 - ((_local3 * _local3) * ((1 / 3) - ((_local3 * _local3) / 5)))))) + 0.392699081698724);
} else {
if (_arg1 < -0.414213562373095){
_local3 = ((_arg1 + 0.414213562373095) / ((0.414213562373095 * _arg1) - 1));
_local2 = (-((_local3 * (1 - ((_local3 * _local3) * ((1 / 3) - ((_local3 * _local3) / 5)))))) - 0.392699081698724);
} else {
if (_arg1 < 0.414213562373095){
_local2 = (_arg1 * (1 - ((_arg1 * _arg1) * ((1 / 3) - ((_arg1 * _arg1) / 5)))));
} else {
if (_arg1 < 1){
_local3 = ((_arg1 - 0.414213562373095) / (1 + (0.414213562373095 * _arg1)));
_local2 = ((_local3 * (1 - ((_local3 * _local3) * ((1 / 3) - ((_local3 * _local3) / 5))))) + 0.392699081698724);
} else {
if (_arg1 < 2.41421356237309){
_local3 = ((1 - (_arg1 * 0.414213562373095)) / (_arg1 + 0.414213562373095));
_local2 = ((1.5707963267949 - (_local3 * (1 - ((_local3 * _local3) * ((1 / 3) - ((_local3 * _local3) / 5)))))) - 0.392699081698724);
} else {
_local3 = (1 / _arg1);
_local2 = (1.5707963267949 - (_local3 * (1 - ((_local3 * _local3) * ((1 / 3) - ((_local3 * _local3) / 5))))));
};
};
};
};
};
};
return (_local2);
}
public static function atan2(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = 3.14159265358979;
_local4 = 1.5707963267949;
if (_arg2 == 0){
if (_arg1 > 0){
return (_local4);
};
if (_arg1 == 0){
return (0);
};
return (-(_local4));
};
_local6 = (_arg1 / _arg2);
if (Math.abs(_local6) < 1){
_local5 = (_local6 / (1 + ((0.28 * _local6) * _local6)));
if (_arg2 < 0){
if (_arg1 < 0){
return ((_local5 - _local3));
};
return ((_local5 + _local3));
};
} else {
_local5 = (_local4 - (_local6 / ((_local6 * _local6) + 0.28)));
if (_arg1 < 0){
return ((_local5 - _local3));
};
};
return (_local5);
}
static function sin(_arg1:Number){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_arg1 = (_arg1 - 1.5707963267949);
_local2 = 0;
_local3 = ((_arg1 > 0)) ? _arg1 : -(_arg1);
if (_local3 >= (12.5663706143592 + 1.5707963267949)){
_local2 = int((_local3 * 0.636619772367581));
if ((_local2 & 1) != 0){
_local2++;
};
_local3 = (_local3 - (_local2 * 1.5707963267949));
} else {
if (_local3 < 1.5707963267949){
} else {
if (_local3 < (1.5707963267949 + 3.14159265358979)){
_local3 = (_local3 - 3.14159265358979);
_local2 = 2;
} else {
if (_local3 < (6.28318530717959 + 1.5707963267949)){
_local3 = (_local3 - 6.28318530717959);
} else {
if (_local3 < (9.42477796076938 + 1.5707963267949)){
_local3 = (_local3 - 9.42477796076938);
_local2 = 2;
} else {
_local3 = (_local3 - 12.5663706143592);
};
};
};
};
};
_local4 = (_local3 * _local3);
_local5 = (0.999999953027512 + (_local4 * (-0.499999047777921 + (_local4 * (0.041663573160188 + (_local4 * (-0.0013853629536173 + (_local4 * 2.31524166599385E-5))))))));
return ((((_local2 & 2))!=0) ? -(_local5) : _local5);
}
static function cos(_arg1:Number){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local2 = 0;
_local3 = ((_arg1 > 0)) ? _arg1 : -(_arg1);
if (_local3 >= (12.5663706143592 + 1.5707963267949)){
_local2 = int((_local3 * 0.636619772367581));
if ((_local2 & 1) != 0){
_local2++;
};
_local3 = (_local3 - (_local2 * 1.5707963267949));
} else {
if (_local3 < 1.5707963267949){
} else {
if (_local3 < (1.5707963267949 + 3.14159265358979)){
_local3 = (_local3 - 3.14159265358979);
_local2 = 2;
} else {
if (_local3 < (6.28318530717959 + 1.5707963267949)){
_local3 = (_local3 - 6.28318530717959);
} else {
if (_local3 < (9.42477796076938 + 1.5707963267949)){
_local3 = (_local3 - 9.42477796076938);
_local2 = 2;
} else {
_local3 = (_local3 - 12.5663706143592);
};
};
};
};
};
_local4 = (_local3 * _local3);
_local5 = (0.999999953027512 + (_local4 * (-0.499999047777921 + (_local4 * (0.041663573160188 + (_local4 * (-0.0013853629536173 + (_local4 * 2.31524166599385E-5))))))));
return ((((_local2 & 2))!=0) ? -(_local5) : _local5);
}
}
}//package com.king.cakemania
Section 74
//Astar (source.pathfinding.Astar)
package source.pathfinding {
import flash.display.*;
public class Astar extends MovieClip {
public var m_realParent;
public var path:Array;
public var open:Array;
public var closed:Array;
public function Astar(_arg1){
m_realParent = _arg1;
}
public function getDistance(_arg1, _arg2):Number{
var _local3:Number;
var _local4:Number;
var _local5:*;
_local3 = (_arg2.x - _arg1.x);
_local4 = (_arg2.y - _arg1.y);
_local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
return (_local5);
}
public function getPath(_arg1, _arg2):Boolean{
var _local3:int;
var _local4:*;
var _local5:*;
var _local6:MyNode;
var _local7:MyNode;
var _local8:*;
var _local9:Number;
m_realParent.reset();
path = new Array();
if (!_arg2.isPassable){
return (false);
};
if (_arg1 == _arg2){
path.push(_arg2);
return (true);
};
open = new Array();
closed = new Array();
_local3 = 0;
while (_local3 < m_realParent.nodeArray.length) {
m_realParent.nodeArray[_local3].inClosed = !(m_realParent.nodeArray[_local3].isPassable);
_local3++;
};
_arg1.distanceMoved = 0;
_arg1.distanceLeftEstimated = getDistance(_arg1, _arg2);
_arg1.distanceTotal = (_arg1.distanceMoved + _arg1.distanceLeftEstimated);
_arg1.parentNode = null;
open.push(_arg1);
while (open.length > 0) {
_local4 = 999999;
_local5 = -1;
_local3 = 0;
while (_local3 < open.length) {
if (open[_local3].distanceTotal < _local4){
_local4 = open[_local3].distanceTotal;
_local5 = _local3;
};
_local3++;
};
_local6 = open[_local5];
open.splice(_local5, 1);
closed.push(_local6);
_local6.inOpen = false;
_local6.inClosed = true;
if (_local6 == _arg2){
do {
_local7 = _local6;
_local7.isPath = true;
path.push(_local6);
_local6 = _local7.parentNode;
} while (_local6 != _arg1);
return (true);
};
_local3 = 0;
for (;_local3 < _local6.neighbors.length;_local3++) {
_local8 = _local6.neighbors[_local3];
if (_local8 == null){
continue;
} else {
_local9 = (_local6.distanceMoved + getDistance(_local6, _local8));
if (((((_local8.inClosed) || (_local8.inOpen))) && ((_local8.distanceMoved <= _local9)))){
continue;
} else {
_local8.parentNode = _local6;
_local8.distanceMoved = _local9;
_local8.distanceLeftEstimated = getDistance(_local8, _arg2);
_local8.distanceTotal = (_local8.distanceMoved + _local8.distanceLeftEstimated);
if (_local8.inClosed){
_local8.inClosed = false;
_local3 = 0;
while (_local3 < closed.length) {
if (closed[_local3] == _local8){
closed.splice(_local3, 1);
};
_local3++;
};
};
if (!_local8.inOpen){
_local8.visited = true;
_local8.inOpen = true;
open.push(_local8);
};
};
};
};
};
return (false);
}
}
}//package source.pathfinding
Section 75
//EdgeManager (source.pathfinding.EdgeManager)
package source.pathfinding {
import flash.display.*;
public class EdgeManager extends MovieClip {
public var m_realParent;
public var edgeArray:Array;
public var m_parent;
public function EdgeManager(_arg1, _arg2){
m_parent = _arg1;
m_realParent = _arg2;
edgeArray = new Array();
m_realParent.addChild(this);
}
public function addEdge(_arg1, _arg2, _arg3):MyEdge{
var _local4:Boolean;
var _local5:*;
var _local6:MyEdge;
_local4 = false;
_local5 = 0;
while (_local5 < edgeArray.length) {
if ((((((edgeArray[_local5].startNode == _arg2)) && ((edgeArray[_local5].endNode == _arg3)))) || ((((edgeArray[_local5].endNode == _arg2)) && ((edgeArray[_local5].startNode == _arg3)))))){
_local4 = true;
};
_local5++;
};
if (!_local4){
_local6 = new MyEdge(m_parent, this, _arg1, _arg2, _arg3);
edgeArray.push(_local6);
_arg2.addNeighbor(_arg3);
_arg3.addNeighbor(_arg2);
return (_local6);
};
return (null);
}
public function render(){
var _local1:*;
_local1 = 0;
while (_local1 < edgeArray.length) {
edgeArray[_local1].render();
_local1++;
};
}
public function update(){
render();
}
public function cleanUp(){
var _local1:*;
_local1 = 0;
while (_local1 < edgeArray.length) {
edgeArray[_local1].cleanUp();
_local1++;
};
}
}
}//package source.pathfinding
Section 76
//MyEdge (source.pathfinding.MyEdge)
package source.pathfinding {
import flash.display.*;
public class MyEdge extends MovieClip {
public var m_realParent;
public var id:int;
public var color;
public var startNode:MyNode;
public var endNode:MyNode;
public var m_parent;
public var sprite:Sprite;
public function MyEdge(_arg1, _arg2, _arg3, _arg4, _arg5){
m_parent = _arg1;
m_realParent = _arg2;
m_realParent.addChild(this);
startNode = _arg4;
endNode = _arg5;
id = _arg3;
color = 0;
sprite = new Sprite();
sprite.graphics.lineStyle(1, color);
sprite.graphics.moveTo(startNode.x, startNode.y);
sprite.graphics.lineTo(endNode.x, endNode.y);
_arg1.addChild(sprite);
}
public function render(){
}
public function cleanUp(){
if (m_realParent.contains(sprite)){
m_realParent.removeChild(sprite);
};
}
}
}//package source.pathfinding
Section 77
//MyNode (source.pathfinding.MyNode)
package source.pathfinding {
import flash.display.*;
public class MyNode extends MovieClip {
public var distanceLeftEstimated:Number;
public var m_realParent;
public var id:int;
public var inOpen:Boolean;
public var visited:Boolean;
public var isPassable:Boolean;
public var color;
public var distanceTotal:Number;
public var isPath:Boolean;
public var radius:int;
public var distanceMoved:Number;
public var neighbors:Array;
public var m_parent;
public var sprite:Sprite;
public var parentNode:MyNode;
public var inClosed:Boolean;
public function MyNode(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
m_parent = _arg1;
m_realParent = _arg2;
m_realParent.addChild(this);
radius = _arg6;
setPosition(_arg4, _arg5);
id = _arg3;
color = 0xFFFFFF;
sprite = new Sprite();
neighbors = new Array();
setup();
sprite.graphics.lineStyle(3, color);
sprite.graphics.drawCircle(x, y, radius);
_arg1.addChild(sprite);
}
public function setup(){
var _local1:int;
isPath = false;
isPassable = true;
inOpen = false;
inClosed = false;
distanceMoved = 0;
distanceLeftEstimated = 0;
distanceTotal = 0;
visited = false;
_local1 = 0;
while (_local1 < neighbors.length) {
neighbors[_local1] = null;
_local1++;
};
}
public function reset(){
isPath = false;
inOpen = false;
inClosed = false;
distanceMoved = 0;
distanceLeftEstimated = 0;
distanceTotal = 0;
visited = false;
}
public function render(){
}
public function addNeighbor(_arg1){
neighbors.push(_arg1);
}
public function setPosition(_arg1, _arg2){
x = _arg1;
y = _arg2;
}
public function cleanUp(){
if (m_realParent.m_realParent.contains(sprite)){
m_realParent.m_realParent.removeChild(sprite);
};
}
}
}//package source.pathfinding
Section 78
//NodeManager (source.pathfinding.NodeManager)
package source.pathfinding {
import flash.display.*;
public class NodeManager extends MovieClip {
public var m_realParent;
public var astar:Astar;
public var nodeArray:Array;
public var m_parent;
public function NodeManager(_arg1, _arg2){
m_parent = _arg1;
m_realParent = _arg2;
nodeArray = new Array();
astar = new Astar(this);
}
public function addNode(_arg1, _arg2, _arg3, _arg4):MyNode{
var _local5:MyNode;
_local5 = new MyNode(m_parent, this, _arg1, _arg2, _arg3, _arg4);
nodeArray.push(_local5);
return (_local5);
}
public function reset(){
var _local1:*;
_local1 = 0;
while (_local1 < nodeArray.length) {
nodeArray[_local1].reset();
_local1++;
};
}
public function getNode(_arg1:int):MyNode{
return (nodeArray[_arg1]);
}
public function getOptimalPath(_arg1, _arg2):Array{
var _local3:Boolean;
var _local4:*;
_local3 = astar.getPath(_arg1, _arg2);
if (_local3){
_local4 = 0;
while (_local4 < astar.path.length) {
_local4++;
};
};
return (astar.path);
}
public function render(){
var _local1:*;
_local1 = 0;
while (_local1 < nodeArray.length) {
nodeArray[_local1].render();
_local1++;
};
}
public function update(){
render();
}
public function cleanUp(){
var _local1:*;
_local1 = 0;
while (_local1 < nodeArray.length) {
nodeArray[_local1].cleanUp();
_local1++;
};
}
}
}//package source.pathfinding
Section 79
//NodeNetwork (source.pathfinding.NodeNetwork)
package source.pathfinding {
import flash.display.*;
import source.*;
public class NodeNetwork extends MovieClip {
public var version:int;
public var edgeManager:EdgeManager;
public var nodeManager:NodeManager;
public var m_parent:MovieClip;
public static var WATER_VERSION:int = 1;
public static var HR_VERSION:int = 0;
public static var FUTURE_VERSION:int = 2;
public function NodeNetwork(_arg1:int, _arg2){
m_parent = _arg2;
this.version = _arg1;
resetAll();
}
public function getClosestNodeIndex(_arg1, _arg2):int{
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
_local3 = -99;
_local4 = 1000000;
_local10 = 0;
while (_local10 < nodeManager.nodeArray.length) {
_local6 = nodeManager.nodeArray[_local10].x;
_local7 = nodeManager.nodeArray[_local10].y;
_local8 = (_local6 - _arg1);
_local9 = (_local7 - _arg2);
_local5 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
if (_local5 < _local4){
_local4 = _local5;
_local3 = _local10;
};
_local10++;
};
return (_local3);
}
public function getNodePosX(_arg1:int):Number{
return (nodeManager.nodeArray[_arg1].x);
}
public function getNodePosY(_arg1:int):Number{
return (nodeManager.nodeArray[_arg1].y);
}
public function addNodesWater(){
nodeManager.addNode(0, 364, 371, 5);
nodeManager.addNode(1, 354, 305, 5);
nodeManager.addNode(2, 328, 0x0101, 5);
nodeManager.addNode(3, 310, 220, 5);
nodeManager.addNode(4, 191, 364, 5);
nodeManager.addNode(5, 316, 362, 5);
nodeManager.addNode(6, 294, 204, 5);
nodeManager.addNode(7, 188, 204, 5);
nodeManager.addNode(8, 154, 229, 5);
nodeManager.addNode(9, 154, 280, 5);
nodeManager.addNode(10, 249, 306, 5);
nodeManager.addNode(11, 208, 198, 5);
edgeManager.addEdge(0, nodeManager.nodeArray[0], nodeManager.nodeArray[1]);
edgeManager.addEdge(1, nodeManager.nodeArray[1], nodeManager.nodeArray[2]);
edgeManager.addEdge(2, nodeManager.nodeArray[2], nodeManager.nodeArray[3]);
edgeManager.addEdge(3, nodeManager.nodeArray[3], nodeManager.nodeArray[6]);
edgeManager.addEdge(4, nodeManager.nodeArray[6], nodeManager.nodeArray[7]);
edgeManager.addEdge(5, nodeManager.nodeArray[7], nodeManager.nodeArray[11]);
edgeManager.addEdge(6, nodeManager.nodeArray[11], nodeManager.nodeArray[6]);
edgeManager.addEdge(7, nodeManager.nodeArray[0], nodeManager.nodeArray[5]);
edgeManager.addEdge(8, nodeManager.nodeArray[5], nodeManager.nodeArray[4]);
edgeManager.addEdge(9, nodeManager.nodeArray[4], nodeManager.nodeArray[9]);
edgeManager.addEdge(10, nodeManager.nodeArray[9], nodeManager.nodeArray[8]);
edgeManager.addEdge(11, nodeManager.nodeArray[8], nodeManager.nodeArray[7]);
edgeManager.addEdge(12, nodeManager.nodeArray[6], nodeManager.nodeArray[2]);
edgeManager.addEdge(13, nodeManager.nodeArray[6], nodeManager.nodeArray[1]);
edgeManager.addEdge(14, nodeManager.nodeArray[6], nodeManager.nodeArray[0]);
edgeManager.addEdge(15, nodeManager.nodeArray[5], nodeManager.nodeArray[1]);
edgeManager.addEdge(16, nodeManager.nodeArray[5], nodeManager.nodeArray[2]);
edgeManager.addEdge(17, nodeManager.nodeArray[4], nodeManager.nodeArray[10]);
edgeManager.addEdge(18, nodeManager.nodeArray[5], nodeManager.nodeArray[10]);
}
public function getNode(_arg1:int):MyNode{
return (nodeManager.getNode(_arg1));
}
public function addNodes(_arg1:int){
switch (_arg1){
case HR_VERSION:
addNodesHR();
break;
case WATER_VERSION:
addNodesWater();
break;
case FUTURE_VERSION:
addNodesFuture();
break;
};
}
public function addNodesFuture(){
nodeManager.addNode(0, 418, 362, 5);
nodeManager.addNode(1, 377, 306, 5);
nodeManager.addNode(2, 334, 0xFF, 5);
nodeManager.addNode(3, 300, 210, 5);
nodeManager.addNode(4, 146, 376, 5);
nodeManager.addNode(5, 274, 367, 5);
nodeManager.addNode(6, 139, 306, 5);
nodeManager.addNode(7, 162, 204, 5);
nodeManager.addNode(8, 290, 196, 5);
nodeManager.addNode(9, 402, 376, 5);
nodeManager.addNode(10, 252, 314, 5);
nodeManager.addNode(11, 202, 205, 5);
nodeManager.addNode(12, 320, 300, 5);
edgeManager.addEdge(0, nodeManager.nodeArray[0], nodeManager.nodeArray[1]);
edgeManager.addEdge(1, nodeManager.nodeArray[1], nodeManager.nodeArray[2]);
edgeManager.addEdge(2, nodeManager.nodeArray[2], nodeManager.nodeArray[3]);
edgeManager.addEdge(3, nodeManager.nodeArray[3], nodeManager.nodeArray[8]);
edgeManager.addEdge(4, nodeManager.nodeArray[4], nodeManager.nodeArray[5]);
edgeManager.addEdge(5, nodeManager.nodeArray[5], nodeManager.nodeArray[9]);
edgeManager.addEdge(6, nodeManager.nodeArray[9], nodeManager.nodeArray[0]);
edgeManager.addEdge(7, nodeManager.nodeArray[4], nodeManager.nodeArray[10]);
edgeManager.addEdge(8, nodeManager.nodeArray[10], nodeManager.nodeArray[5]);
edgeManager.addEdge(9, nodeManager.nodeArray[10], nodeManager.nodeArray[9]);
edgeManager.addEdge(10, nodeManager.nodeArray[4], nodeManager.nodeArray[6]);
edgeManager.addEdge(11, nodeManager.nodeArray[6], nodeManager.nodeArray[7]);
edgeManager.addEdge(12, nodeManager.nodeArray[7], nodeManager.nodeArray[11]);
edgeManager.addEdge(13, nodeManager.nodeArray[11], nodeManager.nodeArray[8]);
edgeManager.addEdge(14, nodeManager.nodeArray[6], nodeManager.nodeArray[10]);
edgeManager.addEdge(15, nodeManager.nodeArray[6], nodeManager.nodeArray[11]);
edgeManager.addEdge(16, nodeManager.nodeArray[10], nodeManager.nodeArray[1]);
edgeManager.addEdge(17, nodeManager.nodeArray[12], nodeManager.nodeArray[2]);
edgeManager.addEdge(18, nodeManager.nodeArray[12], nodeManager.nodeArray[10]);
}
public function addNodesHR(){
var _local1:MyNode;
var _local2:MyNode;
var _local3:MyNode;
var _local4:MyNode;
var _local5:MyNode;
var _local6:MyNode;
var _local7:MyNode;
var _local8:MyNode;
var _local9:MyNode;
var _local10:MyNode;
var _local11:MyNode;
var _local12:MyNode;
_local1 = nodeManager.addNode(0, 0xFF, 365, 5);
_local2 = nodeManager.addNode(1, 265, 315, 5);
_local3 = nodeManager.addNode(2, 275, 265, 5);
_local4 = nodeManager.addNode(3, 301, 217, 5);
_local5 = nodeManager.addNode(4, 300, 360, 5);
_local6 = nodeManager.addNode(5, 427, 358, 5);
_local7 = nodeManager.addNode(6, 325, 205, 5);
_local8 = nodeManager.addNode(7, 420, 205, 5);
_local9 = nodeManager.addNode(8, 465, 225, 5);
_local10 = nodeManager.addNode(9, 465, 280, 5);
_local11 = nodeManager.addNode(10, 368, 310, 5);
_local12 = nodeManager.addNode(11, 340, 200, 5);
edgeManager.addEdge(0, _local1, _local5);
edgeManager.addEdge(1, _local1, _local2);
edgeManager.addEdge(2, _local2, _local5);
edgeManager.addEdge(3, _local3, _local2);
edgeManager.addEdge(4, _local3, _local1);
edgeManager.addEdge(5, _local3, _local5);
edgeManager.addEdge(6, _local7, _local3);
edgeManager.addEdge(7, _local7, _local2);
edgeManager.addEdge(8, _local7, _local1);
edgeManager.addEdge(9, _local7, _local8);
edgeManager.addEdge(10, _local5, _local6);
edgeManager.addEdge(11, _local5, _local11);
edgeManager.addEdge(12, _local6, _local11);
edgeManager.addEdge(13, _local6, _local10);
edgeManager.addEdge(14, _local8, _local9);
edgeManager.addEdge(15, _local9, _local10);
edgeManager.addEdge(16, _local4, _local3);
edgeManager.addEdge(17, _local4, _local7);
edgeManager.addEdge(18, _local8, _local10);
edgeManager.addEdge(19, _local4, _local12);
edgeManager.addEdge(20, _local7, _local12);
edgeManager.addEdge(21, _local8, _local12);
}
public function update(){
nodeManager.update();
edgeManager.update();
}
public function resetAll(){
if (nodeManager){
nodeManager.cleanUp();
};
if (edgeManager){
edgeManager.cleanUp();
};
nodeManager = new NodeManager(m_parent, this);
edgeManager = new EdgeManager(m_parent, this);
addNodes(version);
}
}
}//package source.pathfinding
Section 80
//Cash (source.Cash)
package source {
import flash.display.*;
public dynamic class Cash extends MovieClip {
}
}//package source
Section 81
//Decoration (source.Decoration)
package source {
import flash.display.*;
public dynamic class Decoration extends MovieClip {
}
}//package source
Section 82
//DecoratorMachineObject (source.DecoratorMachineObject)
package source {
import flash.display.*;
public dynamic class DecoratorMachineObject extends MovieClip {
public var readyCircle_mc:ReadyCircle;
public var Marker2_mc:MovieClip;
public var button1:MovieClip;
public var button3:MovieClip;
public var button2:MovieClip;
public var button4:MovieClip;
public var Marker3_mc:MovieClip;
public var cream:MovieClip;
public var Marker5_mc:MovieClip;
public var Marker1_mc:MovieClip;
public var progressbar:MovieClip;
public var Marker4_mc:MovieClip;
public var cake_mc:MovieClip;
}
}//package source
Section 83
//Oven (source.Oven)
package source {
import flash.display.*;
public dynamic class Oven extends MovieClip {
public var work:MovieClip;
public var topTray:MovieClip;
public var Marker2_mc:MovieClip;
public var fire:MovieClip;
public var button1:MovieClip;
public var tray:MovieClip;
public var button3:MovieClip;
public var button2:MovieClip;
public var Marker3_mc:MovieClip;
public var Marker5_mc:MovieClip;
public var button4:MovieClip;
public var Marker1_mc:MovieClip;
public var progressbar:MovieClip;
public var Marker4_mc:MovieClip;
public var cake_mc:MovieClip;
}
}//package source
Section 84
//agent (agent)
package {
import flash.display.*;
public dynamic class agent extends MovieClip {
}
}//package
Section 85
//alien (alien)
package {
import flash.display.*;
public dynamic class alien extends MovieClip {
}
}//package
Section 86
//astro (astro)
package {
import flash.display.*;
public dynamic class astro extends MovieClip {
}
}//package
Section 87
//baker_goal (baker_goal)
package {
import flash.display.*;
import flash.text.*;
public dynamic class baker_goal extends MovieClip {
public var baker_goal_reached:TextField;
}
}//package
Section 88
//bakergoalreached (bakergoalreached)
package {
import flash.media.*;
public dynamic class bakergoalreached extends Sound {
}
}//package
Section 89
//begin_screen (begin_screen)
package {
import flash.display.*;
public dynamic class begin_screen extends MovieClip {
public var texts_mc:MovieClip;
public var Start_down_btn:MovieClip;
public var Start_btn:MovieClip;
}
}//package
Section 90
//BubbleClip (BubbleClip)
package {
import flash.display.*;
import source.*;
public dynamic class BubbleClip extends MovieClip {
public var bubble_menu:MovieClip;
public var money_mc:Cash;
public var box_front_mc:MovieClip;
public var box_back_mc:MovieClip;
public var Marker_mc:MovieClip;
public var bubble:MovieClip;
public var question:MovieClip;
public var hearts:MovieClip;
public var cake_mc:MovieClip;
}
}//package
Section 91
//cakeovenopen (cakeovenopen)
package {
import flash.media.*;
public dynamic class cakeovenopen extends Sound {
}
}//package
Section 92
//cakeready (cakeready)
package {
import flash.media.*;
public dynamic class cakeready extends Sound {
}
}//package
Section 93
//Cakes (Cakes)
package {
import flash.display.*;
public dynamic class Cakes extends MovieClip {
}
}//package
Section 94
//cantplace (cantplace)
package {
import flash.media.*;
public dynamic class cantplace extends Sound {
}
}//package
Section 95
//cash (cash)
package {
import flash.media.*;
public dynamic class cash extends Sound {
}
}//package
Section 96
//closed (closed)
package {
import flash.media.*;
public dynamic class closed extends Sound {
}
}//package
Section 97
//customerarrives (customerarrives)
package {
import flash.media.*;
public dynamic class customerarrives extends Sound {
}
}//package
Section 98
//customerleavesunhappy (customerleavesunhappy)
package {
import flash.media.*;
public dynamic class customerleavesunhappy extends Sound {
}
}//package
Section 99
//customerunhappy (customerunhappy)
package {
import flash.media.*;
public dynamic class customerunhappy extends Sound {
}
}//package
Section 100
//decorationsmall (decorationsmall)
package {
import flash.media.*;
public dynamic class decorationsmall extends Sound {
}
}//package
Section 101
//DisplayCase1 (DisplayCase1)
package {
import flash.display.*;
public dynamic class DisplayCase1 extends MovieClip {
public var Marker1_mc:MovieClip;
public var cake_mc:MovieClip;
}
}//package
Section 102
//doctor (doctor)
package {
import flash.display.*;
public dynamic class doctor extends MovieClip {
}
}//package
Section 103
//endfree (endfree)
package {
import flash.display.*;
import flash.text.*;
public dynamic class endfree extends MovieClip {
public var gameEndsIn_txt:TextField;
public var free_txt:TextField;
}
}//package
Section 104
//fireoven (fireoven)
package {
import flash.media.*;
public dynamic class fireoven extends Sound {
}
}//package
Section 105
//Frost_choc (Frost_choc)
package {
import flash.display.*;
public dynamic class Frost_choc extends MovieClip {
}
}//package
Section 106
//Frost_dark_choc (Frost_dark_choc)
package {
import flash.display.*;
public dynamic class Frost_dark_choc extends MovieClip {
}
}//package
Section 107
//Frost_white (Frost_white)
package {
import flash.display.*;
public dynamic class Frost_white extends MovieClip {
}
}//package
Section 108
//Frost_violet (Frost_violet)
package {
import flash.display.*;
public dynamic class Frost_violet extends MovieClip {
}
}//package
Section 109
//Froster_level0 (Froster_level0)
package {
import flash.display.*;
public dynamic class Froster_level0 extends MovieClip {
}
}//package
Section 110
//frosterspray (frosterspray)
package {
import flash.media.*;
public dynamic class frosterspray extends Sound {
}
}//package
Section 111
//Frosting (Frosting)
package {
import flash.display.*;
public dynamic class Frosting extends MovieClip {
}
}//package
Section 112
//Future (Future)
package {
import flash.display.*;
import source.*;
public dynamic class Future extends MovieClip {
public var waiter_holder_mc:MovieClip;
public var bubbles_holder_mc:MovieClip;
public var calendar:MovieClip;
public var decorator2:DecoratorMachineObject;
public var decorator1:DecoratorMachineObject;
public var waiter_holder_back_mc:MovieClip;
public var oven1:Oven;
public var oven2:Oven;
public var display_case_mc:DisplayCase1;
public var customers_holder_mc:MovieClip;
public var menuTexts:MovieClip;
public var froster1:MovieClip;
public var froster2:MovieClip;
}
}//package
Section 113
//game_loop1 (game_loop1)
package {
import flash.media.*;
public dynamic class game_loop1 extends Sound {
}
}//package
Section 114
//happy (happy)
package {
import flash.media.*;
public dynamic class happy extends Sound {
}
}//package
Section 115
//happyleaving (happyleaving)
package {
import flash.media.*;
public dynamic class happyleaving extends Sound {
}
}//package
Section 116
//HighRiseScene (HighRiseScene)
package {
import flash.display.*;
import source.*;
public dynamic class HighRiseScene extends MovieClip {
public var waiter_holder_mc:MovieClip;
public var hud:MovieClip;
public var leftTable:MovieClip;
public var rightTable:MovieClip;
public var frontTable:MovieClip;
public var bubbles_holder_mc:MovieClip;
public var calendar:MovieClip;
public var middleTable:MovieClip;
public var decorator2:DecoratorMachineObject;
public var decorator1:DecoratorMachineObject;
public var waiter_holder_back_mc:MovieClip;
public var oven1:Oven;
public var oven2:Oven;
public var closed:MovieClip;
public var display_case_mc:DisplayCase1;
public var trashcan:MovieClip;
public var backgrund:MovieClip;
public var customers_holder_mc:MovieClip;
public var scene:MovieClip;
public var menuTexts:MovieClip;
public var froster1:MovieClip;
public var froster2:MovieClip;
}
}//package
Section 117
//Jill (Jill)
package {
import flash.display.*;
public dynamic class Jill extends MovieClip {
public var plateAndCake:MovieClip;
public var cake_mc:MovieClip;
}
}//package
Section 118
//kid (kid)
package {
import flash.display.*;
public dynamic class kid extends MovieClip {
}
}//package
Section 119
//mainmenu_mix_short (mainmenu_mix_short)
package {
import flash.media.*;
public dynamic class mainmenu_mix_short extends Sound {
}
}//package
Section 120
//ovenrunning (ovenrunning)
package {
import flash.media.*;
public dynamic class ovenrunning extends Sound {
}
}//package
Section 121
//pickup (pickup)
package {
import flash.media.*;
public dynamic class pickup extends Sound {
}
}//package
Section 122
//pingvin (pingvin)
package {
import flash.display.*;
public dynamic class pingvin extends MovieClip {
}
}//package
Section 123
//placedown (placedown)
package {
import flash.media.*;
public dynamic class placedown extends Sound {
}
}//package
Section 124
//Pointers (Pointers)
package {
import flash.display.*;
public dynamic class Pointers extends MovieClip {
}
}//package
Section 125
//police (police)
package {
import flash.display.*;
public dynamic class police extends MovieClip {
}
}//package
Section 126
//PuffAngry (PuffAngry)
package {
import flash.display.*;
public dynamic class PuffAngry extends MovieClip {
}
}//package
Section 127
//PuffHappy (PuffHappy)
package {
import flash.display.*;
public dynamic class PuffHappy extends MovieClip {
}
}//package
Section 128
//punk (punk)
package {
import flash.display.*;
public dynamic class punk extends MovieClip {
}
}//package
Section 129
//ReadyCircle (ReadyCircle)
package {
import flash.display.*;
public dynamic class ReadyCircle extends MovieClip {
}
}//package
Section 130
//Result (Result)
package {
import flash.display.*;
public dynamic class Result extends MovieClip {
public var result_screen_mc:MovieClip;
}
}//package
Section 131
//rock (rock)
package {
import flash.display.*;
public dynamic class rock extends MovieClip {
}
}//package
Section 132
//select (select)
package {
import flash.media.*;
public dynamic class select extends Sound {
}
}//package
Section 133
//StartScreen (StartScreen)
package {
import flash.display.*;
public dynamic class StartScreen extends MovieClip {
}
}//package
Section 134
//SumAnimation (SumAnimation)
package {
import flash.display.*;
public dynamic class SumAnimation extends MovieClip {
public var sum:MovieClip;
public function SumAnimation(){
addFrameScript(25, frame26);
}
function frame26(){
stop();
}
}
}//package
Section 135
//timervarning (timervarning)
package {
import flash.media.*;
public dynamic class timervarning extends Sound {
}
}//package
Section 136
//trash (trash)
package {
import flash.media.*;
public dynamic class trash extends Sound {
}
}//package
Section 137
//Tutorial (Tutorial)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public dynamic class Tutorial extends MovieClip {
public var theCurrentLabel;
public var time_starts_txt:TextField;
public var instruction_heading_txt:TextField;
public var text3:MovieClip;
public var text4:MovieClip;
public var text2:MovieClip;
public var text1:MovieClip;
public var arrow_mc:MovieClip;
public var Start_down_btn:MovieClip;
public var bubble:MovieClip;
public var money:MovieClip;
public var Start_btn:MovieClip;
public var theNextScene;
public var btn_forward:MovieClip;
public function Tutorial(){
addFrameScript(0, frame1, 124, frame125, 248, frame249, 374, frame375);
}
function frame1(){
btn_forward.addEventListener(MouseEvent.CLICK, forwardButtonFunction);
}
public function forwardButtonFunction(_arg1:MouseEvent){
switch ((theCurrentLabel = currentLabel)){
case "bubble":
theNextScene = "oven";
break;
case "oven":
theNextScene = "froster";
break;
case "froster":
theNextScene = "money";
break;
case "money":
theNextScene = "bubble";
break;
};
gotoAndPlay(theNextScene);
}
function frame249(){
}
function frame125(){
}
function frame375(){
}
}
}//package
Section 138
//UnderWater (UnderWater)
package {
import flash.display.*;
import source.*;
public dynamic class UnderWater extends MovieClip {
public var waiter_holder_mc:MovieClip;
public var bubbles_holder_mc:MovieClip;
public var calendar:MovieClip;
public var decorator2:DecoratorMachineObject;
public var decorator1:DecoratorMachineObject;
public var waiter_holder_back_mc:MovieClip;
public var oven1:Oven;
public var oven2:Oven;
public var display_case_mc:DisplayCase1;
public var customers_holder_mc:MovieClip;
public var menuTexts:MovieClip;
public var froster1:MovieClip;
public var froster2:MovieClip;
}
}//package
Section 139
//wrap (wrap)
package {
import flash.media.*;
public dynamic class wrap extends Sound {
}
}//package